줄바꿈을 LF로 통일
서버에서 바로 빌드하고 고칠 수 있게 저장소 줄바꿈을 LF로 맞췄습니다. CRLF로 들어가 있던 sh 빌드 스크립트도 이제 리눅스에서 그대로 돌아갑니다. 내용은 바뀌지 않았습니다.
This commit is contained in:
1 parent
40615838ac
commit
2d48091205
623 files changed
+501372
-501365
No files matched your search
@@ -1,90 +1,90 @@
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* AutoMap module.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __AMMAP_H__
|
||||
#define __AMMAP_H__
|
||||
|
||||
#include "d_event.h"
|
||||
|
||||
#define MAPBITS 12
|
||||
#define FRACTOMAPBITS (FRACBITS-MAPBITS)
|
||||
|
||||
// Used by ST StatusBar stuff.
|
||||
#define AM_MSGHEADER (('a'<<24)+('m'<<16))
|
||||
#define AM_MSGENTERED (AM_MSGHEADER | ('e'<<8))
|
||||
#define AM_MSGEXITED (AM_MSGHEADER | ('x'<<8))
|
||||
|
||||
// scale on entry
|
||||
#define INITSCALEMTOF (.2*FRACUNIT)
|
||||
|
||||
// Called by main loop.
|
||||
boolean AM_Responder(event_t *ev);
|
||||
|
||||
// Called by main loop.
|
||||
void AM_Ticker(void);
|
||||
|
||||
// Called by main loop,
|
||||
// called instead of view drawer if automap active.
|
||||
void AM_Drawer(void);
|
||||
|
||||
// Called to force the automap to quit
|
||||
// if the level is completed while it is up.
|
||||
void AM_Stop(void);
|
||||
|
||||
// killough 2/22/98: for saving automap information in savegame:
|
||||
|
||||
extern void AM_Start(void);
|
||||
|
||||
//jff 4/16/98 make externally available
|
||||
|
||||
extern void AM_clearMarks(void);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
fixed_t x, y;
|
||||
} mpoint_t;
|
||||
|
||||
// end changes -- killough 2/22/98
|
||||
|
||||
#endif
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* AutoMap module.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __AMMAP_H__
|
||||
#define __AMMAP_H__
|
||||
|
||||
#include "d_event.h"
|
||||
|
||||
#define MAPBITS 12
|
||||
#define FRACTOMAPBITS (FRACBITS-MAPBITS)
|
||||
|
||||
// Used by ST StatusBar stuff.
|
||||
#define AM_MSGHEADER (('a'<<24)+('m'<<16))
|
||||
#define AM_MSGENTERED (AM_MSGHEADER | ('e'<<8))
|
||||
#define AM_MSGEXITED (AM_MSGHEADER | ('x'<<8))
|
||||
|
||||
// scale on entry
|
||||
#define INITSCALEMTOF (.2*FRACUNIT)
|
||||
|
||||
// Called by main loop.
|
||||
boolean AM_Responder(event_t *ev);
|
||||
|
||||
// Called by main loop.
|
||||
void AM_Ticker(void);
|
||||
|
||||
// Called by main loop,
|
||||
// called instead of view drawer if automap active.
|
||||
void AM_Drawer(void);
|
||||
|
||||
// Called to force the automap to quit
|
||||
// if the level is completed while it is up.
|
||||
void AM_Stop(void);
|
||||
|
||||
// killough 2/22/98: for saving automap information in savegame:
|
||||
|
||||
extern void AM_Start(void);
|
||||
|
||||
//jff 4/16/98 make externally available
|
||||
|
||||
extern void AM_clearMarks(void);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
fixed_t x, y;
|
||||
} mpoint_t;
|
||||
|
||||
// end changes -- killough 2/22/98
|
||||
|
||||
#endif
|
||||
@@ -1,185 +1,185 @@
|
||||
/* config.h. Generated from config.h.in by configure. */
|
||||
/* config.h.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define __WINS__
|
||||
#endif
|
||||
|
||||
/* Uncomment this to exhaustively run memory checks while the game is running
|
||||
(this is EXTREMELY slow). */
|
||||
/* #undef CHECKHEAP */
|
||||
|
||||
/* Define for support for MBF helper dogs */
|
||||
//#define DOGS 1
|
||||
/* Define to be the path where Doom WADs are stored */
|
||||
#define DOOMWADDIR "/usr/local/share/games/doom"
|
||||
|
||||
/* Define to 1 if you have the <asm/byteorder.h> header file. */
|
||||
//#define HAVE_ASM_BYTEORDER_H 1
|
||||
/* Define to 1 if you have the declaration of `sys_siglist', and to 0 if you
|
||||
don't. */
|
||||
//#define HAVE_DECL_SYS_SIGLIST 1
|
||||
/* Define to 1 if you have the `getopt' function. */
|
||||
//#define HAVE_GETOPT 1
|
||||
/* Define to 1 if you have the `inet_aton' function. */
|
||||
//#define HAVE_INET_ATON 1
|
||||
/* Define to 1 if you have the `inet_ntop' function. */
|
||||
//#define HAVE_INET_NTOP 1
|
||||
/* Define to 1 if you have the `inet_pton' function. */
|
||||
//#define HAVE_INET_PTON 1
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
//#define HAVE_INTTYPES_H 1
|
||||
/* Define if you have struct sockaddr_in6 */
|
||||
//#define HAVE_IPv6 1
|
||||
/* Define to 1 if you have the `m' library (-lm). */
|
||||
//#define HAVE_LIBM 1
|
||||
/* Define to 1 if you have the `png' library (-lpng). */
|
||||
//#define HAVE_LIBPNG 1
|
||||
/* Define to 1 if you have the `SDL_mixer' library (-lSDL_mixer). */
|
||||
/* #undef HAVE_LIBSDL_MIXER */
|
||||
|
||||
/* Define if you have the SDL net library -lSDL_net */
|
||||
/* #undef HAVE_LIBSDL_NET */
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#define HAVE_MEMORY_H 1
|
||||
|
||||
/* Define to 1 if you have the `mmap' function. */
|
||||
//#define HAVE_MMAP 1
|
||||
/* Define to 1 if you have the <sched.h> header file. */
|
||||
//#define HAVE_SCHED_H 1
|
||||
/* Define to 1 if you have the `sched_setaffinity' function. */
|
||||
//#define HAVE_SCHED_SETAFFINITY 1
|
||||
/* Define to 1 if you have the `SDL_JoystickGetAxis' function. */
|
||||
//#define HAVE_SDL_JOYSTICKGETAXIS 1
|
||||
/* Define to 1 if you have the `snprintf' function. */
|
||||
//#define HAVE_SNPRINTF 1
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
//#define HAVE_STDINT_H 1
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#define HAVE_STDLIB_H 1
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
//#define HAVE_STRINGS_H 1
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#define HAVE_STRING_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#define HAVE_SYS_STAT_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
|
||||
/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
|
||||
#define HAVE_SYS_WAIT_H 1
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
//#define HAVE_UNISTD_H 1
|
||||
/* Define to 1 if you have the `usleep' function. */
|
||||
//#define HAVE_USLEEP 1
|
||||
/* Define to 1 if you have the `vsnprintf' function. */
|
||||
//#define HAVE_VSNPRINTF 1
|
||||
/* Uncomment this to cause heap dumps to be generated. Only useful if
|
||||
INSTRUMENTED is also defined. */
|
||||
/* #undef HEAPDUMP */
|
||||
|
||||
/* Define for high resolution support */
|
||||
//#define HIGHRES 1
|
||||
/* Define on targets supporting 386 assembly */
|
||||
//#define I386_ASM 1
|
||||
/* Define this to see real-time memory allocation statistics, and enable extra
|
||||
debugging features */
|
||||
/* #undef INSTRUMENTED */
|
||||
|
||||
/* If your platform has a fast version of max, define MAX to it */
|
||||
/* #undef MAX */
|
||||
|
||||
/* If your platform has a fast version of min, define MIN to it */
|
||||
/* #undef MIN */
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#define PACKAGE_BUGREPORT ""
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#define PACKAGE_NAME "prboom"
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#define PACKAGE_STRING "prboom 2.5.0"
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#define PACKAGE_TARNAME "prboom"
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#define PACKAGE_VERSION "2.5.0"
|
||||
|
||||
/* Set to the attribute to apply to struct definitions to make them packed */
|
||||
|
||||
#ifndef __WINS__
|
||||
#define PACKEDATTR __attribute__((packed))
|
||||
#else
|
||||
#define PACKEDATTR
|
||||
#endif
|
||||
/* Define to enable internal range checking */
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#define STDC_HEADERS 1
|
||||
|
||||
/* Defining this causes time stamps to be created each time a lump is locked,
|
||||
and lumps locked for long periods of time are reported */
|
||||
/* #undef TIMEDIAG */
|
||||
|
||||
/* Define if you want to use gluImageScale */
|
||||
//#define USE_GLU_IMAGESCALE 1
|
||||
/* Define if you want to use gluBuild2DMipmaps */
|
||||
//#define USE_GLU_MIPMAP 1
|
||||
/* Define if you want to use the SDL net lib */
|
||||
/* #undef USE_SDL_NET */
|
||||
|
||||
/* Version number of package */
|
||||
#define VERSION "2.5.0"
|
||||
|
||||
/* Define if using the dmalloc debugging malloc package */
|
||||
/* #undef WITH_DMALLOC */
|
||||
|
||||
/* Define to 1 if your processor stores words with the most significant byte
|
||||
first (like Motorola and SPARC, unlike Intel and VAX). */
|
||||
/* #undef WORDS_BIGENDIAN */
|
||||
|
||||
/* Define this to perform id checks on zone blocks, to detect corrupted and
|
||||
illegally freed blocks */
|
||||
|
||||
#ifdef DEBUG
|
||||
#define ZONEIDCHECK 1
|
||||
#endif
|
||||
|
||||
/* Define to empty if `const' does not conform to ANSI C. */
|
||||
/* #undef const */
|
||||
|
||||
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||
/* #undef gid_t */
|
||||
|
||||
/* Define to `__inline__' or `__inline' if that's what the C compiler
|
||||
calls it, or to nothing if 'inline' is not supported under any name. */
|
||||
//#ifndef __cplusplus
|
||||
#ifdef __WINS__
|
||||
#define inline __inline
|
||||
#else
|
||||
#define inline __inline__
|
||||
#endif
|
||||
|
||||
/* Define to `unsigned int' if <sys/types.h> does not define. */
|
||||
/* #undef size_t */
|
||||
|
||||
#ifdef __WINS__
|
||||
#define strncasecmp _strnicmp
|
||||
#define strcasecmp _stricmp
|
||||
#endif
|
||||
|
||||
/* Define to strcasecmp, if we have it */
|
||||
#define stricmp strcasecmp
|
||||
|
||||
/* Define to strncasecmp, if we have it */
|
||||
#define strnicmp strncasecmp
|
||||
|
||||
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||
/* #undef uid_t */
|
||||
/* config.h. Generated from config.h.in by configure. */
|
||||
/* config.h.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define __WINS__
|
||||
#endif
|
||||
|
||||
/* Uncomment this to exhaustively run memory checks while the game is running
|
||||
(this is EXTREMELY slow). */
|
||||
/* #undef CHECKHEAP */
|
||||
|
||||
/* Define for support for MBF helper dogs */
|
||||
//#define DOGS 1
|
||||
/* Define to be the path where Doom WADs are stored */
|
||||
#define DOOMWADDIR "/usr/local/share/games/doom"
|
||||
|
||||
/* Define to 1 if you have the <asm/byteorder.h> header file. */
|
||||
//#define HAVE_ASM_BYTEORDER_H 1
|
||||
/* Define to 1 if you have the declaration of `sys_siglist', and to 0 if you
|
||||
don't. */
|
||||
//#define HAVE_DECL_SYS_SIGLIST 1
|
||||
/* Define to 1 if you have the `getopt' function. */
|
||||
//#define HAVE_GETOPT 1
|
||||
/* Define to 1 if you have the `inet_aton' function. */
|
||||
//#define HAVE_INET_ATON 1
|
||||
/* Define to 1 if you have the `inet_ntop' function. */
|
||||
//#define HAVE_INET_NTOP 1
|
||||
/* Define to 1 if you have the `inet_pton' function. */
|
||||
//#define HAVE_INET_PTON 1
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
//#define HAVE_INTTYPES_H 1
|
||||
/* Define if you have struct sockaddr_in6 */
|
||||
//#define HAVE_IPv6 1
|
||||
/* Define to 1 if you have the `m' library (-lm). */
|
||||
//#define HAVE_LIBM 1
|
||||
/* Define to 1 if you have the `png' library (-lpng). */
|
||||
//#define HAVE_LIBPNG 1
|
||||
/* Define to 1 if you have the `SDL_mixer' library (-lSDL_mixer). */
|
||||
/* #undef HAVE_LIBSDL_MIXER */
|
||||
|
||||
/* Define if you have the SDL net library -lSDL_net */
|
||||
/* #undef HAVE_LIBSDL_NET */
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#define HAVE_MEMORY_H 1
|
||||
|
||||
/* Define to 1 if you have the `mmap' function. */
|
||||
//#define HAVE_MMAP 1
|
||||
/* Define to 1 if you have the <sched.h> header file. */
|
||||
//#define HAVE_SCHED_H 1
|
||||
/* Define to 1 if you have the `sched_setaffinity' function. */
|
||||
//#define HAVE_SCHED_SETAFFINITY 1
|
||||
/* Define to 1 if you have the `SDL_JoystickGetAxis' function. */
|
||||
//#define HAVE_SDL_JOYSTICKGETAXIS 1
|
||||
/* Define to 1 if you have the `snprintf' function. */
|
||||
//#define HAVE_SNPRINTF 1
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
//#define HAVE_STDINT_H 1
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#define HAVE_STDLIB_H 1
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
//#define HAVE_STRINGS_H 1
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#define HAVE_STRING_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#define HAVE_SYS_STAT_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
|
||||
/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
|
||||
#define HAVE_SYS_WAIT_H 1
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
//#define HAVE_UNISTD_H 1
|
||||
/* Define to 1 if you have the `usleep' function. */
|
||||
//#define HAVE_USLEEP 1
|
||||
/* Define to 1 if you have the `vsnprintf' function. */
|
||||
//#define HAVE_VSNPRINTF 1
|
||||
/* Uncomment this to cause heap dumps to be generated. Only useful if
|
||||
INSTRUMENTED is also defined. */
|
||||
/* #undef HEAPDUMP */
|
||||
|
||||
/* Define for high resolution support */
|
||||
//#define HIGHRES 1
|
||||
/* Define on targets supporting 386 assembly */
|
||||
//#define I386_ASM 1
|
||||
/* Define this to see real-time memory allocation statistics, and enable extra
|
||||
debugging features */
|
||||
/* #undef INSTRUMENTED */
|
||||
|
||||
/* If your platform has a fast version of max, define MAX to it */
|
||||
/* #undef MAX */
|
||||
|
||||
/* If your platform has a fast version of min, define MIN to it */
|
||||
/* #undef MIN */
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#define PACKAGE_BUGREPORT ""
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#define PACKAGE_NAME "prboom"
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#define PACKAGE_STRING "prboom 2.5.0"
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#define PACKAGE_TARNAME "prboom"
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#define PACKAGE_VERSION "2.5.0"
|
||||
|
||||
/* Set to the attribute to apply to struct definitions to make them packed */
|
||||
|
||||
#ifndef __WINS__
|
||||
#define PACKEDATTR __attribute__((packed))
|
||||
#else
|
||||
#define PACKEDATTR
|
||||
#endif
|
||||
/* Define to enable internal range checking */
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#define STDC_HEADERS 1
|
||||
|
||||
/* Defining this causes time stamps to be created each time a lump is locked,
|
||||
and lumps locked for long periods of time are reported */
|
||||
/* #undef TIMEDIAG */
|
||||
|
||||
/* Define if you want to use gluImageScale */
|
||||
//#define USE_GLU_IMAGESCALE 1
|
||||
/* Define if you want to use gluBuild2DMipmaps */
|
||||
//#define USE_GLU_MIPMAP 1
|
||||
/* Define if you want to use the SDL net lib */
|
||||
/* #undef USE_SDL_NET */
|
||||
|
||||
/* Version number of package */
|
||||
#define VERSION "2.5.0"
|
||||
|
||||
/* Define if using the dmalloc debugging malloc package */
|
||||
/* #undef WITH_DMALLOC */
|
||||
|
||||
/* Define to 1 if your processor stores words with the most significant byte
|
||||
first (like Motorola and SPARC, unlike Intel and VAX). */
|
||||
/* #undef WORDS_BIGENDIAN */
|
||||
|
||||
/* Define this to perform id checks on zone blocks, to detect corrupted and
|
||||
illegally freed blocks */
|
||||
|
||||
#ifdef DEBUG
|
||||
#define ZONEIDCHECK 1
|
||||
#endif
|
||||
|
||||
/* Define to empty if `const' does not conform to ANSI C. */
|
||||
/* #undef const */
|
||||
|
||||
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||
/* #undef gid_t */
|
||||
|
||||
/* Define to `__inline__' or `__inline' if that's what the C compiler
|
||||
calls it, or to nothing if 'inline' is not supported under any name. */
|
||||
//#ifndef __cplusplus
|
||||
#ifdef __WINS__
|
||||
#define inline __inline
|
||||
#else
|
||||
#define inline __inline__
|
||||
#endif
|
||||
|
||||
/* Define to `unsigned int' if <sys/types.h> does not define. */
|
||||
/* #undef size_t */
|
||||
|
||||
#ifdef __WINS__
|
||||
#define strncasecmp _strnicmp
|
||||
#define strcasecmp _stricmp
|
||||
#endif
|
||||
|
||||
/* Define to strcasecmp, if we have it */
|
||||
#define stricmp strcasecmp
|
||||
|
||||
/* Define to strncasecmp, if we have it */
|
||||
#define strnicmp strncasecmp
|
||||
|
||||
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||
/* #undef uid_t */
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,120 +1,120 @@
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Event information structures.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __D_EVENT__
|
||||
#define __D_EVENT__
|
||||
|
||||
#include "doomtype.h"
|
||||
|
||||
//
|
||||
// Event handling.
|
||||
//
|
||||
|
||||
// Input event types.
|
||||
typedef enum
|
||||
{
|
||||
ev_keydown, ev_keyup, ev_mouse, ev_joystick
|
||||
} evtype_t;
|
||||
|
||||
// Event structure.
|
||||
typedef struct
|
||||
{
|
||||
evtype_t type;
|
||||
int data1; // keys / mouse/joystick buttons
|
||||
int data2; // mouse/joystick x move
|
||||
int data3; // mouse/joystick y move
|
||||
} event_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
ga_nothing,
|
||||
ga_loadlevel,
|
||||
ga_newgame,
|
||||
ga_loadgame,
|
||||
ga_savegame,
|
||||
ga_playdemo,
|
||||
ga_completed,
|
||||
ga_victory,
|
||||
ga_worlddone,
|
||||
} gameaction_t;
|
||||
|
||||
//
|
||||
// Button/action code definitions.
|
||||
//
|
||||
typedef enum
|
||||
{
|
||||
// Press "Fire".
|
||||
BT_ATTACK = 1,
|
||||
|
||||
// Use button, to open doors, activate switches.
|
||||
BT_USE = 2,
|
||||
|
||||
// Flag: game events, not really buttons.
|
||||
BT_SPECIAL = 128,
|
||||
BT_SPECIALMASK = 3,
|
||||
|
||||
// Flag, weapon change pending.
|
||||
// If true, the next 4 bits hold weapon num.
|
||||
BT_CHANGE = 4,
|
||||
|
||||
// The 4bit weapon mask and shift, convenience.
|
||||
//BT_WEAPONMASK = (8+16+32),
|
||||
BT_WEAPONMASK = (8 + 16 + 32 + 64), // extended to pick up SSG // phares
|
||||
BT_WEAPONSHIFT = 3,
|
||||
|
||||
// Special events
|
||||
BTS_LOADGAME = 0, // Loads a game
|
||||
// Pause the game.
|
||||
BTS_PAUSE = 1,
|
||||
// Save the game at each console.
|
||||
BTS_SAVEGAME = 2,
|
||||
BTS_RESTARTLEVEL = 3, // Restarts the current level
|
||||
|
||||
// Savegame slot numbers occupy the second byte of buttons.
|
||||
BTS_SAVEMASK = (4 + 8 + 16),
|
||||
BTS_SAVESHIFT = 2,
|
||||
|
||||
} buttoncode_t;
|
||||
|
||||
#endif
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Event information structures.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __D_EVENT__
|
||||
#define __D_EVENT__
|
||||
|
||||
#include "doomtype.h"
|
||||
|
||||
//
|
||||
// Event handling.
|
||||
//
|
||||
|
||||
// Input event types.
|
||||
typedef enum
|
||||
{
|
||||
ev_keydown, ev_keyup, ev_mouse, ev_joystick
|
||||
} evtype_t;
|
||||
|
||||
// Event structure.
|
||||
typedef struct
|
||||
{
|
||||
evtype_t type;
|
||||
int data1; // keys / mouse/joystick buttons
|
||||
int data2; // mouse/joystick x move
|
||||
int data3; // mouse/joystick y move
|
||||
} event_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
ga_nothing,
|
||||
ga_loadlevel,
|
||||
ga_newgame,
|
||||
ga_loadgame,
|
||||
ga_savegame,
|
||||
ga_playdemo,
|
||||
ga_completed,
|
||||
ga_victory,
|
||||
ga_worlddone,
|
||||
} gameaction_t;
|
||||
|
||||
//
|
||||
// Button/action code definitions.
|
||||
//
|
||||
typedef enum
|
||||
{
|
||||
// Press "Fire".
|
||||
BT_ATTACK = 1,
|
||||
|
||||
// Use button, to open doors, activate switches.
|
||||
BT_USE = 2,
|
||||
|
||||
// Flag: game events, not really buttons.
|
||||
BT_SPECIAL = 128,
|
||||
BT_SPECIALMASK = 3,
|
||||
|
||||
// Flag, weapon change pending.
|
||||
// If true, the next 4 bits hold weapon num.
|
||||
BT_CHANGE = 4,
|
||||
|
||||
// The 4bit weapon mask and shift, convenience.
|
||||
//BT_WEAPONMASK = (8+16+32),
|
||||
BT_WEAPONMASK = (8 + 16 + 32 + 64), // extended to pick up SSG // phares
|
||||
BT_WEAPONSHIFT = 3,
|
||||
|
||||
// Special events
|
||||
BTS_LOADGAME = 0, // Loads a game
|
||||
// Pause the game.
|
||||
BTS_PAUSE = 1,
|
||||
// Save the game at each console.
|
||||
BTS_SAVEGAME = 2,
|
||||
BTS_RESTARTLEVEL = 3, // Restarts the current level
|
||||
|
||||
// Savegame slot numbers occupy the second byte of buttons.
|
||||
BTS_SAVEMASK = (4 + 8 + 16),
|
||||
BTS_SAVESHIFT = 2,
|
||||
|
||||
} buttoncode_t;
|
||||
|
||||
#endif
|
||||
@@ -1,68 +1,68 @@
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Items: key cards, artifacts, weapon, ammunition.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __D_ITEMS__
|
||||
#define __D_ITEMS__
|
||||
|
||||
#include "doomdef.h"
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
/* Weapon info: sprite frames, ammunition use. */
|
||||
typedef struct
|
||||
{
|
||||
ammotype_t ammo;
|
||||
int upstate;
|
||||
int downstate;
|
||||
int readystate;
|
||||
int atkstate;
|
||||
int flashstate;
|
||||
|
||||
} weaponinfo_t;
|
||||
|
||||
extern const weaponinfo_t weaponinfo[NUMWEAPONS];
|
||||
|
||||
#endif
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Items: key cards, artifacts, weapon, ammunition.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __D_ITEMS__
|
||||
#define __D_ITEMS__
|
||||
|
||||
#include "doomdef.h"
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
/* Weapon info: sprite frames, ammunition use. */
|
||||
typedef struct
|
||||
{
|
||||
ammotype_t ammo;
|
||||
int upstate;
|
||||
int downstate;
|
||||
int readystate;
|
||||
int atkstate;
|
||||
int flashstate;
|
||||
|
||||
} weaponinfo_t;
|
||||
|
||||
extern const weaponinfo_t weaponinfo[NUMWEAPONS];
|
||||
|
||||
#endif
|
||||
@@ -1,77 +1,77 @@
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Main startup and splash screenstuff.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __D_MAIN__
|
||||
#define __D_MAIN__
|
||||
|
||||
#include "d_event.h"
|
||||
#include "w_wad.h"
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
//jff end of external declaration of command line playmode
|
||||
|
||||
extern const boolean nosfxparm;
|
||||
extern const boolean nomusicparm;
|
||||
|
||||
extern const boolean nodrawers;
|
||||
// Called by IO functions when input is detected.
|
||||
void D_PostEvent(event_t *ev);
|
||||
|
||||
// Demo stuff
|
||||
void D_AdvanceDemo(void);
|
||||
void D_DoAdvanceDemo(void);
|
||||
|
||||
//
|
||||
// BASE LEVEL
|
||||
//
|
||||
|
||||
void D_PageTicker(void);
|
||||
void D_StartTitle(void);
|
||||
void D_DoomMain(void);
|
||||
void D_AddFile();
|
||||
|
||||
#endif
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Main startup and splash screenstuff.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __D_MAIN__
|
||||
#define __D_MAIN__
|
||||
|
||||
#include "d_event.h"
|
||||
#include "w_wad.h"
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
//jff end of external declaration of command line playmode
|
||||
|
||||
extern const boolean nosfxparm;
|
||||
extern const boolean nomusicparm;
|
||||
|
||||
extern const boolean nodrawers;
|
||||
// Called by IO functions when input is detected.
|
||||
void D_PostEvent(event_t *ev);
|
||||
|
||||
// Demo stuff
|
||||
void D_AdvanceDemo(void);
|
||||
void D_DoAdvanceDemo(void);
|
||||
|
||||
//
|
||||
// BASE LEVEL
|
||||
//
|
||||
|
||||
void D_PageTicker(void);
|
||||
void D_StartTitle(void);
|
||||
void D_DoomMain(void);
|
||||
void D_AddFile();
|
||||
|
||||
#endif
|
||||
@@ -1,62 +1,62 @@
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Networking stuff.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __D_NET__
|
||||
#define __D_NET__
|
||||
|
||||
#include "d_player.h"
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
void D_BuildNewTiccmds(void);
|
||||
|
||||
//? how many ticks to run?
|
||||
void TryRunTics(void);
|
||||
|
||||
// CPhipps - move to header file
|
||||
void D_InitNetGame(void); // This does the setup
|
||||
|
||||
#endif
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Networking stuff.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __D_NET__
|
||||
#define __D_NET__
|
||||
|
||||
#include "d_player.h"
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
void D_BuildNewTiccmds(void);
|
||||
|
||||
//? how many ticks to run?
|
||||
void TryRunTics(void);
|
||||
|
||||
// CPhipps - move to header file
|
||||
void D_InitNetGame(void); // This does the setup
|
||||
|
||||
#endif
|
||||
@@ -1,243 +1,243 @@
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Player state structure.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __D_PLAYER__
|
||||
#define __D_PLAYER__
|
||||
|
||||
// The player data structure depends on a number
|
||||
// of other structs: items (internal inventory),
|
||||
// animation states (closely tied to the sprites
|
||||
// used to represent them, unfortunately).
|
||||
|
||||
#include "d_items.h"
|
||||
|
||||
#include "p_pspr.h"
|
||||
|
||||
// In addition, the player is just a special
|
||||
// case of the generic moving object/actor.
|
||||
#include "p_mobj.h"
|
||||
|
||||
// Finally, for odd reasons, the player input
|
||||
// is buffered within the player data struct,
|
||||
// as commands per game tick.
|
||||
#include "d_ticcmd.h"
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
//
|
||||
// Player states.
|
||||
//
|
||||
typedef enum
|
||||
{
|
||||
// Playing or camping.
|
||||
PST_LIVE,
|
||||
// Dead on the ground, view follows killer.
|
||||
PST_DEAD,
|
||||
// Ready to restart/respawn???
|
||||
PST_REBORN
|
||||
|
||||
} playerstate_t;
|
||||
|
||||
//
|
||||
// Player internal flags, for cheats and debug.
|
||||
//
|
||||
typedef enum
|
||||
{
|
||||
// No clipping, walk through barriers.
|
||||
CF_NOCLIP = 1,
|
||||
// No damage, no health loss.
|
||||
CF_GODMODE = 2,
|
||||
// Not really a cheat, just a debug aid.
|
||||
CF_NOMOMENTUM = 4,
|
||||
|
||||
//You played goldeneye right?
|
||||
CF_ENEMY_ROCKETS = 8
|
||||
|
||||
} cheat_t;
|
||||
|
||||
//
|
||||
// Extended player object info: player_t
|
||||
//
|
||||
typedef struct player_s
|
||||
{
|
||||
mobj_t *mo;
|
||||
playerstate_t playerstate;
|
||||
ticcmd_t cmd;
|
||||
|
||||
// Determine POV,
|
||||
// including viewpoint bobbing during movement.
|
||||
// Focal origin above r.z
|
||||
fixed_t viewz;
|
||||
// Base height above floor for viewz.
|
||||
fixed_t viewheight;
|
||||
// Bob/squat speed.
|
||||
fixed_t deltaviewheight;
|
||||
// bounded/scaled total momentum.
|
||||
fixed_t bob;
|
||||
|
||||
/* killough 10/98: used for realistic bobbing (i.e. not simply overall speed)
|
||||
* mo->momx and mo->momy represent true momenta experienced by player.
|
||||
* This only represents the thrust that the player applies himself.
|
||||
* This avoids anomolies with such things as Boom ice and conveyors.
|
||||
*/
|
||||
fixed_t momx, momy; // killough 10/98
|
||||
|
||||
// This is only used between levels,
|
||||
// mo->health is used during levels.
|
||||
short health;
|
||||
short armorpoints;
|
||||
// Armor type is 0-2.
|
||||
short armortype;
|
||||
|
||||
// Power ups. invinc and invis are tic counters.
|
||||
short powers[NUMPOWERS];
|
||||
boolean cards[NUMCARDS];
|
||||
boolean backpack;
|
||||
|
||||
// Frags, kills of other players.
|
||||
short frags[MAXPLAYERS];
|
||||
short readyweapon;
|
||||
|
||||
// Is wp_nochange if not changing.
|
||||
short pendingweapon;
|
||||
|
||||
short weaponowned[NUMWEAPONS];
|
||||
short ammo[NUMAMMO];
|
||||
short maxammo[NUMAMMO];
|
||||
|
||||
// True if button down last tic.
|
||||
char attackdown;
|
||||
char usedown;
|
||||
|
||||
// Bit flags, for cheats and debug.
|
||||
// See cheat_t, above.
|
||||
int cheats;
|
||||
|
||||
// Refired shots are less accurate.
|
||||
char refire;
|
||||
|
||||
// For intermission stats.
|
||||
short killcount;
|
||||
short itemcount;
|
||||
short secretcount;
|
||||
|
||||
// Hint messages. // CPhipps - const
|
||||
const char *message;
|
||||
|
||||
// For screen flashing (red or bright).
|
||||
short damagecount;
|
||||
short bonuscount;
|
||||
|
||||
// Who did damage (NULL for floors/ceilings).
|
||||
mobj_t *attacker;
|
||||
|
||||
// So gun flashes light up areas.
|
||||
short extralight;
|
||||
|
||||
// Current PLAYPAL, ???
|
||||
// can be set to REDCOLORMAP for pain, etc.
|
||||
short fixedcolormap;
|
||||
|
||||
// Player skin colorshift,
|
||||
// 0-3 for which color to draw player.
|
||||
char colormap;
|
||||
|
||||
// Overlay view sprites (gun, etc).
|
||||
pspdef_t psprites[NUMPSPRITES];
|
||||
|
||||
// True if secret level has been done.
|
||||
boolean didsecret;
|
||||
|
||||
} player_t;
|
||||
|
||||
//
|
||||
// INTERMISSION
|
||||
// Structure passed e.g. to WI_Start(wb)
|
||||
//
|
||||
typedef struct
|
||||
{
|
||||
boolean in; // whether the player is in game
|
||||
|
||||
// Player stats, kills, collected items etc.
|
||||
short skills;
|
||||
short sitems;
|
||||
short ssecret;
|
||||
int stime;
|
||||
short frags[4];
|
||||
int score; // current score on entry, modified on return
|
||||
|
||||
} wbplayerstruct_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t epsd; // episode # (0-2)
|
||||
|
||||
// if true, splash the secret level
|
||||
boolean didsecret;
|
||||
|
||||
// previous and next levels, origin 0
|
||||
char last;
|
||||
char next;
|
||||
|
||||
short maxkills;
|
||||
short maxitems;
|
||||
short maxsecret;
|
||||
short maxfrags;
|
||||
|
||||
// the par time
|
||||
int partime;
|
||||
|
||||
// index of this player in game
|
||||
short pnum;
|
||||
|
||||
wbplayerstruct_t plyr[MAXPLAYERS];
|
||||
|
||||
// CPhipps - total game time for completed levels so far
|
||||
int totaltimes;
|
||||
|
||||
} wbstartstruct_t;
|
||||
|
||||
#endif
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Player state structure.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __D_PLAYER__
|
||||
#define __D_PLAYER__
|
||||
|
||||
// The player data structure depends on a number
|
||||
// of other structs: items (internal inventory),
|
||||
// animation states (closely tied to the sprites
|
||||
// used to represent them, unfortunately).
|
||||
|
||||
#include "d_items.h"
|
||||
|
||||
#include "p_pspr.h"
|
||||
|
||||
// In addition, the player is just a special
|
||||
// case of the generic moving object/actor.
|
||||
#include "p_mobj.h"
|
||||
|
||||
// Finally, for odd reasons, the player input
|
||||
// is buffered within the player data struct,
|
||||
// as commands per game tick.
|
||||
#include "d_ticcmd.h"
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
//
|
||||
// Player states.
|
||||
//
|
||||
typedef enum
|
||||
{
|
||||
// Playing or camping.
|
||||
PST_LIVE,
|
||||
// Dead on the ground, view follows killer.
|
||||
PST_DEAD,
|
||||
// Ready to restart/respawn???
|
||||
PST_REBORN
|
||||
|
||||
} playerstate_t;
|
||||
|
||||
//
|
||||
// Player internal flags, for cheats and debug.
|
||||
//
|
||||
typedef enum
|
||||
{
|
||||
// No clipping, walk through barriers.
|
||||
CF_NOCLIP = 1,
|
||||
// No damage, no health loss.
|
||||
CF_GODMODE = 2,
|
||||
// Not really a cheat, just a debug aid.
|
||||
CF_NOMOMENTUM = 4,
|
||||
|
||||
//You played goldeneye right?
|
||||
CF_ENEMY_ROCKETS = 8
|
||||
|
||||
} cheat_t;
|
||||
|
||||
//
|
||||
// Extended player object info: player_t
|
||||
//
|
||||
typedef struct player_s
|
||||
{
|
||||
mobj_t *mo;
|
||||
playerstate_t playerstate;
|
||||
ticcmd_t cmd;
|
||||
|
||||
// Determine POV,
|
||||
// including viewpoint bobbing during movement.
|
||||
// Focal origin above r.z
|
||||
fixed_t viewz;
|
||||
// Base height above floor for viewz.
|
||||
fixed_t viewheight;
|
||||
// Bob/squat speed.
|
||||
fixed_t deltaviewheight;
|
||||
// bounded/scaled total momentum.
|
||||
fixed_t bob;
|
||||
|
||||
/* killough 10/98: used for realistic bobbing (i.e. not simply overall speed)
|
||||
* mo->momx and mo->momy represent true momenta experienced by player.
|
||||
* This only represents the thrust that the player applies himself.
|
||||
* This avoids anomolies with such things as Boom ice and conveyors.
|
||||
*/
|
||||
fixed_t momx, momy; // killough 10/98
|
||||
|
||||
// This is only used between levels,
|
||||
// mo->health is used during levels.
|
||||
short health;
|
||||
short armorpoints;
|
||||
// Armor type is 0-2.
|
||||
short armortype;
|
||||
|
||||
// Power ups. invinc and invis are tic counters.
|
||||
short powers[NUMPOWERS];
|
||||
boolean cards[NUMCARDS];
|
||||
boolean backpack;
|
||||
|
||||
// Frags, kills of other players.
|
||||
short frags[MAXPLAYERS];
|
||||
short readyweapon;
|
||||
|
||||
// Is wp_nochange if not changing.
|
||||
short pendingweapon;
|
||||
|
||||
short weaponowned[NUMWEAPONS];
|
||||
short ammo[NUMAMMO];
|
||||
short maxammo[NUMAMMO];
|
||||
|
||||
// True if button down last tic.
|
||||
char attackdown;
|
||||
char usedown;
|
||||
|
||||
// Bit flags, for cheats and debug.
|
||||
// See cheat_t, above.
|
||||
int cheats;
|
||||
|
||||
// Refired shots are less accurate.
|
||||
char refire;
|
||||
|
||||
// For intermission stats.
|
||||
short killcount;
|
||||
short itemcount;
|
||||
short secretcount;
|
||||
|
||||
// Hint messages. // CPhipps - const
|
||||
const char *message;
|
||||
|
||||
// For screen flashing (red or bright).
|
||||
short damagecount;
|
||||
short bonuscount;
|
||||
|
||||
// Who did damage (NULL for floors/ceilings).
|
||||
mobj_t *attacker;
|
||||
|
||||
// So gun flashes light up areas.
|
||||
short extralight;
|
||||
|
||||
// Current PLAYPAL, ???
|
||||
// can be set to REDCOLORMAP for pain, etc.
|
||||
short fixedcolormap;
|
||||
|
||||
// Player skin colorshift,
|
||||
// 0-3 for which color to draw player.
|
||||
char colormap;
|
||||
|
||||
// Overlay view sprites (gun, etc).
|
||||
pspdef_t psprites[NUMPSPRITES];
|
||||
|
||||
// True if secret level has been done.
|
||||
boolean didsecret;
|
||||
|
||||
} player_t;
|
||||
|
||||
//
|
||||
// INTERMISSION
|
||||
// Structure passed e.g. to WI_Start(wb)
|
||||
//
|
||||
typedef struct
|
||||
{
|
||||
boolean in; // whether the player is in game
|
||||
|
||||
// Player stats, kills, collected items etc.
|
||||
short skills;
|
||||
short sitems;
|
||||
short ssecret;
|
||||
int stime;
|
||||
short frags[4];
|
||||
int score; // current score on entry, modified on return
|
||||
|
||||
} wbplayerstruct_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t epsd; // episode # (0-2)
|
||||
|
||||
// if true, splash the secret level
|
||||
boolean didsecret;
|
||||
|
||||
// previous and next levels, origin 0
|
||||
char last;
|
||||
char next;
|
||||
|
||||
short maxkills;
|
||||
short maxitems;
|
||||
short maxsecret;
|
||||
short maxfrags;
|
||||
|
||||
// the par time
|
||||
int partime;
|
||||
|
||||
// index of this player in game
|
||||
short pnum;
|
||||
|
||||
wbplayerstruct_t plyr[MAXPLAYERS];
|
||||
|
||||
// CPhipps - total game time for completed levels so far
|
||||
int totaltimes;
|
||||
|
||||
} wbstartstruct_t;
|
||||
|
||||
#endif
|
||||
@@ -1,103 +1,103 @@
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* MapObj data. Map Objects or mobjs are actors, entities,
|
||||
* thinker, take-your-pick... anything that moves, acts, or
|
||||
* suffers state changes of more or less violent nature.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __D_THINK__
|
||||
#define __D_THINK__
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
#include "doomdef.h"
|
||||
/*
|
||||
* Experimental stuff.
|
||||
* To compile this as "ANSI C with classes"
|
||||
* we will need to handle the various
|
||||
* action functions cleanly.
|
||||
*/
|
||||
// killough 11/98: convert back to C instead of C++
|
||||
typedef void (*actionf_t)();
|
||||
//typedef void (*actionf_v)();
|
||||
//typedef void (*actionf_p1)( void* );
|
||||
//typedef void (*actionf_p2)( void*, void* );
|
||||
|
||||
/* Note: In d_deh.c you will find references to these
|
||||
* wherever code pointers and function handlers exist
|
||||
*/
|
||||
/*
|
||||
typedef union
|
||||
{
|
||||
actionf_p1 acp1;
|
||||
actionf_v acv;
|
||||
actionf_p2 acp2;
|
||||
|
||||
} actionf_t;
|
||||
*/
|
||||
|
||||
/* Historically, "think_t" is yet another
|
||||
* function pointer to a routine to handle
|
||||
* an actor.
|
||||
*/
|
||||
typedef actionf_t think_t;
|
||||
|
||||
/* Doubly linked list of actors. */
|
||||
typedef struct thinker_s
|
||||
{
|
||||
//struct thinker_s* prev;
|
||||
unsigned short prev_sptr;
|
||||
//struct thinker_s* next;
|
||||
unsigned short next_sptr;
|
||||
think_t function;
|
||||
|
||||
} thinker_t;
|
||||
static inline thinker_t* getThinkerPrev(thinker_t *pthinker)
|
||||
{
|
||||
return (thinker_t*) getLongPtr(pthinker->prev_sptr);
|
||||
}
|
||||
static inline thinker_t* getThinkerNext(thinker_t *pthinker)
|
||||
{
|
||||
return (thinker_t*) getLongPtr(pthinker->next_sptr);
|
||||
}
|
||||
#endif
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* MapObj data. Map Objects or mobjs are actors, entities,
|
||||
* thinker, take-your-pick... anything that moves, acts, or
|
||||
* suffers state changes of more or less violent nature.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __D_THINK__
|
||||
#define __D_THINK__
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
#include "doomdef.h"
|
||||
/*
|
||||
* Experimental stuff.
|
||||
* To compile this as "ANSI C with classes"
|
||||
* we will need to handle the various
|
||||
* action functions cleanly.
|
||||
*/
|
||||
// killough 11/98: convert back to C instead of C++
|
||||
typedef void (*actionf_t)();
|
||||
//typedef void (*actionf_v)();
|
||||
//typedef void (*actionf_p1)( void* );
|
||||
//typedef void (*actionf_p2)( void*, void* );
|
||||
|
||||
/* Note: In d_deh.c you will find references to these
|
||||
* wherever code pointers and function handlers exist
|
||||
*/
|
||||
/*
|
||||
typedef union
|
||||
{
|
||||
actionf_p1 acp1;
|
||||
actionf_v acv;
|
||||
actionf_p2 acp2;
|
||||
|
||||
} actionf_t;
|
||||
*/
|
||||
|
||||
/* Historically, "think_t" is yet another
|
||||
* function pointer to a routine to handle
|
||||
* an actor.
|
||||
*/
|
||||
typedef actionf_t think_t;
|
||||
|
||||
/* Doubly linked list of actors. */
|
||||
typedef struct thinker_s
|
||||
{
|
||||
//struct thinker_s* prev;
|
||||
unsigned short prev_sptr;
|
||||
//struct thinker_s* next;
|
||||
unsigned short next_sptr;
|
||||
think_t function;
|
||||
|
||||
} thinker_t;
|
||||
static inline thinker_t* getThinkerPrev(thinker_t *pthinker)
|
||||
{
|
||||
return (thinker_t*) getLongPtr(pthinker->prev_sptr);
|
||||
}
|
||||
static inline thinker_t* getThinkerNext(thinker_t *pthinker)
|
||||
{
|
||||
return (thinker_t*) getLongPtr(pthinker->next_sptr);
|
||||
}
|
||||
#endif
|
||||
@@ -1,70 +1,70 @@
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* System specific interface stuff.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __D_TICCMD__
|
||||
#define __D_TICCMD__
|
||||
|
||||
#include "doomtype.h"
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
/* The data sampled per tick (single player)
|
||||
* and transmitted to other peers (multiplayer).
|
||||
* Mainly movements/button commands per game tick,
|
||||
* plus a checksum for internal state consistency.
|
||||
* CPhipps - explicitely signed the elements, since they have to be signed to work right
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
signed char forwardmove; /* *2048 for move */
|
||||
signed char sidemove; /* *2048 for move */
|
||||
signed short angleturn; /* <<16 for angle delta */
|
||||
short consistancy; /* checks for net game */
|
||||
byte chatchar;
|
||||
byte buttons;
|
||||
} ticcmd_t;
|
||||
|
||||
#endif
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* System specific interface stuff.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __D_TICCMD__
|
||||
#define __D_TICCMD__
|
||||
|
||||
#include "doomtype.h"
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
/* The data sampled per tick (single player)
|
||||
* and transmitted to other peers (multiplayer).
|
||||
* Mainly movements/button commands per game tick,
|
||||
* plus a checksum for internal state consistency.
|
||||
* CPhipps - explicitely signed the elements, since they have to be signed to work right
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
signed char forwardmove; /* *2048 for move */
|
||||
signed char sidemove; /* *2048 for move */
|
||||
signed short angleturn; /* <<16 for angle delta */
|
||||
short consistancy; /* checks for net game */
|
||||
byte chatchar;
|
||||
byte buttons;
|
||||
} ticcmd_t;
|
||||
|
||||
#endif
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef DOOM_IWAD_H
|
||||
#define DOOM_IWAD_H
|
||||
|
||||
extern const unsigned char *doom_iwad;
|
||||
extern const unsigned int *p_doom_iwad_len;
|
||||
|
||||
#endif // DOOM_IWAD_H
|
||||
#ifndef DOOM_IWAD_H
|
||||
#define DOOM_IWAD_H
|
||||
|
||||
extern const unsigned char *doom_iwad;
|
||||
extern const unsigned int *p_doom_iwad_len;
|
||||
|
||||
#endif // DOOM_IWAD_H
|
||||
@@ -1,227 +1,227 @@
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* all external data is defined here
|
||||
* most of the data is loaded into different structures at run time
|
||||
* some internal structures shared by many modules are here
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __DOOMDATA__
|
||||
#define __DOOMDATA__
|
||||
|
||||
// The most basic types we use, portability.
|
||||
#include "config.h"
|
||||
#include "doomtype.h"
|
||||
|
||||
//
|
||||
// Map level types.
|
||||
// The following data structures define the persistent format
|
||||
// used in the lumps of the WAD files.
|
||||
//
|
||||
|
||||
// Lump order in a map WAD: each map needs a couple of lumps
|
||||
// to provide a complete scene geometry description.
|
||||
enum
|
||||
{
|
||||
ML_LABEL, // A separator, name, ExMx or MAPxx
|
||||
ML_THINGS, // Monsters, items..
|
||||
ML_LINEDEFS, // LineDefs, from editing
|
||||
ML_SIDEDEFS, // SideDefs, from editing
|
||||
ML_VERTEXES, // Vertices, edited and BSP splits generated
|
||||
ML_SEGS, // LineSegs, from LineDefs split by BSP
|
||||
ML_SSECTORS, // SubSectors, list of LineSegs
|
||||
ML_NODES, // BSP nodes
|
||||
ML_SECTORS, // Sectors, from editing
|
||||
ML_REJECT, // LUT, sector-sector visibility
|
||||
ML_BLOCKMAP // LUT, motion clipping, walls/grid element
|
||||
};
|
||||
|
||||
#ifdef _MSC_VER // proff: This is the same as __attribute__ ((packed)) in GNUC
|
||||
#pragma pack(push)
|
||||
#pragma pack(1)
|
||||
#endif //_MSC_VER
|
||||
|
||||
// A single Vertex.
|
||||
typedef struct
|
||||
{
|
||||
short x, y;
|
||||
} PACKEDATTR mapvertex_t;
|
||||
|
||||
// A SideDef, defining the visual appearance of a wall,
|
||||
// by setting textures and offsets.
|
||||
typedef struct
|
||||
{
|
||||
short textureoffset;
|
||||
short rowoffset;
|
||||
short toptexture;
|
||||
short bottomtexture;
|
||||
short midtexture;
|
||||
short sector; // Front sector, towards viewer.
|
||||
} PACKEDATTR mapsidedef_t;
|
||||
|
||||
// A LineDef, as used for editing, and as input to the BSP builder.
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned short v1;
|
||||
unsigned short v2;
|
||||
unsigned short flags;
|
||||
short special;
|
||||
short tag;
|
||||
// proff 07/23/2006 - support more than 32768 sidedefs
|
||||
// use the unsigned value and special case the -1
|
||||
// sidenum[1] will be -1 (NO_INDEX) if one sided
|
||||
unsigned short sidenum[2];
|
||||
} PACKEDATTR maplinedef_t;
|
||||
|
||||
#define NO_INDEX ((unsigned short)-1)
|
||||
|
||||
//
|
||||
// LineDef attributes.
|
||||
//
|
||||
|
||||
// Solid, is an obstacle.
|
||||
#define ML_BLOCKING 1
|
||||
|
||||
// Blocks monsters only.
|
||||
#define ML_BLOCKMONSTERS 2
|
||||
|
||||
// Backside will not be drawn if not two sided.
|
||||
#define ML_TWOSIDED 4
|
||||
|
||||
// If a texture is pegged, the texture will have
|
||||
// the end exposed to air held constant at the
|
||||
// top or bottom of the texture (stairs or pulled
|
||||
// down things) and will move with a height change
|
||||
// of one of the neighbor sectors.
|
||||
// Unpegged textures always have the first row of
|
||||
// the texture at the top pixel of the line for both
|
||||
// top and bottom textures (use next to windows).
|
||||
|
||||
// upper texture unpegged
|
||||
#define ML_DONTPEGTOP 8
|
||||
|
||||
// lower texture unpegged
|
||||
#define ML_DONTPEGBOTTOM 16
|
||||
|
||||
// In AutoMap: don't map as two sided: IT'S A SECRET!
|
||||
#define ML_SECRET 32
|
||||
|
||||
// Sound rendering: don't let sound cross two of these.
|
||||
#define ML_SOUNDBLOCK 64
|
||||
|
||||
// Don't draw on the automap at all.
|
||||
#define ML_DONTDRAW 128
|
||||
|
||||
// Set if already seen, thus drawn in automap.
|
||||
#define ML_MAPPED 256
|
||||
|
||||
//jff 3/21/98 Set if line absorbs use by player
|
||||
//allow multiple push/switch triggers to be used on one push
|
||||
#define ML_PASSUSE 512
|
||||
|
||||
// Sector definition, from editing.
|
||||
typedef struct
|
||||
{
|
||||
short floorheight;
|
||||
short ceilingheight;
|
||||
char floorpic[8];
|
||||
char ceilingpic[8];
|
||||
short lightlevel;
|
||||
short special;
|
||||
short tag;
|
||||
} PACKEDATTR mapsector_t;
|
||||
|
||||
// SubSector, as generated by BSP.
|
||||
typedef struct
|
||||
{
|
||||
unsigned short numsegs;
|
||||
unsigned short firstseg; // Index of first one; segs are stored sequentially.
|
||||
} PACKEDATTR mapsubsector_t;
|
||||
|
||||
// LineSeg, generated by splitting LineDefs
|
||||
// using partition lines selected by BSP builder.
|
||||
typedef struct
|
||||
{
|
||||
unsigned short v1;
|
||||
unsigned short v2;
|
||||
short angle;
|
||||
unsigned short linedef;
|
||||
short side;
|
||||
short offset;
|
||||
} PACKEDATTR mapseg_t;
|
||||
|
||||
// BSP node structure.
|
||||
|
||||
// Indicate a leaf.
|
||||
#define NF_SUBSECTOR 0x8000
|
||||
|
||||
// Thing definition, position, orientation and type,
|
||||
// plus skill/visibility flags and attributes.
|
||||
typedef struct
|
||||
{
|
||||
short x;
|
||||
short y;
|
||||
short angle;
|
||||
short type;
|
||||
short options;
|
||||
} PACKEDATTR mapthing_t;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma pack(pop)
|
||||
#endif //_MSC_VER
|
||||
|
||||
//This is used at runtime so not packed.
|
||||
//compiler uses byte access on packed structs.
|
||||
|
||||
typedef struct
|
||||
{
|
||||
short x; // Partition line from (x,y) to x+dx,y+dy)
|
||||
short y;
|
||||
short dx;
|
||||
short dy;
|
||||
// Bounding box for each child, clip against view frustum.
|
||||
short bbox[2][4];
|
||||
// If NF_SUBSECTOR its a subsector, else it's a node of another subtree.
|
||||
unsigned short children[2];
|
||||
} mapnode_t;
|
||||
|
||||
#endif // __DOOMDATA__
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* all external data is defined here
|
||||
* most of the data is loaded into different structures at run time
|
||||
* some internal structures shared by many modules are here
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __DOOMDATA__
|
||||
#define __DOOMDATA__
|
||||
|
||||
// The most basic types we use, portability.
|
||||
#include "config.h"
|
||||
#include "doomtype.h"
|
||||
|
||||
//
|
||||
// Map level types.
|
||||
// The following data structures define the persistent format
|
||||
// used in the lumps of the WAD files.
|
||||
//
|
||||
|
||||
// Lump order in a map WAD: each map needs a couple of lumps
|
||||
// to provide a complete scene geometry description.
|
||||
enum
|
||||
{
|
||||
ML_LABEL, // A separator, name, ExMx or MAPxx
|
||||
ML_THINGS, // Monsters, items..
|
||||
ML_LINEDEFS, // LineDefs, from editing
|
||||
ML_SIDEDEFS, // SideDefs, from editing
|
||||
ML_VERTEXES, // Vertices, edited and BSP splits generated
|
||||
ML_SEGS, // LineSegs, from LineDefs split by BSP
|
||||
ML_SSECTORS, // SubSectors, list of LineSegs
|
||||
ML_NODES, // BSP nodes
|
||||
ML_SECTORS, // Sectors, from editing
|
||||
ML_REJECT, // LUT, sector-sector visibility
|
||||
ML_BLOCKMAP // LUT, motion clipping, walls/grid element
|
||||
};
|
||||
|
||||
#ifdef _MSC_VER // proff: This is the same as __attribute__ ((packed)) in GNUC
|
||||
#pragma pack(push)
|
||||
#pragma pack(1)
|
||||
#endif //_MSC_VER
|
||||
|
||||
// A single Vertex.
|
||||
typedef struct
|
||||
{
|
||||
short x, y;
|
||||
} PACKEDATTR mapvertex_t;
|
||||
|
||||
// A SideDef, defining the visual appearance of a wall,
|
||||
// by setting textures and offsets.
|
||||
typedef struct
|
||||
{
|
||||
short textureoffset;
|
||||
short rowoffset;
|
||||
short toptexture;
|
||||
short bottomtexture;
|
||||
short midtexture;
|
||||
short sector; // Front sector, towards viewer.
|
||||
} PACKEDATTR mapsidedef_t;
|
||||
|
||||
// A LineDef, as used for editing, and as input to the BSP builder.
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned short v1;
|
||||
unsigned short v2;
|
||||
unsigned short flags;
|
||||
short special;
|
||||
short tag;
|
||||
// proff 07/23/2006 - support more than 32768 sidedefs
|
||||
// use the unsigned value and special case the -1
|
||||
// sidenum[1] will be -1 (NO_INDEX) if one sided
|
||||
unsigned short sidenum[2];
|
||||
} PACKEDATTR maplinedef_t;
|
||||
|
||||
#define NO_INDEX ((unsigned short)-1)
|
||||
|
||||
//
|
||||
// LineDef attributes.
|
||||
//
|
||||
|
||||
// Solid, is an obstacle.
|
||||
#define ML_BLOCKING 1
|
||||
|
||||
// Blocks monsters only.
|
||||
#define ML_BLOCKMONSTERS 2
|
||||
|
||||
// Backside will not be drawn if not two sided.
|
||||
#define ML_TWOSIDED 4
|
||||
|
||||
// If a texture is pegged, the texture will have
|
||||
// the end exposed to air held constant at the
|
||||
// top or bottom of the texture (stairs or pulled
|
||||
// down things) and will move with a height change
|
||||
// of one of the neighbor sectors.
|
||||
// Unpegged textures always have the first row of
|
||||
// the texture at the top pixel of the line for both
|
||||
// top and bottom textures (use next to windows).
|
||||
|
||||
// upper texture unpegged
|
||||
#define ML_DONTPEGTOP 8
|
||||
|
||||
// lower texture unpegged
|
||||
#define ML_DONTPEGBOTTOM 16
|
||||
|
||||
// In AutoMap: don't map as two sided: IT'S A SECRET!
|
||||
#define ML_SECRET 32
|
||||
|
||||
// Sound rendering: don't let sound cross two of these.
|
||||
#define ML_SOUNDBLOCK 64
|
||||
|
||||
// Don't draw on the automap at all.
|
||||
#define ML_DONTDRAW 128
|
||||
|
||||
// Set if already seen, thus drawn in automap.
|
||||
#define ML_MAPPED 256
|
||||
|
||||
//jff 3/21/98 Set if line absorbs use by player
|
||||
//allow multiple push/switch triggers to be used on one push
|
||||
#define ML_PASSUSE 512
|
||||
|
||||
// Sector definition, from editing.
|
||||
typedef struct
|
||||
{
|
||||
short floorheight;
|
||||
short ceilingheight;
|
||||
char floorpic[8];
|
||||
char ceilingpic[8];
|
||||
short lightlevel;
|
||||
short special;
|
||||
short tag;
|
||||
} PACKEDATTR mapsector_t;
|
||||
|
||||
// SubSector, as generated by BSP.
|
||||
typedef struct
|
||||
{
|
||||
unsigned short numsegs;
|
||||
unsigned short firstseg; // Index of first one; segs are stored sequentially.
|
||||
} PACKEDATTR mapsubsector_t;
|
||||
|
||||
// LineSeg, generated by splitting LineDefs
|
||||
// using partition lines selected by BSP builder.
|
||||
typedef struct
|
||||
{
|
||||
unsigned short v1;
|
||||
unsigned short v2;
|
||||
short angle;
|
||||
unsigned short linedef;
|
||||
short side;
|
||||
short offset;
|
||||
} PACKEDATTR mapseg_t;
|
||||
|
||||
// BSP node structure.
|
||||
|
||||
// Indicate a leaf.
|
||||
#define NF_SUBSECTOR 0x8000
|
||||
|
||||
// Thing definition, position, orientation and type,
|
||||
// plus skill/visibility flags and attributes.
|
||||
typedef struct
|
||||
{
|
||||
short x;
|
||||
short y;
|
||||
short angle;
|
||||
short type;
|
||||
short options;
|
||||
} PACKEDATTR mapthing_t;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma pack(pop)
|
||||
#endif //_MSC_VER
|
||||
|
||||
//This is used at runtime so not packed.
|
||||
//compiler uses byte access on packed structs.
|
||||
|
||||
typedef struct
|
||||
{
|
||||
short x; // Partition line from (x,y) to x+dx,y+dy)
|
||||
short y;
|
||||
short dx;
|
||||
short dy;
|
||||
// Bounding box for each child, clip against view frustum.
|
||||
short bbox[2][4];
|
||||
// If NF_SUBSECTOR its a subsector, else it's a node of another subtree.
|
||||
unsigned short children[2];
|
||||
} mapnode_t;
|
||||
|
||||
#endif // __DOOMDATA__
|
||||
@@ -1,317 +1,317 @@
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Internally used data structures for virtually everything,
|
||||
* key definitions, lots of other stuff.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __DOOMDEF__
|
||||
#define __DOOMDEF__
|
||||
#include "main.h"
|
||||
/* use config.h if autoconf made one -- josh */
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
#define demo_compatibility 1
|
||||
// killough 4/25/98: Make gcc extensions mean nothing on other compilers
|
||||
#ifndef __GNUC__
|
||||
#define __attribute__(x)
|
||||
#endif
|
||||
|
||||
//
|
||||
#define YCOORD_DATATYPE signed short
|
||||
// This must come first, since it redefines malloc(), free(), etc. -- killough:
|
||||
#include "z_zone.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <limits.h>
|
||||
#include "printf.h"
|
||||
// this should go here, not in makefile/configure.ac -- josh
|
||||
#ifndef O_BINARY
|
||||
#define O_BINARY 0
|
||||
#endif
|
||||
|
||||
#include "m_swap.h"
|
||||
#include "version.h"
|
||||
#include "main.h"
|
||||
#include "i_memory.h"
|
||||
//
|
||||
//
|
||||
typedef unsigned angle_t;
|
||||
// Game mode handling - identify IWAD version
|
||||
// to handle IWAD dependend animations etc.
|
||||
typedef enum
|
||||
{
|
||||
shareware, // DOOM 1 shareware, E1, M9
|
||||
registered, // DOOM 1 registered, E3, M27
|
||||
commercial, // DOOM 2 retail, E1 M34 (DOOM 2 german edition not handled)
|
||||
retail, // DOOM 1 retail, E4, M36
|
||||
indetermined // Well, no IWAD found.
|
||||
} GameMode_t;
|
||||
|
||||
// Mission packs - might be useful for TC stuff?
|
||||
typedef enum
|
||||
{
|
||||
doom, // DOOM 1
|
||||
doom2, // DOOM 2
|
||||
pack_tnt, // TNT mission pack
|
||||
pack_plut, // Plutonia pack
|
||||
none
|
||||
} GameMission_t;
|
||||
|
||||
// Identify language to use, software localization.
|
||||
typedef enum
|
||||
{
|
||||
english, french, german, unknown
|
||||
} Language_t;
|
||||
|
||||
//
|
||||
// For resize of screen, at start of game.
|
||||
//
|
||||
|
||||
#define BASE_WIDTH 320
|
||||
#define BASE_HEIGHT 200
|
||||
|
||||
// It is educational but futile to change this
|
||||
// scaling e.g. to 2. Drawing of status bar,
|
||||
// menues etc. is tied to the scale implied
|
||||
// by the graphics.
|
||||
|
||||
#define INV_ASPECT_RATIO 0.625 /* 0.75, ideally */
|
||||
|
||||
// killough 2/8/98: MAX versions for maximum screen sizes
|
||||
// allows us to avoid the overhead of dynamic allocation
|
||||
// when multiple screen sizes are supported
|
||||
|
||||
// proff 08/17/98: Changed for high-res
|
||||
|
||||
#ifndef PDOOM_W
|
||||
#define PDOOM_W 128
|
||||
#define PDOOM_H 128
|
||||
#endif
|
||||
#define SCREENWIDTH_PHYSICAL PDOOM_W
|
||||
#define MAX_SCREENHEIGHT PDOOM_H
|
||||
|
||||
// SCREENWIDTH and SCREENHEIGHT define the visible size
|
||||
#define HIGHRES
|
||||
#ifdef HIGHRES
|
||||
#define MAX_SCREENWIDTH (SCREENWIDTH_PHYSICAL)
|
||||
#else
|
||||
#define MAX_SCREENWIDTH (SCREENWIDTH_PHYSICAL/2)
|
||||
#endif
|
||||
#define SCREENWIDTH MAX_SCREENWIDTH
|
||||
|
||||
#define SCREENHEIGHT MAX_SCREENHEIGHT
|
||||
#define SCREENPITCH SCREENWIDTH //In pixels.
|
||||
// SCREENPITCH is the size of one line in the buffer and
|
||||
// can be bigger than the SCREENWIDTH depending on the size
|
||||
// of one pixel (8, 16 or 32 bit) and the padding at the
|
||||
// end of the line caused by hardware considerations
|
||||
|
||||
// The maximum number of players, multiplayer/networking.
|
||||
#define MAXPLAYERS 1
|
||||
|
||||
// phares 5/14/98:
|
||||
// DOOM Editor Numbers (aka doomednum in mobj_t)
|
||||
|
||||
#define DEN_PLAYER5 4001
|
||||
#define DEN_PLAYER6 4002
|
||||
#define DEN_PLAYER7 4003
|
||||
#define DEN_PLAYER8 4004
|
||||
|
||||
// State updates, number of tics / second.
|
||||
#define TICRATE 35
|
||||
|
||||
// The current state of the game: whether we are playing, gazing
|
||||
// at the intermission screen, the game final animation, or a demo.
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GS_LEVEL, GS_INTERMISSION, GS_FINALE, GS_DEMOSCREEN
|
||||
} gamestate_t;
|
||||
|
||||
//
|
||||
// Difficulty/skill settings/filters.
|
||||
//
|
||||
// These are Thing flags
|
||||
|
||||
// Skill flags.
|
||||
#define MTF_EASY 1
|
||||
#define MTF_NORMAL 2
|
||||
#define MTF_HARD 4
|
||||
// Deaf monsters/do not react to sound.
|
||||
#define MTF_AMBUSH 8
|
||||
|
||||
/* killough 11/98 */
|
||||
#define MTF_NOTSINGLE 16
|
||||
#define MTF_NOTDM 32
|
||||
#define MTF_NOTCOOP 64
|
||||
#define MTF_FRIEND 128
|
||||
#define MTF_RESERVED 256
|
||||
|
||||
typedef enum
|
||||
{
|
||||
sk_none = -1, //jff 3/24/98 create unpicked skill setting
|
||||
sk_baby = 0,
|
||||
sk_easy,
|
||||
sk_medium,
|
||||
sk_hard,
|
||||
sk_nightmare
|
||||
} skill_t;
|
||||
|
||||
//
|
||||
// Key cards.
|
||||
//
|
||||
|
||||
typedef enum
|
||||
{
|
||||
it_bluecard,
|
||||
it_yellowcard,
|
||||
it_redcard,
|
||||
it_blueskull,
|
||||
it_yellowskull,
|
||||
it_redskull,
|
||||
NUMCARDS
|
||||
} card_t;
|
||||
|
||||
// The defined weapons, including a marker
|
||||
// indicating user has not changed weapon.
|
||||
typedef enum
|
||||
{
|
||||
wp_fist,
|
||||
wp_pistol,
|
||||
wp_shotgun,
|
||||
wp_chaingun,
|
||||
wp_missile,
|
||||
wp_plasma,
|
||||
wp_bfg,
|
||||
wp_chainsaw,
|
||||
wp_supershotgun,
|
||||
|
||||
NUMWEAPONS,
|
||||
wp_nochange // No pending weapon change.
|
||||
} weapontype_t;
|
||||
|
||||
// Ammunition types defined.
|
||||
typedef enum
|
||||
{
|
||||
am_clip, // Pistol / chaingun ammo.
|
||||
am_shell, // Shotgun / double barreled shotgun.
|
||||
am_cell, // Plasma rifle, BFG.
|
||||
am_misl, // Missile launcher.
|
||||
NUMAMMO,
|
||||
am_noammo // Unlimited for chainsaw / fist.
|
||||
} ammotype_t;
|
||||
|
||||
// Power up artifacts.
|
||||
typedef enum
|
||||
{
|
||||
pw_invulnerability,
|
||||
pw_strength,
|
||||
pw_invisibility,
|
||||
pw_ironfeet,
|
||||
pw_allmap,
|
||||
pw_infrared,
|
||||
NUMPOWERS
|
||||
} powertype_t;
|
||||
|
||||
// Power up durations (how many seconds till expiration).
|
||||
typedef enum
|
||||
{
|
||||
INVULNTICS = (30 * TICRATE),
|
||||
INVISTICS = (60 * TICRATE),
|
||||
INFRATICS = (120 * TICRATE),
|
||||
IRONTICS = (60 * TICRATE)
|
||||
} powerduration_t;
|
||||
#include "keyboard.h"
|
||||
//
|
||||
#define KEYD_ALT 1
|
||||
#define KEYD_FIRE 2
|
||||
#define KEYD_USE 3
|
||||
#define KEYD_CHGW 4
|
||||
#define KEYD_CHGWDOWN 5
|
||||
#define KEYD_UP 6
|
||||
#define KEYD_DOWN 7
|
||||
#define KEYD_LEFT 8
|
||||
#define KEYD_RIGHT 9
|
||||
#define KEYD_SL 10
|
||||
#define KEYD_SR 11
|
||||
#define KEYD_MENU 12
|
||||
//
|
||||
#define KEYD_MAP1 13
|
||||
#define KEYD_SPEED 14
|
||||
|
||||
//
|
||||
|
||||
// phares 4/19/98:
|
||||
// Defines Setup Screen groups that config variables appear in.
|
||||
// Used when resetting the defaults for every item in a Setup group.
|
||||
|
||||
typedef enum
|
||||
{
|
||||
ss_none,
|
||||
ss_keys,
|
||||
ss_weap,
|
||||
ss_stat,
|
||||
ss_auto,
|
||||
ss_enem,
|
||||
ss_mess,
|
||||
ss_chat,
|
||||
ss_gen, /* killough 10/98 */
|
||||
ss_comp, /* killough 10/98 */
|
||||
ss_max
|
||||
} ss_types;
|
||||
|
||||
typedef YCOORD_DATATYPE ycoord_t; //
|
||||
// phares 3/20/98:
|
||||
//
|
||||
// Player friction is variable, based on controlling
|
||||
// linedefs. More friction can create mud, sludge,
|
||||
// magnetized floors, etc. Less friction can create ice.
|
||||
|
||||
#define MORE_FRICTION_MOMENTUM 15000 // mud factor based on momentum
|
||||
#define ORIG_FRICTION 0xE800 // original value
|
||||
#define ORIG_FRICTION_FACTOR 2048 // original value
|
||||
|
||||
#endif // __DOOMDEF__
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Internally used data structures for virtually everything,
|
||||
* key definitions, lots of other stuff.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __DOOMDEF__
|
||||
#define __DOOMDEF__
|
||||
#include "main.h"
|
||||
/* use config.h if autoconf made one -- josh */
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
#define demo_compatibility 1
|
||||
// killough 4/25/98: Make gcc extensions mean nothing on other compilers
|
||||
#ifndef __GNUC__
|
||||
#define __attribute__(x)
|
||||
#endif
|
||||
|
||||
//
|
||||
#define YCOORD_DATATYPE signed short
|
||||
// This must come first, since it redefines malloc(), free(), etc. -- killough:
|
||||
#include "z_zone.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <limits.h>
|
||||
#include "printf.h"
|
||||
// this should go here, not in makefile/configure.ac -- josh
|
||||
#ifndef O_BINARY
|
||||
#define O_BINARY 0
|
||||
#endif
|
||||
|
||||
#include "m_swap.h"
|
||||
#include "version.h"
|
||||
#include "main.h"
|
||||
#include "i_memory.h"
|
||||
//
|
||||
//
|
||||
typedef unsigned angle_t;
|
||||
// Game mode handling - identify IWAD version
|
||||
// to handle IWAD dependend animations etc.
|
||||
typedef enum
|
||||
{
|
||||
shareware, // DOOM 1 shareware, E1, M9
|
||||
registered, // DOOM 1 registered, E3, M27
|
||||
commercial, // DOOM 2 retail, E1 M34 (DOOM 2 german edition not handled)
|
||||
retail, // DOOM 1 retail, E4, M36
|
||||
indetermined // Well, no IWAD found.
|
||||
} GameMode_t;
|
||||
|
||||
// Mission packs - might be useful for TC stuff?
|
||||
typedef enum
|
||||
{
|
||||
doom, // DOOM 1
|
||||
doom2, // DOOM 2
|
||||
pack_tnt, // TNT mission pack
|
||||
pack_plut, // Plutonia pack
|
||||
none
|
||||
} GameMission_t;
|
||||
|
||||
// Identify language to use, software localization.
|
||||
typedef enum
|
||||
{
|
||||
english, french, german, unknown
|
||||
} Language_t;
|
||||
|
||||
//
|
||||
// For resize of screen, at start of game.
|
||||
//
|
||||
|
||||
#define BASE_WIDTH 320
|
||||
#define BASE_HEIGHT 200
|
||||
|
||||
// It is educational but futile to change this
|
||||
// scaling e.g. to 2. Drawing of status bar,
|
||||
// menues etc. is tied to the scale implied
|
||||
// by the graphics.
|
||||
|
||||
#define INV_ASPECT_RATIO 0.625 /* 0.75, ideally */
|
||||
|
||||
// killough 2/8/98: MAX versions for maximum screen sizes
|
||||
// allows us to avoid the overhead of dynamic allocation
|
||||
// when multiple screen sizes are supported
|
||||
|
||||
// proff 08/17/98: Changed for high-res
|
||||
|
||||
#ifndef PDOOM_W
|
||||
#define PDOOM_W 128
|
||||
#define PDOOM_H 128
|
||||
#endif
|
||||
#define SCREENWIDTH_PHYSICAL PDOOM_W
|
||||
#define MAX_SCREENHEIGHT PDOOM_H
|
||||
|
||||
// SCREENWIDTH and SCREENHEIGHT define the visible size
|
||||
#define HIGHRES
|
||||
#ifdef HIGHRES
|
||||
#define MAX_SCREENWIDTH (SCREENWIDTH_PHYSICAL)
|
||||
#else
|
||||
#define MAX_SCREENWIDTH (SCREENWIDTH_PHYSICAL/2)
|
||||
#endif
|
||||
#define SCREENWIDTH MAX_SCREENWIDTH
|
||||
|
||||
#define SCREENHEIGHT MAX_SCREENHEIGHT
|
||||
#define SCREENPITCH SCREENWIDTH //In pixels.
|
||||
// SCREENPITCH is the size of one line in the buffer and
|
||||
// can be bigger than the SCREENWIDTH depending on the size
|
||||
// of one pixel (8, 16 or 32 bit) and the padding at the
|
||||
// end of the line caused by hardware considerations
|
||||
|
||||
// The maximum number of players, multiplayer/networking.
|
||||
#define MAXPLAYERS 1
|
||||
|
||||
// phares 5/14/98:
|
||||
// DOOM Editor Numbers (aka doomednum in mobj_t)
|
||||
|
||||
#define DEN_PLAYER5 4001
|
||||
#define DEN_PLAYER6 4002
|
||||
#define DEN_PLAYER7 4003
|
||||
#define DEN_PLAYER8 4004
|
||||
|
||||
// State updates, number of tics / second.
|
||||
#define TICRATE 35
|
||||
|
||||
// The current state of the game: whether we are playing, gazing
|
||||
// at the intermission screen, the game final animation, or a demo.
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GS_LEVEL, GS_INTERMISSION, GS_FINALE, GS_DEMOSCREEN
|
||||
} gamestate_t;
|
||||
|
||||
//
|
||||
// Difficulty/skill settings/filters.
|
||||
//
|
||||
// These are Thing flags
|
||||
|
||||
// Skill flags.
|
||||
#define MTF_EASY 1
|
||||
#define MTF_NORMAL 2
|
||||
#define MTF_HARD 4
|
||||
// Deaf monsters/do not react to sound.
|
||||
#define MTF_AMBUSH 8
|
||||
|
||||
/* killough 11/98 */
|
||||
#define MTF_NOTSINGLE 16
|
||||
#define MTF_NOTDM 32
|
||||
#define MTF_NOTCOOP 64
|
||||
#define MTF_FRIEND 128
|
||||
#define MTF_RESERVED 256
|
||||
|
||||
typedef enum
|
||||
{
|
||||
sk_none = -1, //jff 3/24/98 create unpicked skill setting
|
||||
sk_baby = 0,
|
||||
sk_easy,
|
||||
sk_medium,
|
||||
sk_hard,
|
||||
sk_nightmare
|
||||
} skill_t;
|
||||
|
||||
//
|
||||
// Key cards.
|
||||
//
|
||||
|
||||
typedef enum
|
||||
{
|
||||
it_bluecard,
|
||||
it_yellowcard,
|
||||
it_redcard,
|
||||
it_blueskull,
|
||||
it_yellowskull,
|
||||
it_redskull,
|
||||
NUMCARDS
|
||||
} card_t;
|
||||
|
||||
// The defined weapons, including a marker
|
||||
// indicating user has not changed weapon.
|
||||
typedef enum
|
||||
{
|
||||
wp_fist,
|
||||
wp_pistol,
|
||||
wp_shotgun,
|
||||
wp_chaingun,
|
||||
wp_missile,
|
||||
wp_plasma,
|
||||
wp_bfg,
|
||||
wp_chainsaw,
|
||||
wp_supershotgun,
|
||||
|
||||
NUMWEAPONS,
|
||||
wp_nochange // No pending weapon change.
|
||||
} weapontype_t;
|
||||
|
||||
// Ammunition types defined.
|
||||
typedef enum
|
||||
{
|
||||
am_clip, // Pistol / chaingun ammo.
|
||||
am_shell, // Shotgun / double barreled shotgun.
|
||||
am_cell, // Plasma rifle, BFG.
|
||||
am_misl, // Missile launcher.
|
||||
NUMAMMO,
|
||||
am_noammo // Unlimited for chainsaw / fist.
|
||||
} ammotype_t;
|
||||
|
||||
// Power up artifacts.
|
||||
typedef enum
|
||||
{
|
||||
pw_invulnerability,
|
||||
pw_strength,
|
||||
pw_invisibility,
|
||||
pw_ironfeet,
|
||||
pw_allmap,
|
||||
pw_infrared,
|
||||
NUMPOWERS
|
||||
} powertype_t;
|
||||
|
||||
// Power up durations (how many seconds till expiration).
|
||||
typedef enum
|
||||
{
|
||||
INVULNTICS = (30 * TICRATE),
|
||||
INVISTICS = (60 * TICRATE),
|
||||
INFRATICS = (120 * TICRATE),
|
||||
IRONTICS = (60 * TICRATE)
|
||||
} powerduration_t;
|
||||
#include "keyboard.h"
|
||||
//
|
||||
#define KEYD_ALT 1
|
||||
#define KEYD_FIRE 2
|
||||
#define KEYD_USE 3
|
||||
#define KEYD_CHGW 4
|
||||
#define KEYD_CHGWDOWN 5
|
||||
#define KEYD_UP 6
|
||||
#define KEYD_DOWN 7
|
||||
#define KEYD_LEFT 8
|
||||
#define KEYD_RIGHT 9
|
||||
#define KEYD_SL 10
|
||||
#define KEYD_SR 11
|
||||
#define KEYD_MENU 12
|
||||
//
|
||||
#define KEYD_MAP1 13
|
||||
#define KEYD_SPEED 14
|
||||
|
||||
//
|
||||
|
||||
// phares 4/19/98:
|
||||
// Defines Setup Screen groups that config variables appear in.
|
||||
// Used when resetting the defaults for every item in a Setup group.
|
||||
|
||||
typedef enum
|
||||
{
|
||||
ss_none,
|
||||
ss_keys,
|
||||
ss_weap,
|
||||
ss_stat,
|
||||
ss_auto,
|
||||
ss_enem,
|
||||
ss_mess,
|
||||
ss_chat,
|
||||
ss_gen, /* killough 10/98 */
|
||||
ss_comp, /* killough 10/98 */
|
||||
ss_max
|
||||
} ss_types;
|
||||
|
||||
typedef YCOORD_DATATYPE ycoord_t; //
|
||||
// phares 3/20/98:
|
||||
//
|
||||
// Player friction is variable, based on controlling
|
||||
// linedefs. More friction can create mud, sludge,
|
||||
// magnetized floors, etc. Less friction can create ice.
|
||||
|
||||
#define MORE_FRICTION_MOMENTUM 15000 // mud factor based on momentum
|
||||
#define ORIG_FRICTION 0xE800 // original value
|
||||
#define ORIG_FRICTION_FACTOR 2048 // original value
|
||||
|
||||
#endif // __DOOMDEF__
|
||||
@@ -1,90 +1,90 @@
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* All the global variables that store the internal state.
|
||||
* Theoretically speaking, the internal state of the engine
|
||||
* should be found by looking at the variables collected
|
||||
* here, and every relevant module will have to include
|
||||
* this header file.
|
||||
* In practice, things are a bit messy.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __D_STATE__
|
||||
#define __D_STATE__
|
||||
|
||||
// We need the playr data structure as well.
|
||||
|
||||
#include "d_player.h"
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
// -------------------------------------------
|
||||
// Selected skill type, map etc.
|
||||
//
|
||||
|
||||
// Defaults for menu, methinks.
|
||||
extern const skill_t startskill;
|
||||
extern const int startepisode;
|
||||
extern const int startmap;
|
||||
|
||||
// -------------------------
|
||||
// Status flags for refresh.
|
||||
//
|
||||
|
||||
enum automapmode_e
|
||||
{
|
||||
am_active = 1, // currently shown
|
||||
am_overlay = 2, // covers the screen, i.e. not overlay mode
|
||||
am_rotate = 4, // rotates to the player facing direction
|
||||
am_follow = 8, // keep the player centred
|
||||
am_grid = 16, // show grid
|
||||
};
|
||||
extern enum automapmode_e automapmode; // Mode that the automap is in
|
||||
|
||||
//-----------------------------------------
|
||||
// Internal parameters, used for engine.
|
||||
//
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#endif
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* All the global variables that store the internal state.
|
||||
* Theoretically speaking, the internal state of the engine
|
||||
* should be found by looking at the variables collected
|
||||
* here, and every relevant module will have to include
|
||||
* this header file.
|
||||
* In practice, things are a bit messy.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __D_STATE__
|
||||
#define __D_STATE__
|
||||
|
||||
// We need the playr data structure as well.
|
||||
|
||||
#include "d_player.h"
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
// -------------------------------------------
|
||||
// Selected skill type, map etc.
|
||||
//
|
||||
|
||||
// Defaults for menu, methinks.
|
||||
extern const skill_t startskill;
|
||||
extern const int startepisode;
|
||||
extern const int startmap;
|
||||
|
||||
// -------------------------
|
||||
// Status flags for refresh.
|
||||
//
|
||||
|
||||
enum automapmode_e
|
||||
{
|
||||
am_active = 1, // currently shown
|
||||
am_overlay = 2, // covers the screen, i.e. not overlay mode
|
||||
am_rotate = 4, // rotates to the player facing direction
|
||||
am_follow = 8, // keep the player centred
|
||||
am_grid = 16, // show grid
|
||||
};
|
||||
extern enum automapmode_e automapmode; // Mode that the automap is in
|
||||
|
||||
//-----------------------------------------
|
||||
// Internal parameters, used for engine.
|
||||
//
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#endif
|
||||
@@ -1,123 +1,123 @@
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Simple basic typedefs, isolated here to make it easier
|
||||
* separating modules.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __DOOMTYPE__
|
||||
#define __DOOMTYPE__
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
#include <stdbool.h>
|
||||
#ifndef __BYTEBOOL__
|
||||
#define __BYTEBOOL__
|
||||
/* Fixed to use builtin bool type with C++. */
|
||||
#if 0
|
||||
#ifdef __cplusplus
|
||||
typedef bool boolean;
|
||||
#else
|
||||
typedef enum {false, true} boolean;
|
||||
#endif
|
||||
#else
|
||||
// next-hack
|
||||
//typedef enum {false, true} boolean_t;
|
||||
typedef unsigned char boolean;
|
||||
#endif
|
||||
typedef unsigned char byte;
|
||||
#endif
|
||||
// 2021-02-13 next-hack. Each pointer is 4 bytes long, and we use a lot of them.
|
||||
// But since we will have less than 256kB of RAM, and since pointers to struct, int
|
||||
// other zmalloc'ed things are 4-bytes aligned, we can just use one unsigned short
|
||||
// In this way, we save 2 bytes per each pointer.
|
||||
|
||||
//e6y
|
||||
#ifndef MAX
|
||||
#define MAX(a,b) ((a)>(b)?(a):(b))
|
||||
#endif
|
||||
#ifndef MIN
|
||||
#define MIN(a,b) ((a)<(b)?(a):(b))
|
||||
#endif
|
||||
|
||||
/* cph - Wrapper for the long long type, as Win32 used a different name.
|
||||
* Except I don't know what to test as it's compiler specific
|
||||
* Proff - I fixed it */
|
||||
|
||||
#ifdef __WINS__
|
||||
#define int_64_t __int64
|
||||
#define uint_64_t unsigned __int64
|
||||
#else
|
||||
#define int_64_t long long
|
||||
#define uint_64_t unsigned long long
|
||||
#endif
|
||||
|
||||
//typedef _int64 int_64_t;
|
||||
//typedef unsigned _int64 uint_64_t;
|
||||
// define compiled-specific long-long contstant notation here
|
||||
#define LONGLONG(num) (uint_64_t)num
|
||||
#undef PATH_MAX
|
||||
#define PATH_MAX 1024
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define CONSTFUNC
|
||||
#define PUREFUNC
|
||||
#define NORETURN __attribute__ ((noreturn))
|
||||
#else
|
||||
#define CONSTFUNC
|
||||
#define PUREFUNC
|
||||
#define NORETURN
|
||||
#endif
|
||||
|
||||
/* CPhipps - use limits.h instead of depreciated values.h */
|
||||
#include <limits.h>
|
||||
|
||||
/* cph - from v_video.h, needed by gl_struct.h */
|
||||
enum patch_translation_e
|
||||
{
|
||||
VPT_NONE = 0, // Normal
|
||||
VPT_FLIP = 1, // Flip image horizontally
|
||||
VPT_TRANS = 2, // Translate image via a translation table
|
||||
VPT_STRETCH = 4, // Stretch to compensate for high-res
|
||||
};
|
||||
|
||||
#endif
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Simple basic typedefs, isolated here to make it easier
|
||||
* separating modules.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __DOOMTYPE__
|
||||
#define __DOOMTYPE__
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
#include <stdbool.h>
|
||||
#ifndef __BYTEBOOL__
|
||||
#define __BYTEBOOL__
|
||||
/* Fixed to use builtin bool type with C++. */
|
||||
#if 0
|
||||
#ifdef __cplusplus
|
||||
typedef bool boolean;
|
||||
#else
|
||||
typedef enum {false, true} boolean;
|
||||
#endif
|
||||
#else
|
||||
// next-hack
|
||||
//typedef enum {false, true} boolean_t;
|
||||
typedef unsigned char boolean;
|
||||
#endif
|
||||
typedef unsigned char byte;
|
||||
#endif
|
||||
// 2021-02-13 next-hack. Each pointer is 4 bytes long, and we use a lot of them.
|
||||
// But since we will have less than 256kB of RAM, and since pointers to struct, int
|
||||
// other zmalloc'ed things are 4-bytes aligned, we can just use one unsigned short
|
||||
// In this way, we save 2 bytes per each pointer.
|
||||
|
||||
//e6y
|
||||
#ifndef MAX
|
||||
#define MAX(a,b) ((a)>(b)?(a):(b))
|
||||
#endif
|
||||
#ifndef MIN
|
||||
#define MIN(a,b) ((a)<(b)?(a):(b))
|
||||
#endif
|
||||
|
||||
/* cph - Wrapper for the long long type, as Win32 used a different name.
|
||||
* Except I don't know what to test as it's compiler specific
|
||||
* Proff - I fixed it */
|
||||
|
||||
#ifdef __WINS__
|
||||
#define int_64_t __int64
|
||||
#define uint_64_t unsigned __int64
|
||||
#else
|
||||
#define int_64_t long long
|
||||
#define uint_64_t unsigned long long
|
||||
#endif
|
||||
|
||||
//typedef _int64 int_64_t;
|
||||
//typedef unsigned _int64 uint_64_t;
|
||||
// define compiled-specific long-long contstant notation here
|
||||
#define LONGLONG(num) (uint_64_t)num
|
||||
#undef PATH_MAX
|
||||
#define PATH_MAX 1024
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define CONSTFUNC
|
||||
#define PUREFUNC
|
||||
#define NORETURN __attribute__ ((noreturn))
|
||||
#else
|
||||
#define CONSTFUNC
|
||||
#define PUREFUNC
|
||||
#define NORETURN
|
||||
#endif
|
||||
|
||||
/* CPhipps - use limits.h instead of depreciated values.h */
|
||||
#include <limits.h>
|
||||
|
||||
/* cph - from v_video.h, needed by gl_struct.h */
|
||||
enum patch_translation_e
|
||||
{
|
||||
VPT_NONE = 0, // Normal
|
||||
VPT_FLIP = 1, // Flip image horizontally
|
||||
VPT_TRANS = 2, // Translate image via a translation table
|
||||
VPT_STRETCH = 4, // Stretch to compensate for high-res
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,87 +1,87 @@
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* DOOM strings, by language.
|
||||
* Note: In BOOM, some new strings have been defined that are
|
||||
* not found in the French version. A better approach is
|
||||
* to create a BEX text-replacement file for other
|
||||
* languages since any language can be supported that way
|
||||
* without recompiling the program.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __DSTRINGS__
|
||||
#define __DSTRINGS__
|
||||
|
||||
/* All important printed strings.
|
||||
* Language selection (message strings).
|
||||
* Use -DFRENCH etc.
|
||||
*/
|
||||
|
||||
#ifdef FRENCH
|
||||
#include "d_french.h"
|
||||
#else
|
||||
#include "d_englsh.h"
|
||||
#endif
|
||||
|
||||
/* Note this is not externally modifiable through DEH/BEX
|
||||
* Misc. other strings.
|
||||
* #define SAVEGAMENAME "boomsav" * killough 3/22/98 *
|
||||
* Ty 05/04/98 - replaced with a modifiable string, see d_deh.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* File locations,
|
||||
* relative to current position.
|
||||
* Path names are OS-sensitive.
|
||||
*/
|
||||
#define DEVMAPS "devmaps"
|
||||
#define DEVDATA "devdata"
|
||||
|
||||
|
||||
/* Not done in french?
|
||||
* QuitDOOM messages *
|
||||
* killough 1/18/98:
|
||||
* replace hardcoded limit with extern var (silly hack, I know)
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#endif
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* DOOM strings, by language.
|
||||
* Note: In BOOM, some new strings have been defined that are
|
||||
* not found in the French version. A better approach is
|
||||
* to create a BEX text-replacement file for other
|
||||
* languages since any language can be supported that way
|
||||
* without recompiling the program.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __DSTRINGS__
|
||||
#define __DSTRINGS__
|
||||
|
||||
/* All important printed strings.
|
||||
* Language selection (message strings).
|
||||
* Use -DFRENCH etc.
|
||||
*/
|
||||
|
||||
#ifdef FRENCH
|
||||
#include "d_french.h"
|
||||
#else
|
||||
#include "d_englsh.h"
|
||||
#endif
|
||||
|
||||
/* Note this is not externally modifiable through DEH/BEX
|
||||
* Misc. other strings.
|
||||
* #define SAVEGAMENAME "boomsav" * killough 3/22/98 *
|
||||
* Ty 05/04/98 - replaced with a modifiable string, see d_deh.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* File locations,
|
||||
* relative to current position.
|
||||
* Path names are OS-sensitive.
|
||||
*/
|
||||
#define DEVMAPS "devmaps"
|
||||
#define DEVDATA "devdata"
|
||||
|
||||
|
||||
/* Not done in french?
|
||||
* QuitDOOM messages *
|
||||
* killough 1/18/98:
|
||||
* replace hardcoded limit with extern var (silly hack, I know)
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#endif
|
||||
@@ -1,66 +1,66 @@
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Related to f_finale.c, which is called at the end of a level
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __F_FINALE__
|
||||
#define __F_FINALE__
|
||||
|
||||
#include "doomtype.h"
|
||||
#include "d_event.h"
|
||||
|
||||
/*
|
||||
* FINALE
|
||||
*/
|
||||
|
||||
/* Called by main loop. */
|
||||
boolean F_Responder(event_t *ev);
|
||||
|
||||
/* Called by main loop. */
|
||||
void F_Ticker(void);
|
||||
|
||||
/* Called by main loop. */
|
||||
void F_Drawer(void);
|
||||
|
||||
void F_StartFinale(void);
|
||||
|
||||
#endif
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Related to f_finale.c, which is called at the end of a level
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __F_FINALE__
|
||||
#define __F_FINALE__
|
||||
|
||||
#include "doomtype.h"
|
||||
#include "d_event.h"
|
||||
|
||||
/*
|
||||
* FINALE
|
||||
*/
|
||||
|
||||
/* Called by main loop. */
|
||||
boolean F_Responder(event_t *ev);
|
||||
|
||||
/* Called by main loop. */
|
||||
void F_Ticker(void);
|
||||
|
||||
/* Called by main loop. */
|
||||
void F_Drawer(void);
|
||||
|
||||
void F_StartFinale(void);
|
||||
|
||||
#endif
|
||||
@@ -1,56 +1,56 @@
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Mission start screen wipe/melt, special effects.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __F_WIPE_H__
|
||||
#define __F_WIPE_H__
|
||||
#include <stdbool.h>
|
||||
/*
|
||||
* SCREEN WIPE PACKAGE
|
||||
*/
|
||||
void wipe_initMelt(short *y_lookup);
|
||||
int wipe_ScreenWipe(int ticks, short *y_lookup);
|
||||
int wipe_StartScreen(void);
|
||||
int wipe_EndScreen(void);
|
||||
|
||||
#endif
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Mission start screen wipe/melt, special effects.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __F_WIPE_H__
|
||||
#define __F_WIPE_H__
|
||||
#include <stdbool.h>
|
||||
/*
|
||||
* SCREEN WIPE PACKAGE
|
||||
*/
|
||||
void wipe_initMelt(short *y_lookup);
|
||||
int wipe_ScreenWipe(int ticks, short *y_lookup);
|
||||
int wipe_StartScreen(void);
|
||||
int wipe_EndScreen(void);
|
||||
|
||||
#endif
|
||||
@@ -1,156 +1,156 @@
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION: Main game control interface.
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __G_GAME__
|
||||
#define __G_GAME__
|
||||
|
||||
#include "doomdef.h"
|
||||
#include "d_event.h"
|
||||
#include "d_ticcmd.h"
|
||||
|
||||
//
|
||||
// GAME
|
||||
//
|
||||
|
||||
// killough 5/2/98: number of bytes reserved for saving options
|
||||
#define GAME_OPTION_SIZE 64
|
||||
|
||||
boolean G_Responder(event_t *ev);
|
||||
boolean G_CheckDemoStatus(void);
|
||||
void G_InitNew(skill_t skill, int episode, int map);
|
||||
void G_DeferedInitNew(skill_t skill, int episode, int map);
|
||||
void G_DeferedPlayDemo(const char *demo); // CPhipps - const
|
||||
void G_LoadGame(int slot, boolean is_command); // killough 5/15/98
|
||||
void G_ForcedLoadGame(void); // killough 5/15/98: forced loadgames
|
||||
void G_DoLoadGame(void);
|
||||
void G_SaveGame(int slot, const char *description); // Called by M_Responder.
|
||||
void G_ExitLevel(void);
|
||||
void G_SecretExitLevel(void);
|
||||
void G_WorldDone(void);
|
||||
void G_EndGame(void); /* cph - make m_menu.c call a G_* function for this */
|
||||
void G_Ticker(void);
|
||||
void G_ReloadDefaults(void); // killough 3/1/98: loads game defaults
|
||||
void G_DoNewGame(void);
|
||||
void G_DoReborn(int playernum);
|
||||
void G_DoPlayDemo(void);
|
||||
void G_DoCompleted(void);
|
||||
void G_ReadDemoTiccmd(ticcmd_t *cmd);
|
||||
void G_DoWorldDone(void);
|
||||
void G_Compatibility(void);
|
||||
const byte* G_ReadOptions(const byte *demo_p); /* killough 3/1/98 - cph: const byte* */
|
||||
void G_PlayerReborn(int player);
|
||||
void G_RestartLevel(void); // CPhipps - menu involked level restart
|
||||
void G_DoVictory(void);
|
||||
void G_BuildTiccmd(ticcmd_t *cmd); // CPhipps - move decl to header
|
||||
void G_MakeSpecialEvent(buttoncode_t bc, ...); /* cph - new event stuff */
|
||||
|
||||
void G_UpdateSaveGameStrings();
|
||||
|
||||
void G_LoadSettings();
|
||||
void G_SaveSettings();
|
||||
|
||||
// killough 5/2/98: moved from m_misc.c:
|
||||
|
||||
extern const int key_right;
|
||||
extern const int key_left;
|
||||
extern const int key_up;
|
||||
extern const int key_down;
|
||||
extern const int key_menu_right; // phares 3/7/98
|
||||
extern const int key_menu_left; // |
|
||||
extern const int key_menu_up; // V
|
||||
extern const int key_menu_down;
|
||||
extern const int key_menu_escape; // |
|
||||
extern const int key_menu_enter; // phares 3/7/98
|
||||
extern const int key_strafeleft;
|
||||
extern const int key_straferight;
|
||||
extern const int key_fire;
|
||||
extern const int key_use;
|
||||
extern const int key_strafe;
|
||||
extern const int key_speed;
|
||||
extern const int key_escape; // phares
|
||||
extern const int key_savegame; // |
|
||||
extern const int key_loadgame; // V
|
||||
extern const int key_reverse;
|
||||
extern const int key_zoomin;
|
||||
extern const int key_zoomout;
|
||||
extern const int key_chat;
|
||||
extern const int key_backspace;
|
||||
extern const int key_enter;
|
||||
extern const int key_help;
|
||||
extern const int key_soundvolume;
|
||||
extern const int key_hud;
|
||||
extern const int key_quicksave;
|
||||
extern const int key_endgame;
|
||||
extern const int key_messages;
|
||||
extern const int key_quickload;
|
||||
extern const int key_quit;
|
||||
extern const int key_gamma;
|
||||
extern const int key_spy;
|
||||
extern const int key_pause;
|
||||
extern const int key_setup;
|
||||
extern const int key_forward;
|
||||
extern const int key_leftturn;
|
||||
extern const int key_rightturn;
|
||||
extern const int key_backward;
|
||||
extern const int key_map_right;
|
||||
extern const int key_map_left;
|
||||
extern const int key_map_up;
|
||||
extern const int key_map_down;
|
||||
extern const int key_map_zoomin;
|
||||
extern const int key_map_zoomout;
|
||||
extern const int key_map;
|
||||
extern const int key_map_gobig;
|
||||
extern const int key_map_follow;
|
||||
extern const int key_map_mark; // ^
|
||||
extern const int key_map_clear; // |
|
||||
extern const int key_map_grid; // phares
|
||||
|
||||
// killough 5/2/98: moved from d_deh.c:
|
||||
// Par times (new item with BOOM) - from g_game.c
|
||||
extern const int pars[4][10]; // hardcoded array size
|
||||
extern const int cpars[32]; // hardcoded array size
|
||||
// CPhipps - Make savedesciption visible in wider scope
|
||||
#define SAVEDESCLEN 8
|
||||
|
||||
#define NUMKEYS 16
|
||||
|
||||
#endif
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION: Main game control interface.
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __G_GAME__
|
||||
#define __G_GAME__
|
||||
|
||||
#include "doomdef.h"
|
||||
#include "d_event.h"
|
||||
#include "d_ticcmd.h"
|
||||
|
||||
//
|
||||
// GAME
|
||||
//
|
||||
|
||||
// killough 5/2/98: number of bytes reserved for saving options
|
||||
#define GAME_OPTION_SIZE 64
|
||||
|
||||
boolean G_Responder(event_t *ev);
|
||||
boolean G_CheckDemoStatus(void);
|
||||
void G_InitNew(skill_t skill, int episode, int map);
|
||||
void G_DeferedInitNew(skill_t skill, int episode, int map);
|
||||
void G_DeferedPlayDemo(const char *demo); // CPhipps - const
|
||||
void G_LoadGame(int slot, boolean is_command); // killough 5/15/98
|
||||
void G_ForcedLoadGame(void); // killough 5/15/98: forced loadgames
|
||||
void G_DoLoadGame(void);
|
||||
void G_SaveGame(int slot, const char *description); // Called by M_Responder.
|
||||
void G_ExitLevel(void);
|
||||
void G_SecretExitLevel(void);
|
||||
void G_WorldDone(void);
|
||||
void G_EndGame(void); /* cph - make m_menu.c call a G_* function for this */
|
||||
void G_Ticker(void);
|
||||
void G_ReloadDefaults(void); // killough 3/1/98: loads game defaults
|
||||
void G_DoNewGame(void);
|
||||
void G_DoReborn(int playernum);
|
||||
void G_DoPlayDemo(void);
|
||||
void G_DoCompleted(void);
|
||||
void G_ReadDemoTiccmd(ticcmd_t *cmd);
|
||||
void G_DoWorldDone(void);
|
||||
void G_Compatibility(void);
|
||||
const byte* G_ReadOptions(const byte *demo_p); /* killough 3/1/98 - cph: const byte* */
|
||||
void G_PlayerReborn(int player);
|
||||
void G_RestartLevel(void); // CPhipps - menu involked level restart
|
||||
void G_DoVictory(void);
|
||||
void G_BuildTiccmd(ticcmd_t *cmd); // CPhipps - move decl to header
|
||||
void G_MakeSpecialEvent(buttoncode_t bc, ...); /* cph - new event stuff */
|
||||
|
||||
void G_UpdateSaveGameStrings();
|
||||
|
||||
void G_LoadSettings();
|
||||
void G_SaveSettings();
|
||||
|
||||
// killough 5/2/98: moved from m_misc.c:
|
||||
|
||||
extern const int key_right;
|
||||
extern const int key_left;
|
||||
extern const int key_up;
|
||||
extern const int key_down;
|
||||
extern const int key_menu_right; // phares 3/7/98
|
||||
extern const int key_menu_left; // |
|
||||
extern const int key_menu_up; // V
|
||||
extern const int key_menu_down;
|
||||
extern const int key_menu_escape; // |
|
||||
extern const int key_menu_enter; // phares 3/7/98
|
||||
extern const int key_strafeleft;
|
||||
extern const int key_straferight;
|
||||
extern const int key_fire;
|
||||
extern const int key_use;
|
||||
extern const int key_strafe;
|
||||
extern const int key_speed;
|
||||
extern const int key_escape; // phares
|
||||
extern const int key_savegame; // |
|
||||
extern const int key_loadgame; // V
|
||||
extern const int key_reverse;
|
||||
extern const int key_zoomin;
|
||||
extern const int key_zoomout;
|
||||
extern const int key_chat;
|
||||
extern const int key_backspace;
|
||||
extern const int key_enter;
|
||||
extern const int key_help;
|
||||
extern const int key_soundvolume;
|
||||
extern const int key_hud;
|
||||
extern const int key_quicksave;
|
||||
extern const int key_endgame;
|
||||
extern const int key_messages;
|
||||
extern const int key_quickload;
|
||||
extern const int key_quit;
|
||||
extern const int key_gamma;
|
||||
extern const int key_spy;
|
||||
extern const int key_pause;
|
||||
extern const int key_setup;
|
||||
extern const int key_forward;
|
||||
extern const int key_leftturn;
|
||||
extern const int key_rightturn;
|
||||
extern const int key_backward;
|
||||
extern const int key_map_right;
|
||||
extern const int key_map_left;
|
||||
extern const int key_map_up;
|
||||
extern const int key_map_down;
|
||||
extern const int key_map_zoomin;
|
||||
extern const int key_map_zoomout;
|
||||
extern const int key_map;
|
||||
extern const int key_map_gobig;
|
||||
extern const int key_map_follow;
|
||||
extern const int key_map_mark; // ^
|
||||
extern const int key_map_clear; // |
|
||||
extern const int key_map_grid; // phares
|
||||
|
||||
// killough 5/2/98: moved from d_deh.c:
|
||||
// Par times (new item with BOOM) - from g_game.c
|
||||
extern const int pars[4][10]; // hardcoded array size
|
||||
extern const int cpars[32]; // hardcoded array size
|
||||
// CPhipps - Make savedesciption visible in wider scope
|
||||
#define SAVEDESCLEN 8
|
||||
|
||||
#define NUMKEYS 16
|
||||
|
||||
#endif
|
||||
+1640
-1640
File diff suppressed because it is too large.
Load diff
@@ -1,181 +1,181 @@
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION: none
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __HULIB__
|
||||
#define __HULIB__
|
||||
|
||||
// We are referring to patches.
|
||||
#include "r_defs.h"
|
||||
#include "v_video.h" //jff 2/16/52 include color range defs
|
||||
|
||||
/* background and foreground screen numbers
|
||||
* different from other modules. */
|
||||
#define HU_BG 0
|
||||
#define HU_FG 0
|
||||
|
||||
/* font stuff
|
||||
* #define HU_CHARERASE KEYD_BACKSPACE / not used / phares
|
||||
*/
|
||||
|
||||
#define HU_MAXLINES 1
|
||||
#define HU_MAXLINELENGTH 31
|
||||
#define HU_REFRESHSPACING 8 /*jff 2/26/98 space lines in text refresh widget*/
|
||||
/*jff 2/26/98 maximum number of messages allowed in refresh list */
|
||||
#define HU_MAXMESSAGES 1
|
||||
|
||||
/*
|
||||
* Typedefs of widgets
|
||||
*/
|
||||
|
||||
/* Text Line widget
|
||||
* (parent of Scrolling Text and Input Text widgets) */
|
||||
typedef struct
|
||||
{
|
||||
// left-justified position of scrolling text window
|
||||
short x;
|
||||
short y;
|
||||
|
||||
const patch_t **f; // font
|
||||
short sc; // start character
|
||||
//const char *cr; //jff 2/16/52 output color range
|
||||
// Proff - Made this an int again. Needed for OpenGL
|
||||
|
||||
// killough 1/23/98: Support multiple lines:
|
||||
#define MAXLINES 1
|
||||
|
||||
short linelen;
|
||||
char l[HU_MAXLINELENGTH * MAXLINES + 1]; // line of text
|
||||
short len; // current line length
|
||||
|
||||
// whether this line needs to be udpated
|
||||
short needsupdate;
|
||||
|
||||
} hu_textline_t;
|
||||
|
||||
// Scrolling Text window widget
|
||||
// (child of Text Line widget)
|
||||
typedef struct
|
||||
{
|
||||
hu_textline_t l[HU_MAXLINES]; // text lines to draw
|
||||
short h; // height in lines
|
||||
short cl; // current line number
|
||||
|
||||
// pointer to boolean stating whether to update window
|
||||
boolean *on;
|
||||
boolean laston; // last value of *->on.
|
||||
|
||||
} hu_stext_t;
|
||||
|
||||
//jff 2/26/98 new widget to display last hud_msg_lines of messages
|
||||
// Message refresh window widget
|
||||
typedef struct
|
||||
{
|
||||
hu_textline_t l[HU_MAXMESSAGES]; // text lines to draw
|
||||
short nl; // height in lines
|
||||
short nr; // total height in rows
|
||||
short cl; // current line number
|
||||
|
||||
short x, y, w, h; // window position and size
|
||||
const patch_t *bg; // patches for background
|
||||
|
||||
// pointer to boolean stating whether to update window
|
||||
boolean *on;
|
||||
boolean laston; // last value of *->on.
|
||||
|
||||
} hu_mtext_t;
|
||||
|
||||
// Input Text Line widget
|
||||
// (child of Text Line widget)
|
||||
typedef struct
|
||||
{
|
||||
hu_textline_t l; // text line to input on
|
||||
|
||||
// left margin past which I am not to delete characters
|
||||
short lm;
|
||||
|
||||
// pointer to boolean stating whether to update window
|
||||
boolean *on;
|
||||
boolean laston; // last value of *->on;
|
||||
|
||||
} hu_itext_t;
|
||||
|
||||
//
|
||||
// Widget creation, access, and update routines
|
||||
//
|
||||
|
||||
//
|
||||
// textline code
|
||||
//
|
||||
|
||||
// clear a line of text
|
||||
void HUlib_clearTextLine(hu_textline_t *t);
|
||||
|
||||
void HUlib_initTextLine(hu_textline_t *t, short x, short y, const patch_t *f, short sc);
|
||||
|
||||
// returns success
|
||||
boolean HUlib_addCharToTextLine(hu_textline_t *t, char ch);
|
||||
|
||||
// draws tline
|
||||
void HUlib_drawTextLine(hu_textline_t *l, boolean drawcursor);
|
||||
|
||||
// erases text line
|
||||
void HUlib_eraseTextLine(hu_textline_t *l);
|
||||
|
||||
//
|
||||
// Scrolling Text window widget routines
|
||||
//
|
||||
|
||||
// initialize an stext widget
|
||||
void HUlib_initSText(hu_stext_t *s, short x, short y, short h, const patch_t *font, short startchar, //jff 2/16/98 add color range parameter
|
||||
boolean *on);
|
||||
|
||||
// add a text message to an stext widget
|
||||
void HUlib_addMessageToSText(hu_stext_t *s, const char *prefix, const char *msg);
|
||||
|
||||
// draws stext
|
||||
void HUlib_drawSText(hu_stext_t *s);
|
||||
|
||||
// erases all stext lines
|
||||
void HUlib_eraseSText(hu_stext_t *s);
|
||||
|
||||
#endif
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION: none
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __HULIB__
|
||||
#define __HULIB__
|
||||
|
||||
// We are referring to patches.
|
||||
#include "r_defs.h"
|
||||
#include "v_video.h" //jff 2/16/52 include color range defs
|
||||
|
||||
/* background and foreground screen numbers
|
||||
* different from other modules. */
|
||||
#define HU_BG 0
|
||||
#define HU_FG 0
|
||||
|
||||
/* font stuff
|
||||
* #define HU_CHARERASE KEYD_BACKSPACE / not used / phares
|
||||
*/
|
||||
|
||||
#define HU_MAXLINES 1
|
||||
#define HU_MAXLINELENGTH 31
|
||||
#define HU_REFRESHSPACING 8 /*jff 2/26/98 space lines in text refresh widget*/
|
||||
/*jff 2/26/98 maximum number of messages allowed in refresh list */
|
||||
#define HU_MAXMESSAGES 1
|
||||
|
||||
/*
|
||||
* Typedefs of widgets
|
||||
*/
|
||||
|
||||
/* Text Line widget
|
||||
* (parent of Scrolling Text and Input Text widgets) */
|
||||
typedef struct
|
||||
{
|
||||
// left-justified position of scrolling text window
|
||||
short x;
|
||||
short y;
|
||||
|
||||
const patch_t **f; // font
|
||||
short sc; // start character
|
||||
//const char *cr; //jff 2/16/52 output color range
|
||||
// Proff - Made this an int again. Needed for OpenGL
|
||||
|
||||
// killough 1/23/98: Support multiple lines:
|
||||
#define MAXLINES 1
|
||||
|
||||
short linelen;
|
||||
char l[HU_MAXLINELENGTH * MAXLINES + 1]; // line of text
|
||||
short len; // current line length
|
||||
|
||||
// whether this line needs to be udpated
|
||||
short needsupdate;
|
||||
|
||||
} hu_textline_t;
|
||||
|
||||
// Scrolling Text window widget
|
||||
// (child of Text Line widget)
|
||||
typedef struct
|
||||
{
|
||||
hu_textline_t l[HU_MAXLINES]; // text lines to draw
|
||||
short h; // height in lines
|
||||
short cl; // current line number
|
||||
|
||||
// pointer to boolean stating whether to update window
|
||||
boolean *on;
|
||||
boolean laston; // last value of *->on.
|
||||
|
||||
} hu_stext_t;
|
||||
|
||||
//jff 2/26/98 new widget to display last hud_msg_lines of messages
|
||||
// Message refresh window widget
|
||||
typedef struct
|
||||
{
|
||||
hu_textline_t l[HU_MAXMESSAGES]; // text lines to draw
|
||||
short nl; // height in lines
|
||||
short nr; // total height in rows
|
||||
short cl; // current line number
|
||||
|
||||
short x, y, w, h; // window position and size
|
||||
const patch_t *bg; // patches for background
|
||||
|
||||
// pointer to boolean stating whether to update window
|
||||
boolean *on;
|
||||
boolean laston; // last value of *->on.
|
||||
|
||||
} hu_mtext_t;
|
||||
|
||||
// Input Text Line widget
|
||||
// (child of Text Line widget)
|
||||
typedef struct
|
||||
{
|
||||
hu_textline_t l; // text line to input on
|
||||
|
||||
// left margin past which I am not to delete characters
|
||||
short lm;
|
||||
|
||||
// pointer to boolean stating whether to update window
|
||||
boolean *on;
|
||||
boolean laston; // last value of *->on;
|
||||
|
||||
} hu_itext_t;
|
||||
|
||||
//
|
||||
// Widget creation, access, and update routines
|
||||
//
|
||||
|
||||
//
|
||||
// textline code
|
||||
//
|
||||
|
||||
// clear a line of text
|
||||
void HUlib_clearTextLine(hu_textline_t *t);
|
||||
|
||||
void HUlib_initTextLine(hu_textline_t *t, short x, short y, const patch_t *f, short sc);
|
||||
|
||||
// returns success
|
||||
boolean HUlib_addCharToTextLine(hu_textline_t *t, char ch);
|
||||
|
||||
// draws tline
|
||||
void HUlib_drawTextLine(hu_textline_t *l, boolean drawcursor);
|
||||
|
||||
// erases text line
|
||||
void HUlib_eraseTextLine(hu_textline_t *l);
|
||||
|
||||
//
|
||||
// Scrolling Text window widget routines
|
||||
//
|
||||
|
||||
// initialize an stext widget
|
||||
void HUlib_initSText(hu_stext_t *s, short x, short y, short h, const patch_t *font, short startchar, //jff 2/16/98 add color range parameter
|
||||
boolean *on);
|
||||
|
||||
// add a text message to an stext widget
|
||||
void HUlib_addMessageToSText(hu_stext_t *s, const char *prefix, const char *msg);
|
||||
|
||||
// draws stext
|
||||
void HUlib_drawSText(hu_stext_t *s);
|
||||
|
||||
// erases all stext lines
|
||||
void HUlib_eraseSText(hu_stext_t *s);
|
||||
|
||||
#endif
|
||||
@@ -1,87 +1,87 @@
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION: Head up display
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __HU_STUFF_H__
|
||||
#define __HU_STUFF_H__
|
||||
|
||||
#include "d_event.h"
|
||||
|
||||
/*
|
||||
* Globally visible constants.
|
||||
*/
|
||||
#define HU_FONTSTART '!' /* the first font characters */
|
||||
#define HU_FONTEND '_' /*jff 2/16/98 '_' the last font characters */
|
||||
|
||||
/* Calculate # of glyphs in font. */
|
||||
#define HU_FONTSIZE (HU_FONTEND - HU_FONTSTART + 1)
|
||||
|
||||
#define HU_BROADCAST 5
|
||||
|
||||
/*#define HU_MSGREFRESH KEYD_ENTER phares */
|
||||
#define HU_MSGX 0
|
||||
#define HU_MSGY 0
|
||||
#define HU_MSGWIDTH 64 /* in characters */
|
||||
#define HU_MSGHEIGHT 1 /* in lines */
|
||||
|
||||
#define HU_MSGTIMEOUT (4*TICRATE)
|
||||
|
||||
/*
|
||||
* Heads up text
|
||||
*/
|
||||
void HU_Init(void);
|
||||
void HU_Start(void);
|
||||
|
||||
boolean HU_Responder(event_t *ev);
|
||||
|
||||
void HU_Ticker(void);
|
||||
void HU_Drawer(void);
|
||||
void HU_Erase(void);
|
||||
void HU_MoveHud(void); // jff 3/9/98 avoid glitch in HUD display
|
||||
|
||||
/* killough 5/2/98: moved from m_misc.c: */
|
||||
|
||||
/* jff 2/26/98 hud message list color and background enable */
|
||||
extern const int hud_msg_lines; /* number of message lines in window up to 16 */
|
||||
/* jff 2/23/98 hud is currently displayed */
|
||||
|
||||
#endif
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION: Head up display
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __HU_STUFF_H__
|
||||
#define __HU_STUFF_H__
|
||||
|
||||
#include "d_event.h"
|
||||
|
||||
/*
|
||||
* Globally visible constants.
|
||||
*/
|
||||
#define HU_FONTSTART '!' /* the first font characters */
|
||||
#define HU_FONTEND '_' /*jff 2/16/98 '_' the last font characters */
|
||||
|
||||
/* Calculate # of glyphs in font. */
|
||||
#define HU_FONTSIZE (HU_FONTEND - HU_FONTSTART + 1)
|
||||
|
||||
#define HU_BROADCAST 5
|
||||
|
||||
/*#define HU_MSGREFRESH KEYD_ENTER phares */
|
||||
#define HU_MSGX 0
|
||||
#define HU_MSGY 0
|
||||
#define HU_MSGWIDTH 64 /* in characters */
|
||||
#define HU_MSGHEIGHT 1 /* in lines */
|
||||
|
||||
#define HU_MSGTIMEOUT (4*TICRATE)
|
||||
|
||||
/*
|
||||
* Heads up text
|
||||
*/
|
||||
void HU_Init(void);
|
||||
void HU_Start(void);
|
||||
|
||||
boolean HU_Responder(event_t *ev);
|
||||
|
||||
void HU_Ticker(void);
|
||||
void HU_Drawer(void);
|
||||
void HU_Erase(void);
|
||||
void HU_MoveHud(void); // jff 3/9/98 avoid glitch in HUD display
|
||||
|
||||
/* killough 5/2/98: moved from m_misc.c: */
|
||||
|
||||
/* jff 2/26/98 hud message list color and background enable */
|
||||
extern const int hud_msg_lines; /* number of message lines in window up to 16 */
|
||||
/* jff 2/23/98 hud is currently displayed */
|
||||
|
||||
#endif
|
||||
@@ -1,52 +1,52 @@
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* General system functions. Signal related stuff, exit function
|
||||
* prototypes, and programmable Doom clock.
|
||||
*
|
||||
*-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef __I_MAIN__
|
||||
#define __I_MAIN__
|
||||
|
||||
void I_Init(void);
|
||||
|
||||
#endif
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* General system functions. Signal related stuff, exit function
|
||||
* prototypes, and programmable Doom clock.
|
||||
*
|
||||
*-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef __I_MAIN__
|
||||
#define __I_MAIN__
|
||||
|
||||
void I_Init(void);
|
||||
|
||||
#endif
|
||||
@@ -1,179 +1,179 @@
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* next-hack: packed (24) and 16 bit pointers utility functions and other stuff
|
||||
*/
|
||||
|
||||
#ifndef DOOM_INCLUDE_I_MEMORY_H_
|
||||
#define DOOM_INCLUDE_I_MEMORY_H_
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef PARADISE_DEV
|
||||
/* Paradise: SRAM 0x18000000, flash uncached from 0x60000000 (WAD and region), program window 0x10000000 */
|
||||
#define RAM_PTR_BASE 0x18000000UL
|
||||
#define EXT_FLASH_BASE 0x60000000
|
||||
#define FLASH_PTR_BASE 0x10000000
|
||||
#define PACKED_MEMORY_ADDRESS0 RAM_PTR_BASE
|
||||
#ifdef DOOM_FREE
|
||||
#include "pdmcfg.h"
|
||||
#define PACKED_MEMORY_ADDRESS1 g_pk_hi
|
||||
#define PACKED_MEMORY_ADDRESS2 g_pk_lo
|
||||
#define PACKED_MEMORY_ADDRESS2_C 0x60800000
|
||||
#define PD_WAD_OFF (g_dcfg.wad_off - 4u)
|
||||
#define PD_REGION_OFF (g_dcfg.region_off)
|
||||
#define PD_REGION_LEN (g_dcfg.region_len)
|
||||
#define PD_SAVE_ADDR (0x60000000u + g_dcfg.save_off) /* settings, then the save */
|
||||
#else
|
||||
#define PD_SAVE_ADDR 0x6010E000u
|
||||
#define PACKED_MEMORY_ADDRESS1 0x60C00000
|
||||
#define PACKED_MEMORY_ADDRESS2 0x60800000
|
||||
#define PACKED_MEMORY_ADDRESS2_C PACKED_MEMORY_ADDRESS2
|
||||
#endif
|
||||
#define PACKED_MEMORY_ADDRESS3 FLASH_PTR_BASE
|
||||
#ifndef PD_WAD_OFF
|
||||
#define PD_WAD_OFF 0x830000
|
||||
#define PD_REGION_OFF 0xCA0000
|
||||
#define PD_REGION_LEN 0xA8000
|
||||
#endif
|
||||
#define WAD_ADDRESS (EXT_FLASH_BASE + PD_WAD_OFF + 4)
|
||||
#define FLASH_ADDRESS (EXT_FLASH_BASE + PD_REGION_OFF)
|
||||
#define FLASH_CACHE_REGION_SIZE (PD_REGION_LEN)
|
||||
#else
|
||||
#define RAM_PTR_BASE 0x20000000UL
|
||||
#define EXT_FLASH_BASE 0x12000000
|
||||
#define FLASH_PTR_BASE 0
|
||||
#define PACKED_MEMORY_ADDRESS0 RAM_PTR_BASE
|
||||
#define PACKED_MEMORY_ADDRESS1 RAM_PTR_BASE
|
||||
#define PACKED_MEMORY_ADDRESS2 EXT_FLASH_BASE
|
||||
#define PACKED_MEMORY_ADDRESS3 FLASH_PTR_BASE
|
||||
//
|
||||
#define WAD_ADDRESS (EXT_FLASH_BASE + 4)
|
||||
#define FLASH_CODE_KB 268
|
||||
#define FLASH_ADDRESS (0x00000000 + FLASH_CODE_KB * 1024)
|
||||
#define FLASH_CACHE_REGION_SIZE ((1024 - FLASH_CODE_KB) * 1024)
|
||||
#endif
|
||||
#define isRamPtr(p) ((((uint32_t)(p)) >> 24) == (RAM_PTR_BASE >> 24))
|
||||
#define FLASH_IMMUTABLE_REGION_ADDRESS FLASH_ADDRESS
|
||||
#define FLASH_IMMUTABLE_REGION 0
|
||||
#define FLASH_LEVEL_REGION 1
|
||||
#define FLASH_BLOCK_SIZE 4096
|
||||
//
|
||||
#define DEBUG_GETSHORTPTR 0
|
||||
//
|
||||
#ifdef PARADISE
|
||||
#ifdef PARADISE_DEV
|
||||
/* The WAD (before the region) counts as "external": the core then copies columns into RAM buffers */
|
||||
#ifdef DOOM_FREE
|
||||
#define isOnExternalFlash(a) (((uint32_t)(a) - (0x60000000u + g_dcfg.wad_off - 4u)) < g_dcfg.wad_len + 4u)
|
||||
#else
|
||||
#define isOnExternalFlash(a) (((uint32_t)(a) - 0x60000000u) < (uint32_t) PD_REGION_OFF)
|
||||
#endif
|
||||
#else
|
||||
#define isOnExternalFlash(a) (0) /* Paradise test run: everything directly readable */
|
||||
#endif
|
||||
#else
|
||||
#define isOnExternalFlash(a) (((uint32_t) a & EXT_FLASH_BASE) == EXT_FLASH_BASE)
|
||||
#endif
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t addrBytes[3];
|
||||
} __attribute((packed)) packedAddress_t;
|
||||
|
||||
static inline void* getLongPtr(unsigned short shortPointer)
|
||||
{ // Special case: short pointer being all 0 => NULL
|
||||
if (!shortPointer)
|
||||
return 0;
|
||||
return (void*) (((unsigned int) shortPointer << 2) | RAM_PTR_BASE);
|
||||
}
|
||||
static inline unsigned short getShortPtr(void *longPtr)
|
||||
{
|
||||
|
||||
return ((unsigned int) longPtr) >> 2;
|
||||
}
|
||||
|
||||
static inline packedAddress_t getPackedAddress(void *addr)
|
||||
{
|
||||
packedAddress_t ret;
|
||||
unsigned int intaddr = (uint32_t) addr;
|
||||
uint8_t highaddr = intaddr >> 24;
|
||||
uint8_t highAddrBits = 0;
|
||||
ret.addrBytes[0] = intaddr;
|
||||
ret.addrBytes[1] = intaddr >> 8;
|
||||
#ifdef PARADISE_DEV
|
||||
if (highaddr == 0x60)
|
||||
{
|
||||
highAddrBits = intaddr >= PACKED_MEMORY_ADDRESS1 ? 0x40 : 0x80;
|
||||
ret.addrBytes[2] = ((intaddr >> 16) & 0x3F) | highAddrBits;
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
switch (highaddr)
|
||||
{
|
||||
case (PACKED_MEMORY_ADDRESS0 >> 24) & 0xFF:
|
||||
highAddrBits = 0x0;
|
||||
break;
|
||||
/*case (PACKED_MEMORY_ADDRESS1 >> 24) & 0xFF:
|
||||
highAddrBits = 0x40;
|
||||
break;*/
|
||||
case (PACKED_MEMORY_ADDRESS2_C >> 24) & 0xFF:
|
||||
highAddrBits = 0x80;
|
||||
break;
|
||||
case (PACKED_MEMORY_ADDRESS3 >> 24) & 0xFF:
|
||||
highAddrBits = 0xC0;
|
||||
break;
|
||||
}
|
||||
ret.addrBytes[2] = ((intaddr >> 16) & 0x3F) | highAddrBits;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline void* unpackAddress(packedAddress_t a) // passed by copy, because it is shorted than a pointer!
|
||||
{
|
||||
const uint32_t addresses[] =
|
||||
{ PACKED_MEMORY_ADDRESS0, PACKED_MEMORY_ADDRESS1, PACKED_MEMORY_ADDRESS2, PACKED_MEMORY_ADDRESS3 };
|
||||
|
||||
if (!a.addrBytes[2] && !a.addrBytes[1] && !a.addrBytes[0])
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
return (void*) (addresses[a.addrBytes[2] >> 6] | (a.addrBytes[0]) | (a.addrBytes[1] << 8) | ((a.addrBytes[2] & 0x3F) << 16));
|
||||
}
|
||||
|
||||
#endif /* DOOM_INCLUDE_I_MEMORY_H_ */
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* next-hack: packed (24) and 16 bit pointers utility functions and other stuff
|
||||
*/
|
||||
|
||||
#ifndef DOOM_INCLUDE_I_MEMORY_H_
|
||||
#define DOOM_INCLUDE_I_MEMORY_H_
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef PARADISE_DEV
|
||||
/* Paradise: SRAM 0x18000000, flash uncached from 0x60000000 (WAD and region), program window 0x10000000 */
|
||||
#define RAM_PTR_BASE 0x18000000UL
|
||||
#define EXT_FLASH_BASE 0x60000000
|
||||
#define FLASH_PTR_BASE 0x10000000
|
||||
#define PACKED_MEMORY_ADDRESS0 RAM_PTR_BASE
|
||||
#ifdef DOOM_FREE
|
||||
#include "pdmcfg.h"
|
||||
#define PACKED_MEMORY_ADDRESS1 g_pk_hi
|
||||
#define PACKED_MEMORY_ADDRESS2 g_pk_lo
|
||||
#define PACKED_MEMORY_ADDRESS2_C 0x60800000
|
||||
#define PD_WAD_OFF (g_dcfg.wad_off - 4u)
|
||||
#define PD_REGION_OFF (g_dcfg.region_off)
|
||||
#define PD_REGION_LEN (g_dcfg.region_len)
|
||||
#define PD_SAVE_ADDR (0x60000000u + g_dcfg.save_off) /* settings, then the save */
|
||||
#else
|
||||
#define PD_SAVE_ADDR 0x6010E000u
|
||||
#define PACKED_MEMORY_ADDRESS1 0x60C00000
|
||||
#define PACKED_MEMORY_ADDRESS2 0x60800000
|
||||
#define PACKED_MEMORY_ADDRESS2_C PACKED_MEMORY_ADDRESS2
|
||||
#endif
|
||||
#define PACKED_MEMORY_ADDRESS3 FLASH_PTR_BASE
|
||||
#ifndef PD_WAD_OFF
|
||||
#define PD_WAD_OFF 0x830000
|
||||
#define PD_REGION_OFF 0xCA0000
|
||||
#define PD_REGION_LEN 0xA8000
|
||||
#endif
|
||||
#define WAD_ADDRESS (EXT_FLASH_BASE + PD_WAD_OFF + 4)
|
||||
#define FLASH_ADDRESS (EXT_FLASH_BASE + PD_REGION_OFF)
|
||||
#define FLASH_CACHE_REGION_SIZE (PD_REGION_LEN)
|
||||
#else
|
||||
#define RAM_PTR_BASE 0x20000000UL
|
||||
#define EXT_FLASH_BASE 0x12000000
|
||||
#define FLASH_PTR_BASE 0
|
||||
#define PACKED_MEMORY_ADDRESS0 RAM_PTR_BASE
|
||||
#define PACKED_MEMORY_ADDRESS1 RAM_PTR_BASE
|
||||
#define PACKED_MEMORY_ADDRESS2 EXT_FLASH_BASE
|
||||
#define PACKED_MEMORY_ADDRESS3 FLASH_PTR_BASE
|
||||
//
|
||||
#define WAD_ADDRESS (EXT_FLASH_BASE + 4)
|
||||
#define FLASH_CODE_KB 268
|
||||
#define FLASH_ADDRESS (0x00000000 + FLASH_CODE_KB * 1024)
|
||||
#define FLASH_CACHE_REGION_SIZE ((1024 - FLASH_CODE_KB) * 1024)
|
||||
#endif
|
||||
#define isRamPtr(p) ((((uint32_t)(p)) >> 24) == (RAM_PTR_BASE >> 24))
|
||||
#define FLASH_IMMUTABLE_REGION_ADDRESS FLASH_ADDRESS
|
||||
#define FLASH_IMMUTABLE_REGION 0
|
||||
#define FLASH_LEVEL_REGION 1
|
||||
#define FLASH_BLOCK_SIZE 4096
|
||||
//
|
||||
#define DEBUG_GETSHORTPTR 0
|
||||
//
|
||||
#ifdef PARADISE
|
||||
#ifdef PARADISE_DEV
|
||||
/* The WAD (before the region) counts as "external": the core then copies columns into RAM buffers */
|
||||
#ifdef DOOM_FREE
|
||||
#define isOnExternalFlash(a) (((uint32_t)(a) - (0x60000000u + g_dcfg.wad_off - 4u)) < g_dcfg.wad_len + 4u)
|
||||
#else
|
||||
#define isOnExternalFlash(a) (((uint32_t)(a) - 0x60000000u) < (uint32_t) PD_REGION_OFF)
|
||||
#endif
|
||||
#else
|
||||
#define isOnExternalFlash(a) (0) /* Paradise test run: everything directly readable */
|
||||
#endif
|
||||
#else
|
||||
#define isOnExternalFlash(a) (((uint32_t) a & EXT_FLASH_BASE) == EXT_FLASH_BASE)
|
||||
#endif
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t addrBytes[3];
|
||||
} __attribute((packed)) packedAddress_t;
|
||||
|
||||
static inline void* getLongPtr(unsigned short shortPointer)
|
||||
{ // Special case: short pointer being all 0 => NULL
|
||||
if (!shortPointer)
|
||||
return 0;
|
||||
return (void*) (((unsigned int) shortPointer << 2) | RAM_PTR_BASE);
|
||||
}
|
||||
static inline unsigned short getShortPtr(void *longPtr)
|
||||
{
|
||||
|
||||
return ((unsigned int) longPtr) >> 2;
|
||||
}
|
||||
|
||||
static inline packedAddress_t getPackedAddress(void *addr)
|
||||
{
|
||||
packedAddress_t ret;
|
||||
unsigned int intaddr = (uint32_t) addr;
|
||||
uint8_t highaddr = intaddr >> 24;
|
||||
uint8_t highAddrBits = 0;
|
||||
ret.addrBytes[0] = intaddr;
|
||||
ret.addrBytes[1] = intaddr >> 8;
|
||||
#ifdef PARADISE_DEV
|
||||
if (highaddr == 0x60)
|
||||
{
|
||||
highAddrBits = intaddr >= PACKED_MEMORY_ADDRESS1 ? 0x40 : 0x80;
|
||||
ret.addrBytes[2] = ((intaddr >> 16) & 0x3F) | highAddrBits;
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
switch (highaddr)
|
||||
{
|
||||
case (PACKED_MEMORY_ADDRESS0 >> 24) & 0xFF:
|
||||
highAddrBits = 0x0;
|
||||
break;
|
||||
/*case (PACKED_MEMORY_ADDRESS1 >> 24) & 0xFF:
|
||||
highAddrBits = 0x40;
|
||||
break;*/
|
||||
case (PACKED_MEMORY_ADDRESS2_C >> 24) & 0xFF:
|
||||
highAddrBits = 0x80;
|
||||
break;
|
||||
case (PACKED_MEMORY_ADDRESS3 >> 24) & 0xFF:
|
||||
highAddrBits = 0xC0;
|
||||
break;
|
||||
}
|
||||
ret.addrBytes[2] = ((intaddr >> 16) & 0x3F) | highAddrBits;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline void* unpackAddress(packedAddress_t a) // passed by copy, because it is shorted than a pointer!
|
||||
{
|
||||
const uint32_t addresses[] =
|
||||
{ PACKED_MEMORY_ADDRESS0, PACKED_MEMORY_ADDRESS1, PACKED_MEMORY_ADDRESS2, PACKED_MEMORY_ADDRESS3 };
|
||||
|
||||
if (!a.addrBytes[2] && !a.addrBytes[1] && !a.addrBytes[0])
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
return (void*) (addresses[a.addrBytes[2] >> 6] | (a.addrBytes[0]) | (a.addrBytes[1] << 8) | ((a.addrBytes[2] & 0x3F) << 16));
|
||||
}
|
||||
|
||||
#endif /* DOOM_INCLUDE_I_MEMORY_H_ */
|
||||
@@ -1,68 +1,68 @@
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Low level network interface.
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#define UDP_CHANNEL struct sockaddr
|
||||
|
||||
#ifndef IPPORT_RESERVED
|
||||
#define IPPORT_RESERVED 1024
|
||||
#endif
|
||||
|
||||
void I_InitNetwork(void);
|
||||
size_t I_GetPacket(packet_header_t *buffer, size_t buflen);
|
||||
void I_SendPacket(packet_header_t *packet, size_t len);
|
||||
void I_WaitForPacket(int ms);
|
||||
|
||||
#ifdef AF_INET
|
||||
void I_SendPacketTo(packet_header_t* packet, size_t len, UDP_CHANNEL *to);
|
||||
void I_SetupSocket(int sock, int port, int family);
|
||||
void I_PrintAddress(FILE* fp, UDP_CHANNEL *addr);
|
||||
|
||||
extern UDP_CHANNEL sentfrom;
|
||||
extern int v4socket, v6socket;
|
||||
#endif
|
||||
|
||||
extern size_t sentbytes, recvdbytes;
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Low level network interface.
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#define UDP_CHANNEL struct sockaddr
|
||||
|
||||
#ifndef IPPORT_RESERVED
|
||||
#define IPPORT_RESERVED 1024
|
||||
#endif
|
||||
|
||||
void I_InitNetwork(void);
|
||||
size_t I_GetPacket(packet_header_t *buffer, size_t buflen);
|
||||
void I_SendPacket(packet_header_t *packet, size_t len);
|
||||
void I_WaitForPacket(int ms);
|
||||
|
||||
#ifdef AF_INET
|
||||
void I_SendPacketTo(packet_header_t* packet, size_t len, UDP_CHANNEL *to);
|
||||
void I_SetupSocket(int sock, int port, int family);
|
||||
void I_PrintAddress(FILE* fp, UDP_CHANNEL *addr);
|
||||
|
||||
extern UDP_CHANNEL sentfrom;
|
||||
extern int v4socket, v6socket;
|
||||
#endif
|
||||
|
||||
extern size_t sentbytes, recvdbytes;
|
||||
@@ -1,99 +1,99 @@
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* System interface, sound.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __I_SOUND__
|
||||
#define __I_SOUND__
|
||||
|
||||
#include "sounds.h"
|
||||
#include "doomtype.h"
|
||||
|
||||
// Init at program start...
|
||||
void I_InitSound(void);
|
||||
|
||||
// ... shut down and relase at program termination.
|
||||
void I_ShutdownSound(void);
|
||||
|
||||
//
|
||||
// SFX I/O
|
||||
//
|
||||
|
||||
// Starts a sound in a particular sound channel.
|
||||
int I_StartSound(int id, int channel, int vol, int sep);
|
||||
|
||||
//
|
||||
// MUSIC I/O
|
||||
//
|
||||
void I_InitMusic(void);
|
||||
|
||||
// Volume.
|
||||
void I_SetMusicVolume(int volume);
|
||||
|
||||
// PAUSE game handling.
|
||||
void I_PauseSong(int handle);
|
||||
void I_ResumeSong(int handle);
|
||||
|
||||
// Called by anything that wishes to start music.
|
||||
// plays a song, and when the song is done,
|
||||
// starts playing it again in an endless loop.
|
||||
// Horrible thing to do, considering.
|
||||
void I_PlaySong(int handle, int looping);
|
||||
|
||||
// Stops a song over 3 seconds.
|
||||
void I_StopSong(int handle);
|
||||
|
||||
// CPhipps - put these in config file
|
||||
extern const int snd_samplerate;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const char *data;
|
||||
const char *enddata;
|
||||
int vol;
|
||||
|
||||
} channel_info_t;
|
||||
|
||||
#define MUSIC_BUFFER_SAMPLES 2048
|
||||
#define MAX_CHANNELS 8
|
||||
|
||||
#endif
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* System interface, sound.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __I_SOUND__
|
||||
#define __I_SOUND__
|
||||
|
||||
#include "sounds.h"
|
||||
#include "doomtype.h"
|
||||
|
||||
// Init at program start...
|
||||
void I_InitSound(void);
|
||||
|
||||
// ... shut down and relase at program termination.
|
||||
void I_ShutdownSound(void);
|
||||
|
||||
//
|
||||
// SFX I/O
|
||||
//
|
||||
|
||||
// Starts a sound in a particular sound channel.
|
||||
int I_StartSound(int id, int channel, int vol, int sep);
|
||||
|
||||
//
|
||||
// MUSIC I/O
|
||||
//
|
||||
void I_InitMusic(void);
|
||||
|
||||
// Volume.
|
||||
void I_SetMusicVolume(int volume);
|
||||
|
||||
// PAUSE game handling.
|
||||
void I_PauseSong(int handle);
|
||||
void I_ResumeSong(int handle);
|
||||
|
||||
// Called by anything that wishes to start music.
|
||||
// plays a song, and when the song is done,
|
||||
// starts playing it again in an endless loop.
|
||||
// Horrible thing to do, considering.
|
||||
void I_PlaySong(int handle, int looping);
|
||||
|
||||
// Stops a song over 3 seconds.
|
||||
void I_StopSong(int handle);
|
||||
|
||||
// CPhipps - put these in config file
|
||||
extern const int snd_samplerate;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const char *data;
|
||||
const char *enddata;
|
||||
int vol;
|
||||
|
||||
} channel_info_t;
|
||||
|
||||
#define MUSIC_BUFFER_SAMPLES 2048
|
||||
#define MAX_CHANNELS 8
|
||||
|
||||
#endif
|
||||
@@ -1,87 +1,87 @@
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* next-hack: Some wrapper functions, to use SPI routines.
|
||||
* Memory mapped code has been removed.
|
||||
*/
|
||||
#ifndef I_SPI_SUPPORT_H_
|
||||
#define I_SPI_SUPPORT_H_
|
||||
#include <stdint.h>
|
||||
#include "string.h"
|
||||
//
|
||||
extern uint8_t *currentSpiAddress;
|
||||
#ifdef PARADISE_DEV
|
||||
/* Paradise: flash is only fast to read word by word (uncached byte read ~1.3 us), so read aligned words */
|
||||
void plat_fcopy(void *dst, const void *src, unsigned int n);
|
||||
#define FLASH_MEMCPY(d, s, n) plat_fcopy((d), (s), (n))
|
||||
#else
|
||||
#define FLASH_MEMCPY(d, s, n) memcpy((d), (s), (n))
|
||||
#endif
|
||||
static inline uint8_t spiFlashGetByte()
|
||||
{
|
||||
return *currentSpiAddress++;
|
||||
}
|
||||
static inline short spiFlashGetShort()
|
||||
{
|
||||
uint16_t s = *currentSpiAddress++;
|
||||
s |= (*currentSpiAddress++ << 8);
|
||||
return (short) s;
|
||||
/*
|
||||
short s = *((short*) currentSpiAddress);
|
||||
currentSpiAddress+=2;
|
||||
return s;*/
|
||||
}
|
||||
static inline uint8_t spiFlashGetByteFromAddress(const void *addr)
|
||||
{
|
||||
currentSpiAddress = (void*) addr;
|
||||
return spiFlashGetByte();
|
||||
}
|
||||
static inline void* spiFlashGetData(void *dest, unsigned int length)
|
||||
{
|
||||
uint32_t *b = (void*) currentSpiAddress;
|
||||
FLASH_MEMCPY(dest, b, length);
|
||||
currentSpiAddress += length;
|
||||
return dest;
|
||||
}
|
||||
static inline uint32_t spiFlashSetAddress(uint32_t address)
|
||||
{
|
||||
currentSpiAddress = (uint8_t*) address;
|
||||
}
|
||||
#endif /* SOURCE_I_SPI_SUPPORT_H_ */
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* next-hack: Some wrapper functions, to use SPI routines.
|
||||
* Memory mapped code has been removed.
|
||||
*/
|
||||
#ifndef I_SPI_SUPPORT_H_
|
||||
#define I_SPI_SUPPORT_H_
|
||||
#include <stdint.h>
|
||||
#include "string.h"
|
||||
//
|
||||
extern uint8_t *currentSpiAddress;
|
||||
#ifdef PARADISE_DEV
|
||||
/* Paradise: flash is only fast to read word by word (uncached byte read ~1.3 us), so read aligned words */
|
||||
void plat_fcopy(void *dst, const void *src, unsigned int n);
|
||||
#define FLASH_MEMCPY(d, s, n) plat_fcopy((d), (s), (n))
|
||||
#else
|
||||
#define FLASH_MEMCPY(d, s, n) memcpy((d), (s), (n))
|
||||
#endif
|
||||
static inline uint8_t spiFlashGetByte()
|
||||
{
|
||||
return *currentSpiAddress++;
|
||||
}
|
||||
static inline short spiFlashGetShort()
|
||||
{
|
||||
uint16_t s = *currentSpiAddress++;
|
||||
s |= (*currentSpiAddress++ << 8);
|
||||
return (short) s;
|
||||
/*
|
||||
short s = *((short*) currentSpiAddress);
|
||||
currentSpiAddress+=2;
|
||||
return s;*/
|
||||
}
|
||||
static inline uint8_t spiFlashGetByteFromAddress(const void *addr)
|
||||
{
|
||||
currentSpiAddress = (void*) addr;
|
||||
return spiFlashGetByte();
|
||||
}
|
||||
static inline void* spiFlashGetData(void *dest, unsigned int length)
|
||||
{
|
||||
uint32_t *b = (void*) currentSpiAddress;
|
||||
FLASH_MEMCPY(dest, b, length);
|
||||
currentSpiAddress += length;
|
||||
return dest;
|
||||
}
|
||||
static inline uint32_t spiFlashSetAddress(uint32_t address)
|
||||
{
|
||||
currentSpiAddress = (uint8_t*) address;
|
||||
}
|
||||
#endif /* SOURCE_I_SPI_SUPPORT_H_ */
|
||||
@@ -1,63 +1,63 @@
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* System specific interface stuff.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __I_SYSTEM__
|
||||
#define __I_SYSTEM__
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
#include "printf.h"
|
||||
boolean I_StartDisplay(void);
|
||||
void I_EndDisplay(void);
|
||||
unsigned int I_GetTime(void); /* killough */
|
||||
unsigned int I_GetTimeMicrosecs();
|
||||
|
||||
/* cphipps - I_GetVersionString
|
||||
* Returns a version string in the given buffer
|
||||
*/
|
||||
const char* I_GetVersionString(char *buf, size_t sz);
|
||||
|
||||
#endif
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* System specific interface stuff.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __I_SYSTEM__
|
||||
#define __I_SYSTEM__
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
#include "printf.h"
|
||||
boolean I_StartDisplay(void);
|
||||
void I_EndDisplay(void);
|
||||
unsigned int I_GetTime(void); /* killough */
|
||||
unsigned int I_GetTimeMicrosecs();
|
||||
|
||||
/* cphipps - I_GetVersionString
|
||||
* Returns a version string in the given buffer
|
||||
*/
|
||||
const char* I_GetVersionString(char *buf, size_t sz);
|
||||
|
||||
#endif
|
||||
@@ -1,85 +1,85 @@
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* System specific interface stuff.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __I_VIDEO__
|
||||
#define __I_VIDEO__
|
||||
|
||||
#include "doomtype.h"
|
||||
#include "v_video.h"
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
void I_PreInitGraphics(void); /* CPhipps - do stuff immediately on start */
|
||||
void I_SetRes(void); /* set resolution */
|
||||
void I_InitGraphics(void);
|
||||
void I_UpdateVideoMode(void);
|
||||
void I_ShutdownGraphics(void);
|
||||
|
||||
/* Takes full 8 bit values. */
|
||||
void I_SetPalette(int pal); /* CPhipps - pass down palette number */
|
||||
boolean I_StartDisplay(void);
|
||||
void I_FinishUpdateBlock(void);
|
||||
/* I_StartTic
|
||||
* Called by D_DoomLoop,
|
||||
* called before processing each tic in a frame.
|
||||
* Quick syncronous operations are performed here.
|
||||
* Can call D_PostEvent.
|
||||
*/
|
||||
void I_StartTic(void);
|
||||
key_t keysDown();
|
||||
/* I_StartFrame
|
||||
* Called by D_DoomLoop,
|
||||
* called before processing any tics in a frame
|
||||
* (just after displaying a frame).
|
||||
* Time consuming syncronous operations
|
||||
* are performed here (joystick reading).
|
||||
* Can call D_PostEvent.
|
||||
*/
|
||||
void handleDisplayBacklightToggle();
|
||||
|
||||
void I_StartFrame(void);
|
||||
extern uint8_t displayBuffer[96 * SCREENWIDTH_PHYSICAL];
|
||||
#endif
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* System specific interface stuff.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __I_VIDEO__
|
||||
#define __I_VIDEO__
|
||||
|
||||
#include "doomtype.h"
|
||||
#include "v_video.h"
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
void I_PreInitGraphics(void); /* CPhipps - do stuff immediately on start */
|
||||
void I_SetRes(void); /* set resolution */
|
||||
void I_InitGraphics(void);
|
||||
void I_UpdateVideoMode(void);
|
||||
void I_ShutdownGraphics(void);
|
||||
|
||||
/* Takes full 8 bit values. */
|
||||
void I_SetPalette(int pal); /* CPhipps - pass down palette number */
|
||||
boolean I_StartDisplay(void);
|
||||
void I_FinishUpdateBlock(void);
|
||||
/* I_StartTic
|
||||
* Called by D_DoomLoop,
|
||||
* called before processing each tic in a frame.
|
||||
* Quick syncronous operations are performed here.
|
||||
* Can call D_PostEvent.
|
||||
*/
|
||||
void I_StartTic(void);
|
||||
key_t keysDown();
|
||||
/* I_StartFrame
|
||||
* Called by D_DoomLoop,
|
||||
* called before processing any tics in a frame
|
||||
* (just after displaying a frame).
|
||||
* Time consuming syncronous operations
|
||||
* are performed here (joystick reading).
|
||||
* Can call D_PostEvent.
|
||||
*/
|
||||
void handleDisplayBacklightToggle();
|
||||
|
||||
void I_StartFrame(void);
|
||||
extern uint8_t displayBuffer[96 * SCREENWIDTH_PHYSICAL];
|
||||
#endif
|
||||
+1508
-1508
File diff suppressed because it is too large.
Load diff
@@ -1,98 +1,98 @@
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Declarations etc. for logical console output
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __LPRINTF__
|
||||
#define __LPRINTF__
|
||||
#include "printf.h"
|
||||
#include <stdarg.h>
|
||||
typedef enum /* Logical output levels */
|
||||
{
|
||||
LO_INFO = 1, /* One of these is used in each physical output */
|
||||
LO_CONFIRM = 2, /* call. Which are output, or echoed to console */
|
||||
LO_WARN = 4, /* if output redirected is determined by the */
|
||||
LO_ERROR = 8, /* global masks: cons_output_mask,cons_error_mask. */
|
||||
LO_FATAL = 16, LO_DEBUG = 32, LO_ALWAYS = 64,
|
||||
} OutputLevels;
|
||||
|
||||
//extern int lprintf(OutputLevels pri, const char *fmt, ...);
|
||||
#ifdef PARADISE_DEV
|
||||
void plat_plog(int n);
|
||||
#define PLOG(n) plat_plog(n)
|
||||
#else
|
||||
#define PLOG(n)
|
||||
#endif
|
||||
#ifdef PARADISE_DEV
|
||||
void plat_mark(int line, const char *file);
|
||||
#define lprintf(pri, fmt, ...) plat_mark(__LINE__, __FILE__)
|
||||
#else
|
||||
#define lprintf(pri, fmt, ...) printf(fmt, ## __VA_ARGS__)
|
||||
#endif
|
||||
#define MIN_DEMO_GAMETIC_TO_PRINT 0
|
||||
/* 1.7.2 DOOM_FREE: P_Random looked for a backslash in the file name on every call (about 15 KB backwards through the
|
||||
* program part, for a debug print that is off): left out */
|
||||
#ifdef DOOM_FREE
|
||||
#define PRND_SCAN 0
|
||||
#else
|
||||
#define PRND_SCAN 1
|
||||
#endif
|
||||
|
||||
#define DEBUG_DEMO 0
|
||||
#if DEBUG_DEMO
|
||||
#define demodbgprintf printf
|
||||
#else
|
||||
#define demodbgprintf(...)
|
||||
#endif
|
||||
|
||||
/* killough 3/20/98: add const
|
||||
* killough 4/25/98: add gcc attributes
|
||||
* cphipps 01/11- moved from i_system.h */
|
||||
//void I_Error (const char *error, ...);
|
||||
#ifdef PARADISE_DEV
|
||||
void plat_error(int line, const char *file);
|
||||
#define I_Error(...) plat_error(__LINE__, __FILE__)
|
||||
#else
|
||||
#define I_Error printf
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Declarations etc. for logical console output
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __LPRINTF__
|
||||
#define __LPRINTF__
|
||||
#include "printf.h"
|
||||
#include <stdarg.h>
|
||||
typedef enum /* Logical output levels */
|
||||
{
|
||||
LO_INFO = 1, /* One of these is used in each physical output */
|
||||
LO_CONFIRM = 2, /* call. Which are output, or echoed to console */
|
||||
LO_WARN = 4, /* if output redirected is determined by the */
|
||||
LO_ERROR = 8, /* global masks: cons_output_mask,cons_error_mask. */
|
||||
LO_FATAL = 16, LO_DEBUG = 32, LO_ALWAYS = 64,
|
||||
} OutputLevels;
|
||||
|
||||
//extern int lprintf(OutputLevels pri, const char *fmt, ...);
|
||||
#ifdef PARADISE_DEV
|
||||
void plat_plog(int n);
|
||||
#define PLOG(n) plat_plog(n)
|
||||
#else
|
||||
#define PLOG(n)
|
||||
#endif
|
||||
#ifdef PARADISE_DEV
|
||||
void plat_mark(int line, const char *file);
|
||||
#define lprintf(pri, fmt, ...) plat_mark(__LINE__, __FILE__)
|
||||
#else
|
||||
#define lprintf(pri, fmt, ...) printf(fmt, ## __VA_ARGS__)
|
||||
#endif
|
||||
#define MIN_DEMO_GAMETIC_TO_PRINT 0
|
||||
/* 1.7.2 DOOM_FREE: P_Random looked for a backslash in the file name on every call (about 15 KB backwards through the
|
||||
* program part, for a debug print that is off): left out */
|
||||
#ifdef DOOM_FREE
|
||||
#define PRND_SCAN 0
|
||||
#else
|
||||
#define PRND_SCAN 1
|
||||
#endif
|
||||
|
||||
#define DEBUG_DEMO 0
|
||||
#if DEBUG_DEMO
|
||||
#define demodbgprintf printf
|
||||
#else
|
||||
#define demodbgprintf(...)
|
||||
#endif
|
||||
|
||||
/* killough 3/20/98: add const
|
||||
* killough 4/25/98: add gcc attributes
|
||||
* cphipps 01/11- moved from i_system.h */
|
||||
//void I_Error (const char *error, ...);
|
||||
#ifdef PARADISE_DEV
|
||||
void plat_error(int line, const char *file);
|
||||
#define I_Error(...) plat_error(__LINE__, __FILE__)
|
||||
#else
|
||||
#define I_Error printf
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,64 +1,64 @@
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Simple bounding box datatype and functions.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __M_BBOX__
|
||||
#define __M_BBOX__
|
||||
|
||||
#include <limits.h>
|
||||
#include "m_fixed.h"
|
||||
|
||||
/* Bounding box coordinate storage. */
|
||||
enum
|
||||
{
|
||||
BOXTOP, BOXBOTTOM, BOXLEFT, BOXRIGHT
|
||||
};
|
||||
/* bbox coordinates */
|
||||
|
||||
/* Bounding box functions. */
|
||||
|
||||
void M_ClearBox(fixed_t *box);
|
||||
|
||||
void M_AddToBox(fixed_t *box, fixed_t x, fixed_t y);
|
||||
|
||||
#endif
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Simple bounding box datatype and functions.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __M_BBOX__
|
||||
#define __M_BBOX__
|
||||
|
||||
#include <limits.h>
|
||||
#include "m_fixed.h"
|
||||
|
||||
/* Bounding box coordinate storage. */
|
||||
enum
|
||||
{
|
||||
BOXTOP, BOXBOTTOM, BOXLEFT, BOXRIGHT
|
||||
};
|
||||
/* bbox coordinates */
|
||||
|
||||
/* Bounding box functions. */
|
||||
|
||||
void M_ClearBox(fixed_t *box);
|
||||
|
||||
void M_AddToBox(fixed_t *box, fixed_t x, fixed_t y);
|
||||
|
||||
#endif
|
||||
@@ -1,8 +1,8 @@
|
||||
#ifndef M_CHEAT_H
|
||||
#define M_CHEAT_H
|
||||
|
||||
#include "d_event.h"
|
||||
|
||||
boolean C_Responder(event_t *ev);
|
||||
|
||||
#endif // M_CHEAT_H
|
||||
#ifndef M_CHEAT_H
|
||||
#define M_CHEAT_H
|
||||
|
||||
#include "d_event.h"
|
||||
|
||||
boolean C_Responder(event_t *ev);
|
||||
|
||||
#endif // M_CHEAT_H
|
||||
@@ -1,167 +1,167 @@
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Fixed point arithemtics, implementation.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __M_FIXED__
|
||||
#define __M_FIXED__
|
||||
|
||||
#include "config.h"
|
||||
#include "doomtype.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
// to count divisions per frame
|
||||
extern int divisions;
|
||||
/*
|
||||
* Fixed point, 32bit as 16.16.
|
||||
*/
|
||||
|
||||
#define FRACBITS 16
|
||||
#define FRACUNIT (1<<FRACBITS)
|
||||
|
||||
typedef int fixed_t;
|
||||
|
||||
/*
|
||||
* Absolute Value
|
||||
*
|
||||
* killough 5/10/98: In djgpp, use inlined assembly for performance
|
||||
* killough 9/05/98: better code seems to be gotten from using inlined C
|
||||
* next-hack: standard library implements this function in 2 asm instructions.
|
||||
*/
|
||||
|
||||
inline static int CONSTFUNC D_abs(fixed_t x)
|
||||
{
|
||||
return abs(x);
|
||||
/*fixed_t _t = (x), _s;
|
||||
_s = _t >> (8 * sizeof _t - 1);
|
||||
return (_t ^ _s) - _s;*/
|
||||
}
|
||||
|
||||
/*
|
||||
* Fixed Point Multiplication
|
||||
*/
|
||||
|
||||
/* CPhipps - made __inline__ to inline, as specified in the gcc docs
|
||||
* Also made const */
|
||||
|
||||
fixed_t CONSTFUNC FixedMul(fixed_t a, fixed_t b);
|
||||
|
||||
/*
|
||||
* Fixed Point Division
|
||||
*/
|
||||
|
||||
/* CPhipps - made __inline__ to inline, as specified in the gcc docs
|
||||
* Also made const */
|
||||
|
||||
inline static fixed_t CONSTFUNC FixedDiv(fixed_t a, fixed_t b)
|
||||
{
|
||||
|
||||
divisions++;
|
||||
return ((unsigned)D_abs(a)>>14) >= (unsigned)D_abs(b) ? ((a^b)>>31) ^ INT_MAX : (fixed_t)(((int_64_t) a << FRACBITS) / b);
|
||||
// this is much faster as we have a FPU..
|
||||
// float r = ((float) a) / b;
|
||||
// return (fixed_t) 65536 * r;
|
||||
}
|
||||
|
||||
/* CPhipps -
|
||||
* FixedMod - returns a % b, guaranteeing 0<=a<b
|
||||
* (notice that the C standard for % does not guarantee this)
|
||||
*/
|
||||
|
||||
inline static fixed_t CONSTFUNC FixedMod(fixed_t a, fixed_t b)
|
||||
{
|
||||
divisions++;
|
||||
|
||||
if (!a)
|
||||
return 0;
|
||||
|
||||
if (b & (b - 1))
|
||||
{
|
||||
fixed_t r = a % b;
|
||||
return ((r < 0) ? r + b : r);
|
||||
}
|
||||
else
|
||||
return (a & (b - 1));
|
||||
}
|
||||
|
||||
//Approx Reciprocal of v
|
||||
inline static CONSTFUNC fixed_t FixedReciprocal(fixed_t v)
|
||||
{
|
||||
divisions++;
|
||||
fixed_t result;
|
||||
// CORTEX M4 and M33 have FPU. Let's use it (we can't afford 64k of flash for reciprocals!) .
|
||||
if (0 == v)
|
||||
return 0; // we should return infinity, but the table returned 0
|
||||
#ifdef PARADISE
|
||||
/* Cortex-M3 without floating point: integer 2^32 / v */
|
||||
(void) result;
|
||||
if (v == 1 || v == -1) return v > 0 ? INT_MAX : -INT_MAX;
|
||||
return (fixed_t) (0x100000000LL / v);
|
||||
#else
|
||||
float r;
|
||||
r = 65536.0 / v;
|
||||
result = (fixed_t) (r * 65536);
|
||||
return result;
|
||||
#endif
|
||||
}
|
||||
//Count leading zeros. 16bit.
|
||||
inline static CONSTFUNC unsigned int clz16(unsigned int x)
|
||||
{
|
||||
return __builtin_clz(x);
|
||||
}
|
||||
|
||||
//Approx fixed point divide of a/b using reciprocal. -> a * (1/b).
|
||||
inline static CONSTFUNC fixed_t FixedApproxDiv(fixed_t a, fixed_t b)
|
||||
{
|
||||
divisions++;
|
||||
|
||||
#ifdef PARADISE
|
||||
if (!b) return 0;
|
||||
return (fixed_t) (((int_64_t) a << FRACBITS) / b);
|
||||
#else
|
||||
float r = ((float) a) / b;
|
||||
return (fixed_t) 65536 * r;
|
||||
#endif
|
||||
// return FixedMul(a, FixedReciprocal(b));
|
||||
}
|
||||
|
||||
#endif
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Fixed point arithemtics, implementation.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __M_FIXED__
|
||||
#define __M_FIXED__
|
||||
|
||||
#include "config.h"
|
||||
#include "doomtype.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
// to count divisions per frame
|
||||
extern int divisions;
|
||||
/*
|
||||
* Fixed point, 32bit as 16.16.
|
||||
*/
|
||||
|
||||
#define FRACBITS 16
|
||||
#define FRACUNIT (1<<FRACBITS)
|
||||
|
||||
typedef int fixed_t;
|
||||
|
||||
/*
|
||||
* Absolute Value
|
||||
*
|
||||
* killough 5/10/98: In djgpp, use inlined assembly for performance
|
||||
* killough 9/05/98: better code seems to be gotten from using inlined C
|
||||
* next-hack: standard library implements this function in 2 asm instructions.
|
||||
*/
|
||||
|
||||
inline static int CONSTFUNC D_abs(fixed_t x)
|
||||
{
|
||||
return abs(x);
|
||||
/*fixed_t _t = (x), _s;
|
||||
_s = _t >> (8 * sizeof _t - 1);
|
||||
return (_t ^ _s) - _s;*/
|
||||
}
|
||||
|
||||
/*
|
||||
* Fixed Point Multiplication
|
||||
*/
|
||||
|
||||
/* CPhipps - made __inline__ to inline, as specified in the gcc docs
|
||||
* Also made const */
|
||||
|
||||
fixed_t CONSTFUNC FixedMul(fixed_t a, fixed_t b);
|
||||
|
||||
/*
|
||||
* Fixed Point Division
|
||||
*/
|
||||
|
||||
/* CPhipps - made __inline__ to inline, as specified in the gcc docs
|
||||
* Also made const */
|
||||
|
||||
inline static fixed_t CONSTFUNC FixedDiv(fixed_t a, fixed_t b)
|
||||
{
|
||||
|
||||
divisions++;
|
||||
return ((unsigned)D_abs(a)>>14) >= (unsigned)D_abs(b) ? ((a^b)>>31) ^ INT_MAX : (fixed_t)(((int_64_t) a << FRACBITS) / b);
|
||||
// this is much faster as we have a FPU..
|
||||
// float r = ((float) a) / b;
|
||||
// return (fixed_t) 65536 * r;
|
||||
}
|
||||
|
||||
/* CPhipps -
|
||||
* FixedMod - returns a % b, guaranteeing 0<=a<b
|
||||
* (notice that the C standard for % does not guarantee this)
|
||||
*/
|
||||
|
||||
inline static fixed_t CONSTFUNC FixedMod(fixed_t a, fixed_t b)
|
||||
{
|
||||
divisions++;
|
||||
|
||||
if (!a)
|
||||
return 0;
|
||||
|
||||
if (b & (b - 1))
|
||||
{
|
||||
fixed_t r = a % b;
|
||||
return ((r < 0) ? r + b : r);
|
||||
}
|
||||
else
|
||||
return (a & (b - 1));
|
||||
}
|
||||
|
||||
//Approx Reciprocal of v
|
||||
inline static CONSTFUNC fixed_t FixedReciprocal(fixed_t v)
|
||||
{
|
||||
divisions++;
|
||||
fixed_t result;
|
||||
// CORTEX M4 and M33 have FPU. Let's use it (we can't afford 64k of flash for reciprocals!) .
|
||||
if (0 == v)
|
||||
return 0; // we should return infinity, but the table returned 0
|
||||
#ifdef PARADISE
|
||||
/* Cortex-M3 without floating point: integer 2^32 / v */
|
||||
(void) result;
|
||||
if (v == 1 || v == -1) return v > 0 ? INT_MAX : -INT_MAX;
|
||||
return (fixed_t) (0x100000000LL / v);
|
||||
#else
|
||||
float r;
|
||||
r = 65536.0 / v;
|
||||
result = (fixed_t) (r * 65536);
|
||||
return result;
|
||||
#endif
|
||||
}
|
||||
//Count leading zeros. 16bit.
|
||||
inline static CONSTFUNC unsigned int clz16(unsigned int x)
|
||||
{
|
||||
return __builtin_clz(x);
|
||||
}
|
||||
|
||||
//Approx fixed point divide of a/b using reciprocal. -> a * (1/b).
|
||||
inline static CONSTFUNC fixed_t FixedApproxDiv(fixed_t a, fixed_t b)
|
||||
{
|
||||
divisions++;
|
||||
|
||||
#ifdef PARADISE
|
||||
if (!b) return 0;
|
||||
return (fixed_t) (((int_64_t) a << FRACBITS) / b);
|
||||
#else
|
||||
float r = ((float) a) / b;
|
||||
return (fixed_t) 65536 * r;
|
||||
#endif
|
||||
// return FixedMul(a, FixedReciprocal(b));
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,162 +1,162 @@
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Menu widget stuff, episode selection and such.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __M_MENU__
|
||||
#define __M_MENU__
|
||||
|
||||
#include "d_event.h"
|
||||
|
||||
//
|
||||
// MENUS
|
||||
//
|
||||
// Called by main loop,
|
||||
// saves config file and calls I_Quit when user exits.
|
||||
// Even when the menu is not displayed,
|
||||
// this can resize the view and change game parameters.
|
||||
// Does all the real work of the menu interaction.
|
||||
|
||||
boolean M_Responder(event_t *ev);
|
||||
|
||||
// Called by main loop,
|
||||
// only used for menu (skull cursor) animation.
|
||||
|
||||
void M_Ticker(void);
|
||||
|
||||
// Called by main loop,
|
||||
// draws the menus directly into the screen buffer.
|
||||
|
||||
void M_Drawer(void);
|
||||
|
||||
// Called by D_DoomMain,
|
||||
// loads the config file.
|
||||
|
||||
void M_Init(void);
|
||||
|
||||
// Called by intro code to force menu up upon a keypress,
|
||||
// does nothing if menu is already up.
|
||||
|
||||
void M_StartControlPanel(void);
|
||||
|
||||
void M_ResetMenu(void); // killough 11/98: reset main menu ordering
|
||||
|
||||
void M_DrawCredits(void); // killough 11/98
|
||||
|
||||
void M_ChangeGamma(int choice); // Adafruit Clue onboard button gamma adjust
|
||||
|
||||
/****************************
|
||||
*
|
||||
* The following #defines are for the m_flags field of each item on every
|
||||
* Setup Screen. They can be OR'ed together where appropriate
|
||||
*/
|
||||
|
||||
#define S_HILITE 0x1 // Cursor is sitting on this item
|
||||
#define S_SELECT 0x2 // We're changing this item
|
||||
#define S_TITLE 0x4 // Title item
|
||||
#define S_YESNO 0x8 // Yes or No item
|
||||
#define S_CRITEM 0x10 // Message color
|
||||
#define S_COLOR 0x20 // Automap color
|
||||
#define S_CHAT 0x40 // Chat String
|
||||
#define S_RESET 0x80 // Reset to Defaults Button
|
||||
#define S_PREV 0x100 // Previous menu exists
|
||||
#define S_NEXT 0x200 // Next menu exists
|
||||
#define S_KEY 0x400 // Key Binding
|
||||
#define S_WEAP 0x800 // Weapon #
|
||||
#define S_NUM 0x1000 // Numerical item
|
||||
#define S_SKIP 0x2000 // Cursor can't land here
|
||||
#define S_KEEP 0x4000 // Don't swap key out
|
||||
#define S_END 0x8000 // Last item in list (dummy)
|
||||
#define S_LEVWARN 0x10000// killough 8/30/98: Always warn about pending change
|
||||
#define S_PRGWARN 0x20000// killough 10/98: Warn about change until next run
|
||||
#define S_BADVAL 0x40000// killough 10/98: Warn about bad value
|
||||
#define S_FILE 0x80000// killough 10/98: Filenames
|
||||
#define S_LEFTJUST 0x100000 // killough 10/98: items which are left-justified
|
||||
#define S_CREDIT 0x200000 // killough 10/98: credit
|
||||
#define S_BADVID 0x400000 // killough 12/98: video mode change error
|
||||
#define S_CHOICE 0x800000 // this item has several values
|
||||
|
||||
/* S_SHOWDESC = the set of items whose description should be displayed
|
||||
* S_SHOWSET = the set of items whose setting should be displayed
|
||||
* S_STRING = the set of items whose settings are strings -- killough 10/98:
|
||||
* S_HASDEFPTR = the set of items whose var field points to default array
|
||||
*/
|
||||
|
||||
#define S_SHOWDESC (S_TITLE|S_YESNO|S_CRITEM|S_COLOR|S_CHAT|S_RESET|S_PREV|S_NEXT|S_KEY|S_WEAP|S_NUM|S_FILE|S_CREDIT|S_CHOICE)
|
||||
|
||||
#define S_SHOWSET (S_YESNO|S_CRITEM|S_COLOR|S_CHAT|S_KEY|S_WEAP|S_NUM|S_FILE|S_CHOICE)
|
||||
|
||||
#define S_STRING (S_CHAT|S_FILE)
|
||||
|
||||
#define S_HASDEFPTR (S_STRING|S_YESNO|S_NUM|S_WEAP|S_COLOR|S_CRITEM|S_CHOICE)
|
||||
|
||||
#define SAVESTRINGSIZE 8
|
||||
|
||||
//
|
||||
// MENU TYPEDEFS
|
||||
//
|
||||
|
||||
typedef struct
|
||||
{
|
||||
short status; // 0 = no cursor here, 1 = ok, 2 = arrows ok
|
||||
char name[10];
|
||||
|
||||
// choice = menu item #.
|
||||
// if status = 2,
|
||||
// choice=0:leftarrow,1:rightarrow
|
||||
void (*routine)(int choice);
|
||||
} menuitem_t;
|
||||
|
||||
typedef struct menu_s
|
||||
{
|
||||
short numitems; // # of menu items
|
||||
const menuitem_t *menuitems; // menu items
|
||||
void (*routine)(); // draw routine
|
||||
short x;
|
||||
short y; // x,y of menu
|
||||
const struct menu_s *prevMenu; // previous menu
|
||||
short previtemOn;
|
||||
} menu_t;
|
||||
|
||||
extern char savegamestrings[8][8];
|
||||
|
||||
#endif
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Menu widget stuff, episode selection and such.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __M_MENU__
|
||||
#define __M_MENU__
|
||||
|
||||
#include "d_event.h"
|
||||
|
||||
//
|
||||
// MENUS
|
||||
//
|
||||
// Called by main loop,
|
||||
// saves config file and calls I_Quit when user exits.
|
||||
// Even when the menu is not displayed,
|
||||
// this can resize the view and change game parameters.
|
||||
// Does all the real work of the menu interaction.
|
||||
|
||||
boolean M_Responder(event_t *ev);
|
||||
|
||||
// Called by main loop,
|
||||
// only used for menu (skull cursor) animation.
|
||||
|
||||
void M_Ticker(void);
|
||||
|
||||
// Called by main loop,
|
||||
// draws the menus directly into the screen buffer.
|
||||
|
||||
void M_Drawer(void);
|
||||
|
||||
// Called by D_DoomMain,
|
||||
// loads the config file.
|
||||
|
||||
void M_Init(void);
|
||||
|
||||
// Called by intro code to force menu up upon a keypress,
|
||||
// does nothing if menu is already up.
|
||||
|
||||
void M_StartControlPanel(void);
|
||||
|
||||
void M_ResetMenu(void); // killough 11/98: reset main menu ordering
|
||||
|
||||
void M_DrawCredits(void); // killough 11/98
|
||||
|
||||
void M_ChangeGamma(int choice); // Adafruit Clue onboard button gamma adjust
|
||||
|
||||
/****************************
|
||||
*
|
||||
* The following #defines are for the m_flags field of each item on every
|
||||
* Setup Screen. They can be OR'ed together where appropriate
|
||||
*/
|
||||
|
||||
#define S_HILITE 0x1 // Cursor is sitting on this item
|
||||
#define S_SELECT 0x2 // We're changing this item
|
||||
#define S_TITLE 0x4 // Title item
|
||||
#define S_YESNO 0x8 // Yes or No item
|
||||
#define S_CRITEM 0x10 // Message color
|
||||
#define S_COLOR 0x20 // Automap color
|
||||
#define S_CHAT 0x40 // Chat String
|
||||
#define S_RESET 0x80 // Reset to Defaults Button
|
||||
#define S_PREV 0x100 // Previous menu exists
|
||||
#define S_NEXT 0x200 // Next menu exists
|
||||
#define S_KEY 0x400 // Key Binding
|
||||
#define S_WEAP 0x800 // Weapon #
|
||||
#define S_NUM 0x1000 // Numerical item
|
||||
#define S_SKIP 0x2000 // Cursor can't land here
|
||||
#define S_KEEP 0x4000 // Don't swap key out
|
||||
#define S_END 0x8000 // Last item in list (dummy)
|
||||
#define S_LEVWARN 0x10000// killough 8/30/98: Always warn about pending change
|
||||
#define S_PRGWARN 0x20000// killough 10/98: Warn about change until next run
|
||||
#define S_BADVAL 0x40000// killough 10/98: Warn about bad value
|
||||
#define S_FILE 0x80000// killough 10/98: Filenames
|
||||
#define S_LEFTJUST 0x100000 // killough 10/98: items which are left-justified
|
||||
#define S_CREDIT 0x200000 // killough 10/98: credit
|
||||
#define S_BADVID 0x400000 // killough 12/98: video mode change error
|
||||
#define S_CHOICE 0x800000 // this item has several values
|
||||
|
||||
/* S_SHOWDESC = the set of items whose description should be displayed
|
||||
* S_SHOWSET = the set of items whose setting should be displayed
|
||||
* S_STRING = the set of items whose settings are strings -- killough 10/98:
|
||||
* S_HASDEFPTR = the set of items whose var field points to default array
|
||||
*/
|
||||
|
||||
#define S_SHOWDESC (S_TITLE|S_YESNO|S_CRITEM|S_COLOR|S_CHAT|S_RESET|S_PREV|S_NEXT|S_KEY|S_WEAP|S_NUM|S_FILE|S_CREDIT|S_CHOICE)
|
||||
|
||||
#define S_SHOWSET (S_YESNO|S_CRITEM|S_COLOR|S_CHAT|S_KEY|S_WEAP|S_NUM|S_FILE|S_CHOICE)
|
||||
|
||||
#define S_STRING (S_CHAT|S_FILE)
|
||||
|
||||
#define S_HASDEFPTR (S_STRING|S_YESNO|S_NUM|S_WEAP|S_COLOR|S_CRITEM|S_CHOICE)
|
||||
|
||||
#define SAVESTRINGSIZE 8
|
||||
|
||||
//
|
||||
// MENU TYPEDEFS
|
||||
//
|
||||
|
||||
typedef struct
|
||||
{
|
||||
short status; // 0 = no cursor here, 1 = ok, 2 = arrows ok
|
||||
char name[10];
|
||||
|
||||
// choice = menu item #.
|
||||
// if status = 2,
|
||||
// choice=0:leftarrow,1:rightarrow
|
||||
void (*routine)(int choice);
|
||||
} menuitem_t;
|
||||
|
||||
typedef struct menu_s
|
||||
{
|
||||
short numitems; // # of menu items
|
||||
const menuitem_t *menuitems; // menu items
|
||||
void (*routine)(); // draw routine
|
||||
short x;
|
||||
short y; // x,y of menu
|
||||
const struct menu_s *prevMenu; // previous menu
|
||||
short previtemOn;
|
||||
} menu_t;
|
||||
|
||||
extern char savegamestrings[8][8];
|
||||
|
||||
#endif
|
||||
@@ -1,51 +1,51 @@
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* External non-system-specific stuff, like storing config settings,
|
||||
* simple file handling, and saving screnshots.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __M_MISC__
|
||||
#define __M_MISC__
|
||||
|
||||
#include "doomtype.h"
|
||||
|
||||
#endif
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* External non-system-specific stuff, like storing config settings,
|
||||
* simple file handling, and saving screnshots.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __M_MISC__
|
||||
#define __M_MISC__
|
||||
|
||||
#include "doomtype.h"
|
||||
|
||||
#endif
|
||||
@@ -1,62 +1,62 @@
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Functions to return random numbers.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __M_RANDOM__
|
||||
#define __M_RANDOM__
|
||||
|
||||
#include "doomtype.h"
|
||||
|
||||
#include "doomtype.h"
|
||||
|
||||
// Returns a number from 0 to 255,
|
||||
// from a lookup table.
|
||||
int M_Random(void);
|
||||
|
||||
// As M_Random, but used only by the play simulation.
|
||||
int P_Random(const char *, int, const char *);
|
||||
|
||||
// Fix randoms for demos.
|
||||
void M_ClearRandom(void);
|
||||
|
||||
#endif
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Functions to return random numbers.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __M_RANDOM__
|
||||
#define __M_RANDOM__
|
||||
|
||||
#include "doomtype.h"
|
||||
|
||||
#include "doomtype.h"
|
||||
|
||||
// Returns a number from 0 to 255,
|
||||
// from a lookup table.
|
||||
int M_Random(void);
|
||||
|
||||
// As M_Random, but used only by the play simulation.
|
||||
int P_Random(const char *, int, const char *);
|
||||
|
||||
// Fix randoms for demos.
|
||||
void M_ClearRandom(void);
|
||||
|
||||
#endif
|
||||
@@ -1,110 +1,110 @@
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Endianess handling, swapping 16bit and 32bit.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __M_SWAP__
|
||||
#define __M_SWAP__
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
/* CPhipps - now the endianness handling, converting input or output to/from
|
||||
* the machine's endianness to that wanted for this type of I/O
|
||||
*
|
||||
* To find our own endianness, use config.h
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
/* Endianess handling. */
|
||||
|
||||
/* cph - First the macros to do the actual byte swapping */
|
||||
|
||||
/* leban
|
||||
* rather than continue the confusing tradition of redefining the
|
||||
* stardard macro, we now present the doom_ntoh and doom_hton macros....
|
||||
* might as well use the xdoom macros.
|
||||
*/
|
||||
|
||||
#ifndef doom_swap_l
|
||||
#define doom_swap_l(x) \
|
||||
((long int)((((unsigned long int)(x) & 0x000000ffU) << 24) | \
|
||||
(((unsigned long int)(x) & 0x0000ff00U) << 8) | \
|
||||
(((unsigned long int)(x) & 0x00ff0000U) >> 8) | \
|
||||
(((unsigned long int)(x) & 0xff000000U) >> 24)))
|
||||
#endif
|
||||
|
||||
#ifndef doom_swap_s
|
||||
#define doom_swap_s(x) \
|
||||
((short int)((((unsigned short int)(x) & 0x00ff) << 8) | \
|
||||
(((unsigned short int)(x) & 0xff00) >> 8)))
|
||||
#endif
|
||||
|
||||
/* Macros are named doom_XtoYT, where
|
||||
* X is thing to convert from, Y is thing to convert to, chosen from
|
||||
* n for network, h for host (i.e our machine's), w for WAD (Doom data files)
|
||||
* and T is the type, l or s for long or short
|
||||
*
|
||||
* CPhipps - all WADs and network packets will be little endian for now
|
||||
* Use separate macros so network could be converted to big-endian later.
|
||||
*/
|
||||
|
||||
#define doom_wtohl(x) (long int)(x)
|
||||
#define doom_htowl(x) (long int)(x)
|
||||
#define doom_wtohs(x) (short int)(x)
|
||||
#define doom_htows(x) (short int)(x)
|
||||
|
||||
#define doom_ntohl(x) (long int)(x)
|
||||
#define doom_htonl(x) (long int)(x)
|
||||
#define doom_ntohs(x) (short int)(x)
|
||||
#define doom_htons(x) (short int)(x)
|
||||
|
||||
/* CPhipps - Boom's old LONG and SHORT endianness macros are for WAD stuff */
|
||||
|
||||
#define LONG(x) doom_wtohl(x)
|
||||
#define SHORT(x) doom_htows(x)
|
||||
|
||||
#endif
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Endianess handling, swapping 16bit and 32bit.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __M_SWAP__
|
||||
#define __M_SWAP__
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
/* CPhipps - now the endianness handling, converting input or output to/from
|
||||
* the machine's endianness to that wanted for this type of I/O
|
||||
*
|
||||
* To find our own endianness, use config.h
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
/* Endianess handling. */
|
||||
|
||||
/* cph - First the macros to do the actual byte swapping */
|
||||
|
||||
/* leban
|
||||
* rather than continue the confusing tradition of redefining the
|
||||
* stardard macro, we now present the doom_ntoh and doom_hton macros....
|
||||
* might as well use the xdoom macros.
|
||||
*/
|
||||
|
||||
#ifndef doom_swap_l
|
||||
#define doom_swap_l(x) \
|
||||
((long int)((((unsigned long int)(x) & 0x000000ffU) << 24) | \
|
||||
(((unsigned long int)(x) & 0x0000ff00U) << 8) | \
|
||||
(((unsigned long int)(x) & 0x00ff0000U) >> 8) | \
|
||||
(((unsigned long int)(x) & 0xff000000U) >> 24)))
|
||||
#endif
|
||||
|
||||
#ifndef doom_swap_s
|
||||
#define doom_swap_s(x) \
|
||||
((short int)((((unsigned short int)(x) & 0x00ff) << 8) | \
|
||||
(((unsigned short int)(x) & 0xff00) >> 8)))
|
||||
#endif
|
||||
|
||||
/* Macros are named doom_XtoYT, where
|
||||
* X is thing to convert from, Y is thing to convert to, chosen from
|
||||
* n for network, h for host (i.e our machine's), w for WAD (Doom data files)
|
||||
* and T is the type, l or s for long or short
|
||||
*
|
||||
* CPhipps - all WADs and network packets will be little endian for now
|
||||
* Use separate macros so network could be converted to big-endian later.
|
||||
*/
|
||||
|
||||
#define doom_wtohl(x) (long int)(x)
|
||||
#define doom_htowl(x) (long int)(x)
|
||||
#define doom_wtohs(x) (short int)(x)
|
||||
#define doom_htows(x) (short int)(x)
|
||||
|
||||
#define doom_ntohl(x) (long int)(x)
|
||||
#define doom_htonl(x) (long int)(x)
|
||||
#define doom_ntohs(x) (short int)(x)
|
||||
#define doom_htons(x) (short int)(x)
|
||||
|
||||
/* CPhipps - Boom's old LONG and SHORT endianness macros are for WAD stuff */
|
||||
|
||||
#define LONG(x) doom_wtohl(x)
|
||||
#define SHORT(x) doom_htows(x)
|
||||
|
||||
#endif
|
||||
@@ -1,129 +1,129 @@
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Enemy thinking, AI.
|
||||
* Action Pointer Functions
|
||||
* that are associated with states/frames.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __P_ENEMY__
|
||||
#define __P_ENEMY__
|
||||
|
||||
#include "p_mobj.h"
|
||||
|
||||
void P_NoiseAlert(mobj_t *target, mobj_t *emmiter);
|
||||
void P_SpawnBrainTargets(void); /* killough 3/26/98: spawn icon landings */
|
||||
|
||||
typedef struct brain_t
|
||||
{ /* killough 3/26/98: global state of boss brain */
|
||||
int easy, targeton;
|
||||
} brain_t;
|
||||
|
||||
// ********************************************************************
|
||||
// Function addresses or Code Pointers
|
||||
// ********************************************************************
|
||||
// These function addresses are the Code Pointers that have been
|
||||
// modified for years by Dehacked enthusiasts. The new BEX format
|
||||
// allows more extensive changes (see d_deh.c)
|
||||
|
||||
// Doesn't work with g++, needs actionf_p1
|
||||
void A_Explode();
|
||||
void A_Pain();
|
||||
void A_PlayerScream();
|
||||
void A_Fall();
|
||||
void A_XScream();
|
||||
void A_Look();
|
||||
void A_Chase();
|
||||
void A_FaceTarget();
|
||||
void A_PosAttack();
|
||||
void A_Scream();
|
||||
void A_SPosAttack();
|
||||
void A_VileChase();
|
||||
void A_VileStart();
|
||||
void A_VileTarget();
|
||||
void A_VileAttack();
|
||||
void A_StartFire();
|
||||
void A_Fire();
|
||||
void A_FireCrackle();
|
||||
void A_Tracer();
|
||||
void A_SkelWhoosh();
|
||||
void A_SkelFist();
|
||||
void A_SkelMissile();
|
||||
void A_FatRaise();
|
||||
void A_FatAttack1();
|
||||
void A_FatAttack2();
|
||||
void A_FatAttack3();
|
||||
void A_BossDeath();
|
||||
void A_CPosAttack();
|
||||
void A_CPosRefire();
|
||||
void A_TroopAttack();
|
||||
void A_SargAttack();
|
||||
void A_HeadAttack();
|
||||
void A_BruisAttack();
|
||||
void A_SkullAttack();
|
||||
void A_Metal();
|
||||
void A_SpidRefire();
|
||||
void A_BabyMetal();
|
||||
void A_BspiAttack();
|
||||
void A_Hoof();
|
||||
void A_CyberAttack();
|
||||
void A_PainAttack();
|
||||
void A_PainDie();
|
||||
void A_KeenDie();
|
||||
void A_BrainPain();
|
||||
void A_BrainScream();
|
||||
void A_BrainDie();
|
||||
void A_BrainAwake();
|
||||
void A_BrainSpit();
|
||||
void A_SpawnSound();
|
||||
void A_SpawnFly();
|
||||
void A_BrainExplode();
|
||||
void A_Die();
|
||||
void A_Detonate(); /* killough 8/9/98: detonate a bomb or other device */
|
||||
void A_Mushroom(); /* killough 10/98: mushroom effect */
|
||||
void A_Spawn(); // killough 11/98
|
||||
void A_Turn(); // killough 11/98
|
||||
void A_Face(); // killough 11/98
|
||||
void A_Scratch(); // killough 11/98
|
||||
void A_PlaySound(); // killough 11/98
|
||||
void A_RandomJump(); // killough 11/98
|
||||
|
||||
#endif // __P_ENEMY__
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Enemy thinking, AI.
|
||||
* Action Pointer Functions
|
||||
* that are associated with states/frames.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __P_ENEMY__
|
||||
#define __P_ENEMY__
|
||||
|
||||
#include "p_mobj.h"
|
||||
|
||||
void P_NoiseAlert(mobj_t *target, mobj_t *emmiter);
|
||||
void P_SpawnBrainTargets(void); /* killough 3/26/98: spawn icon landings */
|
||||
|
||||
typedef struct brain_t
|
||||
{ /* killough 3/26/98: global state of boss brain */
|
||||
int easy, targeton;
|
||||
} brain_t;
|
||||
|
||||
// ********************************************************************
|
||||
// Function addresses or Code Pointers
|
||||
// ********************************************************************
|
||||
// These function addresses are the Code Pointers that have been
|
||||
// modified for years by Dehacked enthusiasts. The new BEX format
|
||||
// allows more extensive changes (see d_deh.c)
|
||||
|
||||
// Doesn't work with g++, needs actionf_p1
|
||||
void A_Explode();
|
||||
void A_Pain();
|
||||
void A_PlayerScream();
|
||||
void A_Fall();
|
||||
void A_XScream();
|
||||
void A_Look();
|
||||
void A_Chase();
|
||||
void A_FaceTarget();
|
||||
void A_PosAttack();
|
||||
void A_Scream();
|
||||
void A_SPosAttack();
|
||||
void A_VileChase();
|
||||
void A_VileStart();
|
||||
void A_VileTarget();
|
||||
void A_VileAttack();
|
||||
void A_StartFire();
|
||||
void A_Fire();
|
||||
void A_FireCrackle();
|
||||
void A_Tracer();
|
||||
void A_SkelWhoosh();
|
||||
void A_SkelFist();
|
||||
void A_SkelMissile();
|
||||
void A_FatRaise();
|
||||
void A_FatAttack1();
|
||||
void A_FatAttack2();
|
||||
void A_FatAttack3();
|
||||
void A_BossDeath();
|
||||
void A_CPosAttack();
|
||||
void A_CPosRefire();
|
||||
void A_TroopAttack();
|
||||
void A_SargAttack();
|
||||
void A_HeadAttack();
|
||||
void A_BruisAttack();
|
||||
void A_SkullAttack();
|
||||
void A_Metal();
|
||||
void A_SpidRefire();
|
||||
void A_BabyMetal();
|
||||
void A_BspiAttack();
|
||||
void A_Hoof();
|
||||
void A_CyberAttack();
|
||||
void A_PainAttack();
|
||||
void A_PainDie();
|
||||
void A_KeenDie();
|
||||
void A_BrainPain();
|
||||
void A_BrainScream();
|
||||
void A_BrainDie();
|
||||
void A_BrainAwake();
|
||||
void A_BrainSpit();
|
||||
void A_SpawnSound();
|
||||
void A_SpawnFly();
|
||||
void A_BrainExplode();
|
||||
void A_Die();
|
||||
void A_Detonate(); /* killough 8/9/98: detonate a bomb or other device */
|
||||
void A_Mushroom(); /* killough 10/98: mushroom effect */
|
||||
void A_Spawn(); // killough 11/98
|
||||
void A_Turn(); // killough 11/98
|
||||
void A_Face(); // killough 11/98
|
||||
void A_Scratch(); // killough 11/98
|
||||
void A_PlaySound(); // killough 11/98
|
||||
void A_RandomJump(); // killough 11/98
|
||||
|
||||
#endif // __P_ENEMY__
|
||||
@@ -1,85 +1,85 @@
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Thing events, and dehacked specified numbers controlling them.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __P_INTER__
|
||||
#define __P_INTER__
|
||||
|
||||
#include "d_player.h"
|
||||
#include "p_mobj.h"
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
/* Ty 03/09/98 Moved to an int in p_inter.c for deh and externalization */
|
||||
#define MAXHEALTH maxhealth
|
||||
|
||||
/* follow a player exlusively for 3 seconds */
|
||||
#define BASETHRESHOLD (100)
|
||||
|
||||
boolean P_GivePower(player_t*, int);
|
||||
void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher);
|
||||
void P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, int damage);
|
||||
|
||||
/* killough 5/2/98: moved from d_deh.c, g_game.c, m_misc.c, others: */
|
||||
|
||||
extern const int god_health; /* Ty 03/09/98 - deh support, see also p_inter.c */
|
||||
extern const int idfa_armor;
|
||||
extern const int idfa_armor_class;
|
||||
extern const int idkfa_armor;
|
||||
extern const int idkfa_armor_class; /* Ty - end */
|
||||
/* Ty 03/13/98 - externalized initial settings for respawned player */
|
||||
extern const int initial_health;
|
||||
extern const int initial_bullets;
|
||||
extern const int maxhealth;
|
||||
extern const int max_armor;
|
||||
extern const int green_armor_class;
|
||||
extern const int blue_armor_class;
|
||||
extern const int max_soul;
|
||||
extern const int soul_health;
|
||||
extern const int mega_health;
|
||||
extern const int bfgcells;
|
||||
extern const int maxammo[], clipammo[];
|
||||
|
||||
#endif
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Thing events, and dehacked specified numbers controlling them.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __P_INTER__
|
||||
#define __P_INTER__
|
||||
|
||||
#include "d_player.h"
|
||||
#include "p_mobj.h"
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
/* Ty 03/09/98 Moved to an int in p_inter.c for deh and externalization */
|
||||
#define MAXHEALTH maxhealth
|
||||
|
||||
/* follow a player exlusively for 3 seconds */
|
||||
#define BASETHRESHOLD (100)
|
||||
|
||||
boolean P_GivePower(player_t*, int);
|
||||
void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher);
|
||||
void P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, int damage);
|
||||
|
||||
/* killough 5/2/98: moved from d_deh.c, g_game.c, m_misc.c, others: */
|
||||
|
||||
extern const int god_health; /* Ty 03/09/98 - deh support, see also p_inter.c */
|
||||
extern const int idfa_armor;
|
||||
extern const int idfa_armor_class;
|
||||
extern const int idkfa_armor;
|
||||
extern const int idkfa_armor_class; /* Ty - end */
|
||||
/* Ty 03/13/98 - externalized initial settings for respawned player */
|
||||
extern const int initial_health;
|
||||
extern const int initial_bullets;
|
||||
extern const int maxhealth;
|
||||
extern const int max_armor;
|
||||
extern const int green_armor_class;
|
||||
extern const int blue_armor_class;
|
||||
extern const int max_soul;
|
||||
extern const int soul_health;
|
||||
extern const int mega_health;
|
||||
extern const int bfgcells;
|
||||
extern const int maxammo[], clipammo[];
|
||||
|
||||
#endif
|
||||
@@ -1,86 +1,86 @@
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Map functions
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __P_MAP__
|
||||
#define __P_MAP__
|
||||
|
||||
#include "r_defs.h"
|
||||
#include "d_player.h"
|
||||
|
||||
#define USERANGE (64*FRACUNIT)
|
||||
#define MELEERANGE (64*FRACUNIT)
|
||||
#define MISSILERANGE (32*64*FRACUNIT)
|
||||
#define LOOKRANGE (768*FRACUNIT) // was 768 in GBA
|
||||
|
||||
// MAXRADIUS is for precalculated sector block boxes the spider demon
|
||||
// is larger, but we do not have any moving sectors nearby
|
||||
#define MAXRADIUS (32*FRACUNIT)
|
||||
|
||||
// killough 3/15/98: add fourth argument to P_TryMove
|
||||
boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean dropoff);
|
||||
|
||||
// killough 8/9/98: extra argument for telefragging
|
||||
boolean P_TeleportMove(mobj_t *thing, fixed_t x, fixed_t y, boolean boss);
|
||||
void P_SlideMove(mobj_t *mo);
|
||||
boolean P_CheckSight(mobj_t *t1, mobj_t *t2);
|
||||
void P_UseLines(player_t *player);
|
||||
|
||||
// killough 8/2/98: add 'mask' argument to prevent friends autoaiming at others
|
||||
fixed_t P_AimLineAttack(mobj_t *t1, angle_t angle, fixed_t distance, uint_64_t mask);
|
||||
|
||||
void P_LineAttack(mobj_t *t1, angle_t angle, fixed_t distance, fixed_t slope, int damage);
|
||||
void P_RadiusAttack(mobj_t *spot, mobj_t *source, int damage);
|
||||
boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y);
|
||||
|
||||
//jff 3/19/98 P_CheckSector(): new routine to replace P_ChangeSector()
|
||||
boolean P_CheckSector(sector_t *sector, boolean crunch);
|
||||
void P_DelSeclist(msecnode_t*); // phares 3/16/98
|
||||
void P_CreateSecNodeList(mobj_t*, fixed_t, fixed_t); // phares 3/14/98
|
||||
boolean Check_Sides(mobj_t*, int, int); // phares
|
||||
|
||||
/* cphipps 2004/08/30 */
|
||||
void P_MapStart(void);
|
||||
void P_MapEnd(void);
|
||||
|
||||
#endif // __P_MAP__
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Map functions
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __P_MAP__
|
||||
#define __P_MAP__
|
||||
|
||||
#include "r_defs.h"
|
||||
#include "d_player.h"
|
||||
|
||||
#define USERANGE (64*FRACUNIT)
|
||||
#define MELEERANGE (64*FRACUNIT)
|
||||
#define MISSILERANGE (32*64*FRACUNIT)
|
||||
#define LOOKRANGE (768*FRACUNIT) // was 768 in GBA
|
||||
|
||||
// MAXRADIUS is for precalculated sector block boxes the spider demon
|
||||
// is larger, but we do not have any moving sectors nearby
|
||||
#define MAXRADIUS (32*FRACUNIT)
|
||||
|
||||
// killough 3/15/98: add fourth argument to P_TryMove
|
||||
boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean dropoff);
|
||||
|
||||
// killough 8/9/98: extra argument for telefragging
|
||||
boolean P_TeleportMove(mobj_t *thing, fixed_t x, fixed_t y, boolean boss);
|
||||
void P_SlideMove(mobj_t *mo);
|
||||
boolean P_CheckSight(mobj_t *t1, mobj_t *t2);
|
||||
void P_UseLines(player_t *player);
|
||||
|
||||
// killough 8/2/98: add 'mask' argument to prevent friends autoaiming at others
|
||||
fixed_t P_AimLineAttack(mobj_t *t1, angle_t angle, fixed_t distance, uint_64_t mask);
|
||||
|
||||
void P_LineAttack(mobj_t *t1, angle_t angle, fixed_t distance, fixed_t slope, int damage);
|
||||
void P_RadiusAttack(mobj_t *spot, mobj_t *source, int damage);
|
||||
boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y);
|
||||
|
||||
//jff 3/19/98 P_CheckSector(): new routine to replace P_ChangeSector()
|
||||
boolean P_CheckSector(sector_t *sector, boolean crunch);
|
||||
void P_DelSeclist(msecnode_t*); // phares 3/16/98
|
||||
void P_CreateSecNodeList(mobj_t*, fixed_t, fixed_t); // phares 3/14/98
|
||||
boolean Check_Sides(mobj_t*, int, int); // phares
|
||||
|
||||
/* cphipps 2004/08/30 */
|
||||
void P_MapStart(void);
|
||||
void P_MapEnd(void);
|
||||
|
||||
#endif // __P_MAP__
|
||||
@@ -1,106 +1,106 @@
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Map utility functions
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __P_MAPUTL__
|
||||
#define __P_MAPUTL__
|
||||
|
||||
#include "r_defs.h"
|
||||
|
||||
/* mapblocks are used to check movement against lines and things */
|
||||
#define MAPBLOCKUNITS 128
|
||||
#define MAPBLOCKSIZE (MAPBLOCKUNITS*FRACUNIT)
|
||||
#define MAPBLOCKSHIFT (FRACBITS+7)
|
||||
#define MAPBMASK (MAPBLOCKSIZE-1)
|
||||
#define MAPBTOFRAC (MAPBLOCKSHIFT-FRACBITS)
|
||||
|
||||
#define PT_ADDLINES 1
|
||||
#define PT_ADDTHINGS 2
|
||||
#define PT_EARLYOUT 4
|
||||
|
||||
#define MAXINTERCEPTS 64
|
||||
|
||||
typedef struct
|
||||
{
|
||||
fixed_t x;
|
||||
fixed_t y;
|
||||
fixed_t dx;
|
||||
fixed_t dy;
|
||||
} divline_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
fixed_t frac; /* along trace line */
|
||||
//boolean isaline;
|
||||
union
|
||||
{
|
||||
mobj_t *thing;
|
||||
const line_t *line;
|
||||
} d;
|
||||
} intercept_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
fixed_t sightzstart, t2x, t2y; // eye z of looker
|
||||
divline_t strace; // from t1 to t2
|
||||
fixed_t topslope, bottomslope; // slopes to top and bottom of target
|
||||
fixed_t bbox[4];
|
||||
fixed_t maxz, minz; // cph - z optimisations for 2sided lines
|
||||
} los_t;
|
||||
|
||||
typedef boolean (*traverser_t)(intercept_t *in);
|
||||
|
||||
fixed_t CONSTFUNC P_AproxDistance(fixed_t dx, fixed_t dy);
|
||||
int P_PointOnLineSide(fixed_t x, fixed_t y, const line_t *line);
|
||||
int P_BoxOnLineSide(const fixed_t *tmbox, const line_t *ld);
|
||||
/* cph - old compatibility version below */
|
||||
fixed_t P_InterceptVector2(const divline_t *v2, const divline_t *v1);
|
||||
|
||||
void P_LineOpening(const line_t *linedef);
|
||||
void P_UnsetThingPosition(mobj_t *thing);
|
||||
void P_SetThingPosition(mobj_t *thing);
|
||||
boolean P_BlockLinesIterator(int x, int y, boolean func(const line_t*));
|
||||
boolean P_BlockThingsIterator(int x, int y, boolean func(mobj_t*));
|
||||
boolean P_PathTraverse(fixed_t x1, fixed_t y1, fixed_t x2, fixed_t y2, int flags, boolean trav(intercept_t*));
|
||||
|
||||
#endif /* __P_MAPUTL__ */
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Map utility functions
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __P_MAPUTL__
|
||||
#define __P_MAPUTL__
|
||||
|
||||
#include "r_defs.h"
|
||||
|
||||
/* mapblocks are used to check movement against lines and things */
|
||||
#define MAPBLOCKUNITS 128
|
||||
#define MAPBLOCKSIZE (MAPBLOCKUNITS*FRACUNIT)
|
||||
#define MAPBLOCKSHIFT (FRACBITS+7)
|
||||
#define MAPBMASK (MAPBLOCKSIZE-1)
|
||||
#define MAPBTOFRAC (MAPBLOCKSHIFT-FRACBITS)
|
||||
|
||||
#define PT_ADDLINES 1
|
||||
#define PT_ADDTHINGS 2
|
||||
#define PT_EARLYOUT 4
|
||||
|
||||
#define MAXINTERCEPTS 64
|
||||
|
||||
typedef struct
|
||||
{
|
||||
fixed_t x;
|
||||
fixed_t y;
|
||||
fixed_t dx;
|
||||
fixed_t dy;
|
||||
} divline_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
fixed_t frac; /* along trace line */
|
||||
//boolean isaline;
|
||||
union
|
||||
{
|
||||
mobj_t *thing;
|
||||
const line_t *line;
|
||||
} d;
|
||||
} intercept_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
fixed_t sightzstart, t2x, t2y; // eye z of looker
|
||||
divline_t strace; // from t1 to t2
|
||||
fixed_t topslope, bottomslope; // slopes to top and bottom of target
|
||||
fixed_t bbox[4];
|
||||
fixed_t maxz, minz; // cph - z optimisations for 2sided lines
|
||||
} los_t;
|
||||
|
||||
typedef boolean (*traverser_t)(intercept_t *in);
|
||||
|
||||
fixed_t CONSTFUNC P_AproxDistance(fixed_t dx, fixed_t dy);
|
||||
int P_PointOnLineSide(fixed_t x, fixed_t y, const line_t *line);
|
||||
int P_BoxOnLineSide(const fixed_t *tmbox, const line_t *ld);
|
||||
/* cph - old compatibility version below */
|
||||
fixed_t P_InterceptVector2(const divline_t *v2, const divline_t *v1);
|
||||
|
||||
void P_LineOpening(const line_t *linedef);
|
||||
void P_UnsetThingPosition(mobj_t *thing);
|
||||
void P_SetThingPosition(mobj_t *thing);
|
||||
boolean P_BlockLinesIterator(int x, int y, boolean func(const line_t*));
|
||||
boolean P_BlockThingsIterator(int x, int y, boolean func(mobj_t*));
|
||||
boolean P_PathTraverse(fixed_t x1, fixed_t y1, fixed_t x2, fixed_t y2, int flags, boolean trav(intercept_t*));
|
||||
|
||||
#endif /* __P_MAPUTL__ */
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,132 +1,132 @@
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Sprite animation.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __P_PSPR__
|
||||
#define __P_PSPR__
|
||||
|
||||
/* Basic data types.
|
||||
* Needs fixed point, and BAM angles. */
|
||||
|
||||
#include "m_fixed.h"
|
||||
|
||||
#include "tables.h"
|
||||
|
||||
/* Needs to include the precompiled sprite animation tables.
|
||||
*
|
||||
* Header generated by multigen utility.
|
||||
* This includes all the data for thing animation,
|
||||
* i.e. the Thing Atrributes table and the Frame Sequence table.
|
||||
*/
|
||||
|
||||
#include "info.h"
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Frame flags:
|
||||
* handles maximum brightness (torches, muzzle flare, light sources)
|
||||
*/
|
||||
|
||||
#define FF_FULLBRIGHT 0x8000 /* flag in thing->frame */
|
||||
#define FF_FRAMEMASK 0x7fff
|
||||
|
||||
/*
|
||||
* Overlay psprites are scaled shapes
|
||||
* drawn directly on the view screen,
|
||||
* coordinates are given for a 320*200 view screen.
|
||||
*/
|
||||
|
||||
typedef enum
|
||||
{
|
||||
ps_weapon, ps_flash, NUMPSPRITES
|
||||
} psprnum_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const state_t *state; /* a NULL state means not active */
|
||||
int tics;
|
||||
fixed_t sx;
|
||||
fixed_t sy;
|
||||
} pspdef_t;
|
||||
|
||||
extern const int weapon_preferences[NUMWEAPONS + 1]; /* killough 5/2/98 */
|
||||
int P_WeaponPreferred(int w1, int w2);
|
||||
|
||||
struct player_s;
|
||||
int P_SwitchWeapon(struct player_s *player);
|
||||
boolean P_CheckAmmo(struct player_s *player);
|
||||
void P_SetupPsprites(struct player_s *curplayer);
|
||||
void P_MovePsprites(struct player_s *curplayer);
|
||||
void P_DropWeapon(struct player_s *player);
|
||||
|
||||
int P_WeaponCycleUp(struct player_s *player);
|
||||
int P_WeaponCycleDown(struct player_s *player);
|
||||
|
||||
void A_Light0();
|
||||
void A_WeaponReady();
|
||||
void A_Lower();
|
||||
void A_Raise();
|
||||
void A_Punch();
|
||||
void A_ReFire();
|
||||
void A_FirePistol();
|
||||
void A_Light1();
|
||||
void A_FireShotgun();
|
||||
void A_Light2();
|
||||
void A_FireShotgun2();
|
||||
void A_CheckReload();
|
||||
void A_OpenShotgun2();
|
||||
void A_LoadShotgun2();
|
||||
void A_CloseShotgun2();
|
||||
void A_FireCGun();
|
||||
void A_GunFlash();
|
||||
void A_FireMissile();
|
||||
void A_Saw();
|
||||
void A_FirePlasma();
|
||||
void A_BFGsound();
|
||||
void A_FireBFG();
|
||||
void A_BFGSpray();
|
||||
|
||||
#endif
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Sprite animation.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __P_PSPR__
|
||||
#define __P_PSPR__
|
||||
|
||||
/* Basic data types.
|
||||
* Needs fixed point, and BAM angles. */
|
||||
|
||||
#include "m_fixed.h"
|
||||
|
||||
#include "tables.h"
|
||||
|
||||
/* Needs to include the precompiled sprite animation tables.
|
||||
*
|
||||
* Header generated by multigen utility.
|
||||
* This includes all the data for thing animation,
|
||||
* i.e. the Thing Atrributes table and the Frame Sequence table.
|
||||
*/
|
||||
|
||||
#include "info.h"
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Frame flags:
|
||||
* handles maximum brightness (torches, muzzle flare, light sources)
|
||||
*/
|
||||
|
||||
#define FF_FULLBRIGHT 0x8000 /* flag in thing->frame */
|
||||
#define FF_FRAMEMASK 0x7fff
|
||||
|
||||
/*
|
||||
* Overlay psprites are scaled shapes
|
||||
* drawn directly on the view screen,
|
||||
* coordinates are given for a 320*200 view screen.
|
||||
*/
|
||||
|
||||
typedef enum
|
||||
{
|
||||
ps_weapon, ps_flash, NUMPSPRITES
|
||||
} psprnum_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const state_t *state; /* a NULL state means not active */
|
||||
int tics;
|
||||
fixed_t sx;
|
||||
fixed_t sy;
|
||||
} pspdef_t;
|
||||
|
||||
extern const int weapon_preferences[NUMWEAPONS + 1]; /* killough 5/2/98 */
|
||||
int P_WeaponPreferred(int w1, int w2);
|
||||
|
||||
struct player_s;
|
||||
int P_SwitchWeapon(struct player_s *player);
|
||||
boolean P_CheckAmmo(struct player_s *player);
|
||||
void P_SetupPsprites(struct player_s *curplayer);
|
||||
void P_MovePsprites(struct player_s *curplayer);
|
||||
void P_DropWeapon(struct player_s *player);
|
||||
|
||||
int P_WeaponCycleUp(struct player_s *player);
|
||||
int P_WeaponCycleDown(struct player_s *player);
|
||||
|
||||
void A_Light0();
|
||||
void A_WeaponReady();
|
||||
void A_Lower();
|
||||
void A_Raise();
|
||||
void A_Punch();
|
||||
void A_ReFire();
|
||||
void A_FirePistol();
|
||||
void A_Light1();
|
||||
void A_FireShotgun();
|
||||
void A_Light2();
|
||||
void A_FireShotgun2();
|
||||
void A_CheckReload();
|
||||
void A_OpenShotgun2();
|
||||
void A_LoadShotgun2();
|
||||
void A_CloseShotgun2();
|
||||
void A_FireCGun();
|
||||
void A_GunFlash();
|
||||
void A_FireMissile();
|
||||
void A_Saw();
|
||||
void A_FirePlasma();
|
||||
void A_BFGsound();
|
||||
void A_FireBFG();
|
||||
void A_BFGSpray();
|
||||
|
||||
#endif
|
||||
@@ -1,57 +1,57 @@
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Setup a game, startup stuff.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __P_SETUP__
|
||||
#define __P_SETUP__
|
||||
|
||||
#include "p_mobj.h"
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
void P_SetupLevel(int episode, int map, int playermask, skill_t skill);
|
||||
void P_Init(void); /* Called by startup code. */
|
||||
|
||||
#endif
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Setup a game, startup stuff.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __P_SETUP__
|
||||
#define __P_SETUP__
|
||||
|
||||
#include "p_mobj.h"
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
void P_SetupLevel(int episode, int map, int playermask, skill_t skill);
|
||||
void P_Init(void); /* Called by startup code. */
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,84 +1,84 @@
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Core thinker processing prototypes.
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __P_TICK__
|
||||
#define __P_TICK__
|
||||
|
||||
#include "d_think.h"
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
/* Called by C_Ticker, can call G_PlayerExited.
|
||||
* Carries out all thinking of monsters and players. */
|
||||
|
||||
void P_Ticker(void);
|
||||
|
||||
void P_InitThinkers(void);
|
||||
void P_AddThinker(thinker_t *thinker);
|
||||
void P_RemoveThinker(thinker_t *thinker);
|
||||
void P_RemoveStaticThinker(thinker_t *thinker);
|
||||
void P_RemoveThinkerDelayed(thinker_t *thinker); // killough 4/25/98
|
||||
void P_RemoveStaticThinkerDelayed(thinker_t *thinker); // 2021-03-13 next-hack
|
||||
void P_UpdateThinker(thinker_t *thinker); // killough 8/29/98
|
||||
|
||||
void P_RunThinkers(void);
|
||||
|
||||
void P_SetTarget(mobj_t **mo, mobj_t *target); // killough 11/98
|
||||
|
||||
/* killough 8/29/98: threads of thinkers, for more efficient searches
|
||||
* cph 2002/01/13: for consistency with the main thinker list, keep objects
|
||||
* pending deletion on a class list too
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
th_all = 0, /* For P_NextThinker, indicates "any class" */
|
||||
} th_class;
|
||||
|
||||
#define thinkercap _g->thinkerclasscap[th_all]
|
||||
|
||||
/* cph 2002/01/13 - iterator for thinker lists */
|
||||
thinker_t* P_NextThinker(thinker_t*);
|
||||
|
||||
#endif
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Core thinker processing prototypes.
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __P_TICK__
|
||||
#define __P_TICK__
|
||||
|
||||
#include "d_think.h"
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
/* Called by C_Ticker, can call G_PlayerExited.
|
||||
* Carries out all thinking of monsters and players. */
|
||||
|
||||
void P_Ticker(void);
|
||||
|
||||
void P_InitThinkers(void);
|
||||
void P_AddThinker(thinker_t *thinker);
|
||||
void P_RemoveThinker(thinker_t *thinker);
|
||||
void P_RemoveStaticThinker(thinker_t *thinker);
|
||||
void P_RemoveThinkerDelayed(thinker_t *thinker); // killough 4/25/98
|
||||
void P_RemoveStaticThinkerDelayed(thinker_t *thinker); // 2021-03-13 next-hack
|
||||
void P_UpdateThinker(thinker_t *thinker); // killough 8/29/98
|
||||
|
||||
void P_RunThinkers(void);
|
||||
|
||||
void P_SetTarget(mobj_t **mo, mobj_t *target); // killough 11/98
|
||||
|
||||
/* killough 8/29/98: threads of thinkers, for more efficient searches
|
||||
* cph 2002/01/13: for consistency with the main thinker list, keep objects
|
||||
* pending deletion on a class list too
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
th_all = 0, /* For P_NextThinker, indicates "any class" */
|
||||
} th_class;
|
||||
|
||||
#define thinkercap _g->thinkerclasscap[th_all]
|
||||
|
||||
/* cph 2002/01/13 - iterator for thinker lists */
|
||||
thinker_t* P_NextThinker(thinker_t*);
|
||||
|
||||
#endif
|
||||
@@ -1,56 +1,56 @@
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Player related stuff.
|
||||
* Bobbing POV/weapon, movement.
|
||||
* Pending weapon.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __P_USER__
|
||||
#define __P_USER__
|
||||
|
||||
#include "d_player.h"
|
||||
|
||||
void P_PlayerThink(player_t *player);
|
||||
void P_CalcHeight(player_t *player);
|
||||
void P_Thrust(player_t *player, angle_t angle, fixed_t move);
|
||||
|
||||
#endif /* __P_USER__ */
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Player related stuff.
|
||||
* Bobbing POV/weapon, movement.
|
||||
* Pending weapon.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __P_USER__
|
||||
#define __P_USER__
|
||||
|
||||
#include "d_player.h"
|
||||
|
||||
void P_PlayerThink(player_t *player);
|
||||
void P_CalcHeight(player_t *player);
|
||||
void P_Thrust(player_t *player, angle_t angle, fixed_t move);
|
||||
|
||||
#endif /* __P_USER__ */
|
||||
@@ -1,116 +1,116 @@
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Doom Network protocol packet definitions.
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#include "doomtype.h"
|
||||
#include "d_ticcmd.h"
|
||||
#include "m_swap.h"
|
||||
|
||||
enum packet_type_e
|
||||
{
|
||||
PKT_INIT, // initial packet to server
|
||||
PKT_SETUP, // game information packet
|
||||
PKT_GO, // game has started
|
||||
PKT_TICC, // tics from client
|
||||
PKT_TICS, // tics from server
|
||||
PKT_RETRANS, // Request for retransmission
|
||||
PKT_EXTRA, // Extra info packet
|
||||
PKT_QUIT, // Player quit game
|
||||
PKT_DOWN, // Server downed
|
||||
PKT_WAD, // Wad file request
|
||||
PKT_BACKOFF, // Request for client back-off
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
byte checksum; // Simple checksum of the entire packet
|
||||
byte type; /* Type of packet */
|
||||
byte reserved[2]; /* Was random in prboom <=2.2.4, now 0 */
|
||||
unsigned tic; // Timestamp
|
||||
}PACKEDATTR packet_header_t;
|
||||
|
||||
static inline void packet_set(packet_header_t *p, enum packet_type_e t, unsigned long tic)
|
||||
{
|
||||
p->tic = doom_htonl(tic);
|
||||
p->type = t;
|
||||
p->reserved[0] = 0;
|
||||
p->reserved[1] = 0;
|
||||
}
|
||||
|
||||
#ifndef GAME_OPTIONS_SIZE
|
||||
// From g_game.h
|
||||
#define GAME_OPTIONS_SIZE 64
|
||||
#endif
|
||||
|
||||
struct setup_packet_s
|
||||
{
|
||||
byte players, yourplayer, skill, episode, level, deathmatch, complevel,
|
||||
ticdup, extratic;
|
||||
byte game_options[GAME_OPTIONS_SIZE];
|
||||
byte numwads;
|
||||
byte wadnames[1]; // Actually longer
|
||||
};
|
||||
|
||||
/* cph - convert network byte stream to usable ticcmd_t and visa-versa
|
||||
* - the functions are functionally identical apart from parameters
|
||||
* - the void* param can be unaligned. By using void* as the parameter
|
||||
* it means gcc won't assume alignment so won't make false assumptions
|
||||
* when optimising. So I'm told.
|
||||
*/
|
||||
inline static void RawToTic(ticcmd_t *dst, const void *src)
|
||||
{
|
||||
memcpy(dst, src, sizeof *dst);
|
||||
dst->angleturn = doom_ntohs(dst->angleturn);
|
||||
dst->consistancy = doom_ntohs(dst->consistancy);
|
||||
}
|
||||
|
||||
inline static void TicToRaw(void *dst, const ticcmd_t *src)
|
||||
{
|
||||
/* We have to make a copy of the source struct, then do byte swaps,
|
||||
* and fnially copy to the destination (can't do the swaps in the
|
||||
* destination, because it might not be aligned).
|
||||
*/
|
||||
ticcmd_t tmp = *src;
|
||||
tmp.angleturn = doom_ntohs(tmp.angleturn);
|
||||
tmp.consistancy = doom_ntohs(tmp.consistancy);
|
||||
memcpy(dst, &tmp, sizeof tmp);
|
||||
}
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Doom Network protocol packet definitions.
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#include "doomtype.h"
|
||||
#include "d_ticcmd.h"
|
||||
#include "m_swap.h"
|
||||
|
||||
enum packet_type_e
|
||||
{
|
||||
PKT_INIT, // initial packet to server
|
||||
PKT_SETUP, // game information packet
|
||||
PKT_GO, // game has started
|
||||
PKT_TICC, // tics from client
|
||||
PKT_TICS, // tics from server
|
||||
PKT_RETRANS, // Request for retransmission
|
||||
PKT_EXTRA, // Extra info packet
|
||||
PKT_QUIT, // Player quit game
|
||||
PKT_DOWN, // Server downed
|
||||
PKT_WAD, // Wad file request
|
||||
PKT_BACKOFF, // Request for client back-off
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
byte checksum; // Simple checksum of the entire packet
|
||||
byte type; /* Type of packet */
|
||||
byte reserved[2]; /* Was random in prboom <=2.2.4, now 0 */
|
||||
unsigned tic; // Timestamp
|
||||
}PACKEDATTR packet_header_t;
|
||||
|
||||
static inline void packet_set(packet_header_t *p, enum packet_type_e t, unsigned long tic)
|
||||
{
|
||||
p->tic = doom_htonl(tic);
|
||||
p->type = t;
|
||||
p->reserved[0] = 0;
|
||||
p->reserved[1] = 0;
|
||||
}
|
||||
|
||||
#ifndef GAME_OPTIONS_SIZE
|
||||
// From g_game.h
|
||||
#define GAME_OPTIONS_SIZE 64
|
||||
#endif
|
||||
|
||||
struct setup_packet_s
|
||||
{
|
||||
byte players, yourplayer, skill, episode, level, deathmatch, complevel,
|
||||
ticdup, extratic;
|
||||
byte game_options[GAME_OPTIONS_SIZE];
|
||||
byte numwads;
|
||||
byte wadnames[1]; // Actually longer
|
||||
};
|
||||
|
||||
/* cph - convert network byte stream to usable ticcmd_t and visa-versa
|
||||
* - the functions are functionally identical apart from parameters
|
||||
* - the void* param can be unaligned. By using void* as the parameter
|
||||
* it means gcc won't assume alignment so won't make false assumptions
|
||||
* when optimising. So I'm told.
|
||||
*/
|
||||
inline static void RawToTic(ticcmd_t *dst, const void *src)
|
||||
{
|
||||
memcpy(dst, src, sizeof *dst);
|
||||
dst->angleturn = doom_ntohs(dst->angleturn);
|
||||
dst->consistancy = doom_ntohs(dst->consistancy);
|
||||
}
|
||||
|
||||
inline static void TicToRaw(void *dst, const ticcmd_t *src)
|
||||
{
|
||||
/* We have to make a copy of the source struct, then do byte swaps,
|
||||
* and fnially copy to the destination (can't do the swaps in the
|
||||
* destination, because it might not be aligned).
|
||||
*/
|
||||
ticcmd_t tmp = *src;
|
||||
tmp.angleturn = doom_ntohs(tmp.angleturn);
|
||||
tmp.consistancy = doom_ntohs(tmp.consistancy);
|
||||
memcpy(dst, &tmp, sizeof tmp);
|
||||
}
|
||||
@@ -1,104 +1,104 @@
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Refresh module, data I/O, caching, retrieval of graphics
|
||||
* by name.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __R_DATA__
|
||||
#define __R_DATA__
|
||||
|
||||
#include "r_defs.h"
|
||||
#include "r_state.h"
|
||||
#include "r_patch.h"
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
// A single patch from a texture definition, basically
|
||||
// a rectangular area within the texture rectangle.
|
||||
typedef struct
|
||||
{
|
||||
short originx, originy; // Block origin, which has already accounted
|
||||
const patch_t *patch; // for the internal origin of the patch.
|
||||
} texpatch_t;
|
||||
|
||||
//
|
||||
// Texture definition.
|
||||
// A DOOM wall texture is a list of patches
|
||||
// which are to be combined in a predefined order.
|
||||
//
|
||||
typedef struct
|
||||
{
|
||||
// 2021/03/06: next-hack removed name, useless
|
||||
//const char* name; // Keep name for switch changing, etc.
|
||||
//int next, index; // killough 1/31/98: used in hashing algorithm
|
||||
// CPhipps - moved arrays with per-texture entries to elements here
|
||||
unsigned short widthmask;
|
||||
// CPhipps - end of additions
|
||||
short width, height;
|
||||
|
||||
unsigned char overlapped;
|
||||
unsigned char patchcount; // All the patches[patchcount] are drawn
|
||||
texpatch_t patches[1]; // back-to-front into the cached texture.
|
||||
} texture_t;
|
||||
|
||||
// I/O, setting up the stuff.
|
||||
void R_InitData(void);
|
||||
|
||||
// Retrieval.
|
||||
// Floor/ceiling opaque texture tiles,
|
||||
// lookup by name. For animation?
|
||||
int R_FlatNumForName(const char *name); // killough -- const added
|
||||
|
||||
// R_*TextureNumForName returns the texture number for the texture name, or NO_TEXTURE if
|
||||
// there is no texture (i.e. "-") specified.
|
||||
/* cph 2006/07/23 - defined value for no-texture marker (texture "-" in the WAD file) */
|
||||
#define NO_TEXTURE 0
|
||||
int R_CheckTextureNumForName(const char *name);
|
||||
|
||||
const texture_t* R_GetTexture(int texture, boolean cacheToFlash, uint32_t *spaceRequired);
|
||||
int R_LoadTextureByName(const char *tex_name, boolean cacheToFlash);
|
||||
uint32_t getTextureStructSize(int texture_num);
|
||||
void R_FillTextureHeightData();
|
||||
|
||||
#endif
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Refresh module, data I/O, caching, retrieval of graphics
|
||||
* by name.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __R_DATA__
|
||||
#define __R_DATA__
|
||||
|
||||
#include "r_defs.h"
|
||||
#include "r_state.h"
|
||||
#include "r_patch.h"
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
// A single patch from a texture definition, basically
|
||||
// a rectangular area within the texture rectangle.
|
||||
typedef struct
|
||||
{
|
||||
short originx, originy; // Block origin, which has already accounted
|
||||
const patch_t *patch; // for the internal origin of the patch.
|
||||
} texpatch_t;
|
||||
|
||||
//
|
||||
// Texture definition.
|
||||
// A DOOM wall texture is a list of patches
|
||||
// which are to be combined in a predefined order.
|
||||
//
|
||||
typedef struct
|
||||
{
|
||||
// 2021/03/06: next-hack removed name, useless
|
||||
//const char* name; // Keep name for switch changing, etc.
|
||||
//int next, index; // killough 1/31/98: used in hashing algorithm
|
||||
// CPhipps - moved arrays with per-texture entries to elements here
|
||||
unsigned short widthmask;
|
||||
// CPhipps - end of additions
|
||||
short width, height;
|
||||
|
||||
unsigned char overlapped;
|
||||
unsigned char patchcount; // All the patches[patchcount] are drawn
|
||||
texpatch_t patches[1]; // back-to-front into the cached texture.
|
||||
} texture_t;
|
||||
|
||||
// I/O, setting up the stuff.
|
||||
void R_InitData(void);
|
||||
|
||||
// Retrieval.
|
||||
// Floor/ceiling opaque texture tiles,
|
||||
// lookup by name. For animation?
|
||||
int R_FlatNumForName(const char *name); // killough -- const added
|
||||
|
||||
// R_*TextureNumForName returns the texture number for the texture name, or NO_TEXTURE if
|
||||
// there is no texture (i.e. "-") specified.
|
||||
/* cph 2006/07/23 - defined value for no-texture marker (texture "-" in the WAD file) */
|
||||
#define NO_TEXTURE 0
|
||||
int R_CheckTextureNumForName(const char *name);
|
||||
|
||||
const texture_t* R_GetTexture(int texture, boolean cacheToFlash, uint32_t *spaceRequired);
|
||||
int R_LoadTextureByName(const char *tex_name, boolean cacheToFlash);
|
||||
uint32_t getTextureStructSize(int texture_num);
|
||||
void R_FillTextureHeightData();
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,96 +1,96 @@
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* System specific interface stuff.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __R_DRAW__
|
||||
#define __R_DRAW__
|
||||
|
||||
#include "r_defs.h"
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
// Packaged into a struct - POPE
|
||||
typedef struct
|
||||
{
|
||||
int x;
|
||||
int yl;
|
||||
int yh;
|
||||
fixed_t iscale;
|
||||
fixed_t texturemid;
|
||||
|
||||
const byte *source; // first pixel in a column
|
||||
|
||||
const lighttable_t *colormap;
|
||||
const byte *translation;
|
||||
|
||||
} draw_column_vars_t;
|
||||
|
||||
void R_SetDefaultDrawColumnVars(draw_column_vars_t *dcvars);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned int position;
|
||||
unsigned int step;
|
||||
const byte *source; // start of a 64*64 tile image
|
||||
const lighttable_t *colormap;
|
||||
} draw_span_vars_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t *byte_topleft;
|
||||
} draw_vars_t;
|
||||
|
||||
extern draw_vars_t drawvars;
|
||||
|
||||
typedef void (*R_DrawColumn_f)(const draw_column_vars_t *dcvars);
|
||||
|
||||
// Draw with color translation tables,
|
||||
// for player sprite rendering,
|
||||
// Green/Red/Blue/Indigo shirts.
|
||||
void R_DrawTranslatedColumn(const draw_column_vars_t *dcvars);
|
||||
|
||||
void R_InitBuffer();
|
||||
|
||||
#endif
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* System specific interface stuff.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __R_DRAW__
|
||||
#define __R_DRAW__
|
||||
|
||||
#include "r_defs.h"
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
// Packaged into a struct - POPE
|
||||
typedef struct
|
||||
{
|
||||
int x;
|
||||
int yl;
|
||||
int yh;
|
||||
fixed_t iscale;
|
||||
fixed_t texturemid;
|
||||
|
||||
const byte *source; // first pixel in a column
|
||||
|
||||
const lighttable_t *colormap;
|
||||
const byte *translation;
|
||||
|
||||
} draw_column_vars_t;
|
||||
|
||||
void R_SetDefaultDrawColumnVars(draw_column_vars_t *dcvars);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned int position;
|
||||
unsigned int step;
|
||||
const byte *source; // start of a 64*64 tile image
|
||||
const lighttable_t *colormap;
|
||||
} draw_span_vars_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t *byte_topleft;
|
||||
} draw_vars_t;
|
||||
|
||||
extern draw_vars_t drawvars;
|
||||
|
||||
typedef void (*R_DrawColumn_f)(const draw_column_vars_t *dcvars);
|
||||
|
||||
// Draw with color translation tables,
|
||||
// for player sprite rendering,
|
||||
// Green/Red/Blue/Indigo shirts.
|
||||
void R_DrawTranslatedColumn(const draw_column_vars_t *dcvars);
|
||||
|
||||
void R_InitBuffer();
|
||||
|
||||
#endif
|
||||
@@ -1,110 +1,110 @@
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Renderer main interface.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __R_MAIN__
|
||||
#define __R_MAIN__
|
||||
|
||||
#include "d_player.h"
|
||||
#include "r_data.h"
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
//
|
||||
// Lighting LUT.
|
||||
// Used for z-depth cuing per column/row,
|
||||
// and other lighting effects (sector ambient, flash).
|
||||
//
|
||||
|
||||
extern const int viewheight;
|
||||
|
||||
extern const int centery;
|
||||
|
||||
extern const fixed_t projection;
|
||||
extern const fixed_t iprojection;
|
||||
|
||||
//Global vars.
|
||||
|
||||
extern short numnodes;
|
||||
extern const mapnode_t *nodes;
|
||||
|
||||
extern fixed_t viewx, viewy, viewz;
|
||||
|
||||
extern angle_t viewangle;
|
||||
|
||||
//extern short *floorclip, *ceilingclip;
|
||||
|
||||
extern const lighttable_t *fullcolormap;
|
||||
//extern const lighttable_t *colormaps;
|
||||
extern const lighttable_t *fixedcolormap;
|
||||
|
||||
extern byte extralight; // bumped light from gun blasts
|
||||
|
||||
extern const texture_t **textures; // proff - 04/05/2000 removed static for OpenGL
|
||||
extern fixed_t *textureheight; //needed for texture pegging (and TFE fix - killough)
|
||||
|
||||
extern short *flattranslation; // for global animation
|
||||
extern short *texturetranslation;
|
||||
|
||||
extern fixed_t basexscale, baseyscale;
|
||||
|
||||
extern fixed_t viewcos, viewsin;
|
||||
|
||||
//
|
||||
// Utility functions.
|
||||
//
|
||||
|
||||
angle_t R_PointToAngle2(fixed_t x1, fixed_t y1, fixed_t x2, fixed_t y2);
|
||||
subsector_t* R_PointInSubsector(fixed_t x, fixed_t y);
|
||||
|
||||
//
|
||||
// REFRESH - the actual rendering functions.
|
||||
//
|
||||
|
||||
void R_RenderPlayerView(player_t *player); // Called by G_Drawer.
|
||||
void R_Init(void); // Called by startup code.
|
||||
void R_SetupFrame(player_t *player);
|
||||
|
||||
#endif
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Renderer main interface.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __R_MAIN__
|
||||
#define __R_MAIN__
|
||||
|
||||
#include "d_player.h"
|
||||
#include "r_data.h"
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
//
|
||||
// Lighting LUT.
|
||||
// Used for z-depth cuing per column/row,
|
||||
// and other lighting effects (sector ambient, flash).
|
||||
//
|
||||
|
||||
extern const int viewheight;
|
||||
|
||||
extern const int centery;
|
||||
|
||||
extern const fixed_t projection;
|
||||
extern const fixed_t iprojection;
|
||||
|
||||
//Global vars.
|
||||
|
||||
extern short numnodes;
|
||||
extern const mapnode_t *nodes;
|
||||
|
||||
extern fixed_t viewx, viewy, viewz;
|
||||
|
||||
extern angle_t viewangle;
|
||||
|
||||
//extern short *floorclip, *ceilingclip;
|
||||
|
||||
extern const lighttable_t *fullcolormap;
|
||||
//extern const lighttable_t *colormaps;
|
||||
extern const lighttable_t *fixedcolormap;
|
||||
|
||||
extern byte extralight; // bumped light from gun blasts
|
||||
|
||||
extern const texture_t **textures; // proff - 04/05/2000 removed static for OpenGL
|
||||
extern fixed_t *textureheight; //needed for texture pegging (and TFE fix - killough)
|
||||
|
||||
extern short *flattranslation; // for global animation
|
||||
extern short *texturetranslation;
|
||||
|
||||
extern fixed_t basexscale, baseyscale;
|
||||
|
||||
extern fixed_t viewcos, viewsin;
|
||||
|
||||
//
|
||||
// Utility functions.
|
||||
//
|
||||
|
||||
angle_t R_PointToAngle2(fixed_t x1, fixed_t y1, fixed_t x2, fixed_t y2);
|
||||
subsector_t* R_PointInSubsector(fixed_t x, fixed_t y);
|
||||
|
||||
//
|
||||
// REFRESH - the actual rendering functions.
|
||||
//
|
||||
|
||||
void R_RenderPlayerView(player_t *player); // Called by G_Drawer.
|
||||
void R_Init(void); // Called by startup code.
|
||||
void R_SetupFrame(player_t *player);
|
||||
|
||||
#endif
|
||||
@@ -1,51 +1,51 @@
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef R_PATCH_H
|
||||
#define R_PATCH_H
|
||||
|
||||
// Size query funcs
|
||||
int R_NumPatchWidth(int lump);
|
||||
int R_NumPatchHeight(int lump);
|
||||
//#define R_NamePatchWidth(name) R_NumPatchWidth(W_GetNumForName(name))
|
||||
//#define R_NamePatchHeight(name) R_NumPatchHeight(W_GetNumForName(name))
|
||||
|
||||
#endif
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef R_PATCH_H
|
||||
#define R_PATCH_H
|
||||
|
||||
// Size query funcs
|
||||
int R_NumPatchWidth(int lump);
|
||||
int R_NumPatchHeight(int lump);
|
||||
//#define R_NamePatchWidth(name) R_NumPatchWidth(W_GetNumForName(name))
|
||||
//#define R_NamePatchHeight(name) R_NumPatchHeight(W_GetNumForName(name))
|
||||
|
||||
#endif
|
||||
@@ -1,65 +1,65 @@
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Refresh, visplane stuff (floor, ceilings).
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __R_PLANE__
|
||||
#define __R_PLANE__
|
||||
|
||||
#include "r_data.h"
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
void R_InitPlanes(void);
|
||||
void R_ResetPlanes();
|
||||
|
||||
#define MAXVISPLANES 32 /* must be a power of 2 */
|
||||
|
||||
// killough -- hash function for visplanes
|
||||
// Empirically verified to be fairly uniform:
|
||||
|
||||
#define visplane_hash(picnum,lightlevel,height) \
|
||||
((unsigned)((picnum)*3+(lightlevel)+(height)*7) & (MAXVISPLANES-1))
|
||||
|
||||
#endif
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Refresh, visplane stuff (floor, ceilings).
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __R_PLANE__
|
||||
#define __R_PLANE__
|
||||
|
||||
#include "r_data.h"
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
void R_InitPlanes(void);
|
||||
void R_ResetPlanes();
|
||||
|
||||
#define MAXVISPLANES 32 /* must be a power of 2 */
|
||||
|
||||
// killough -- hash function for visplanes
|
||||
// Empirically verified to be fairly uniform:
|
||||
|
||||
#define visplane_hash(picnum,lightlevel,height) \
|
||||
((unsigned)((picnum)*3+(lightlevel)+(height)*7) & (MAXVISPLANES-1))
|
||||
|
||||
#endif
|
||||
@@ -1,52 +1,52 @@
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Refresh module, drawing LineSegs from BSP.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __R_SEGS__
|
||||
#define __R_SEGS__
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Refresh module, drawing LineSegs from BSP.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __R_SEGS__
|
||||
#define __R_SEGS__
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,60 +1,60 @@
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Sky rendering.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __R_SKY__
|
||||
#define __R_SKY__
|
||||
|
||||
#include "m_fixed.h"
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
/* SKY, store the number for name. */
|
||||
#define SKYFLATNAME "F_SKY1"
|
||||
|
||||
/* The sky map is 256*128*4 maps. */
|
||||
#define ANGLETOSKYSHIFT 22
|
||||
|
||||
#endif
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Sky rendering.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __R_SKY__
|
||||
#define __R_SKY__
|
||||
|
||||
#include "m_fixed.h"
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
/* SKY, store the number for name. */
|
||||
#define SKYFLATNAME "F_SKY1"
|
||||
|
||||
/* The sky map is 256*128*4 maps. */
|
||||
#define ANGLETOSKYSHIFT 22
|
||||
|
||||
#endif
|
||||
@@ -1,56 +1,56 @@
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Refresh/render internal state variables (global).
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __R_STATE__
|
||||
#define __R_STATE__
|
||||
|
||||
// Need data structure definitions.
|
||||
#include "d_player.h"
|
||||
#include "r_data.h"
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Refresh/render internal state variables (global).
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __R_STATE__
|
||||
#define __R_STATE__
|
||||
|
||||
// Need data structure definitions.
|
||||
#include "d_player.h"
|
||||
#include "r_data.h"
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,64 +1,64 @@
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Rendering of moving objects, sprites.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __R_THINGS__
|
||||
#define __R_THINGS__
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
#include "r_draw.h"
|
||||
|
||||
/* Constant arrays used for psprite clipping and initializing clipping. */
|
||||
|
||||
void R_InitSprites(const char *const*namelist);
|
||||
|
||||
#define MAX_SPRITE_FRAMES 29 /* Macroized -- killough 1/25/98 */
|
||||
|
||||
#define MINZ (FRACUNIT*4)
|
||||
#define MAXZ (FRACUNIT*1280)
|
||||
|
||||
|
||||
#endif
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Rendering of moving objects, sprites.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __R_THINGS__
|
||||
#define __R_THINGS__
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
#include "r_draw.h"
|
||||
|
||||
/* Constant arrays used for psprite clipping and initializing clipping. */
|
||||
|
||||
void R_InitSprites(const char *const*namelist);
|
||||
|
||||
#define MAX_SPRITE_FRAMES 29 /* Macroized -- killough 1/25/98 */
|
||||
|
||||
#define MINZ (FRACUNIT*4)
|
||||
#define MAXZ (FRACUNIT*1280)
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1,116 +1,116 @@
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* The not so system specific sound interface.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __S_SOUND__
|
||||
#define __S_SOUND__
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
#include "p_mobj.h"
|
||||
#include "r_defs.h"
|
||||
#include "sounds.h"
|
||||
|
||||
//
|
||||
// Initializes sound stuff, including volume
|
||||
// Sets channels, SFX and music volume,
|
||||
// allocates channel buffer, sets S_sfx lookup.
|
||||
//
|
||||
void S_Init(int sfxVolume, int musicVolume);
|
||||
|
||||
// Kills all sounds
|
||||
void S_Stop(void);
|
||||
|
||||
//
|
||||
// Per level startup code.
|
||||
// Kills playing sounds at start of level,
|
||||
// determines music if any, changes music.
|
||||
//
|
||||
void S_Start(void);
|
||||
|
||||
//
|
||||
// Start sound for thing at <origin>
|
||||
// using <sound_id> from sounds.h
|
||||
//
|
||||
void S_StartSound(mobj_t *origin, int sfx_id);
|
||||
|
||||
void S_StartSound2(degenmobj_t *origin, int sfx_id);
|
||||
|
||||
// killough 4/25/98: mask used to indicate sound origin is player item pickup
|
||||
#define PICKUP_SOUND (0x8000)
|
||||
|
||||
// Stop sound for thing at <origin>
|
||||
void S_StopSound(void *origin);
|
||||
|
||||
// Start music using <music_id> from sounds.h
|
||||
void S_StartMusic(int music_id);
|
||||
|
||||
// Start music using <music_id> from sounds.h, and set whether looping
|
||||
void S_ChangeMusic(int music_id, int looping);
|
||||
|
||||
// Stops the music fer sure.
|
||||
void S_StopMusic(void);
|
||||
|
||||
// Stop and resume music, during game PAUSE.
|
||||
void S_PauseSound(void);
|
||||
void S_ResumeSound(void);
|
||||
|
||||
//
|
||||
// Updates music & sounds
|
||||
//
|
||||
void S_UpdateSounds(void *listener);
|
||||
void S_SetMusicVolume(int volume);
|
||||
void S_SetSfxVolume(int volume);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const sfxinfo_t *sfxinfo; // sound information (if null, channel avail.)
|
||||
int tickend;
|
||||
void *origin; // origin of sound
|
||||
short handle; // handle of the sound being played
|
||||
short is_pickup; // killough 4/25/98: whether sound is a player's weapon
|
||||
} channel_t;
|
||||
|
||||
#endif
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* The not so system specific sound interface.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __S_SOUND__
|
||||
#define __S_SOUND__
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
#include "p_mobj.h"
|
||||
#include "r_defs.h"
|
||||
#include "sounds.h"
|
||||
|
||||
//
|
||||
// Initializes sound stuff, including volume
|
||||
// Sets channels, SFX and music volume,
|
||||
// allocates channel buffer, sets S_sfx lookup.
|
||||
//
|
||||
void S_Init(int sfxVolume, int musicVolume);
|
||||
|
||||
// Kills all sounds
|
||||
void S_Stop(void);
|
||||
|
||||
//
|
||||
// Per level startup code.
|
||||
// Kills playing sounds at start of level,
|
||||
// determines music if any, changes music.
|
||||
//
|
||||
void S_Start(void);
|
||||
|
||||
//
|
||||
// Start sound for thing at <origin>
|
||||
// using <sound_id> from sounds.h
|
||||
//
|
||||
void S_StartSound(mobj_t *origin, int sfx_id);
|
||||
|
||||
void S_StartSound2(degenmobj_t *origin, int sfx_id);
|
||||
|
||||
// killough 4/25/98: mask used to indicate sound origin is player item pickup
|
||||
#define PICKUP_SOUND (0x8000)
|
||||
|
||||
// Stop sound for thing at <origin>
|
||||
void S_StopSound(void *origin);
|
||||
|
||||
// Start music using <music_id> from sounds.h
|
||||
void S_StartMusic(int music_id);
|
||||
|
||||
// Start music using <music_id> from sounds.h, and set whether looping
|
||||
void S_ChangeMusic(int music_id, int looping);
|
||||
|
||||
// Stops the music fer sure.
|
||||
void S_StopMusic(void);
|
||||
|
||||
// Stop and resume music, during game PAUSE.
|
||||
void S_PauseSound(void);
|
||||
void S_ResumeSound(void);
|
||||
|
||||
//
|
||||
// Updates music & sounds
|
||||
//
|
||||
void S_UpdateSounds(void *listener);
|
||||
void S_SetMusicVolume(int volume);
|
||||
void S_SetSfxVolume(int volume);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const sfxinfo_t *sfxinfo; // sound information (if null, channel avail.)
|
||||
int tickend;
|
||||
void *origin; // origin of sound
|
||||
short handle; // handle of the sound being played
|
||||
short is_pickup; // killough 4/25/98: whether sound is a player's weapon
|
||||
} channel_t;
|
||||
|
||||
#endif
|
||||
@@ -1,280 +1,280 @@
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Created by the sound utility written by Dave Taylor.
|
||||
* Kept as a sample, DOOM2 sounds. Frozen.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __SOUNDS__
|
||||
#define __SOUNDS__
|
||||
|
||||
//
|
||||
// SoundFX struct.
|
||||
//
|
||||
|
||||
struct sfxinfo_struct;
|
||||
|
||||
typedef struct sfxinfo_struct sfxinfo_t;
|
||||
|
||||
struct sfxinfo_struct
|
||||
{
|
||||
|
||||
// up to 6-character name
|
||||
const char *name; // CPhipps - const
|
||||
|
||||
int singularity;
|
||||
|
||||
// Sfx priority
|
||||
int priority;
|
||||
|
||||
// referenced sound if a link
|
||||
const sfxinfo_t *link;
|
||||
|
||||
// volume if a link
|
||||
int volume;
|
||||
|
||||
//Length of clip
|
||||
int ticks;
|
||||
};
|
||||
|
||||
//
|
||||
// MusicInfo struct.
|
||||
//
|
||||
|
||||
// the complete set of sound effects
|
||||
extern const sfxinfo_t S_sfx[];
|
||||
|
||||
//
|
||||
// Identifiers for all music in game.
|
||||
//
|
||||
|
||||
typedef enum
|
||||
{
|
||||
mus_None,
|
||||
mus_e1m1,
|
||||
mus_e1m2,
|
||||
mus_e1m3,
|
||||
mus_e1m4,
|
||||
mus_e1m5,
|
||||
mus_e1m6,
|
||||
mus_e1m7,
|
||||
mus_e1m8,
|
||||
mus_e1m9,
|
||||
mus_e2m1,
|
||||
mus_e2m2,
|
||||
mus_e2m3,
|
||||
mus_e2m4,
|
||||
mus_e2m5,
|
||||
mus_e2m6,
|
||||
mus_e2m7,
|
||||
mus_e2m8,
|
||||
mus_e2m9,
|
||||
mus_e3m1,
|
||||
mus_e3m2,
|
||||
mus_e3m3,
|
||||
mus_e3m4,
|
||||
mus_e3m5,
|
||||
mus_e3m6,
|
||||
mus_e3m7,
|
||||
mus_e3m8,
|
||||
mus_e3m9,
|
||||
mus_inter,
|
||||
mus_intro,
|
||||
mus_bunny,
|
||||
mus_victor,
|
||||
mus_introa,
|
||||
mus_runnin,
|
||||
mus_stalks,
|
||||
mus_countd,
|
||||
mus_betwee,
|
||||
mus_doom,
|
||||
mus_the_da,
|
||||
mus_shawn,
|
||||
mus_ddtblu,
|
||||
mus_in_cit,
|
||||
mus_dead,
|
||||
mus_stlks2,
|
||||
mus_theda2,
|
||||
mus_doom2,
|
||||
mus_ddtbl2,
|
||||
mus_runni2,
|
||||
mus_dead2,
|
||||
mus_stlks3,
|
||||
mus_romero,
|
||||
mus_shawn2,
|
||||
mus_messag,
|
||||
mus_count2,
|
||||
mus_ddtbl3,
|
||||
mus_ampie,
|
||||
mus_theda3,
|
||||
mus_adrian,
|
||||
mus_messg2,
|
||||
mus_romer2,
|
||||
mus_tense,
|
||||
mus_shawn3,
|
||||
mus_openin,
|
||||
mus_evil,
|
||||
mus_ultima,
|
||||
mus_read_m,
|
||||
mus_dm2ttl,
|
||||
mus_dm2int,
|
||||
NUMMUSIC
|
||||
} musicenum_t;
|
||||
|
||||
//
|
||||
// Identifiers for all sfx in game.
|
||||
//
|
||||
|
||||
typedef enum
|
||||
{
|
||||
sfx_None,
|
||||
sfx_pistol,
|
||||
sfx_shotgn,
|
||||
sfx_sgcock,
|
||||
sfx_dshtgn,
|
||||
sfx_dbopn,
|
||||
sfx_dbcls,
|
||||
sfx_dbload,
|
||||
sfx_plasma,
|
||||
sfx_bfg,
|
||||
sfx_sawup,
|
||||
sfx_sawidl,
|
||||
sfx_sawful,
|
||||
sfx_sawhit,
|
||||
sfx_rlaunc,
|
||||
sfx_rxplod,
|
||||
sfx_firsht,
|
||||
sfx_firxpl,
|
||||
sfx_pstart,
|
||||
sfx_pstop,
|
||||
sfx_doropn,
|
||||
sfx_dorcls,
|
||||
sfx_stnmov,
|
||||
sfx_swtchn,
|
||||
sfx_swtchx,
|
||||
sfx_plpain,
|
||||
sfx_dmpain,
|
||||
sfx_popain,
|
||||
sfx_vipain,
|
||||
sfx_mnpain,
|
||||
sfx_pepain,
|
||||
sfx_slop,
|
||||
sfx_itemup,
|
||||
sfx_wpnup,
|
||||
sfx_oof,
|
||||
sfx_telept,
|
||||
sfx_posit1,
|
||||
sfx_posit2,
|
||||
sfx_posit3,
|
||||
sfx_bgsit1,
|
||||
sfx_bgsit2,
|
||||
sfx_sgtsit,
|
||||
sfx_cacsit,
|
||||
sfx_brssit,
|
||||
sfx_cybsit,
|
||||
sfx_spisit,
|
||||
sfx_bspsit,
|
||||
sfx_kntsit,
|
||||
sfx_vilsit,
|
||||
sfx_mansit,
|
||||
sfx_pesit,
|
||||
sfx_sklatk,
|
||||
sfx_sgtatk,
|
||||
sfx_skepch,
|
||||
sfx_vilatk,
|
||||
sfx_claw,
|
||||
sfx_skeswg,
|
||||
sfx_pldeth,
|
||||
sfx_pdiehi,
|
||||
sfx_podth1,
|
||||
sfx_podth2,
|
||||
sfx_podth3,
|
||||
sfx_bgdth1,
|
||||
sfx_bgdth2,
|
||||
sfx_sgtdth,
|
||||
sfx_cacdth,
|
||||
sfx_skldth,
|
||||
sfx_brsdth,
|
||||
sfx_cybdth,
|
||||
sfx_spidth,
|
||||
sfx_bspdth,
|
||||
sfx_vildth,
|
||||
sfx_kntdth,
|
||||
sfx_pedth,
|
||||
sfx_skedth,
|
||||
sfx_posact,
|
||||
sfx_bgact,
|
||||
sfx_dmact,
|
||||
sfx_bspact,
|
||||
sfx_bspwlk,
|
||||
sfx_vilact,
|
||||
sfx_noway,
|
||||
sfx_barexp,
|
||||
sfx_punch,
|
||||
sfx_hoof,
|
||||
sfx_metal,
|
||||
sfx_chgun,
|
||||
sfx_tink,
|
||||
sfx_bdopn,
|
||||
sfx_bdcls,
|
||||
sfx_itmbk,
|
||||
sfx_flame,
|
||||
sfx_flamst,
|
||||
sfx_getpow,
|
||||
sfx_bospit,
|
||||
sfx_boscub,
|
||||
sfx_bossit,
|
||||
sfx_bospn,
|
||||
sfx_bosdth,
|
||||
sfx_manatk,
|
||||
sfx_mandth,
|
||||
sfx_sssit,
|
||||
sfx_ssdth,
|
||||
sfx_keenpn,
|
||||
sfx_keendt,
|
||||
sfx_skeact,
|
||||
sfx_skesit,
|
||||
sfx_skeatk,
|
||||
sfx_radio,
|
||||
NUMSFX
|
||||
} sfxenum_t;
|
||||
|
||||
#endif
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Created by the sound utility written by Dave Taylor.
|
||||
* Kept as a sample, DOOM2 sounds. Frozen.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __SOUNDS__
|
||||
#define __SOUNDS__
|
||||
|
||||
//
|
||||
// SoundFX struct.
|
||||
//
|
||||
|
||||
struct sfxinfo_struct;
|
||||
|
||||
typedef struct sfxinfo_struct sfxinfo_t;
|
||||
|
||||
struct sfxinfo_struct
|
||||
{
|
||||
|
||||
// up to 6-character name
|
||||
const char *name; // CPhipps - const
|
||||
|
||||
int singularity;
|
||||
|
||||
// Sfx priority
|
||||
int priority;
|
||||
|
||||
// referenced sound if a link
|
||||
const sfxinfo_t *link;
|
||||
|
||||
// volume if a link
|
||||
int volume;
|
||||
|
||||
//Length of clip
|
||||
int ticks;
|
||||
};
|
||||
|
||||
//
|
||||
// MusicInfo struct.
|
||||
//
|
||||
|
||||
// the complete set of sound effects
|
||||
extern const sfxinfo_t S_sfx[];
|
||||
|
||||
//
|
||||
// Identifiers for all music in game.
|
||||
//
|
||||
|
||||
typedef enum
|
||||
{
|
||||
mus_None,
|
||||
mus_e1m1,
|
||||
mus_e1m2,
|
||||
mus_e1m3,
|
||||
mus_e1m4,
|
||||
mus_e1m5,
|
||||
mus_e1m6,
|
||||
mus_e1m7,
|
||||
mus_e1m8,
|
||||
mus_e1m9,
|
||||
mus_e2m1,
|
||||
mus_e2m2,
|
||||
mus_e2m3,
|
||||
mus_e2m4,
|
||||
mus_e2m5,
|
||||
mus_e2m6,
|
||||
mus_e2m7,
|
||||
mus_e2m8,
|
||||
mus_e2m9,
|
||||
mus_e3m1,
|
||||
mus_e3m2,
|
||||
mus_e3m3,
|
||||
mus_e3m4,
|
||||
mus_e3m5,
|
||||
mus_e3m6,
|
||||
mus_e3m7,
|
||||
mus_e3m8,
|
||||
mus_e3m9,
|
||||
mus_inter,
|
||||
mus_intro,
|
||||
mus_bunny,
|
||||
mus_victor,
|
||||
mus_introa,
|
||||
mus_runnin,
|
||||
mus_stalks,
|
||||
mus_countd,
|
||||
mus_betwee,
|
||||
mus_doom,
|
||||
mus_the_da,
|
||||
mus_shawn,
|
||||
mus_ddtblu,
|
||||
mus_in_cit,
|
||||
mus_dead,
|
||||
mus_stlks2,
|
||||
mus_theda2,
|
||||
mus_doom2,
|
||||
mus_ddtbl2,
|
||||
mus_runni2,
|
||||
mus_dead2,
|
||||
mus_stlks3,
|
||||
mus_romero,
|
||||
mus_shawn2,
|
||||
mus_messag,
|
||||
mus_count2,
|
||||
mus_ddtbl3,
|
||||
mus_ampie,
|
||||
mus_theda3,
|
||||
mus_adrian,
|
||||
mus_messg2,
|
||||
mus_romer2,
|
||||
mus_tense,
|
||||
mus_shawn3,
|
||||
mus_openin,
|
||||
mus_evil,
|
||||
mus_ultima,
|
||||
mus_read_m,
|
||||
mus_dm2ttl,
|
||||
mus_dm2int,
|
||||
NUMMUSIC
|
||||
} musicenum_t;
|
||||
|
||||
//
|
||||
// Identifiers for all sfx in game.
|
||||
//
|
||||
|
||||
typedef enum
|
||||
{
|
||||
sfx_None,
|
||||
sfx_pistol,
|
||||
sfx_shotgn,
|
||||
sfx_sgcock,
|
||||
sfx_dshtgn,
|
||||
sfx_dbopn,
|
||||
sfx_dbcls,
|
||||
sfx_dbload,
|
||||
sfx_plasma,
|
||||
sfx_bfg,
|
||||
sfx_sawup,
|
||||
sfx_sawidl,
|
||||
sfx_sawful,
|
||||
sfx_sawhit,
|
||||
sfx_rlaunc,
|
||||
sfx_rxplod,
|
||||
sfx_firsht,
|
||||
sfx_firxpl,
|
||||
sfx_pstart,
|
||||
sfx_pstop,
|
||||
sfx_doropn,
|
||||
sfx_dorcls,
|
||||
sfx_stnmov,
|
||||
sfx_swtchn,
|
||||
sfx_swtchx,
|
||||
sfx_plpain,
|
||||
sfx_dmpain,
|
||||
sfx_popain,
|
||||
sfx_vipain,
|
||||
sfx_mnpain,
|
||||
sfx_pepain,
|
||||
sfx_slop,
|
||||
sfx_itemup,
|
||||
sfx_wpnup,
|
||||
sfx_oof,
|
||||
sfx_telept,
|
||||
sfx_posit1,
|
||||
sfx_posit2,
|
||||
sfx_posit3,
|
||||
sfx_bgsit1,
|
||||
sfx_bgsit2,
|
||||
sfx_sgtsit,
|
||||
sfx_cacsit,
|
||||
sfx_brssit,
|
||||
sfx_cybsit,
|
||||
sfx_spisit,
|
||||
sfx_bspsit,
|
||||
sfx_kntsit,
|
||||
sfx_vilsit,
|
||||
sfx_mansit,
|
||||
sfx_pesit,
|
||||
sfx_sklatk,
|
||||
sfx_sgtatk,
|
||||
sfx_skepch,
|
||||
sfx_vilatk,
|
||||
sfx_claw,
|
||||
sfx_skeswg,
|
||||
sfx_pldeth,
|
||||
sfx_pdiehi,
|
||||
sfx_podth1,
|
||||
sfx_podth2,
|
||||
sfx_podth3,
|
||||
sfx_bgdth1,
|
||||
sfx_bgdth2,
|
||||
sfx_sgtdth,
|
||||
sfx_cacdth,
|
||||
sfx_skldth,
|
||||
sfx_brsdth,
|
||||
sfx_cybdth,
|
||||
sfx_spidth,
|
||||
sfx_bspdth,
|
||||
sfx_vildth,
|
||||
sfx_kntdth,
|
||||
sfx_pedth,
|
||||
sfx_skedth,
|
||||
sfx_posact,
|
||||
sfx_bgact,
|
||||
sfx_dmact,
|
||||
sfx_bspact,
|
||||
sfx_bspwlk,
|
||||
sfx_vilact,
|
||||
sfx_noway,
|
||||
sfx_barexp,
|
||||
sfx_punch,
|
||||
sfx_hoof,
|
||||
sfx_metal,
|
||||
sfx_chgun,
|
||||
sfx_tink,
|
||||
sfx_bdopn,
|
||||
sfx_bdcls,
|
||||
sfx_itmbk,
|
||||
sfx_flame,
|
||||
sfx_flamst,
|
||||
sfx_getpow,
|
||||
sfx_bospit,
|
||||
sfx_boscub,
|
||||
sfx_bossit,
|
||||
sfx_bospn,
|
||||
sfx_bosdth,
|
||||
sfx_manatk,
|
||||
sfx_mandth,
|
||||
sfx_sssit,
|
||||
sfx_ssdth,
|
||||
sfx_keenpn,
|
||||
sfx_keendt,
|
||||
sfx_skeact,
|
||||
sfx_skesit,
|
||||
sfx_skeatk,
|
||||
sfx_radio,
|
||||
NUMSFX
|
||||
} sfxenum_t;
|
||||
|
||||
#endif
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef ST_GFX_H
|
||||
#define ST_GFX_H
|
||||
|
||||
extern const unsigned char gfx_stbar[];
|
||||
extern const unsigned int gfx_stbar_len;
|
||||
|
||||
#endif // ST_GFX_H
|
||||
#ifndef ST_GFX_H
|
||||
#define ST_GFX_H
|
||||
|
||||
extern const unsigned char gfx_stbar[];
|
||||
extern const unsigned int gfx_stbar_len;
|
||||
|
||||
#endif // ST_GFX_H
|
||||
@@ -1,177 +1,177 @@
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* The status bar widget definitions and prototypes
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __STLIB__
|
||||
#define __STLIB__
|
||||
|
||||
// We are referring to patches.
|
||||
#include "r_defs.h"
|
||||
#include "v_video.h" // color ranges
|
||||
|
||||
//
|
||||
// Background and foreground screen numbers
|
||||
//
|
||||
#define ST_BG 1
|
||||
#define ST_FG 0
|
||||
|
||||
//
|
||||
// Typedefs of widgets
|
||||
//
|
||||
|
||||
// Number widget
|
||||
|
||||
typedef struct
|
||||
{
|
||||
// upper right-hand corner
|
||||
// of the number (right-justified)
|
||||
int x;
|
||||
int y;
|
||||
|
||||
// max # of digits in number
|
||||
int width;
|
||||
|
||||
// last number value
|
||||
int oldnum;
|
||||
|
||||
// pointer to current value
|
||||
short *num;
|
||||
|
||||
// pointer to boolean stating
|
||||
// whether to update number
|
||||
boolean *on;
|
||||
|
||||
// list of patches for 0-9
|
||||
const patch_t **p;
|
||||
|
||||
} st_number_t;
|
||||
|
||||
// Percent widget ("child" of number widget,
|
||||
// or, more precisely, contains a number widget.)
|
||||
typedef struct
|
||||
{
|
||||
// number information
|
||||
st_number_t n;
|
||||
|
||||
// percent sign graphic
|
||||
const patch_t *p;
|
||||
} st_percent_t;
|
||||
|
||||
// Multiple Icon widget
|
||||
typedef struct
|
||||
{
|
||||
// center-justified location of icons
|
||||
short x;
|
||||
short y;
|
||||
|
||||
// last icon number
|
||||
short oldinum;
|
||||
|
||||
// pointer to current icon
|
||||
short *inum;
|
||||
|
||||
// pointer to boolean stating
|
||||
// whether to update icon
|
||||
boolean *on;
|
||||
|
||||
// list of icons
|
||||
const patch_t **p;
|
||||
|
||||
} st_multicon_t;
|
||||
|
||||
// Binary Icon widget
|
||||
|
||||
typedef struct
|
||||
{
|
||||
// center-justified location of icon
|
||||
int x;
|
||||
int y;
|
||||
|
||||
// last icon value
|
||||
boolean oldval;
|
||||
|
||||
// pointer to current icon status
|
||||
boolean *val;
|
||||
|
||||
// pointer to boolean
|
||||
// stating whether to update icon
|
||||
boolean *on;
|
||||
|
||||
const patch_t *p; // icon
|
||||
int data; // user data
|
||||
} st_binicon_t;
|
||||
|
||||
//
|
||||
// Widget creation, access, and update routines
|
||||
//
|
||||
|
||||
// Initializes widget library.
|
||||
// More precisely, initialize STMINUS,
|
||||
// everything else is done somewhere else.
|
||||
//
|
||||
void STlib_init(void);
|
||||
|
||||
// Number widget routines
|
||||
void STlib_initNum(st_number_t *n, int x, int y, const patch_t **pl, short *num, boolean *on, int width);
|
||||
|
||||
void STlib_updateNum(st_number_t *n, int cm, boolean refresh);
|
||||
|
||||
// Percent widget routines
|
||||
void STlib_initPercent(st_percent_t *p, int x, int y, const patch_t **pl, short *num, boolean *on, const patch_t *percent);
|
||||
|
||||
void STlib_updatePercent(st_percent_t *per, int cm, int refresh);
|
||||
|
||||
// Multiple Icon widget routines
|
||||
void STlib_initMultIcon(st_multicon_t *mi, int x, int y, const patch_t **il, short *inum, boolean *on);
|
||||
|
||||
void STlib_updateMultIcon(st_multicon_t *mi, boolean refresh);
|
||||
|
||||
// Binary Icon widget routines
|
||||
|
||||
void STlib_initBinIcon(st_binicon_t *b, int x, int y, const patch_t *i, boolean *val, boolean *on);
|
||||
|
||||
void STlib_updateBinIcon(st_binicon_t *bi, boolean refresh);
|
||||
|
||||
void ST_refreshBackground(void);
|
||||
|
||||
#endif
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* The status bar widget definitions and prototypes
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __STLIB__
|
||||
#define __STLIB__
|
||||
|
||||
// We are referring to patches.
|
||||
#include "r_defs.h"
|
||||
#include "v_video.h" // color ranges
|
||||
|
||||
//
|
||||
// Background and foreground screen numbers
|
||||
//
|
||||
#define ST_BG 1
|
||||
#define ST_FG 0
|
||||
|
||||
//
|
||||
// Typedefs of widgets
|
||||
//
|
||||
|
||||
// Number widget
|
||||
|
||||
typedef struct
|
||||
{
|
||||
// upper right-hand corner
|
||||
// of the number (right-justified)
|
||||
int x;
|
||||
int y;
|
||||
|
||||
// max # of digits in number
|
||||
int width;
|
||||
|
||||
// last number value
|
||||
int oldnum;
|
||||
|
||||
// pointer to current value
|
||||
short *num;
|
||||
|
||||
// pointer to boolean stating
|
||||
// whether to update number
|
||||
boolean *on;
|
||||
|
||||
// list of patches for 0-9
|
||||
const patch_t **p;
|
||||
|
||||
} st_number_t;
|
||||
|
||||
// Percent widget ("child" of number widget,
|
||||
// or, more precisely, contains a number widget.)
|
||||
typedef struct
|
||||
{
|
||||
// number information
|
||||
st_number_t n;
|
||||
|
||||
// percent sign graphic
|
||||
const patch_t *p;
|
||||
} st_percent_t;
|
||||
|
||||
// Multiple Icon widget
|
||||
typedef struct
|
||||
{
|
||||
// center-justified location of icons
|
||||
short x;
|
||||
short y;
|
||||
|
||||
// last icon number
|
||||
short oldinum;
|
||||
|
||||
// pointer to current icon
|
||||
short *inum;
|
||||
|
||||
// pointer to boolean stating
|
||||
// whether to update icon
|
||||
boolean *on;
|
||||
|
||||
// list of icons
|
||||
const patch_t **p;
|
||||
|
||||
} st_multicon_t;
|
||||
|
||||
// Binary Icon widget
|
||||
|
||||
typedef struct
|
||||
{
|
||||
// center-justified location of icon
|
||||
int x;
|
||||
int y;
|
||||
|
||||
// last icon value
|
||||
boolean oldval;
|
||||
|
||||
// pointer to current icon status
|
||||
boolean *val;
|
||||
|
||||
// pointer to boolean
|
||||
// stating whether to update icon
|
||||
boolean *on;
|
||||
|
||||
const patch_t *p; // icon
|
||||
int data; // user data
|
||||
} st_binicon_t;
|
||||
|
||||
//
|
||||
// Widget creation, access, and update routines
|
||||
//
|
||||
|
||||
// Initializes widget library.
|
||||
// More precisely, initialize STMINUS,
|
||||
// everything else is done somewhere else.
|
||||
//
|
||||
void STlib_init(void);
|
||||
|
||||
// Number widget routines
|
||||
void STlib_initNum(st_number_t *n, int x, int y, const patch_t **pl, short *num, boolean *on, int width);
|
||||
|
||||
void STlib_updateNum(st_number_t *n, int cm, boolean refresh);
|
||||
|
||||
// Percent widget routines
|
||||
void STlib_initPercent(st_percent_t *p, int x, int y, const patch_t **pl, short *num, boolean *on, const patch_t *percent);
|
||||
|
||||
void STlib_updatePercent(st_percent_t *per, int cm, int refresh);
|
||||
|
||||
// Multiple Icon widget routines
|
||||
void STlib_initMultIcon(st_multicon_t *mi, int x, int y, const patch_t **il, short *inum, boolean *on);
|
||||
|
||||
void STlib_updateMultIcon(st_multicon_t *mi, boolean refresh);
|
||||
|
||||
// Binary Icon widget routines
|
||||
|
||||
void STlib_initBinIcon(st_binicon_t *b, int x, int y, const patch_t *i, boolean *val, boolean *on);
|
||||
|
||||
void STlib_updateBinIcon(st_binicon_t *bi, boolean refresh);
|
||||
|
||||
void ST_refreshBackground(void);
|
||||
|
||||
#endif
|
||||
@@ -1,380 +1,380 @@
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Status bar code.
|
||||
* Does the face/direction indicator animatin.
|
||||
* Does palette indicators as well (red pain/berserk, bright pickup)
|
||||
*
|
||||
* next-hack:
|
||||
* pointers to patches now stored in immutable flash region, saving a few
|
||||
* hundred bytes of RAM.
|
||||
* modified so that instead of re-rendering, if no
|
||||
* changes are required, and the status bar is already rendered in
|
||||
* the previous frame buffer (but not on the current one), then the
|
||||
* previous frame is copied to the current frame buffer.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __STSTUFF_H__
|
||||
#define __STSTUFF_H__
|
||||
|
||||
#include "doomtype.h"
|
||||
#include "d_event.h"
|
||||
|
||||
// Size of statusbar.
|
||||
// Now sensitive for scaling.
|
||||
|
||||
// proff 08/18/98: Changed for high-res
|
||||
#define ST_HEIGHT 32
|
||||
#define ST_WIDTH 320
|
||||
#define ST_Y (SCREENHEIGHT - ST_HEIGHT)
|
||||
#if PDOOM_W == 240
|
||||
#define ST_SCALED_HEIGHT ST_HEIGHT
|
||||
#else
|
||||
#define ST_SCALED_HEIGHT 17 /* Paradise: status bar 240x32 scaled down to 128x17 */
|
||||
#define ST_SMALL 1
|
||||
#endif
|
||||
#define ST_SCALED_WIDTH SCREENWIDTH
|
||||
#define ST_SCALED_Y (SCREENHEIGHT - ST_SCALED_HEIGHT)
|
||||
// nh: reduction constant from GBA port to ours
|
||||
#define ST_C 160/160
|
||||
//
|
||||
// STATUS BAR DATA
|
||||
//
|
||||
|
||||
// Palette indices.
|
||||
// For damage/bonus red-/gold-shifts
|
||||
#define STARTREDPALS 1
|
||||
#define STARTBONUSPALS 9
|
||||
#define NUMREDPALS 8
|
||||
#define NUMBONUSPALS 4
|
||||
// Radiation suit, green shift.
|
||||
#define RADIATIONPAL 13
|
||||
|
||||
// Location of status bar
|
||||
#define ST_X 0
|
||||
#define ST_X2 104
|
||||
|
||||
// proff 08/18/98: Changed for high-res
|
||||
#define ST_FX (ST_X+143 * ST_C)
|
||||
#define ST_FY (ST_Y+1)
|
||||
|
||||
// Should be set to patch width
|
||||
// for tall numbers later on
|
||||
#define ST_TALLNUMWIDTH (tallnum[0]->width)
|
||||
|
||||
// Number of status faces.
|
||||
#define ST_NUMPAINFACES 5
|
||||
#define ST_NUMSTRAIGHTFACES 3
|
||||
#define ST_NUMTURNFACES 2
|
||||
#define ST_NUMSPECIALFACES 3
|
||||
|
||||
#define ST_FACESTRIDE \
|
||||
(ST_NUMSTRAIGHTFACES+ST_NUMTURNFACES+ST_NUMSPECIALFACES)
|
||||
|
||||
#define ST_NUMEXTRAFACES 2
|
||||
|
||||
#define ST_NUMFACES \
|
||||
(ST_FACESTRIDE*ST_NUMPAINFACES+ST_NUMEXTRAFACES)
|
||||
|
||||
#define ST_TURNOFFSET (ST_NUMSTRAIGHTFACES)
|
||||
#define ST_OUCHOFFSET (ST_TURNOFFSET + ST_NUMTURNFACES)
|
||||
#define ST_EVILGRINOFFSET (ST_OUCHOFFSET + 1)
|
||||
#define ST_RAMPAGEOFFSET (ST_EVILGRINOFFSET + 1)
|
||||
#define ST_GODFACE (ST_NUMPAINFACES*ST_FACESTRIDE)
|
||||
#define ST_DEADFACE (ST_GODFACE+1)
|
||||
|
||||
// proff 08/18/98: Changed for high-res
|
||||
#define ST_FACESX (ST_X+104 * ST_C)
|
||||
#define ST_FACESY (ST_Y)
|
||||
|
||||
#define ST_EVILGRINCOUNT (2*TICRATE)
|
||||
//Fix Status bar face timing ~Kippykip
|
||||
//#define ST_STRAIGHTFACECOUNT (TICRATE*2)
|
||||
#define ST_STRAIGHTFACECOUNT (18)
|
||||
#define ST_TURNCOUNT (1*TICRATE)
|
||||
#define ST_OUCHCOUNT (1*TICRATE)
|
||||
#define ST_RAMPAGEDELAY (2*TICRATE)
|
||||
|
||||
#define ST_MUCHPAIN 20
|
||||
|
||||
// Location and size of statistics,
|
||||
// justified according to widget type.
|
||||
// Problem is, within which space? STbar? Screen?
|
||||
// Note: this could be read in by a lump.
|
||||
// Problem is, is the stuff rendered
|
||||
// into a buffer,
|
||||
// or into the frame buffer?
|
||||
// I dunno, why don't you go and find out!!! killough
|
||||
#if 1
|
||||
// AMMO number pos.
|
||||
#define ST_AMMOWIDTH 3
|
||||
// proff 08/18/98: Changed for high-res
|
||||
#define ST_AMMOX (ST_X+32 * ST_C)
|
||||
#define ST_AMMOY (ST_Y+6)
|
||||
//#define ST_AMMOX 44
|
||||
//#define ST_AMMOY 171
|
||||
|
||||
// HEALTH number pos.
|
||||
#define ST_HEALTHWIDTH 2
|
||||
// proff 08/18/98: Changed for high-res
|
||||
#define ST_HEALTHX (ST_X+66 * ST_C)
|
||||
#define ST_HEALTHY (ST_Y+6)
|
||||
|
||||
// Weapon pos.
|
||||
// proff 08/18/98: Changed for high-res
|
||||
#define ST_ARMSX (ST_X+82 * ST_C)
|
||||
#define ST_ARMSY (ST_Y+4)
|
||||
#define ST_ARMSBGX (ST_X+104 * ST_C)
|
||||
#define ST_ARMSBGY (ST_Y)
|
||||
|
||||
#define ST_ARMSXSPACE 8
|
||||
#define ST_ARMSYSPACE 10
|
||||
|
||||
// Frags pos.
|
||||
// proff 08/18/98: Changed for high-res
|
||||
#define ST_FRAGSX (ST_X+138 * ST_C)
|
||||
#define ST_FRAGSY (ST_Y+3)
|
||||
//#define ST_FRAGSX 138
|
||||
//#define ST_FRAGSY 171
|
||||
#define ST_FRAGSWIDTH 2
|
||||
|
||||
// ARMOR number pos.
|
||||
#define ST_ARMORWIDTH 3
|
||||
// proff 08/18/98: Changed for high-res
|
||||
#define ST_ARMORX (ST_X+166 * ST_C)
|
||||
#define ST_ARMORY (ST_Y+6)
|
||||
|
||||
// Key icon positions.
|
||||
#define ST_KEY0WIDTH 8
|
||||
#define ST_KEY0HEIGHT 5
|
||||
// proff 08/18/98: Changed for high-res
|
||||
#define ST_KEY0X (ST_X+178 * ST_C)
|
||||
#define ST_KEY0Y (ST_Y+3)
|
||||
|
||||
#define ST_KEY1WIDTH ST_KEY0WIDTH
|
||||
// proff 08/18/98: Changed for high-res
|
||||
#define ST_KEY1X (ST_X+178 * ST_C)
|
||||
#define ST_KEY1Y (ST_Y+13)
|
||||
|
||||
#define ST_KEY2WIDTH ST_KEY0WIDTH
|
||||
// proff 08/18/98: Changed for high-res
|
||||
#define ST_KEY2X (ST_X+178 * ST_C)
|
||||
#define ST_KEY2Y (ST_Y+23)
|
||||
|
||||
// Ammunition counter.
|
||||
#define ST_AMMO0WIDTH 3
|
||||
#define ST_AMMO0HEIGHT 6
|
||||
// proff 08/18/98: Changed for high-res
|
||||
#define ST_AMMO0X (ST_X+220 * ST_C)
|
||||
#define ST_AMMO0Y (ST_Y+5)
|
||||
|
||||
#define ST_AMMO1WIDTH ST_AMMO0WIDTH
|
||||
// proff 08/18/98: Changed for high-res
|
||||
#define ST_AMMO1X (ST_X+220 * ST_C)
|
||||
#define ST_AMMO1Y (ST_Y+11)
|
||||
|
||||
#define ST_AMMO2WIDTH ST_AMMO0WIDTH
|
||||
// proff 08/18/98: Changed for high-res
|
||||
#define ST_AMMO2X (ST_X+220 * ST_C)
|
||||
#define ST_AMMO2Y (ST_Y+23)
|
||||
|
||||
#define ST_AMMO3WIDTH ST_AMMO0WIDTH
|
||||
// proff 08/18/98: Changed for high-res
|
||||
#define ST_AMMO3X (ST_X+220 * ST_C)
|
||||
#define ST_AMMO3Y (ST_Y+17)
|
||||
|
||||
// Indicate maximum ammunition.
|
||||
// Only needed because backpack exists.
|
||||
#define ST_MAXAMMO0WIDTH 3
|
||||
#define ST_MAXAMMO0HEIGHT 5
|
||||
// proff 08/18/98: Changed for high-res
|
||||
#define ST_MAXAMMO0X (ST_X+238 * ST_C)
|
||||
#define ST_MAXAMMO0Y (ST_Y+5)
|
||||
|
||||
#define ST_MAXAMMO1WIDTH ST_MAXAMMO0WIDTH
|
||||
// proff 08/18/98: Changed for high-res
|
||||
#define ST_MAXAMMO1X (ST_X+238 * ST_C)
|
||||
#define ST_MAXAMMO1Y (ST_Y+11)
|
||||
|
||||
#define ST_MAXAMMO2WIDTH ST_MAXAMMO0WIDTH
|
||||
// proff 08/18/98: Changed for high-res
|
||||
#define ST_MAXAMMO2X (ST_X+238 * ST_C)
|
||||
#define ST_MAXAMMO2Y (ST_Y+23)
|
||||
|
||||
#define ST_MAXAMMO3WIDTH ST_MAXAMMO0WIDTH
|
||||
// proff 08/18/98: Changed for high-res
|
||||
#define ST_MAXAMMO3X (ST_X+238 * ST_C)
|
||||
#define ST_MAXAMMO3Y (ST_Y+17)
|
||||
|
||||
#else
|
||||
#define ST_YC 1
|
||||
// AMMO number pos.
|
||||
#define ST_AMMOWIDTH 3
|
||||
#define ST_AMMOX 44
|
||||
#define ST_AMMOY 171 * ST_YC
|
||||
|
||||
// HEALTH number pos.
|
||||
#define ST_HEALTHWIDTH 3
|
||||
#define ST_HEALTHX 90
|
||||
#define ST_HEALTHY 171 * ST_YC
|
||||
|
||||
// Weapon pos.
|
||||
#define ST_ARMSX 111
|
||||
#define ST_ARMSY 172 * ST_YC
|
||||
#define ST_ARMSBGX 104
|
||||
#define ST_ARMSBGY 168 * ST_YC
|
||||
#define ST_ARMSXSPACE 12
|
||||
#define ST_ARMSYSPACE 10
|
||||
|
||||
// Frags pos.
|
||||
#define ST_FRAGSX 138
|
||||
#define ST_FRAGSY 171 * ST_YC
|
||||
#define ST_FRAGSWIDTH 2
|
||||
|
||||
// ARMOR number pos.
|
||||
#define ST_ARMORWIDTH 3
|
||||
#define ST_ARMORX 221
|
||||
#define ST_ARMORY 171 * ST_YC
|
||||
|
||||
// Key icon positions.
|
||||
#define ST_KEY0WIDTH 8
|
||||
#define ST_KEY0HEIGHT 5
|
||||
#define ST_KEY0X 239
|
||||
#define ST_KEY0Y 171 * ST_YC
|
||||
#define ST_KEY1WIDTH ST_KEY0WIDTH
|
||||
#define ST_KEY1X 239
|
||||
#define ST_KEY1Y 181 * ST_YC
|
||||
#define ST_KEY2WIDTH ST_KEY0WIDTH
|
||||
#define ST_KEY2X 239
|
||||
#define ST_KEY2Y 191 * ST_YC
|
||||
|
||||
// Ammunition counter.
|
||||
#define ST_AMMO0WIDTH 3
|
||||
#define ST_AMMO0HEIGHT 6
|
||||
#define ST_AMMO0X 288
|
||||
#define ST_AMMO0Y 173 * ST_YC
|
||||
#define ST_AMMO1WIDTH ST_AMMO0WIDTH
|
||||
#define ST_AMMO1X 288
|
||||
#define ST_AMMO1Y 179 * ST_YC
|
||||
#define ST_AMMO2WIDTH ST_AMMO0WIDTH
|
||||
#define ST_AMMO2X 288
|
||||
#define ST_AMMO2Y 191 * ST_YC
|
||||
#define ST_AMMO3WIDTH ST_AMMO0WIDTH
|
||||
#define ST_AMMO3X 288
|
||||
#define ST_AMMO3Y 185 * ST_YC
|
||||
|
||||
// Indicate maximum ammunition.
|
||||
// Only needed because backpack exists.
|
||||
#define ST_MAXAMMO0WIDTH 3
|
||||
#define ST_MAXAMMO0HEIGHT 5
|
||||
#define ST_MAXAMMO0X 314
|
||||
#define ST_MAXAMMO0Y 173 * ST_YC
|
||||
#define ST_MAXAMMO1WIDTH ST_MAXAMMO0WIDTH
|
||||
#define ST_MAXAMMO1X 314
|
||||
#define ST_MAXAMMO1Y 179 * ST_YC
|
||||
#define ST_MAXAMMO2WIDTH ST_MAXAMMO0WIDTH
|
||||
#define ST_MAXAMMO2X 314
|
||||
#define ST_MAXAMMO2Y 191 * ST_YC
|
||||
#define ST_MAXAMMO3WIDTH ST_MAXAMMO0WIDTH
|
||||
#define ST_MAXAMMO3X 314
|
||||
#define ST_MAXAMMO3Y 185 * ST_YC
|
||||
|
||||
// pistol
|
||||
#define ST_WEAPON0X 110
|
||||
#define ST_WEAPON0Y 172 * ST_YC
|
||||
|
||||
// shotgun
|
||||
#define ST_WEAPON1X 122
|
||||
#define ST_WEAPON1Y 172 * ST_YC
|
||||
|
||||
// chain gun
|
||||
#define ST_WEAPON2X 134
|
||||
#define ST_WEAPON2Y 172 * ST_YC
|
||||
|
||||
// missile launcher
|
||||
#define ST_WEAPON3X 110
|
||||
#define ST_WEAPON3Y 181 * ST_YC
|
||||
|
||||
// plasma gun
|
||||
#define ST_WEAPON4X 122
|
||||
#define ST_WEAPON4Y 181 * ST_YC
|
||||
|
||||
// bfg
|
||||
#define ST_WEAPON5X 134
|
||||
#define ST_WEAPON5Y 181 * ST_YC
|
||||
|
||||
// WPNS title
|
||||
#define ST_WPNSX 109
|
||||
#define ST_WPNSY 191 * ST_YC
|
||||
|
||||
// DETH title
|
||||
#define ST_DETHX 109
|
||||
#define ST_DETHY 191 * ST_YC
|
||||
#endif
|
||||
|
||||
//
|
||||
// STATUS BAR
|
||||
//
|
||||
|
||||
// Called by main loop.
|
||||
boolean ST_Responder(const event_t *ev);
|
||||
|
||||
// Called by main loop.
|
||||
void ST_Ticker(void);
|
||||
|
||||
// Called by main loop.
|
||||
void ST_Drawer(boolean st_statusbaron, boolean refresh);
|
||||
|
||||
// Called when the console player is spawned on each level.
|
||||
void ST_Start(void);
|
||||
|
||||
// Called by startup code.
|
||||
void ST_Init(void);
|
||||
|
||||
// States for status bar code.
|
||||
typedef enum
|
||||
{
|
||||
AutomapState, FirstPersonState
|
||||
} st_stateenum_t;
|
||||
|
||||
// killough 5/2/98: moved from m_misc.c:
|
||||
|
||||
#endif
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Status bar code.
|
||||
* Does the face/direction indicator animatin.
|
||||
* Does palette indicators as well (red pain/berserk, bright pickup)
|
||||
*
|
||||
* next-hack:
|
||||
* pointers to patches now stored in immutable flash region, saving a few
|
||||
* hundred bytes of RAM.
|
||||
* modified so that instead of re-rendering, if no
|
||||
* changes are required, and the status bar is already rendered in
|
||||
* the previous frame buffer (but not on the current one), then the
|
||||
* previous frame is copied to the current frame buffer.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __STSTUFF_H__
|
||||
#define __STSTUFF_H__
|
||||
|
||||
#include "doomtype.h"
|
||||
#include "d_event.h"
|
||||
|
||||
// Size of statusbar.
|
||||
// Now sensitive for scaling.
|
||||
|
||||
// proff 08/18/98: Changed for high-res
|
||||
#define ST_HEIGHT 32
|
||||
#define ST_WIDTH 320
|
||||
#define ST_Y (SCREENHEIGHT - ST_HEIGHT)
|
||||
#if PDOOM_W == 240
|
||||
#define ST_SCALED_HEIGHT ST_HEIGHT
|
||||
#else
|
||||
#define ST_SCALED_HEIGHT 17 /* Paradise: status bar 240x32 scaled down to 128x17 */
|
||||
#define ST_SMALL 1
|
||||
#endif
|
||||
#define ST_SCALED_WIDTH SCREENWIDTH
|
||||
#define ST_SCALED_Y (SCREENHEIGHT - ST_SCALED_HEIGHT)
|
||||
// nh: reduction constant from GBA port to ours
|
||||
#define ST_C 160/160
|
||||
//
|
||||
// STATUS BAR DATA
|
||||
//
|
||||
|
||||
// Palette indices.
|
||||
// For damage/bonus red-/gold-shifts
|
||||
#define STARTREDPALS 1
|
||||
#define STARTBONUSPALS 9
|
||||
#define NUMREDPALS 8
|
||||
#define NUMBONUSPALS 4
|
||||
// Radiation suit, green shift.
|
||||
#define RADIATIONPAL 13
|
||||
|
||||
// Location of status bar
|
||||
#define ST_X 0
|
||||
#define ST_X2 104
|
||||
|
||||
// proff 08/18/98: Changed for high-res
|
||||
#define ST_FX (ST_X+143 * ST_C)
|
||||
#define ST_FY (ST_Y+1)
|
||||
|
||||
// Should be set to patch width
|
||||
// for tall numbers later on
|
||||
#define ST_TALLNUMWIDTH (tallnum[0]->width)
|
||||
|
||||
// Number of status faces.
|
||||
#define ST_NUMPAINFACES 5
|
||||
#define ST_NUMSTRAIGHTFACES 3
|
||||
#define ST_NUMTURNFACES 2
|
||||
#define ST_NUMSPECIALFACES 3
|
||||
|
||||
#define ST_FACESTRIDE \
|
||||
(ST_NUMSTRAIGHTFACES+ST_NUMTURNFACES+ST_NUMSPECIALFACES)
|
||||
|
||||
#define ST_NUMEXTRAFACES 2
|
||||
|
||||
#define ST_NUMFACES \
|
||||
(ST_FACESTRIDE*ST_NUMPAINFACES+ST_NUMEXTRAFACES)
|
||||
|
||||
#define ST_TURNOFFSET (ST_NUMSTRAIGHTFACES)
|
||||
#define ST_OUCHOFFSET (ST_TURNOFFSET + ST_NUMTURNFACES)
|
||||
#define ST_EVILGRINOFFSET (ST_OUCHOFFSET + 1)
|
||||
#define ST_RAMPAGEOFFSET (ST_EVILGRINOFFSET + 1)
|
||||
#define ST_GODFACE (ST_NUMPAINFACES*ST_FACESTRIDE)
|
||||
#define ST_DEADFACE (ST_GODFACE+1)
|
||||
|
||||
// proff 08/18/98: Changed for high-res
|
||||
#define ST_FACESX (ST_X+104 * ST_C)
|
||||
#define ST_FACESY (ST_Y)
|
||||
|
||||
#define ST_EVILGRINCOUNT (2*TICRATE)
|
||||
//Fix Status bar face timing ~Kippykip
|
||||
//#define ST_STRAIGHTFACECOUNT (TICRATE*2)
|
||||
#define ST_STRAIGHTFACECOUNT (18)
|
||||
#define ST_TURNCOUNT (1*TICRATE)
|
||||
#define ST_OUCHCOUNT (1*TICRATE)
|
||||
#define ST_RAMPAGEDELAY (2*TICRATE)
|
||||
|
||||
#define ST_MUCHPAIN 20
|
||||
|
||||
// Location and size of statistics,
|
||||
// justified according to widget type.
|
||||
// Problem is, within which space? STbar? Screen?
|
||||
// Note: this could be read in by a lump.
|
||||
// Problem is, is the stuff rendered
|
||||
// into a buffer,
|
||||
// or into the frame buffer?
|
||||
// I dunno, why don't you go and find out!!! killough
|
||||
#if 1
|
||||
// AMMO number pos.
|
||||
#define ST_AMMOWIDTH 3
|
||||
// proff 08/18/98: Changed for high-res
|
||||
#define ST_AMMOX (ST_X+32 * ST_C)
|
||||
#define ST_AMMOY (ST_Y+6)
|
||||
//#define ST_AMMOX 44
|
||||
//#define ST_AMMOY 171
|
||||
|
||||
// HEALTH number pos.
|
||||
#define ST_HEALTHWIDTH 2
|
||||
// proff 08/18/98: Changed for high-res
|
||||
#define ST_HEALTHX (ST_X+66 * ST_C)
|
||||
#define ST_HEALTHY (ST_Y+6)
|
||||
|
||||
// Weapon pos.
|
||||
// proff 08/18/98: Changed for high-res
|
||||
#define ST_ARMSX (ST_X+82 * ST_C)
|
||||
#define ST_ARMSY (ST_Y+4)
|
||||
#define ST_ARMSBGX (ST_X+104 * ST_C)
|
||||
#define ST_ARMSBGY (ST_Y)
|
||||
|
||||
#define ST_ARMSXSPACE 8
|
||||
#define ST_ARMSYSPACE 10
|
||||
|
||||
// Frags pos.
|
||||
// proff 08/18/98: Changed for high-res
|
||||
#define ST_FRAGSX (ST_X+138 * ST_C)
|
||||
#define ST_FRAGSY (ST_Y+3)
|
||||
//#define ST_FRAGSX 138
|
||||
//#define ST_FRAGSY 171
|
||||
#define ST_FRAGSWIDTH 2
|
||||
|
||||
// ARMOR number pos.
|
||||
#define ST_ARMORWIDTH 3
|
||||
// proff 08/18/98: Changed for high-res
|
||||
#define ST_ARMORX (ST_X+166 * ST_C)
|
||||
#define ST_ARMORY (ST_Y+6)
|
||||
|
||||
// Key icon positions.
|
||||
#define ST_KEY0WIDTH 8
|
||||
#define ST_KEY0HEIGHT 5
|
||||
// proff 08/18/98: Changed for high-res
|
||||
#define ST_KEY0X (ST_X+178 * ST_C)
|
||||
#define ST_KEY0Y (ST_Y+3)
|
||||
|
||||
#define ST_KEY1WIDTH ST_KEY0WIDTH
|
||||
// proff 08/18/98: Changed for high-res
|
||||
#define ST_KEY1X (ST_X+178 * ST_C)
|
||||
#define ST_KEY1Y (ST_Y+13)
|
||||
|
||||
#define ST_KEY2WIDTH ST_KEY0WIDTH
|
||||
// proff 08/18/98: Changed for high-res
|
||||
#define ST_KEY2X (ST_X+178 * ST_C)
|
||||
#define ST_KEY2Y (ST_Y+23)
|
||||
|
||||
// Ammunition counter.
|
||||
#define ST_AMMO0WIDTH 3
|
||||
#define ST_AMMO0HEIGHT 6
|
||||
// proff 08/18/98: Changed for high-res
|
||||
#define ST_AMMO0X (ST_X+220 * ST_C)
|
||||
#define ST_AMMO0Y (ST_Y+5)
|
||||
|
||||
#define ST_AMMO1WIDTH ST_AMMO0WIDTH
|
||||
// proff 08/18/98: Changed for high-res
|
||||
#define ST_AMMO1X (ST_X+220 * ST_C)
|
||||
#define ST_AMMO1Y (ST_Y+11)
|
||||
|
||||
#define ST_AMMO2WIDTH ST_AMMO0WIDTH
|
||||
// proff 08/18/98: Changed for high-res
|
||||
#define ST_AMMO2X (ST_X+220 * ST_C)
|
||||
#define ST_AMMO2Y (ST_Y+23)
|
||||
|
||||
#define ST_AMMO3WIDTH ST_AMMO0WIDTH
|
||||
// proff 08/18/98: Changed for high-res
|
||||
#define ST_AMMO3X (ST_X+220 * ST_C)
|
||||
#define ST_AMMO3Y (ST_Y+17)
|
||||
|
||||
// Indicate maximum ammunition.
|
||||
// Only needed because backpack exists.
|
||||
#define ST_MAXAMMO0WIDTH 3
|
||||
#define ST_MAXAMMO0HEIGHT 5
|
||||
// proff 08/18/98: Changed for high-res
|
||||
#define ST_MAXAMMO0X (ST_X+238 * ST_C)
|
||||
#define ST_MAXAMMO0Y (ST_Y+5)
|
||||
|
||||
#define ST_MAXAMMO1WIDTH ST_MAXAMMO0WIDTH
|
||||
// proff 08/18/98: Changed for high-res
|
||||
#define ST_MAXAMMO1X (ST_X+238 * ST_C)
|
||||
#define ST_MAXAMMO1Y (ST_Y+11)
|
||||
|
||||
#define ST_MAXAMMO2WIDTH ST_MAXAMMO0WIDTH
|
||||
// proff 08/18/98: Changed for high-res
|
||||
#define ST_MAXAMMO2X (ST_X+238 * ST_C)
|
||||
#define ST_MAXAMMO2Y (ST_Y+23)
|
||||
|
||||
#define ST_MAXAMMO3WIDTH ST_MAXAMMO0WIDTH
|
||||
// proff 08/18/98: Changed for high-res
|
||||
#define ST_MAXAMMO3X (ST_X+238 * ST_C)
|
||||
#define ST_MAXAMMO3Y (ST_Y+17)
|
||||
|
||||
#else
|
||||
#define ST_YC 1
|
||||
// AMMO number pos.
|
||||
#define ST_AMMOWIDTH 3
|
||||
#define ST_AMMOX 44
|
||||
#define ST_AMMOY 171 * ST_YC
|
||||
|
||||
// HEALTH number pos.
|
||||
#define ST_HEALTHWIDTH 3
|
||||
#define ST_HEALTHX 90
|
||||
#define ST_HEALTHY 171 * ST_YC
|
||||
|
||||
// Weapon pos.
|
||||
#define ST_ARMSX 111
|
||||
#define ST_ARMSY 172 * ST_YC
|
||||
#define ST_ARMSBGX 104
|
||||
#define ST_ARMSBGY 168 * ST_YC
|
||||
#define ST_ARMSXSPACE 12
|
||||
#define ST_ARMSYSPACE 10
|
||||
|
||||
// Frags pos.
|
||||
#define ST_FRAGSX 138
|
||||
#define ST_FRAGSY 171 * ST_YC
|
||||
#define ST_FRAGSWIDTH 2
|
||||
|
||||
// ARMOR number pos.
|
||||
#define ST_ARMORWIDTH 3
|
||||
#define ST_ARMORX 221
|
||||
#define ST_ARMORY 171 * ST_YC
|
||||
|
||||
// Key icon positions.
|
||||
#define ST_KEY0WIDTH 8
|
||||
#define ST_KEY0HEIGHT 5
|
||||
#define ST_KEY0X 239
|
||||
#define ST_KEY0Y 171 * ST_YC
|
||||
#define ST_KEY1WIDTH ST_KEY0WIDTH
|
||||
#define ST_KEY1X 239
|
||||
#define ST_KEY1Y 181 * ST_YC
|
||||
#define ST_KEY2WIDTH ST_KEY0WIDTH
|
||||
#define ST_KEY2X 239
|
||||
#define ST_KEY2Y 191 * ST_YC
|
||||
|
||||
// Ammunition counter.
|
||||
#define ST_AMMO0WIDTH 3
|
||||
#define ST_AMMO0HEIGHT 6
|
||||
#define ST_AMMO0X 288
|
||||
#define ST_AMMO0Y 173 * ST_YC
|
||||
#define ST_AMMO1WIDTH ST_AMMO0WIDTH
|
||||
#define ST_AMMO1X 288
|
||||
#define ST_AMMO1Y 179 * ST_YC
|
||||
#define ST_AMMO2WIDTH ST_AMMO0WIDTH
|
||||
#define ST_AMMO2X 288
|
||||
#define ST_AMMO2Y 191 * ST_YC
|
||||
#define ST_AMMO3WIDTH ST_AMMO0WIDTH
|
||||
#define ST_AMMO3X 288
|
||||
#define ST_AMMO3Y 185 * ST_YC
|
||||
|
||||
// Indicate maximum ammunition.
|
||||
// Only needed because backpack exists.
|
||||
#define ST_MAXAMMO0WIDTH 3
|
||||
#define ST_MAXAMMO0HEIGHT 5
|
||||
#define ST_MAXAMMO0X 314
|
||||
#define ST_MAXAMMO0Y 173 * ST_YC
|
||||
#define ST_MAXAMMO1WIDTH ST_MAXAMMO0WIDTH
|
||||
#define ST_MAXAMMO1X 314
|
||||
#define ST_MAXAMMO1Y 179 * ST_YC
|
||||
#define ST_MAXAMMO2WIDTH ST_MAXAMMO0WIDTH
|
||||
#define ST_MAXAMMO2X 314
|
||||
#define ST_MAXAMMO2Y 191 * ST_YC
|
||||
#define ST_MAXAMMO3WIDTH ST_MAXAMMO0WIDTH
|
||||
#define ST_MAXAMMO3X 314
|
||||
#define ST_MAXAMMO3Y 185 * ST_YC
|
||||
|
||||
// pistol
|
||||
#define ST_WEAPON0X 110
|
||||
#define ST_WEAPON0Y 172 * ST_YC
|
||||
|
||||
// shotgun
|
||||
#define ST_WEAPON1X 122
|
||||
#define ST_WEAPON1Y 172 * ST_YC
|
||||
|
||||
// chain gun
|
||||
#define ST_WEAPON2X 134
|
||||
#define ST_WEAPON2Y 172 * ST_YC
|
||||
|
||||
// missile launcher
|
||||
#define ST_WEAPON3X 110
|
||||
#define ST_WEAPON3Y 181 * ST_YC
|
||||
|
||||
// plasma gun
|
||||
#define ST_WEAPON4X 122
|
||||
#define ST_WEAPON4Y 181 * ST_YC
|
||||
|
||||
// bfg
|
||||
#define ST_WEAPON5X 134
|
||||
#define ST_WEAPON5Y 181 * ST_YC
|
||||
|
||||
// WPNS title
|
||||
#define ST_WPNSX 109
|
||||
#define ST_WPNSY 191 * ST_YC
|
||||
|
||||
// DETH title
|
||||
#define ST_DETHX 109
|
||||
#define ST_DETHY 191 * ST_YC
|
||||
#endif
|
||||
|
||||
//
|
||||
// STATUS BAR
|
||||
//
|
||||
|
||||
// Called by main loop.
|
||||
boolean ST_Responder(const event_t *ev);
|
||||
|
||||
// Called by main loop.
|
||||
void ST_Ticker(void);
|
||||
|
||||
// Called by main loop.
|
||||
void ST_Drawer(boolean st_statusbaron, boolean refresh);
|
||||
|
||||
// Called when the console player is spawned on each level.
|
||||
void ST_Start(void);
|
||||
|
||||
// Called by startup code.
|
||||
void ST_Init(void);
|
||||
|
||||
// States for status bar code.
|
||||
typedef enum
|
||||
{
|
||||
AutomapState, FirstPersonState
|
||||
} st_stateenum_t;
|
||||
|
||||
// killough 5/2/98: moved from m_misc.c:
|
||||
|
||||
#endif
|
||||
@@ -1,137 +1,137 @@
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Lookup tables.
|
||||
* Do not try to look them up :-).
|
||||
* In the order of appearance:
|
||||
*
|
||||
* int finetangent[4096] - Tangens LUT.
|
||||
* Should work with BAM fairly well (12 of 16bit,
|
||||
* effectively, by shifting).
|
||||
*
|
||||
* int finesine[10240] - Sine lookup.
|
||||
* Guess what, serves as cosine, too.
|
||||
* Remarkable thing is, how to use BAMs with this?
|
||||
*
|
||||
* int tantoangle[2049] - ArcTan LUT,
|
||||
* maps tan(angle) to angle fast. Gotta search.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __TABLES__
|
||||
#define __TABLES__
|
||||
|
||||
#include "m_fixed.h"
|
||||
#include "doomdef.h"
|
||||
//
|
||||
// Lighting constants.
|
||||
|
||||
#define LIGHTLEVELS 16
|
||||
#define LIGHTSEGSHIFT 4
|
||||
#define MAXLIGHTSCALE 48
|
||||
#define LIGHTSCALESHIFT 12
|
||||
#define MAXLIGHTZ 128
|
||||
#define LIGHTZSHIFT 20
|
||||
|
||||
// Number of diminishing brightness levels.
|
||||
// There a 0-31, i.e. 32 LUT in the COLORMAP lump.
|
||||
|
||||
#define NUMCOLORMAPS 32
|
||||
//
|
||||
#define TABULATED_VALUES 1 // use resolution-dependent tabulated values for some arrays.
|
||||
#define FINEANGLES 8192
|
||||
#define FINEMASK (FINEANGLES-1)
|
||||
|
||||
// 0x100000000 to 0x2000
|
||||
#define ANGLETOFINESHIFT 19
|
||||
|
||||
// Binary Angle Measument, BAM.
|
||||
#define ANG45 0x20000000
|
||||
#define ANG90 0x40000000
|
||||
#define ANG180 0x80000000
|
||||
#define ANG270 0xc0000000
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.14159265358979323846
|
||||
#endif
|
||||
|
||||
#define SLOPERANGE 2048
|
||||
#define SLOPEBITS 11
|
||||
#define DBITS (FRACBITS-SLOPEBITS)
|
||||
|
||||
typedef unsigned angle_t;
|
||||
|
||||
// Load trig tables if needed
|
||||
void R_LoadTrigTables(void);
|
||||
|
||||
// Effective size is 10240.
|
||||
extern const fixed_t finesine[10240];
|
||||
|
||||
// Re-use data, is just PI/2 phase shift.
|
||||
extern const fixed_t *const finecosine;
|
||||
|
||||
// Effective size is 4096.
|
||||
extern const fixed_t finetangent[4096];
|
||||
|
||||
// Effective size is 2049;
|
||||
// The +1 size is to handle the case when x==y without additional checking.
|
||||
|
||||
extern const angle_t tantoangle[2049];
|
||||
|
||||
#if TABULATED_VALUES
|
||||
extern const short viewangletox[4096];
|
||||
extern const angle_t xtoviewangle[SCREENWIDTH + 1];
|
||||
extern const fixed_t yslope[SCREENHEIGHT];
|
||||
extern const fixed_t distscale[SCREENWIDTH];
|
||||
extern const uint8_t scalelight[LIGHTLEVELS][MAXLIGHTSCALE];
|
||||
extern const uint8_t zlight[LIGHTLEVELS][MAXLIGHTZ];
|
||||
#else
|
||||
extern int viewangletox[4096];
|
||||
extern angle_t xtoviewangle[SCREENWIDTH + 1];
|
||||
extern fixed_t yslope[SCREENHEIGHT];
|
||||
extern fixed_t distscale[SCREENWIDTH];
|
||||
#endif
|
||||
|
||||
extern const short screenheightarray[SCREENWIDTH_PHYSICAL];
|
||||
|
||||
extern const short negonearray[SCREENWIDTH_PHYSICAL];
|
||||
|
||||
extern const unsigned char translationtables[1023];
|
||||
|
||||
#endif
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Lookup tables.
|
||||
* Do not try to look them up :-).
|
||||
* In the order of appearance:
|
||||
*
|
||||
* int finetangent[4096] - Tangens LUT.
|
||||
* Should work with BAM fairly well (12 of 16bit,
|
||||
* effectively, by shifting).
|
||||
*
|
||||
* int finesine[10240] - Sine lookup.
|
||||
* Guess what, serves as cosine, too.
|
||||
* Remarkable thing is, how to use BAMs with this?
|
||||
*
|
||||
* int tantoangle[2049] - ArcTan LUT,
|
||||
* maps tan(angle) to angle fast. Gotta search.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __TABLES__
|
||||
#define __TABLES__
|
||||
|
||||
#include "m_fixed.h"
|
||||
#include "doomdef.h"
|
||||
//
|
||||
// Lighting constants.
|
||||
|
||||
#define LIGHTLEVELS 16
|
||||
#define LIGHTSEGSHIFT 4
|
||||
#define MAXLIGHTSCALE 48
|
||||
#define LIGHTSCALESHIFT 12
|
||||
#define MAXLIGHTZ 128
|
||||
#define LIGHTZSHIFT 20
|
||||
|
||||
// Number of diminishing brightness levels.
|
||||
// There a 0-31, i.e. 32 LUT in the COLORMAP lump.
|
||||
|
||||
#define NUMCOLORMAPS 32
|
||||
//
|
||||
#define TABULATED_VALUES 1 // use resolution-dependent tabulated values for some arrays.
|
||||
#define FINEANGLES 8192
|
||||
#define FINEMASK (FINEANGLES-1)
|
||||
|
||||
// 0x100000000 to 0x2000
|
||||
#define ANGLETOFINESHIFT 19
|
||||
|
||||
// Binary Angle Measument, BAM.
|
||||
#define ANG45 0x20000000
|
||||
#define ANG90 0x40000000
|
||||
#define ANG180 0x80000000
|
||||
#define ANG270 0xc0000000
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.14159265358979323846
|
||||
#endif
|
||||
|
||||
#define SLOPERANGE 2048
|
||||
#define SLOPEBITS 11
|
||||
#define DBITS (FRACBITS-SLOPEBITS)
|
||||
|
||||
typedef unsigned angle_t;
|
||||
|
||||
// Load trig tables if needed
|
||||
void R_LoadTrigTables(void);
|
||||
|
||||
// Effective size is 10240.
|
||||
extern const fixed_t finesine[10240];
|
||||
|
||||
// Re-use data, is just PI/2 phase shift.
|
||||
extern const fixed_t *const finecosine;
|
||||
|
||||
// Effective size is 4096.
|
||||
extern const fixed_t finetangent[4096];
|
||||
|
||||
// Effective size is 2049;
|
||||
// The +1 size is to handle the case when x==y without additional checking.
|
||||
|
||||
extern const angle_t tantoangle[2049];
|
||||
|
||||
#if TABULATED_VALUES
|
||||
extern const short viewangletox[4096];
|
||||
extern const angle_t xtoviewangle[SCREENWIDTH + 1];
|
||||
extern const fixed_t yslope[SCREENHEIGHT];
|
||||
extern const fixed_t distscale[SCREENWIDTH];
|
||||
extern const uint8_t scalelight[LIGHTLEVELS][MAXLIGHTSCALE];
|
||||
extern const uint8_t zlight[LIGHTLEVELS][MAXLIGHTZ];
|
||||
#else
|
||||
extern int viewangletox[4096];
|
||||
extern angle_t xtoviewangle[SCREENWIDTH + 1];
|
||||
extern fixed_t yslope[SCREENHEIGHT];
|
||||
extern fixed_t distscale[SCREENWIDTH];
|
||||
#endif
|
||||
|
||||
extern const short screenheightarray[SCREENWIDTH_PHYSICAL];
|
||||
|
||||
extern const short negonearray[SCREENWIDTH_PHYSICAL];
|
||||
|
||||
extern const unsigned char translationtables[1023];
|
||||
|
||||
#endif
|
||||
@@ -1,147 +1,147 @@
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Gamma correction LUT.
|
||||
* Color range translation support
|
||||
* Functions to draw patches (by post) directly to screen.
|
||||
* Functions to blit a block to the screen.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __V_VIDEO__
|
||||
#define __V_VIDEO__
|
||||
|
||||
#include "doomtype.h"
|
||||
#include "doomdef.h"
|
||||
// Needed because we are refering to patches.
|
||||
#include "r_data.h"
|
||||
#include "r_patch.h"
|
||||
|
||||
#define MAX_PATCH_COLOFFS 128
|
||||
#define MAX_COLUMN_DATA 256
|
||||
//
|
||||
// VIDEO
|
||||
//
|
||||
#define MAX_GAMMA 4
|
||||
#define CENTERY (SCREENHEIGHT/2)
|
||||
extern int v_pitch;
|
||||
#define ScreenYToOffset(x) (v_pitch * (x))
|
||||
|
||||
// symbolic indices into color translation table pointer array
|
||||
typedef enum
|
||||
{
|
||||
CR_BRICK, //0
|
||||
CR_TAN, //1
|
||||
CR_GRAY, //2
|
||||
CR_GREEN, //3
|
||||
CR_BROWN, //4
|
||||
CR_GOLD, //5
|
||||
CR_RED, //6
|
||||
CR_BLUE, //7
|
||||
CR_ORANGE, //8
|
||||
CR_YELLOW, //9
|
||||
CR_BLUE2, //10 // proff
|
||||
CR_LIMIT //11 //jff 2/27/98 added for range check
|
||||
} crange_idx_e;
|
||||
//jff 1/16/98 end palette color range additions
|
||||
|
||||
#define CR_DEFAULT CR_RED /* default value for out of range colors */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t *data; // pointer to the screen content
|
||||
// short width; // the width of the surface
|
||||
// short height; // the height of the surface, used when mallocing
|
||||
} screeninfo_t;
|
||||
|
||||
#define NUM_SCREENS 1
|
||||
|
||||
// V_FillRect
|
||||
void V_FillRect(int x, int y, int width, int height, byte colour);
|
||||
|
||||
// CPhipps - patch drawing
|
||||
// Consolidated into the 3 really useful functions:
|
||||
|
||||
// V_DrawNumPatch - Draws the patch from lump num
|
||||
void V_DrawNumPatch(int x, int y, int scrn, int lump, int cm, enum patch_translation_e flags);
|
||||
|
||||
void V_DrawPatch(int x, int y, int scrn, const patch_t *patch);
|
||||
|
||||
void V_DrawPatchXScale(int x, int y, const patch_t *patch);
|
||||
void V_DrawPatchNoScale(int x, int y, const patch_t *patch);
|
||||
|
||||
// V_DrawNamePatch - Draws the patch from lump "name"
|
||||
#define V_DrawNamePatch(x,y,s,n,t,f) V_DrawNumPatch(x,y,s,W_GetNumForName(n),t,f)
|
||||
|
||||
/* cph -
|
||||
* Functions to return width & height of a patch.
|
||||
* Doesn't really belong here, but is often used in conjunction with
|
||||
* this code.
|
||||
*/
|
||||
#define V_NamePatchWidth(name) R_NumPatchWidth(W_GetNumForName(name))
|
||||
#define V_NamePatchHeight(name) R_NumPatchHeight(W_GetNumForName(name))
|
||||
|
||||
/* cphipps 10/99: function to tile a flat over the screen */
|
||||
void V_DrawBackground(const char *flatname);
|
||||
|
||||
// CPhipps - function to set the palette to palette number pal.
|
||||
void V_SetPalette(int pal);
|
||||
|
||||
// Kippykip - Multiple colour corrected palettes
|
||||
void V_SetPalLump(int pal);
|
||||
|
||||
// CPhipps - function to plot a pixel
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int x, y;
|
||||
} fpoint_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
fpoint_t a, b;
|
||||
} fline_t;
|
||||
|
||||
// V_DrawLine
|
||||
void V_DrawLine(fline_t *fl, int color);
|
||||
//
|
||||
extern const byte gammatable[5][256];
|
||||
|
||||
#endif
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Gamma correction LUT.
|
||||
* Color range translation support
|
||||
* Functions to draw patches (by post) directly to screen.
|
||||
* Functions to blit a block to the screen.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __V_VIDEO__
|
||||
#define __V_VIDEO__
|
||||
|
||||
#include "doomtype.h"
|
||||
#include "doomdef.h"
|
||||
// Needed because we are refering to patches.
|
||||
#include "r_data.h"
|
||||
#include "r_patch.h"
|
||||
|
||||
#define MAX_PATCH_COLOFFS 128
|
||||
#define MAX_COLUMN_DATA 256
|
||||
//
|
||||
// VIDEO
|
||||
//
|
||||
#define MAX_GAMMA 4
|
||||
#define CENTERY (SCREENHEIGHT/2)
|
||||
extern int v_pitch;
|
||||
#define ScreenYToOffset(x) (v_pitch * (x))
|
||||
|
||||
// symbolic indices into color translation table pointer array
|
||||
typedef enum
|
||||
{
|
||||
CR_BRICK, //0
|
||||
CR_TAN, //1
|
||||
CR_GRAY, //2
|
||||
CR_GREEN, //3
|
||||
CR_BROWN, //4
|
||||
CR_GOLD, //5
|
||||
CR_RED, //6
|
||||
CR_BLUE, //7
|
||||
CR_ORANGE, //8
|
||||
CR_YELLOW, //9
|
||||
CR_BLUE2, //10 // proff
|
||||
CR_LIMIT //11 //jff 2/27/98 added for range check
|
||||
} crange_idx_e;
|
||||
//jff 1/16/98 end palette color range additions
|
||||
|
||||
#define CR_DEFAULT CR_RED /* default value for out of range colors */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t *data; // pointer to the screen content
|
||||
// short width; // the width of the surface
|
||||
// short height; // the height of the surface, used when mallocing
|
||||
} screeninfo_t;
|
||||
|
||||
#define NUM_SCREENS 1
|
||||
|
||||
// V_FillRect
|
||||
void V_FillRect(int x, int y, int width, int height, byte colour);
|
||||
|
||||
// CPhipps - patch drawing
|
||||
// Consolidated into the 3 really useful functions:
|
||||
|
||||
// V_DrawNumPatch - Draws the patch from lump num
|
||||
void V_DrawNumPatch(int x, int y, int scrn, int lump, int cm, enum patch_translation_e flags);
|
||||
|
||||
void V_DrawPatch(int x, int y, int scrn, const patch_t *patch);
|
||||
|
||||
void V_DrawPatchXScale(int x, int y, const patch_t *patch);
|
||||
void V_DrawPatchNoScale(int x, int y, const patch_t *patch);
|
||||
|
||||
// V_DrawNamePatch - Draws the patch from lump "name"
|
||||
#define V_DrawNamePatch(x,y,s,n,t,f) V_DrawNumPatch(x,y,s,W_GetNumForName(n),t,f)
|
||||
|
||||
/* cph -
|
||||
* Functions to return width & height of a patch.
|
||||
* Doesn't really belong here, but is often used in conjunction with
|
||||
* this code.
|
||||
*/
|
||||
#define V_NamePatchWidth(name) R_NumPatchWidth(W_GetNumForName(name))
|
||||
#define V_NamePatchHeight(name) R_NumPatchHeight(W_GetNumForName(name))
|
||||
|
||||
/* cphipps 10/99: function to tile a flat over the screen */
|
||||
void V_DrawBackground(const char *flatname);
|
||||
|
||||
// CPhipps - function to set the palette to palette number pal.
|
||||
void V_SetPalette(int pal);
|
||||
|
||||
// Kippykip - Multiple colour corrected palettes
|
||||
void V_SetPalLump(int pal);
|
||||
|
||||
// CPhipps - function to plot a pixel
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int x, y;
|
||||
} fpoint_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
fpoint_t a, b;
|
||||
} fline_t;
|
||||
|
||||
// V_DrawLine
|
||||
void V_DrawLine(fline_t *fl, int color);
|
||||
//
|
||||
extern const byte gammatable[5][256];
|
||||
|
||||
#endif
|
||||
@@ -1,50 +1,50 @@
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Doom version indicators.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __DOOMVERSION__
|
||||
#define __DOOMVERSION__
|
||||
|
||||
extern const char version_date[];
|
||||
|
||||
#endif
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Doom version indicators.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __DOOMVERSION__
|
||||
#define __DOOMVERSION__
|
||||
|
||||
extern const char version_date[];
|
||||
|
||||
#endif
|
||||
+167
-167
@@ -1,167 +1,167 @@
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* WAD I/O functions.
|
||||
* next-hack: important data internal flash caching functions.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __W_WAD__
|
||||
#define __W_WAD__
|
||||
|
||||
#include "doomtype.h"
|
||||
#include <stdint.h>
|
||||
#include "st_stuff.h"
|
||||
#include "r_defs.h"
|
||||
#include "i_memory.h"
|
||||
//
|
||||
// TYPES
|
||||
//
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char identification[4]; // Should be "IWAD" or "PWAD".
|
||||
int numlumps;
|
||||
int infotableofs;
|
||||
} wadinfo_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int filepos;
|
||||
int size;
|
||||
char name[8];
|
||||
} filelump_t;
|
||||
|
||||
// killough 4/17/98: if W_CheckNumForName() called with only
|
||||
// one argument, pass ns_global as the default namespace
|
||||
typedef struct
|
||||
{
|
||||
uint32_t dataLength;
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
uint32_t map :16;
|
||||
uint32_t episode :16;
|
||||
};
|
||||
uint32_t mapEpisode;
|
||||
};
|
||||
void **lumpAddressTable;
|
||||
uint32_t numvertex;
|
||||
vertex_t *vertexes;
|
||||
uint32_t numsegs;
|
||||
seg_t *segs;
|
||||
int numnodes;
|
||||
mapnode_t *nodes;
|
||||
int numlines;
|
||||
line_t *lines;
|
||||
int numsides;
|
||||
short *blockmaplump;
|
||||
side_t *sides;
|
||||
byte *rejectmatrix;
|
||||
uint32_t data[0]; // textures, flats,
|
||||
} wad_level_flash_data_t;
|
||||
typedef struct
|
||||
{
|
||||
uint32_t wadCRC;
|
||||
uint32_t wadSize;
|
||||
uint32_t immutableDataCRC;
|
||||
uint32_t immutableDataLength; // including this structure
|
||||
wadinfo_t wadHeader;
|
||||
uint32_t numsprites;
|
||||
spritedef_t *sprites;
|
||||
uint8_t *palette_lump;
|
||||
lighttable_t *colormaps;
|
||||
uint32_t *soundLumps;
|
||||
uint32_t numtextures;
|
||||
fixed_t *textureheight;
|
||||
short *switchlist;
|
||||
patchsizeoffsets_t *patchLumpSizeOffsets;
|
||||
// 0-9, tall numbers
|
||||
const patch_t *tallnum[10];
|
||||
// 0-9, short, yellow (,different!) numbers
|
||||
const patch_t *shortnum[10];
|
||||
// tall % sign
|
||||
const patch_t *tallpercent;
|
||||
const patch_t *keys[NUMCARDS];
|
||||
// face status patches
|
||||
const patch_t *faces[ST_NUMFACES]; // >160 bytes wasted...
|
||||
// weapon ownership patches
|
||||
const patch_t *arms[6][2];
|
||||
wad_level_flash_data_t *levelData;
|
||||
// after this, immutable data:
|
||||
// playpal, and some TBD
|
||||
uint32_t data[0];
|
||||
} wad_immutable_flash_data_t;
|
||||
extern wad_immutable_flash_data_t *p_wad_immutable_flash_data;
|
||||
extern wad_level_flash_data_t *p_wad_level_flash_data;
|
||||
void W_Init(void); // CPhipps - uses the above array
|
||||
|
||||
int PUREFUNC W_CheckNumForName(const char *name); // killough 4/17/98
|
||||
int PUREFUNC W_GetNumForName(const char *name);
|
||||
const char* PUREFUNC W_GetNameForNum(int lump);
|
||||
|
||||
int PUREFUNC W_LumpLength(int lump);
|
||||
|
||||
// CPhipps - modified for 'new' lump locking
|
||||
const void* /*PUREFUNC*/W_CacheLumpNum(int lump);
|
||||
|
||||
// CPhipps - convenience macros
|
||||
#define W_CacheLumpName(name) W_CacheLumpNum(W_GetNumForName(name))
|
||||
/*static inline void *W_CacheLumpName(char * name)
|
||||
{
|
||||
printf("Caching name %s\r\n", name);
|
||||
return W_CacheLumpNum(W_GetNumForName(name));
|
||||
}*/
|
||||
void ExtractFileBase(const char*, char*); // killough
|
||||
// next-hack additions
|
||||
void initLumpPtrTable(void);
|
||||
void* writeLumpToFlashRegion(int lumpnum, uint8_t flashRegion, boolean updateSize);
|
||||
void* writeBufferToFlashRegion(void *buffer, int size, uint8_t flashRegion, boolean updateSize);
|
||||
int getUserFlashRegionRemainingSpace();
|
||||
void getFileLumpByNum(int n, filelump_t *fl);
|
||||
void initImmutableFlashRegion();
|
||||
void* getAddressOrCacheLumpNum(int lump, boolean storeInFlash, uint8_t flashRegion);
|
||||
void** storeLumpArrayToFlash(boolean levelChanged);
|
||||
void* storeFlashImmutableValues();
|
||||
void* storeLevelValues(boolean levelChanged);
|
||||
wad_level_flash_data_t* initLevelFlashRegion();
|
||||
extern void **lumpPtrArray;
|
||||
#endif
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* WAD I/O functions.
|
||||
* next-hack: important data internal flash caching functions.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __W_WAD__
|
||||
#define __W_WAD__
|
||||
|
||||
#include "doomtype.h"
|
||||
#include <stdint.h>
|
||||
#include "st_stuff.h"
|
||||
#include "r_defs.h"
|
||||
#include "i_memory.h"
|
||||
//
|
||||
// TYPES
|
||||
//
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char identification[4]; // Should be "IWAD" or "PWAD".
|
||||
int numlumps;
|
||||
int infotableofs;
|
||||
} wadinfo_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int filepos;
|
||||
int size;
|
||||
char name[8];
|
||||
} filelump_t;
|
||||
|
||||
// killough 4/17/98: if W_CheckNumForName() called with only
|
||||
// one argument, pass ns_global as the default namespace
|
||||
typedef struct
|
||||
{
|
||||
uint32_t dataLength;
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
uint32_t map :16;
|
||||
uint32_t episode :16;
|
||||
};
|
||||
uint32_t mapEpisode;
|
||||
};
|
||||
void **lumpAddressTable;
|
||||
uint32_t numvertex;
|
||||
vertex_t *vertexes;
|
||||
uint32_t numsegs;
|
||||
seg_t *segs;
|
||||
int numnodes;
|
||||
mapnode_t *nodes;
|
||||
int numlines;
|
||||
line_t *lines;
|
||||
int numsides;
|
||||
short *blockmaplump;
|
||||
side_t *sides;
|
||||
byte *rejectmatrix;
|
||||
uint32_t data[0]; // textures, flats,
|
||||
} wad_level_flash_data_t;
|
||||
typedef struct
|
||||
{
|
||||
uint32_t wadCRC;
|
||||
uint32_t wadSize;
|
||||
uint32_t immutableDataCRC;
|
||||
uint32_t immutableDataLength; // including this structure
|
||||
wadinfo_t wadHeader;
|
||||
uint32_t numsprites;
|
||||
spritedef_t *sprites;
|
||||
uint8_t *palette_lump;
|
||||
lighttable_t *colormaps;
|
||||
uint32_t *soundLumps;
|
||||
uint32_t numtextures;
|
||||
fixed_t *textureheight;
|
||||
short *switchlist;
|
||||
patchsizeoffsets_t *patchLumpSizeOffsets;
|
||||
// 0-9, tall numbers
|
||||
const patch_t *tallnum[10];
|
||||
// 0-9, short, yellow (,different!) numbers
|
||||
const patch_t *shortnum[10];
|
||||
// tall % sign
|
||||
const patch_t *tallpercent;
|
||||
const patch_t *keys[NUMCARDS];
|
||||
// face status patches
|
||||
const patch_t *faces[ST_NUMFACES]; // >160 bytes wasted...
|
||||
// weapon ownership patches
|
||||
const patch_t *arms[6][2];
|
||||
wad_level_flash_data_t *levelData;
|
||||
// after this, immutable data:
|
||||
// playpal, and some TBD
|
||||
uint32_t data[0];
|
||||
} wad_immutable_flash_data_t;
|
||||
extern wad_immutable_flash_data_t *p_wad_immutable_flash_data;
|
||||
extern wad_level_flash_data_t *p_wad_level_flash_data;
|
||||
void W_Init(void); // CPhipps - uses the above array
|
||||
|
||||
int PUREFUNC W_CheckNumForName(const char *name); // killough 4/17/98
|
||||
int PUREFUNC W_GetNumForName(const char *name);
|
||||
const char* PUREFUNC W_GetNameForNum(int lump);
|
||||
|
||||
int PUREFUNC W_LumpLength(int lump);
|
||||
|
||||
// CPhipps - modified for 'new' lump locking
|
||||
const void* /*PUREFUNC*/W_CacheLumpNum(int lump);
|
||||
|
||||
// CPhipps - convenience macros
|
||||
#define W_CacheLumpName(name) W_CacheLumpNum(W_GetNumForName(name))
|
||||
/*static inline void *W_CacheLumpName(char * name)
|
||||
{
|
||||
printf("Caching name %s\r\n", name);
|
||||
return W_CacheLumpNum(W_GetNumForName(name));
|
||||
}*/
|
||||
void ExtractFileBase(const char*, char*); // killough
|
||||
// next-hack additions
|
||||
void initLumpPtrTable(void);
|
||||
void* writeLumpToFlashRegion(int lumpnum, uint8_t flashRegion, boolean updateSize);
|
||||
void* writeBufferToFlashRegion(void *buffer, int size, uint8_t flashRegion, boolean updateSize);
|
||||
int getUserFlashRegionRemainingSpace();
|
||||
void getFileLumpByNum(int n, filelump_t *fl);
|
||||
void initImmutableFlashRegion();
|
||||
void* getAddressOrCacheLumpNum(int lump, boolean storeInFlash, uint8_t flashRegion);
|
||||
void** storeLumpArrayToFlash(boolean levelChanged);
|
||||
void* storeFlashImmutableValues();
|
||||
void* storeLevelValues(boolean levelChanged);
|
||||
wad_level_flash_data_t* initLevelFlashRegion();
|
||||
extern void **lumpPtrArray;
|
||||
#endif
|
||||
@@ -1,76 +1,76 @@
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Intermission screens.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __WI_STUFF__
|
||||
#define __WI_STUFF__
|
||||
|
||||
//#include "v_video.h"
|
||||
|
||||
#include "doomdef.h"
|
||||
|
||||
// States for the intermission
|
||||
|
||||
typedef enum
|
||||
{
|
||||
NoState = -1, StatCount, ShowNextLoc
|
||||
|
||||
} stateenum_t;
|
||||
|
||||
// called by the initialization
|
||||
void WI_Init(void);
|
||||
|
||||
// Called by main loop, animate the intermission.
|
||||
void WI_Ticker(void);
|
||||
|
||||
// Called by main loop,
|
||||
// draws the intermission directly into the screen buffer.
|
||||
void WI_Drawer(void);
|
||||
|
||||
// Setup for an intermission screen.
|
||||
void WI_Start(wbstartstruct_t *wbstartstruct);
|
||||
|
||||
// Release intermission screen memory
|
||||
void WI_End(void);
|
||||
|
||||
#endif
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Intermission screens.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __WI_STUFF__
|
||||
#define __WI_STUFF__
|
||||
|
||||
//#include "v_video.h"
|
||||
|
||||
#include "doomdef.h"
|
||||
|
||||
// States for the intermission
|
||||
|
||||
typedef enum
|
||||
{
|
||||
NoState = -1, StatCount, ShowNextLoc
|
||||
|
||||
} stateenum_t;
|
||||
|
||||
// called by the initialization
|
||||
void WI_Init(void);
|
||||
|
||||
// Called by main loop, animate the intermission.
|
||||
void WI_Ticker(void);
|
||||
|
||||
// Called by main loop,
|
||||
// draws the intermission directly into the screen buffer.
|
||||
void WI_Drawer(void);
|
||||
|
||||
// Setup for an intermission screen.
|
||||
void WI_Start(wbstartstruct_t *wbstartstruct);
|
||||
|
||||
// Release intermission screen memory
|
||||
void WI_End(void);
|
||||
|
||||
#endif
|
||||
@@ -1,67 +1,67 @@
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Block memory allocator
|
||||
* This is designed to be a fast allocator for small, regularly used block sizes
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
struct block_memory_alloc_s
|
||||
{
|
||||
void *firstpool;
|
||||
// size_t size;
|
||||
// size_t perpool;
|
||||
// int tag;
|
||||
unsigned short size;
|
||||
unsigned short perpool :11;
|
||||
unsigned short tag :5;
|
||||
// const char *desc;
|
||||
};
|
||||
|
||||
#define DECLARE_BLOCK_MEMORY_ALLOC_ZONE(name) extern struct block_memory_alloc_s name
|
||||
#define IMPLEMENT_BLOCK_MEMORY_ALLOC_ZONE(name, size, tag, num, desc) \
|
||||
struct block_memory_alloc_s name = { NULL, size, num, tag}
|
||||
#define NULL_BLOCK_MEMORY_ALLOC_ZONE(name) name.firstpool = NULL
|
||||
|
||||
DECLARE_BLOCK_MEMORY_ALLOC_ZONE(mobjzone);
|
||||
DECLARE_BLOCK_MEMORY_ALLOC_ZONE(static_mobjzone);
|
||||
|
||||
void* Z_BMalloc(struct block_memory_alloc_s *pzone);
|
||||
|
||||
boolean Z_BFree(struct block_memory_alloc_s *pzone, void *p);
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Block memory allocator
|
||||
* This is designed to be a fast allocator for small, regularly used block sizes
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
struct block_memory_alloc_s
|
||||
{
|
||||
void *firstpool;
|
||||
// size_t size;
|
||||
// size_t perpool;
|
||||
// int tag;
|
||||
unsigned short size;
|
||||
unsigned short perpool :11;
|
||||
unsigned short tag :5;
|
||||
// const char *desc;
|
||||
};
|
||||
|
||||
#define DECLARE_BLOCK_MEMORY_ALLOC_ZONE(name) extern struct block_memory_alloc_s name
|
||||
#define IMPLEMENT_BLOCK_MEMORY_ALLOC_ZONE(name, size, tag, num, desc) \
|
||||
struct block_memory_alloc_s name = { NULL, size, num, tag}
|
||||
#define NULL_BLOCK_MEMORY_ALLOC_ZONE(name) name.firstpool = NULL
|
||||
|
||||
DECLARE_BLOCK_MEMORY_ALLOC_ZONE(mobjzone);
|
||||
DECLARE_BLOCK_MEMORY_ALLOC_ZONE(static_mobjzone);
|
||||
|
||||
void* Z_BMalloc(struct block_memory_alloc_s *pzone);
|
||||
|
||||
boolean Z_BFree(struct block_memory_alloc_s *pzone, void *p);
|
||||
@@ -1,125 +1,125 @@
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Zone Memory Allocation, perhaps NeXT ObjectiveC inspired.
|
||||
* Remark: this was the only stuff that, according
|
||||
* to John Carmack, might have been useful for
|
||||
* Quake.
|
||||
*
|
||||
* Rewritten by Lee Killough, though, since it was not efficient enough.
|
||||
*
|
||||
* Restored back to its original form by Nicola Wrachien and optimized,
|
||||
* as it was not memory efficient enough (see zone.c).
|
||||
*
|
||||
*---------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __Z_ZONE__
|
||||
#define __Z_ZONE__
|
||||
|
||||
#ifndef __GNUC__
|
||||
#define __attribute__(x)
|
||||
#endif
|
||||
|
||||
// Include system definitions so that prototypes become
|
||||
// active before macro replacements below are in effect.
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
//#include <assert.h>
|
||||
#define STRINGIFY(x) #x
|
||||
#define TOSTRING(x) STRINGIFY(x)
|
||||
|
||||
// ZONE MEMORY
|
||||
// PU - purge tags.
|
||||
|
||||
enum
|
||||
{
|
||||
PU_FREE, PU_STATIC, /*PU_SOUND, PU_MUSIC,*/PU_LEVEL, PU_LEVSPEC, /*PU_CACHE,*/
|
||||
/* Must always be last -- killough */PU_MAX
|
||||
};
|
||||
|
||||
#define PU_PURGELEVEL PU_MAX /* First purgable tag's level */
|
||||
|
||||
#define DA(x,y)
|
||||
#define DAC(x,y)
|
||||
|
||||
void* (Z_Malloc2)(int size, int tag, void **ptr, const char *sz DA(const char *, int));
|
||||
void (Z_Free)(void *ptr DA(const char *, int));
|
||||
void (Z_FreeTags)(int lowtag, int hightag DA(const char *, int));
|
||||
void (Z_ChangeTag)(void *ptr, int tag DA(const char *, int));
|
||||
void (Z_Init)(void);
|
||||
void Z_Close(void);
|
||||
void* (Z_Calloc)(size_t n, size_t n2, int tag, void **user DA(const char *, int));
|
||||
void* (Z_Realloc)(void *p, size_t n, int tag, void **user DA(const char *, int));
|
||||
char* (Z_Strdup)(const char *s, int tag, void **user DA(const char *, int));
|
||||
void (Z_CheckHeap)(DAC(const char *,int)); // killough 3/22/98: add file/line info
|
||||
void Z_DumpHistory(char*);
|
||||
|
||||
#define Z_Malloc(n, tag, u) Z_Malloc2(n, tag, u, TOSTRING(n) )
|
||||
/* cphipps 2001/11/18 -
|
||||
* If we're using memory mapped file access to WADs, we won't need to maintain
|
||||
* our own heap. So we *could* let "normal" malloc users use the libc malloc
|
||||
* directly, for efficiency. Except we do need a wrapper to handle out of memory
|
||||
* errors... damn, ok, we'll leave it for now.
|
||||
*/
|
||||
#ifndef HAVE_LIBDMALLOC
|
||||
// Remove all definitions before including system definitions
|
||||
//
|
||||
#undef malloc
|
||||
#undef free
|
||||
#undef realloc
|
||||
#undef calloc
|
||||
#undef strdup
|
||||
|
||||
#define malloc(n) Z_Malloc(n,PU_STATIC,0)
|
||||
#define free(p) Z_Free(p)
|
||||
#define realloc(p,n) Z_Realloc(p,n,PU_STATIC,0)
|
||||
#define calloc(n1,n2) Z_Calloc(n1,n2,PU_STATIC,0)
|
||||
#define strdup(s) Z_Strdup(s,PU_STATIC,0)
|
||||
|
||||
#endif
|
||||
|
||||
void Z_ZoneHistory(char*);
|
||||
|
||||
#endif
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Zone Memory Allocation, perhaps NeXT ObjectiveC inspired.
|
||||
* Remark: this was the only stuff that, according
|
||||
* to John Carmack, might have been useful for
|
||||
* Quake.
|
||||
*
|
||||
* Rewritten by Lee Killough, though, since it was not efficient enough.
|
||||
*
|
||||
* Restored back to its original form by Nicola Wrachien and optimized,
|
||||
* as it was not memory efficient enough (see zone.c).
|
||||
*
|
||||
*---------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __Z_ZONE__
|
||||
#define __Z_ZONE__
|
||||
|
||||
#ifndef __GNUC__
|
||||
#define __attribute__(x)
|
||||
#endif
|
||||
|
||||
// Include system definitions so that prototypes become
|
||||
// active before macro replacements below are in effect.
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
//#include <assert.h>
|
||||
#define STRINGIFY(x) #x
|
||||
#define TOSTRING(x) STRINGIFY(x)
|
||||
|
||||
// ZONE MEMORY
|
||||
// PU - purge tags.
|
||||
|
||||
enum
|
||||
{
|
||||
PU_FREE, PU_STATIC, /*PU_SOUND, PU_MUSIC,*/PU_LEVEL, PU_LEVSPEC, /*PU_CACHE,*/
|
||||
/* Must always be last -- killough */PU_MAX
|
||||
};
|
||||
|
||||
#define PU_PURGELEVEL PU_MAX /* First purgable tag's level */
|
||||
|
||||
#define DA(x,y)
|
||||
#define DAC(x,y)
|
||||
|
||||
void* (Z_Malloc2)(int size, int tag, void **ptr, const char *sz DA(const char *, int));
|
||||
void (Z_Free)(void *ptr DA(const char *, int));
|
||||
void (Z_FreeTags)(int lowtag, int hightag DA(const char *, int));
|
||||
void (Z_ChangeTag)(void *ptr, int tag DA(const char *, int));
|
||||
void (Z_Init)(void);
|
||||
void Z_Close(void);
|
||||
void* (Z_Calloc)(size_t n, size_t n2, int tag, void **user DA(const char *, int));
|
||||
void* (Z_Realloc)(void *p, size_t n, int tag, void **user DA(const char *, int));
|
||||
char* (Z_Strdup)(const char *s, int tag, void **user DA(const char *, int));
|
||||
void (Z_CheckHeap)(DAC(const char *,int)); // killough 3/22/98: add file/line info
|
||||
void Z_DumpHistory(char*);
|
||||
|
||||
#define Z_Malloc(n, tag, u) Z_Malloc2(n, tag, u, TOSTRING(n) )
|
||||
/* cphipps 2001/11/18 -
|
||||
* If we're using memory mapped file access to WADs, we won't need to maintain
|
||||
* our own heap. So we *could* let "normal" malloc users use the libc malloc
|
||||
* directly, for efficiency. Except we do need a wrapper to handle out of memory
|
||||
* errors... damn, ok, we'll leave it for now.
|
||||
*/
|
||||
#ifndef HAVE_LIBDMALLOC
|
||||
// Remove all definitions before including system definitions
|
||||
//
|
||||
#undef malloc
|
||||
#undef free
|
||||
#undef realloc
|
||||
#undef calloc
|
||||
#undef strdup
|
||||
|
||||
#define malloc(n) Z_Malloc(n,PU_STATIC,0)
|
||||
#define free(p) Z_Free(p)
|
||||
#define realloc(p,n) Z_Realloc(p,n,PU_STATIC,0)
|
||||
#define calloc(n1,n2) Z_Calloc(n1,n2,PU_STATIC,0)
|
||||
#define strdup(s) Z_Strdup(s,PU_STATIC,0)
|
||||
|
||||
#endif
|
||||
|
||||
void Z_ZoneHistory(char*);
|
||||
|
||||
#endif
|
||||
+1086
-1086
File diff suppressed because it is too large.
Load diff
@@ -1,168 +1,168 @@
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* next-hack: On this port no multplayer is supported.
|
||||
* Here we use the display-buffer (15kB) as stack, so we
|
||||
* do not need to worry for stack overflows at least when dealing
|
||||
* with Doom game-logic handling.
|
||||
*
|
||||
*-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_WAIT_H
|
||||
#include <sys/wait.h>
|
||||
#endif
|
||||
|
||||
#include "doomtype.h"
|
||||
#include "doomstat.h"
|
||||
#include "d_net.h"
|
||||
#include "z_zone.h"
|
||||
|
||||
#include "d_main.h"
|
||||
#include "g_game.h"
|
||||
#include "m_menu.h"
|
||||
|
||||
#include "protocol.h"
|
||||
#include "i_network.h"
|
||||
#include "i_system.h"
|
||||
#include "i_main.h"
|
||||
#include "i_video.h"
|
||||
#include "lprintf.h"
|
||||
|
||||
#include "global_data.h"
|
||||
#include "graphics.h"
|
||||
void D_InitNetGame(void)
|
||||
{
|
||||
_g->playeringame = true;
|
||||
}
|
||||
|
||||
void D_BuildNewTiccmds(void)
|
||||
{
|
||||
int newtics = I_GetTime() - _g->lastmadetic;
|
||||
_g->lastmadetic += newtics;
|
||||
|
||||
while (newtics--)
|
||||
{
|
||||
I_StartTic();
|
||||
if (_g->maketic - _g->gametic > 3)
|
||||
break;
|
||||
|
||||
G_BuildTiccmd(&_g->netcmd);
|
||||
_g->maketic++;
|
||||
}
|
||||
}
|
||||
|
||||
void TryRunTics2(void)
|
||||
{
|
||||
int runtics;
|
||||
int entertime = I_GetTime();
|
||||
|
||||
// Wait for tics to run
|
||||
static int plog_tr; int plog_b = 0;
|
||||
if (plog_tr < 3) PLOG(0x300 + plog_tr * 0x10);
|
||||
while (1)
|
||||
{
|
||||
D_BuildNewTiccmds();
|
||||
if (plog_tr < 3 && !plog_b) { PLOG(0x301 + plog_tr * 0x10); plog_b = 1; }
|
||||
|
||||
runtics = (_g->maketic) - _g->gametic;
|
||||
if (runtics <= 0)
|
||||
{
|
||||
if (I_GetTime() - entertime > 10)
|
||||
{
|
||||
M_Ticker();
|
||||
if (plog_tr < 3) { PLOG(0x30F + plog_tr * 0x10); plog_tr++; }
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
while (runtics-- > 0)
|
||||
{
|
||||
|
||||
if (_g->advancedemo)
|
||||
D_DoAdvanceDemo();
|
||||
if (plog_tr < 3) PLOG(0x302 + plog_tr * 0x10);
|
||||
M_Ticker();
|
||||
if (plog_tr < 3) PLOG(0x303 + plog_tr * 0x10);
|
||||
G_Ticker();
|
||||
if (plog_tr < 3) PLOG(0x304 + plog_tr * 0x10);
|
||||
|
||||
_g->gametic++;
|
||||
}
|
||||
if (plog_tr < 3) plog_tr++;
|
||||
}
|
||||
void TryRunTics(void)
|
||||
{
|
||||
#ifdef NO_STACK_SWITCH
|
||||
/* v0.1.9: game loop on the normal stack in SRAM instead of in the framebuffer (RAM20) */
|
||||
TryRunTics2();
|
||||
return;
|
||||
#endif
|
||||
// "displayData.displayFrameBuffer[displayData.workingBuffer]" is a very large buffer, which will be modified
|
||||
// by the game rendering AFTER the game logic has been called, and for sure is not the one used by the DMA.
|
||||
// Why not using it as stack ?
|
||||
// Note, why "-SCREEN_WIDTH * ST_HEIGHT - 4"? Because in this way, when the status bar does not need an update (i.e. no change in ammo, health, etc.)
|
||||
// we can avoid redrawing it, saving a lot of time.
|
||||
__asm volatile
|
||||
(
|
||||
"STR SP, [%[newStack]], #-4\n\t"
|
||||
"MOV SP, %[newStack]\n\t"
|
||||
: : [newStack] "r" ((uint8_t*) displayData.displayFrameBuffer[displayData.workingBuffer] + sizeof(displayData.displayFrameBuffer[0]) - SCREENWIDTH * ST_HEIGHT - 4)
|
||||
);
|
||||
// actually run doom game
|
||||
TryRunTics2();
|
||||
// restore stack
|
||||
__asm volatile
|
||||
(
|
||||
"LDR SP, [%[newStack]]\n\t"
|
||||
: : [newStack] "r" ((uint8_t*) displayData.displayFrameBuffer[displayData.workingBuffer] + sizeof(displayData.displayFrameBuffer[0]) - SCREENWIDTH * ST_HEIGHT - 4)
|
||||
);
|
||||
|
||||
}
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* next-hack: On this port no multplayer is supported.
|
||||
* Here we use the display-buffer (15kB) as stack, so we
|
||||
* do not need to worry for stack overflows at least when dealing
|
||||
* with Doom game-logic handling.
|
||||
*
|
||||
*-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_WAIT_H
|
||||
#include <sys/wait.h>
|
||||
#endif
|
||||
|
||||
#include "doomtype.h"
|
||||
#include "doomstat.h"
|
||||
#include "d_net.h"
|
||||
#include "z_zone.h"
|
||||
|
||||
#include "d_main.h"
|
||||
#include "g_game.h"
|
||||
#include "m_menu.h"
|
||||
|
||||
#include "protocol.h"
|
||||
#include "i_network.h"
|
||||
#include "i_system.h"
|
||||
#include "i_main.h"
|
||||
#include "i_video.h"
|
||||
#include "lprintf.h"
|
||||
|
||||
#include "global_data.h"
|
||||
#include "graphics.h"
|
||||
void D_InitNetGame(void)
|
||||
{
|
||||
_g->playeringame = true;
|
||||
}
|
||||
|
||||
void D_BuildNewTiccmds(void)
|
||||
{
|
||||
int newtics = I_GetTime() - _g->lastmadetic;
|
||||
_g->lastmadetic += newtics;
|
||||
|
||||
while (newtics--)
|
||||
{
|
||||
I_StartTic();
|
||||
if (_g->maketic - _g->gametic > 3)
|
||||
break;
|
||||
|
||||
G_BuildTiccmd(&_g->netcmd);
|
||||
_g->maketic++;
|
||||
}
|
||||
}
|
||||
|
||||
void TryRunTics2(void)
|
||||
{
|
||||
int runtics;
|
||||
int entertime = I_GetTime();
|
||||
|
||||
// Wait for tics to run
|
||||
static int plog_tr; int plog_b = 0;
|
||||
if (plog_tr < 3) PLOG(0x300 + plog_tr * 0x10);
|
||||
while (1)
|
||||
{
|
||||
D_BuildNewTiccmds();
|
||||
if (plog_tr < 3 && !plog_b) { PLOG(0x301 + plog_tr * 0x10); plog_b = 1; }
|
||||
|
||||
runtics = (_g->maketic) - _g->gametic;
|
||||
if (runtics <= 0)
|
||||
{
|
||||
if (I_GetTime() - entertime > 10)
|
||||
{
|
||||
M_Ticker();
|
||||
if (plog_tr < 3) { PLOG(0x30F + plog_tr * 0x10); plog_tr++; }
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
while (runtics-- > 0)
|
||||
{
|
||||
|
||||
if (_g->advancedemo)
|
||||
D_DoAdvanceDemo();
|
||||
if (plog_tr < 3) PLOG(0x302 + plog_tr * 0x10);
|
||||
M_Ticker();
|
||||
if (plog_tr < 3) PLOG(0x303 + plog_tr * 0x10);
|
||||
G_Ticker();
|
||||
if (plog_tr < 3) PLOG(0x304 + plog_tr * 0x10);
|
||||
|
||||
_g->gametic++;
|
||||
}
|
||||
if (plog_tr < 3) plog_tr++;
|
||||
}
|
||||
void TryRunTics(void)
|
||||
{
|
||||
#ifdef NO_STACK_SWITCH
|
||||
/* v0.1.9: game loop on the normal stack in SRAM instead of in the framebuffer (RAM20) */
|
||||
TryRunTics2();
|
||||
return;
|
||||
#endif
|
||||
// "displayData.displayFrameBuffer[displayData.workingBuffer]" is a very large buffer, which will be modified
|
||||
// by the game rendering AFTER the game logic has been called, and for sure is not the one used by the DMA.
|
||||
// Why not using it as stack ?
|
||||
// Note, why "-SCREEN_WIDTH * ST_HEIGHT - 4"? Because in this way, when the status bar does not need an update (i.e. no change in ammo, health, etc.)
|
||||
// we can avoid redrawing it, saving a lot of time.
|
||||
__asm volatile
|
||||
(
|
||||
"STR SP, [%[newStack]], #-4\n\t"
|
||||
"MOV SP, %[newStack]\n\t"
|
||||
: : [newStack] "r" ((uint8_t*) displayData.displayFrameBuffer[displayData.workingBuffer] + sizeof(displayData.displayFrameBuffer[0]) - SCREENWIDTH * ST_HEIGHT - 4)
|
||||
);
|
||||
// actually run doom game
|
||||
TryRunTics2();
|
||||
// restore stack
|
||||
__asm volatile
|
||||
(
|
||||
"LDR SP, [%[newStack]]\n\t"
|
||||
: : [newStack] "r" ((uint8_t*) displayData.displayFrameBuffer[displayData.workingBuffer] + sizeof(displayData.displayFrameBuffer[0]) - SCREENWIDTH * ST_HEIGHT - 4)
|
||||
);
|
||||
|
||||
}
|
||||
@@ -1,81 +1,81 @@
|
||||
/* Emacs style mode select -*- C++ -*-
|
||||
*-----------------------------------------------------------------------------
|
||||
*
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Something to do with weapon sprite frames. Don't ask me.
|
||||
*
|
||||
*-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
// We are referring to sprite numbers.
|
||||
#include "doomtype.h"
|
||||
#include "info.h"
|
||||
|
||||
#include "d_items.h"
|
||||
|
||||
//
|
||||
// PSPRITE ACTIONS for waepons.
|
||||
// This struct controls the weapon animations.
|
||||
//
|
||||
// Each entry is:
|
||||
// ammo/amunition type
|
||||
// upstate
|
||||
// downstate
|
||||
// readystate
|
||||
// atkstate, i.e. attack/fire/hit frame
|
||||
// flashstate, muzzle flash
|
||||
//
|
||||
const weaponinfo_t weaponinfo[NUMWEAPONS] = {
|
||||
{// fist
|
||||
am_noammo, S_PUNCHUP, S_PUNCHDOWN, S_PUNCH, S_PUNCH1, S_NULL
|
||||
},
|
||||
{// pistol
|
||||
am_clip, S_PISTOLUP, S_PISTOLDOWN, S_PISTOL, S_PISTOL1, S_PISTOLFLASH
|
||||
},
|
||||
{// shotgun
|
||||
am_shell, S_SGUNUP, S_SGUNDOWN, S_SGUN, S_SGUN1, S_SGUNFLASH1
|
||||
},
|
||||
{// chaingun
|
||||
am_clip, S_CHAINUP, S_CHAINDOWN, S_CHAIN, S_CHAIN1, S_CHAINFLASH1
|
||||
},
|
||||
{// missile launcher
|
||||
am_misl, S_MISSILEUP, S_MISSILEDOWN, S_MISSILE, S_MISSILE1, S_MISSILEFLASH1
|
||||
},
|
||||
{// plasma rifle
|
||||
am_cell, S_PLASMAUP, S_PLASMADOWN, S_PLASMA, S_PLASMA1, S_PLASMAFLASH1
|
||||
},
|
||||
{// bfg 9000
|
||||
am_cell, S_BFGUP, S_BFGDOWN, S_BFG, S_BFG1, S_BFGFLASH1
|
||||
},
|
||||
{// chainsaw
|
||||
am_noammo, S_SAWUP, S_SAWDOWN, S_SAW, S_SAW1, S_NULL
|
||||
},
|
||||
{// super shotgun
|
||||
am_shell, S_DSGUNUP, S_DSGUNDOWN, S_DSGUN, S_DSGUN1, S_DSGUNFLASH1
|
||||
},
|
||||
/* Emacs style mode select -*- C++ -*-
|
||||
*-----------------------------------------------------------------------------
|
||||
*
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Something to do with weapon sprite frames. Don't ask me.
|
||||
*
|
||||
*-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
// We are referring to sprite numbers.
|
||||
#include "doomtype.h"
|
||||
#include "info.h"
|
||||
|
||||
#include "d_items.h"
|
||||
|
||||
//
|
||||
// PSPRITE ACTIONS for waepons.
|
||||
// This struct controls the weapon animations.
|
||||
//
|
||||
// Each entry is:
|
||||
// ammo/amunition type
|
||||
// upstate
|
||||
// downstate
|
||||
// readystate
|
||||
// atkstate, i.e. attack/fire/hit frame
|
||||
// flashstate, muzzle flash
|
||||
//
|
||||
const weaponinfo_t weaponinfo[NUMWEAPONS] = {
|
||||
{// fist
|
||||
am_noammo, S_PUNCHUP, S_PUNCHDOWN, S_PUNCH, S_PUNCH1, S_NULL
|
||||
},
|
||||
{// pistol
|
||||
am_clip, S_PISTOLUP, S_PISTOLDOWN, S_PISTOL, S_PISTOL1, S_PISTOLFLASH
|
||||
},
|
||||
{// shotgun
|
||||
am_shell, S_SGUNUP, S_SGUNDOWN, S_SGUN, S_SGUN1, S_SGUNFLASH1
|
||||
},
|
||||
{// chaingun
|
||||
am_clip, S_CHAINUP, S_CHAINDOWN, S_CHAIN, S_CHAIN1, S_CHAINFLASH1
|
||||
},
|
||||
{// missile launcher
|
||||
am_misl, S_MISSILEUP, S_MISSILEDOWN, S_MISSILE, S_MISSILE1, S_MISSILEFLASH1
|
||||
},
|
||||
{// plasma rifle
|
||||
am_cell, S_PLASMAUP, S_PLASMADOWN, S_PLASMA, S_PLASMA1, S_PLASMAFLASH1
|
||||
},
|
||||
{// bfg 9000
|
||||
am_cell, S_BFGUP, S_BFGDOWN, S_BFG, S_BFG1, S_BFGFLASH1
|
||||
},
|
||||
{// chainsaw
|
||||
am_noammo, S_SAWUP, S_SAWDOWN, S_SAW, S_SAW1, S_NULL
|
||||
},
|
||||
{// super shotgun
|
||||
am_shell, S_DSGUNUP, S_DSGUNDOWN, S_DSGUN, S_DSGUN1, S_DSGUNFLASH1
|
||||
},
|
||||
};
|
||||
+981
-981
File diff suppressed because it is too large.
Load diff
@@ -1,54 +1,54 @@
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* wad pointers.
|
||||
*
|
||||
*/
|
||||
#pragma GCC optimize ("-O0")
|
||||
#include "w_wad.h"
|
||||
#include "doom_iwad.h"
|
||||
#ifdef DOOM_FREE
|
||||
const unsigned char *doom_iwad; /* set at start from the settings block */
|
||||
const unsigned int *p_doom_iwad_len;
|
||||
#else
|
||||
const unsigned char *doom_iwad = (const unsigned char*) WAD_ADDRESS;
|
||||
const unsigned int *p_doom_iwad_len = (const unsigned int*) (WAD_ADDRESS - 4);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* wad pointers.
|
||||
*
|
||||
*/
|
||||
#pragma GCC optimize ("-O0")
|
||||
#include "w_wad.h"
|
||||
#include "doom_iwad.h"
|
||||
#ifdef DOOM_FREE
|
||||
const unsigned char *doom_iwad; /* set at start from the settings block */
|
||||
const unsigned int *p_doom_iwad_len;
|
||||
#else
|
||||
const unsigned char *doom_iwad = (const unsigned char*) WAD_ADDRESS;
|
||||
const unsigned int *p_doom_iwad_len = (const unsigned int*) (WAD_ADDRESS - 4);
|
||||
#endif
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
+158
-158
@@ -1,159 +1,159 @@
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Mission begin melt/wipe screen special effect.
|
||||
* next-hack: the GBA doom port removed the screen melt effect, so the
|
||||
* wipe has been reduced now to a stub function.
|
||||
* I will probably remove all the functions and variables too sooner or later.
|
||||
*
|
||||
*-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "doomdef.h"
|
||||
#include "f_wipe.h"
|
||||
#include "global_data.h"
|
||||
#include "graphics.h"
|
||||
#include "i_video.h"
|
||||
#include "m_random.h"
|
||||
#include "v_video.h"
|
||||
#include "z_zone.h"
|
||||
//
|
||||
// SCREEN WIPE PACKAGE
|
||||
//
|
||||
|
||||
int wipe_StartScreen(void)
|
||||
{
|
||||
_g->wipe_tick = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int wipe_EndScreen(void)
|
||||
{
|
||||
_g->wipe_tick = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// oh man, why aren't you commenting anything ?
|
||||
// 2021-08-08 next-hack: commented and modified to use the dual buffer.
|
||||
static int wipe_doMelt(int ticks, short *y_lookup)
|
||||
{
|
||||
boolean done = true;
|
||||
int i;
|
||||
while (ticks--)
|
||||
{
|
||||
for (i = 0; i < (SCREENWIDTH); i++)
|
||||
{
|
||||
if (y_lookup[i] < 0)
|
||||
{
|
||||
y_lookup[i]++;
|
||||
done = false;
|
||||
continue;
|
||||
}
|
||||
// scroll down columns, which are still visible
|
||||
if (y_lookup[i] < SCREENHEIGHT)
|
||||
{
|
||||
byte *s, *d;
|
||||
int j, k, dy;
|
||||
|
||||
/* cph 2001/07/29 -
|
||||
* The original melt rate was 8 pixels/sec, i.e. 25 frames to melt
|
||||
* the whole screen, so make the melt rate depend on SCREENHEIGHT
|
||||
* so it takes no longer in high res
|
||||
*/
|
||||
dy = (y_lookup[i] < 16) ? y_lookup[i] + 1 : SCREENHEIGHT / 25;
|
||||
// At most dy shall be so that the column is shifted by SCREENHEIGHT (i.e. just
|
||||
// invisible)
|
||||
if (y_lookup[i] + dy >= SCREENHEIGHT)
|
||||
dy = SCREENHEIGHT - y_lookup[i];
|
||||
s = &displayData.displayFrameBuffer[displayData.workingBuffer][i] +
|
||||
((SCREENHEIGHT - dy - 1) * SCREENPITCH);
|
||||
d = &displayData.displayFrameBuffer[displayData.workingBuffer][i] +
|
||||
((SCREENHEIGHT - 1) * SCREENPITCH);
|
||||
// scroll down the column. Of course we need to copy from the bottom... up to
|
||||
// SCREENHEIGHT - yLookup - dy
|
||||
for (j = SCREENHEIGHT - y_lookup[i] - dy; j; j--)
|
||||
{
|
||||
*d = *s;
|
||||
d += -SCREENPITCH;
|
||||
s += -SCREENPITCH;
|
||||
}
|
||||
// copy new screen. We need to copy only between y_lookup and + dy y_lookup
|
||||
s = &displayData.displayFrameBuffer[1 - displayData.workingBuffer][i] + y_lookup[i] * SCREENPITCH;
|
||||
d = &displayData.displayFrameBuffer[displayData.workingBuffer][i] + y_lookup[i] * SCREENPITCH;
|
||||
for (j = 0 ; j < dy; j++)
|
||||
{
|
||||
*d = *s;
|
||||
d += SCREENPITCH;
|
||||
s += SCREENPITCH;
|
||||
}
|
||||
y_lookup[i] += dy;
|
||||
done = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return done;
|
||||
}
|
||||
|
||||
void wipe_initMelt(short *y_lookup)
|
||||
{
|
||||
// setup initial column positions (y<0 => not ready to scroll yet)
|
||||
y_lookup[0] = -(M_Random() % 16);
|
||||
for (int i = 1; i < SCREENWIDTH; i++)
|
||||
{
|
||||
int r = (M_Random() % 3) - 1;
|
||||
y_lookup[i] = y_lookup[i - 1] + r;
|
||||
if (y_lookup[i] > 0)
|
||||
y_lookup[i] = 0;
|
||||
else if (y_lookup[i] == -16)
|
||||
y_lookup[i] = -15;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int wipe_ScreenWipe(int ticks, short *y_lookup)
|
||||
{
|
||||
// do a piece of wipe-in
|
||||
return wipe_doMelt(ticks, y_lookup);
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Mission begin melt/wipe screen special effect.
|
||||
* next-hack: the GBA doom port removed the screen melt effect, so the
|
||||
* wipe has been reduced now to a stub function.
|
||||
* I will probably remove all the functions and variables too sooner or later.
|
||||
*
|
||||
*-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "doomdef.h"
|
||||
#include "f_wipe.h"
|
||||
#include "global_data.h"
|
||||
#include "graphics.h"
|
||||
#include "i_video.h"
|
||||
#include "m_random.h"
|
||||
#include "v_video.h"
|
||||
#include "z_zone.h"
|
||||
//
|
||||
// SCREEN WIPE PACKAGE
|
||||
//
|
||||
|
||||
int wipe_StartScreen(void)
|
||||
{
|
||||
_g->wipe_tick = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int wipe_EndScreen(void)
|
||||
{
|
||||
_g->wipe_tick = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// oh man, why aren't you commenting anything ?
|
||||
// 2021-08-08 next-hack: commented and modified to use the dual buffer.
|
||||
static int wipe_doMelt(int ticks, short *y_lookup)
|
||||
{
|
||||
boolean done = true;
|
||||
int i;
|
||||
while (ticks--)
|
||||
{
|
||||
for (i = 0; i < (SCREENWIDTH); i++)
|
||||
{
|
||||
if (y_lookup[i] < 0)
|
||||
{
|
||||
y_lookup[i]++;
|
||||
done = false;
|
||||
continue;
|
||||
}
|
||||
// scroll down columns, which are still visible
|
||||
if (y_lookup[i] < SCREENHEIGHT)
|
||||
{
|
||||
byte *s, *d;
|
||||
int j, k, dy;
|
||||
|
||||
/* cph 2001/07/29 -
|
||||
* The original melt rate was 8 pixels/sec, i.e. 25 frames to melt
|
||||
* the whole screen, so make the melt rate depend on SCREENHEIGHT
|
||||
* so it takes no longer in high res
|
||||
*/
|
||||
dy = (y_lookup[i] < 16) ? y_lookup[i] + 1 : SCREENHEIGHT / 25;
|
||||
// At most dy shall be so that the column is shifted by SCREENHEIGHT (i.e. just
|
||||
// invisible)
|
||||
if (y_lookup[i] + dy >= SCREENHEIGHT)
|
||||
dy = SCREENHEIGHT - y_lookup[i];
|
||||
s = &displayData.displayFrameBuffer[displayData.workingBuffer][i] +
|
||||
((SCREENHEIGHT - dy - 1) * SCREENPITCH);
|
||||
d = &displayData.displayFrameBuffer[displayData.workingBuffer][i] +
|
||||
((SCREENHEIGHT - 1) * SCREENPITCH);
|
||||
// scroll down the column. Of course we need to copy from the bottom... up to
|
||||
// SCREENHEIGHT - yLookup - dy
|
||||
for (j = SCREENHEIGHT - y_lookup[i] - dy; j; j--)
|
||||
{
|
||||
*d = *s;
|
||||
d += -SCREENPITCH;
|
||||
s += -SCREENPITCH;
|
||||
}
|
||||
// copy new screen. We need to copy only between y_lookup and + dy y_lookup
|
||||
s = &displayData.displayFrameBuffer[1 - displayData.workingBuffer][i] + y_lookup[i] * SCREENPITCH;
|
||||
d = &displayData.displayFrameBuffer[displayData.workingBuffer][i] + y_lookup[i] * SCREENPITCH;
|
||||
for (j = 0 ; j < dy; j++)
|
||||
{
|
||||
*d = *s;
|
||||
d += SCREENPITCH;
|
||||
s += SCREENPITCH;
|
||||
}
|
||||
y_lookup[i] += dy;
|
||||
done = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return done;
|
||||
}
|
||||
|
||||
void wipe_initMelt(short *y_lookup)
|
||||
{
|
||||
// setup initial column positions (y<0 => not ready to scroll yet)
|
||||
y_lookup[0] = -(M_Random() % 16);
|
||||
for (int i = 1; i < SCREENWIDTH; i++)
|
||||
{
|
||||
int r = (M_Random() % 3) - 1;
|
||||
y_lookup[i] = y_lookup[i - 1] + r;
|
||||
if (y_lookup[i] > 0)
|
||||
y_lookup[i] = 0;
|
||||
else if (y_lookup[i] == -16)
|
||||
y_lookup[i] = -15;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int wipe_ScreenWipe(int ticks, short *y_lookup)
|
||||
{
|
||||
// do a piece of wipe-in
|
||||
return wipe_doMelt(ticks, y_lookup);
|
||||
}
|
||||
+1515
-1515
File diff suppressed because it is too large.
Load diff
@@ -1,122 +1,122 @@
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* next-hack: originally doomhack, in his GBA port, put (almost) all the global
|
||||
* variables in a global structure, which was by the way Z_malloc'ed.
|
||||
* Here the structure is not z_malloc'ed but it is static.
|
||||
*
|
||||
*-----------------------------------------------------------------------------
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include "global_data.h"
|
||||
|
||||
globals_t global;
|
||||
globals_t *_g;
|
||||
|
||||
void InitGlobals()
|
||||
{
|
||||
_g = &global;
|
||||
memset(_g, 0, sizeof(globals_t));
|
||||
|
||||
//******************************************************************************
|
||||
//am_map.c
|
||||
//******************************************************************************
|
||||
|
||||
_g->scale_mtof = (fixed_t) INITSCALEMTOF;
|
||||
_g->stopped = true;
|
||||
|
||||
_g->lastlevel = -1;
|
||||
_g->lastepisode = -1;
|
||||
|
||||
_g->mtof_zoommul = FRACUNIT; // how far the window zooms each tic (map coords)
|
||||
_g->ftom_zoommul = FRACUNIT; // how far the window zooms each tic (fb coords)
|
||||
|
||||
//******************************************************************************
|
||||
//d_main.c
|
||||
//******************************************************************************
|
||||
|
||||
_g->wipegamestate = GS_DEMOSCREEN;
|
||||
_g->oldgamestate = -1;
|
||||
|
||||
//******************************************************************************
|
||||
//doomstat.c
|
||||
//******************************************************************************
|
||||
|
||||
// Game Mode - identify IWAD as shareware, retail etc.
|
||||
_g->gamemode = indetermined;
|
||||
_g->gamemission = doom;
|
||||
|
||||
//******************************************************************************
|
||||
//m_menu.c
|
||||
//******************************************************************************
|
||||
|
||||
_g->showMessages = 1; // Show messages has default, 0 = off, 1 = on
|
||||
|
||||
//******************************************************************************
|
||||
//p_setup.c
|
||||
//******************************************************************************
|
||||
|
||||
// _g->rejectlump = -1;// cph - store reject lump num if cached
|
||||
|
||||
//******************************************************************************
|
||||
//r_main.c
|
||||
//******************************************************************************
|
||||
|
||||
_g->validcount = 1; // increment every time a check is made
|
||||
|
||||
_g->freehead = &_g->freetail; // killough
|
||||
|
||||
//******************************************************************************
|
||||
//s_sounds.c
|
||||
//******************************************************************************
|
||||
|
||||
_g->snd_SfxVolume = 15;
|
||||
|
||||
// Maximum volume of music. Useless so far.
|
||||
_g->snd_MusicVolume = 15;
|
||||
|
||||
//******************************************************************************
|
||||
//st_stuff.c
|
||||
//******************************************************************************
|
||||
|
||||
_g->st_oldhealth = -1;
|
||||
//
|
||||
_g->tex_lookup_valid = false;
|
||||
}
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* next-hack: originally doomhack, in his GBA port, put (almost) all the global
|
||||
* variables in a global structure, which was by the way Z_malloc'ed.
|
||||
* Here the structure is not z_malloc'ed but it is static.
|
||||
*
|
||||
*-----------------------------------------------------------------------------
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include "global_data.h"
|
||||
|
||||
globals_t global;
|
||||
globals_t *_g;
|
||||
|
||||
void InitGlobals()
|
||||
{
|
||||
_g = &global;
|
||||
memset(_g, 0, sizeof(globals_t));
|
||||
|
||||
//******************************************************************************
|
||||
//am_map.c
|
||||
//******************************************************************************
|
||||
|
||||
_g->scale_mtof = (fixed_t) INITSCALEMTOF;
|
||||
_g->stopped = true;
|
||||
|
||||
_g->lastlevel = -1;
|
||||
_g->lastepisode = -1;
|
||||
|
||||
_g->mtof_zoommul = FRACUNIT; // how far the window zooms each tic (map coords)
|
||||
_g->ftom_zoommul = FRACUNIT; // how far the window zooms each tic (fb coords)
|
||||
|
||||
//******************************************************************************
|
||||
//d_main.c
|
||||
//******************************************************************************
|
||||
|
||||
_g->wipegamestate = GS_DEMOSCREEN;
|
||||
_g->oldgamestate = -1;
|
||||
|
||||
//******************************************************************************
|
||||
//doomstat.c
|
||||
//******************************************************************************
|
||||
|
||||
// Game Mode - identify IWAD as shareware, retail etc.
|
||||
_g->gamemode = indetermined;
|
||||
_g->gamemission = doom;
|
||||
|
||||
//******************************************************************************
|
||||
//m_menu.c
|
||||
//******************************************************************************
|
||||
|
||||
_g->showMessages = 1; // Show messages has default, 0 = off, 1 = on
|
||||
|
||||
//******************************************************************************
|
||||
//p_setup.c
|
||||
//******************************************************************************
|
||||
|
||||
// _g->rejectlump = -1;// cph - store reject lump num if cached
|
||||
|
||||
//******************************************************************************
|
||||
//r_main.c
|
||||
//******************************************************************************
|
||||
|
||||
_g->validcount = 1; // increment every time a check is made
|
||||
|
||||
_g->freehead = &_g->freetail; // killough
|
||||
|
||||
//******************************************************************************
|
||||
//s_sounds.c
|
||||
//******************************************************************************
|
||||
|
||||
_g->snd_SfxVolume = 15;
|
||||
|
||||
// Maximum volume of music. Useless so far.
|
||||
_g->snd_MusicVolume = 15;
|
||||
|
||||
//******************************************************************************
|
||||
//st_stuff.c
|
||||
//******************************************************************************
|
||||
|
||||
_g->st_oldhealth = -1;
|
||||
//
|
||||
_g->tex_lookup_valid = false;
|
||||
}
|
||||
+312
-312
@@ -1,312 +1,312 @@
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION: heads-up text and input code
|
||||
*
|
||||
*-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "doomdef.h"
|
||||
#include "doomstat.h"
|
||||
#include "v_video.h"
|
||||
#include "m_swap.h"
|
||||
#include "hu_lib.h"
|
||||
#include "hu_stuff.h"
|
||||
#include "r_main.h"
|
||||
#include "r_draw.h"
|
||||
|
||||
#include "global_data.h"
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
//
|
||||
// Basic text line widget
|
||||
//
|
||||
////////////////////////////////////////////////////////
|
||||
|
||||
//
|
||||
// HUlib_clearTextLine()
|
||||
//
|
||||
// Blank the internal text line in a hu_textline_t widget
|
||||
//
|
||||
// Passed a hu_textline_t, returns nothing
|
||||
//
|
||||
void HUlib_clearTextLine(hu_textline_t *t)
|
||||
{
|
||||
t->linelen = // killough 1/23 98: support multiple lines
|
||||
t->len = 0;
|
||||
t->l[0] = 0;
|
||||
t->needsupdate = true;
|
||||
}
|
||||
|
||||
//
|
||||
// HUlib_initTextLine()
|
||||
//
|
||||
// Initialize a hu_textline_t widget. Set the position, font, start char
|
||||
// of the font, and color range to be used.
|
||||
//
|
||||
// Passed a hu_textline_t, and the values used to initialize
|
||||
// Returns nothing
|
||||
//
|
||||
void HUlib_initTextLine(hu_textline_t *t, short x, short y, const patch_t *f, short sc)
|
||||
//jff 2/16/98 add color range parameter
|
||||
{
|
||||
t->x = x;
|
||||
t->y = y;
|
||||
t->f = (const patch_t**) f;
|
||||
t->sc = sc;
|
||||
HUlib_clearTextLine(t);
|
||||
}
|
||||
|
||||
//
|
||||
// HUlib_addCharToTextLine()
|
||||
//
|
||||
// Adds a character at the end of the text line in a hu_textline_t widget
|
||||
//
|
||||
// Passed the hu_textline_t and the char to add
|
||||
// Returns false if already at length limit, true if the character added
|
||||
//
|
||||
boolean HUlib_addCharToTextLine(hu_textline_t *t, char ch)
|
||||
{
|
||||
// killough 1/23/98 -- support multiple lines
|
||||
if (t->linelen == HU_MAXLINELENGTH)
|
||||
return false;
|
||||
else
|
||||
{
|
||||
t->linelen++;
|
||||
if (ch == '\n')
|
||||
t->linelen = 0;
|
||||
|
||||
t->l[t->len++] = ch;
|
||||
t->l[t->len] = 0;
|
||||
t->needsupdate = 4;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// HUlib_drawTextLine()
|
||||
//
|
||||
// Draws a hu_textline_t widget
|
||||
//
|
||||
// Passed the hu_textline_t and flag whether to draw a cursor
|
||||
// Returns nothing
|
||||
//
|
||||
void HUlib_drawTextLine(hu_textline_t *l, boolean drawcursor)
|
||||
{
|
||||
|
||||
int i;
|
||||
int w;
|
||||
int x;
|
||||
unsigned char c;
|
||||
int y = l->y; // killough 1/18/98 -- support multiple lines
|
||||
|
||||
// draw the new stuff
|
||||
x = l->x;
|
||||
for (i = 0; i < l->len; i++)
|
||||
{
|
||||
c = toupper(l->l[i]); //jff insure were not getting a cheap toupper conv.
|
||||
|
||||
if (c == '\n') // killough 1/18/98 -- support multiple lines
|
||||
x = 0, y += 8;
|
||||
else if (c == '\t') // killough 1/23/98 -- support tab stops
|
||||
x = x - x % 80 + 80;
|
||||
else if (c != ' ' && c >= l->sc && c <= '_')
|
||||
{
|
||||
w = l->f[c - l->sc]->width;
|
||||
if (x + w > SCREENWIDTH_PHYSICAL)
|
||||
break;
|
||||
// killough 1/18/98 -- support multiple lines:
|
||||
// CPhipps - patch drawing updated
|
||||
V_DrawPatchNoScale(x, y, l->f[c - l->sc]);
|
||||
x += w;
|
||||
}
|
||||
else
|
||||
{
|
||||
x += 4;
|
||||
if (x >= SCREENWIDTH_PHYSICAL)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// draw the cursor if requested
|
||||
if (drawcursor && x + l->f['_' - l->sc]->width <= BASE_WIDTH)
|
||||
{
|
||||
// killough 1/18/98 -- support multiple lines
|
||||
// CPhipps - patch drawing updated
|
||||
V_DrawPatch(x, y, HU_FG, l->f['_' - l->sc]);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// HUlib_eraseTextLine()
|
||||
//
|
||||
// Erases a hu_textline_t widget when screen border is behind text
|
||||
// Sorta called by HU_Erase and just better darn get things straight
|
||||
//
|
||||
// Passed the hu_textline_t
|
||||
// Returns nothing
|
||||
//
|
||||
void HUlib_eraseTextLine(hu_textline_t *l)
|
||||
{
|
||||
if (l->needsupdate)
|
||||
l->needsupdate--;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
//
|
||||
// Player message widget (up to 4 lines of text)
|
||||
//
|
||||
////////////////////////////////////////////////////////
|
||||
|
||||
//
|
||||
// HUlib_initSText()
|
||||
//
|
||||
// Initialize a hu_stext_t widget. Set the position, number of lines, font,
|
||||
// start char of the font, and color range to be used, and whether enabled.
|
||||
//
|
||||
// Passed a hu_stext_t, and the values used to initialize
|
||||
// Returns nothing
|
||||
//
|
||||
void HUlib_initSText(hu_stext_t *s, short x, short y, short h, const patch_t *font, short startchar, boolean *on)
|
||||
{
|
||||
|
||||
int i;
|
||||
|
||||
s->h = h;
|
||||
s->on = on;
|
||||
s->laston = true;
|
||||
s->cl = 0;
|
||||
for (i = 0; i < h; i++)
|
||||
HUlib_initTextLine(&s->l[i], x, y - i * (font[0].height + 1), font, startchar);
|
||||
}
|
||||
|
||||
//
|
||||
// HUlib_addLineToSText()
|
||||
//
|
||||
// Adds a blank line to a hu_stext_t widget
|
||||
//
|
||||
// Passed a hu_stext_t
|
||||
// Returns nothing
|
||||
//
|
||||
static void HUlib_addLineToSText(hu_stext_t *s)
|
||||
{
|
||||
|
||||
int i;
|
||||
|
||||
// add a clear line
|
||||
if (++s->cl == s->h)
|
||||
s->cl = 0;
|
||||
HUlib_clearTextLine(&s->l[s->cl]);
|
||||
|
||||
// everything needs updating
|
||||
for (i = 0; i < s->h; i++)
|
||||
s->l[i].needsupdate = 4;
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// HUlib_addMessageToSText()
|
||||
//
|
||||
// Adds a message line with prefix to a hu_stext_t widget
|
||||
//
|
||||
// Passed a hu_stext_t, the prefix string, and a message string
|
||||
// Returns nothing
|
||||
//
|
||||
void HUlib_addMessageToSText(hu_stext_t *s, const char *prefix, const char *msg)
|
||||
{
|
||||
HUlib_addLineToSText(s);
|
||||
if (prefix)
|
||||
while (*prefix)
|
||||
HUlib_addCharToTextLine(&s->l[s->cl], *(prefix++));
|
||||
|
||||
while (*msg)
|
||||
HUlib_addCharToTextLine(&s->l[s->cl], *(msg++));
|
||||
}
|
||||
|
||||
//
|
||||
// HUlib_drawSText()
|
||||
//
|
||||
// Displays a hu_stext_t widget
|
||||
//
|
||||
// Passed a hu_stext_t
|
||||
// Returns nothing
|
||||
//
|
||||
void HUlib_drawSText(hu_stext_t *s)
|
||||
{
|
||||
int i, idx;
|
||||
hu_textline_t *l;
|
||||
|
||||
if (!*s->on)
|
||||
return; // if not on, don't draw
|
||||
|
||||
// draw everything
|
||||
for (i = 0; i < s->h; i++)
|
||||
{
|
||||
idx = s->cl - i;
|
||||
if (idx < 0)
|
||||
idx += s->h; // handle queue of lines
|
||||
|
||||
l = &s->l[idx];
|
||||
|
||||
// need a decision made here on whether to skip the draw
|
||||
HUlib_drawTextLine(l, false); // no cursor, please
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// HUlib_eraseSText()
|
||||
//
|
||||
// Erases a hu_stext_t widget, when the screen is not fullsize
|
||||
//
|
||||
// Passed a hu_stext_t
|
||||
// Returns nothing
|
||||
//
|
||||
void HUlib_eraseSText(hu_stext_t *s)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < s->h; i++)
|
||||
{
|
||||
if (s->laston && !*s->on)
|
||||
s->l[i].needsupdate = 4;
|
||||
HUlib_eraseTextLine(&s->l[i]);
|
||||
}
|
||||
s->laston = *s->on;
|
||||
}
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION: heads-up text and input code
|
||||
*
|
||||
*-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "doomdef.h"
|
||||
#include "doomstat.h"
|
||||
#include "v_video.h"
|
||||
#include "m_swap.h"
|
||||
#include "hu_lib.h"
|
||||
#include "hu_stuff.h"
|
||||
#include "r_main.h"
|
||||
#include "r_draw.h"
|
||||
|
||||
#include "global_data.h"
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
//
|
||||
// Basic text line widget
|
||||
//
|
||||
////////////////////////////////////////////////////////
|
||||
|
||||
//
|
||||
// HUlib_clearTextLine()
|
||||
//
|
||||
// Blank the internal text line in a hu_textline_t widget
|
||||
//
|
||||
// Passed a hu_textline_t, returns nothing
|
||||
//
|
||||
void HUlib_clearTextLine(hu_textline_t *t)
|
||||
{
|
||||
t->linelen = // killough 1/23 98: support multiple lines
|
||||
t->len = 0;
|
||||
t->l[0] = 0;
|
||||
t->needsupdate = true;
|
||||
}
|
||||
|
||||
//
|
||||
// HUlib_initTextLine()
|
||||
//
|
||||
// Initialize a hu_textline_t widget. Set the position, font, start char
|
||||
// of the font, and color range to be used.
|
||||
//
|
||||
// Passed a hu_textline_t, and the values used to initialize
|
||||
// Returns nothing
|
||||
//
|
||||
void HUlib_initTextLine(hu_textline_t *t, short x, short y, const patch_t *f, short sc)
|
||||
//jff 2/16/98 add color range parameter
|
||||
{
|
||||
t->x = x;
|
||||
t->y = y;
|
||||
t->f = (const patch_t**) f;
|
||||
t->sc = sc;
|
||||
HUlib_clearTextLine(t);
|
||||
}
|
||||
|
||||
//
|
||||
// HUlib_addCharToTextLine()
|
||||
//
|
||||
// Adds a character at the end of the text line in a hu_textline_t widget
|
||||
//
|
||||
// Passed the hu_textline_t and the char to add
|
||||
// Returns false if already at length limit, true if the character added
|
||||
//
|
||||
boolean HUlib_addCharToTextLine(hu_textline_t *t, char ch)
|
||||
{
|
||||
// killough 1/23/98 -- support multiple lines
|
||||
if (t->linelen == HU_MAXLINELENGTH)
|
||||
return false;
|
||||
else
|
||||
{
|
||||
t->linelen++;
|
||||
if (ch == '\n')
|
||||
t->linelen = 0;
|
||||
|
||||
t->l[t->len++] = ch;
|
||||
t->l[t->len] = 0;
|
||||
t->needsupdate = 4;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// HUlib_drawTextLine()
|
||||
//
|
||||
// Draws a hu_textline_t widget
|
||||
//
|
||||
// Passed the hu_textline_t and flag whether to draw a cursor
|
||||
// Returns nothing
|
||||
//
|
||||
void HUlib_drawTextLine(hu_textline_t *l, boolean drawcursor)
|
||||
{
|
||||
|
||||
int i;
|
||||
int w;
|
||||
int x;
|
||||
unsigned char c;
|
||||
int y = l->y; // killough 1/18/98 -- support multiple lines
|
||||
|
||||
// draw the new stuff
|
||||
x = l->x;
|
||||
for (i = 0; i < l->len; i++)
|
||||
{
|
||||
c = toupper(l->l[i]); //jff insure were not getting a cheap toupper conv.
|
||||
|
||||
if (c == '\n') // killough 1/18/98 -- support multiple lines
|
||||
x = 0, y += 8;
|
||||
else if (c == '\t') // killough 1/23/98 -- support tab stops
|
||||
x = x - x % 80 + 80;
|
||||
else if (c != ' ' && c >= l->sc && c <= '_')
|
||||
{
|
||||
w = l->f[c - l->sc]->width;
|
||||
if (x + w > SCREENWIDTH_PHYSICAL)
|
||||
break;
|
||||
// killough 1/18/98 -- support multiple lines:
|
||||
// CPhipps - patch drawing updated
|
||||
V_DrawPatchNoScale(x, y, l->f[c - l->sc]);
|
||||
x += w;
|
||||
}
|
||||
else
|
||||
{
|
||||
x += 4;
|
||||
if (x >= SCREENWIDTH_PHYSICAL)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// draw the cursor if requested
|
||||
if (drawcursor && x + l->f['_' - l->sc]->width <= BASE_WIDTH)
|
||||
{
|
||||
// killough 1/18/98 -- support multiple lines
|
||||
// CPhipps - patch drawing updated
|
||||
V_DrawPatch(x, y, HU_FG, l->f['_' - l->sc]);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// HUlib_eraseTextLine()
|
||||
//
|
||||
// Erases a hu_textline_t widget when screen border is behind text
|
||||
// Sorta called by HU_Erase and just better darn get things straight
|
||||
//
|
||||
// Passed the hu_textline_t
|
||||
// Returns nothing
|
||||
//
|
||||
void HUlib_eraseTextLine(hu_textline_t *l)
|
||||
{
|
||||
if (l->needsupdate)
|
||||
l->needsupdate--;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
//
|
||||
// Player message widget (up to 4 lines of text)
|
||||
//
|
||||
////////////////////////////////////////////////////////
|
||||
|
||||
//
|
||||
// HUlib_initSText()
|
||||
//
|
||||
// Initialize a hu_stext_t widget. Set the position, number of lines, font,
|
||||
// start char of the font, and color range to be used, and whether enabled.
|
||||
//
|
||||
// Passed a hu_stext_t, and the values used to initialize
|
||||
// Returns nothing
|
||||
//
|
||||
void HUlib_initSText(hu_stext_t *s, short x, short y, short h, const patch_t *font, short startchar, boolean *on)
|
||||
{
|
||||
|
||||
int i;
|
||||
|
||||
s->h = h;
|
||||
s->on = on;
|
||||
s->laston = true;
|
||||
s->cl = 0;
|
||||
for (i = 0; i < h; i++)
|
||||
HUlib_initTextLine(&s->l[i], x, y - i * (font[0].height + 1), font, startchar);
|
||||
}
|
||||
|
||||
//
|
||||
// HUlib_addLineToSText()
|
||||
//
|
||||
// Adds a blank line to a hu_stext_t widget
|
||||
//
|
||||
// Passed a hu_stext_t
|
||||
// Returns nothing
|
||||
//
|
||||
static void HUlib_addLineToSText(hu_stext_t *s)
|
||||
{
|
||||
|
||||
int i;
|
||||
|
||||
// add a clear line
|
||||
if (++s->cl == s->h)
|
||||
s->cl = 0;
|
||||
HUlib_clearTextLine(&s->l[s->cl]);
|
||||
|
||||
// everything needs updating
|
||||
for (i = 0; i < s->h; i++)
|
||||
s->l[i].needsupdate = 4;
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// HUlib_addMessageToSText()
|
||||
//
|
||||
// Adds a message line with prefix to a hu_stext_t widget
|
||||
//
|
||||
// Passed a hu_stext_t, the prefix string, and a message string
|
||||
// Returns nothing
|
||||
//
|
||||
void HUlib_addMessageToSText(hu_stext_t *s, const char *prefix, const char *msg)
|
||||
{
|
||||
HUlib_addLineToSText(s);
|
||||
if (prefix)
|
||||
while (*prefix)
|
||||
HUlib_addCharToTextLine(&s->l[s->cl], *(prefix++));
|
||||
|
||||
while (*msg)
|
||||
HUlib_addCharToTextLine(&s->l[s->cl], *(msg++));
|
||||
}
|
||||
|
||||
//
|
||||
// HUlib_drawSText()
|
||||
//
|
||||
// Displays a hu_stext_t widget
|
||||
//
|
||||
// Passed a hu_stext_t
|
||||
// Returns nothing
|
||||
//
|
||||
void HUlib_drawSText(hu_stext_t *s)
|
||||
{
|
||||
int i, idx;
|
||||
hu_textline_t *l;
|
||||
|
||||
if (!*s->on)
|
||||
return; // if not on, don't draw
|
||||
|
||||
// draw everything
|
||||
for (i = 0; i < s->h; i++)
|
||||
{
|
||||
idx = s->cl - i;
|
||||
if (idx < 0)
|
||||
idx += s->h; // handle queue of lines
|
||||
|
||||
l = &s->l[idx];
|
||||
|
||||
// need a decision made here on whether to skip the draw
|
||||
HUlib_drawTextLine(l, false); // no cursor, please
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// HUlib_eraseSText()
|
||||
//
|
||||
// Erases a hu_stext_t widget, when the screen is not fullsize
|
||||
//
|
||||
// Passed a hu_stext_t
|
||||
// Returns nothing
|
||||
//
|
||||
void HUlib_eraseSText(hu_stext_t *s)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < s->h; i++)
|
||||
{
|
||||
if (s->laston && !*s->on)
|
||||
s->l[i].needsupdate = 4;
|
||||
HUlib_eraseTextLine(&s->l[i]);
|
||||
}
|
||||
s->laston = *s->on;
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,163 +1,163 @@
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* System interface for sound.
|
||||
* next-hack: added support for pwm sound. Removed music.
|
||||
*
|
||||
*-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <math.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include "z_zone.h"
|
||||
|
||||
#include "m_swap.h"
|
||||
#include "i_sound.h"
|
||||
#include "m_misc.h"
|
||||
#include "w_wad.h"
|
||||
#include "lprintf.h"
|
||||
#include "s_sound.h"
|
||||
|
||||
#include "doomdef.h"
|
||||
#include "doomstat.h"
|
||||
#include "doomtype.h"
|
||||
|
||||
#include "d_main.h"
|
||||
|
||||
#include "m_fixed.h"
|
||||
|
||||
#include "global_data.h"
|
||||
#include "pwm_audio.h"
|
||||
|
||||
//
|
||||
// Starting a sound means adding it
|
||||
// to the current list of active sounds
|
||||
// in the internal channels.
|
||||
// As the SFX info struct contains
|
||||
// e.g. a pointer to the raw data,
|
||||
// it is ignored.
|
||||
// As our sound handling does not handle
|
||||
// priority, it is ignored.
|
||||
// Pitching (that is, increased speed of playback)
|
||||
// is set, but currently not used by mixing.
|
||||
//
|
||||
int I_StartSound(int id, int channel, int vol, int sep)
|
||||
{
|
||||
|
||||
if ((channel < 0) || (channel >= MAX_CHANNELS))
|
||||
return -1;
|
||||
// 2021/05/15 next-hack
|
||||
//
|
||||
soundChannels[channel].lastAudioBufferIdx = 0xFFFF;
|
||||
soundChannels[channel].offset = 0;
|
||||
soundChannels[channel].sfxIdx = id;
|
||||
soundChannels[channel].volume = vol;
|
||||
#ifdef PARADISE_DEV
|
||||
{ extern void plat_sound(int id); if (vol > 0) plat_sound(id); } /* v0.2.6: effects volume 0 in the menu = silent */
|
||||
#endif
|
||||
return channel;
|
||||
}
|
||||
|
||||
void I_ShutdownSound(void)
|
||||
{
|
||||
if (_g->sound_inited)
|
||||
{
|
||||
lprintf(LO_INFO, "I_ShutdownSound: ");
|
||||
lprintf(LO_INFO, "\n");
|
||||
_g->sound_inited = false;
|
||||
}
|
||||
}
|
||||
|
||||
//static SDL_AudioSpec audio;
|
||||
|
||||
void I_InitSound(void)
|
||||
{
|
||||
|
||||
if (!nomusicparm)
|
||||
I_InitMusic();
|
||||
|
||||
// Finished initialization.
|
||||
lprintf(LO_INFO, "I_InitSound: sound ready");
|
||||
}
|
||||
|
||||
void I_InitMusic(void)
|
||||
{
|
||||
}
|
||||
|
||||
void I_PlaySong(int handle, int looping)
|
||||
{
|
||||
if (handle == mus_None)
|
||||
return;
|
||||
#if defined(PARADISE_DEV) && defined(MUS_PLAY)
|
||||
{ extern void plat_music_play(int h, int l); plat_music_play(handle, looping); }
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
#if defined(PARADISE_DEV) && defined(MUS_PLAY)
|
||||
extern void plat_music_pause(int p); extern void plat_music_stop(void); extern void plat_music_volume(int v);
|
||||
void I_PauseSong(int handle) { plat_music_pause(1); }
|
||||
void I_ResumeSong(int handle) { plat_music_pause(0); }
|
||||
void I_StopSong(int handle) { plat_music_stop(); }
|
||||
void I_SetMusicVolume(int volume) { plat_music_volume(volume); }
|
||||
#else
|
||||
void I_PauseSong(int handle)
|
||||
{
|
||||
}
|
||||
|
||||
void I_ResumeSong(int handle)
|
||||
{
|
||||
}
|
||||
|
||||
void I_StopSong(int handle)
|
||||
{
|
||||
}
|
||||
|
||||
void I_SetMusicVolume(int volume)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* System interface for sound.
|
||||
* next-hack: added support for pwm sound. Removed music.
|
||||
*
|
||||
*-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <math.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include "z_zone.h"
|
||||
|
||||
#include "m_swap.h"
|
||||
#include "i_sound.h"
|
||||
#include "m_misc.h"
|
||||
#include "w_wad.h"
|
||||
#include "lprintf.h"
|
||||
#include "s_sound.h"
|
||||
|
||||
#include "doomdef.h"
|
||||
#include "doomstat.h"
|
||||
#include "doomtype.h"
|
||||
|
||||
#include "d_main.h"
|
||||
|
||||
#include "m_fixed.h"
|
||||
|
||||
#include "global_data.h"
|
||||
#include "pwm_audio.h"
|
||||
|
||||
//
|
||||
// Starting a sound means adding it
|
||||
// to the current list of active sounds
|
||||
// in the internal channels.
|
||||
// As the SFX info struct contains
|
||||
// e.g. a pointer to the raw data,
|
||||
// it is ignored.
|
||||
// As our sound handling does not handle
|
||||
// priority, it is ignored.
|
||||
// Pitching (that is, increased speed of playback)
|
||||
// is set, but currently not used by mixing.
|
||||
//
|
||||
int I_StartSound(int id, int channel, int vol, int sep)
|
||||
{
|
||||
|
||||
if ((channel < 0) || (channel >= MAX_CHANNELS))
|
||||
return -1;
|
||||
// 2021/05/15 next-hack
|
||||
//
|
||||
soundChannels[channel].lastAudioBufferIdx = 0xFFFF;
|
||||
soundChannels[channel].offset = 0;
|
||||
soundChannels[channel].sfxIdx = id;
|
||||
soundChannels[channel].volume = vol;
|
||||
#ifdef PARADISE_DEV
|
||||
{ extern void plat_sound(int id); if (vol > 0) plat_sound(id); } /* v0.2.6: effects volume 0 in the menu = silent */
|
||||
#endif
|
||||
return channel;
|
||||
}
|
||||
|
||||
void I_ShutdownSound(void)
|
||||
{
|
||||
if (_g->sound_inited)
|
||||
{
|
||||
lprintf(LO_INFO, "I_ShutdownSound: ");
|
||||
lprintf(LO_INFO, "\n");
|
||||
_g->sound_inited = false;
|
||||
}
|
||||
}
|
||||
|
||||
//static SDL_AudioSpec audio;
|
||||
|
||||
void I_InitSound(void)
|
||||
{
|
||||
|
||||
if (!nomusicparm)
|
||||
I_InitMusic();
|
||||
|
||||
// Finished initialization.
|
||||
lprintf(LO_INFO, "I_InitSound: sound ready");
|
||||
}
|
||||
|
||||
void I_InitMusic(void)
|
||||
{
|
||||
}
|
||||
|
||||
void I_PlaySong(int handle, int looping)
|
||||
{
|
||||
if (handle == mus_None)
|
||||
return;
|
||||
#if defined(PARADISE_DEV) && defined(MUS_PLAY)
|
||||
{ extern void plat_music_play(int h, int l); plat_music_play(handle, looping); }
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
#if defined(PARADISE_DEV) && defined(MUS_PLAY)
|
||||
extern void plat_music_pause(int p); extern void plat_music_stop(void); extern void plat_music_volume(int v);
|
||||
void I_PauseSong(int handle) { plat_music_pause(1); }
|
||||
void I_ResumeSong(int handle) { plat_music_pause(0); }
|
||||
void I_StopSong(int handle) { plat_music_stop(); }
|
||||
void I_SetMusicVolume(int volume) { plat_music_volume(volume); }
|
||||
#else
|
||||
void I_PauseSong(int handle)
|
||||
{
|
||||
}
|
||||
|
||||
void I_ResumeSong(int handle)
|
||||
{
|
||||
}
|
||||
|
||||
void I_StopSong(int handle)
|
||||
{
|
||||
}
|
||||
|
||||
void I_SetMusicVolume(int volume)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
+106
-106
@@ -1,106 +1,106 @@
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Startup and quit functions. Handles signals, inits the
|
||||
* memory management, then calls D_DoomMain. Also contains
|
||||
* I_Init which does other system-related startup stuff.
|
||||
*
|
||||
* next-hack: put sound init and time functions
|
||||
*
|
||||
*-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include "doomdef.h"
|
||||
#include "d_main.h"
|
||||
#include "m_fixed.h"
|
||||
#include "i_system.h"
|
||||
#include "i_video.h"
|
||||
#include "z_zone.h"
|
||||
#include "lprintf.h"
|
||||
#include "m_random.h"
|
||||
#include "doomstat.h"
|
||||
#include "g_game.h"
|
||||
#include "m_misc.h"
|
||||
#include "i_sound.h"
|
||||
#include "i_main.h"
|
||||
#include "lprintf.h"
|
||||
#include "global_data.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "nrf.h"
|
||||
unsigned int plat_micros(void);
|
||||
unsigned int I_GetTimeMicrosecs()
|
||||
{
|
||||
return plat_micros();
|
||||
}
|
||||
|
||||
unsigned int I_GetTime(void)
|
||||
{
|
||||
uint32_t time = I_GetTimeMicrosecs();
|
||||
if (!_g->basetime)
|
||||
{
|
||||
_g->basetime = time;
|
||||
return 0;
|
||||
}
|
||||
uint32_t diff = time - _g->basetime;
|
||||
#define SPEED10X 0
|
||||
#if SPEED10X
|
||||
#warning speed10x
|
||||
diff = diff / (100000 / TICRATE);
|
||||
|
||||
#else
|
||||
diff = diff / (1000000 / TICRATE);
|
||||
#endif
|
||||
return diff;
|
||||
}
|
||||
|
||||
void I_Init(void)
|
||||
{
|
||||
if (!(nomusicparm && nosfxparm))
|
||||
I_InitSound();
|
||||
}
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Startup and quit functions. Handles signals, inits the
|
||||
* memory management, then calls D_DoomMain. Also contains
|
||||
* I_Init which does other system-related startup stuff.
|
||||
*
|
||||
* next-hack: put sound init and time functions
|
||||
*
|
||||
*-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include "doomdef.h"
|
||||
#include "d_main.h"
|
||||
#include "m_fixed.h"
|
||||
#include "i_system.h"
|
||||
#include "i_video.h"
|
||||
#include "z_zone.h"
|
||||
#include "lprintf.h"
|
||||
#include "m_random.h"
|
||||
#include "doomstat.h"
|
||||
#include "g_game.h"
|
||||
#include "m_misc.h"
|
||||
#include "i_sound.h"
|
||||
#include "i_main.h"
|
||||
#include "lprintf.h"
|
||||
#include "global_data.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "nrf.h"
|
||||
unsigned int plat_micros(void);
|
||||
unsigned int I_GetTimeMicrosecs()
|
||||
{
|
||||
return plat_micros();
|
||||
}
|
||||
|
||||
unsigned int I_GetTime(void)
|
||||
{
|
||||
uint32_t time = I_GetTimeMicrosecs();
|
||||
if (!_g->basetime)
|
||||
{
|
||||
_g->basetime = time;
|
||||
return 0;
|
||||
}
|
||||
uint32_t diff = time - _g->basetime;
|
||||
#define SPEED10X 0
|
||||
#if SPEED10X
|
||||
#warning speed10x
|
||||
diff = diff / (100000 / TICRATE);
|
||||
|
||||
#else
|
||||
diff = diff / (1000000 / TICRATE);
|
||||
#endif
|
||||
return diff;
|
||||
}
|
||||
|
||||
void I_Init(void)
|
||||
{
|
||||
if (!(nomusicparm && nosfxparm))
|
||||
I_InitSound();
|
||||
}
|
||||
@@ -1,61 +1,61 @@
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* next-hack: Some wrapper functions, to use SPI routines.
|
||||
* Memory mapped code has been removed.
|
||||
*/
|
||||
#include <string.h>
|
||||
#include "i_spi_support.h"
|
||||
#include "printf.h"
|
||||
uint8_t *currentSpiAddress;
|
||||
#if NO_INLINE_SPI
|
||||
uint32_t spiFlashSetAddress(uint32_t address)
|
||||
{
|
||||
currentSpiAddress = (uint8_t*) address;
|
||||
// printf("SA 0x%08x 0x%02x\r\n", address, *currentSpiAddress);
|
||||
}
|
||||
void* spiFlashGetData(void *dest, unsigned int length)
|
||||
{
|
||||
memcpy(dest, currentSpiAddress, length);
|
||||
currentSpiAddress += length;
|
||||
// printf("GD: %08x, %d: %08x\r\n", currentSpiAddress, length, *((uint32_t*) dest));
|
||||
return dest;
|
||||
}
|
||||
#endif
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* next-hack: Some wrapper functions, to use SPI routines.
|
||||
* Memory mapped code has been removed.
|
||||
*/
|
||||
#include <string.h>
|
||||
#include "i_spi_support.h"
|
||||
#include "printf.h"
|
||||
uint8_t *currentSpiAddress;
|
||||
#if NO_INLINE_SPI
|
||||
uint32_t spiFlashSetAddress(uint32_t address)
|
||||
{
|
||||
currentSpiAddress = (uint8_t*) address;
|
||||
// printf("SA 0x%08x 0x%02x\r\n", address, *currentSpiAddress);
|
||||
}
|
||||
void* spiFlashGetData(void *dest, unsigned int length)
|
||||
{
|
||||
memcpy(dest, currentSpiAddress, length);
|
||||
currentSpiAddress += length;
|
||||
// printf("GD: %08x, %d: %08x\r\n", currentSpiAddress, length, *((uint32_t*) dest));
|
||||
return dest;
|
||||
}
|
||||
#endif
|
||||
@@ -1,297 +1,297 @@
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* DOOM graphics stuff.
|
||||
* next-hack: and also key handling, don't ask me why they were put in
|
||||
* i_video.c. Key handling and graphics I/O modified according HW...
|
||||
*
|
||||
*-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "main.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <math.h>
|
||||
#include "main.h"
|
||||
|
||||
#include "doomstat.h"
|
||||
#include "doomdef.h"
|
||||
#include "doomtype.h"
|
||||
#include "v_video.h"
|
||||
#include "r_draw.h"
|
||||
#include "d_main.h"
|
||||
#include "d_event.h"
|
||||
#include "i_video.h"
|
||||
#include "i_sound.h"
|
||||
#include "m_menu.h"
|
||||
#include "z_zone.h"
|
||||
#include "s_sound.h"
|
||||
#include "sounds.h"
|
||||
#include "w_wad.h"
|
||||
#include "st_stuff.h"
|
||||
#include "lprintf.h"
|
||||
#include "doomdef.h"
|
||||
|
||||
#include "global_data.h"
|
||||
#include "display.h"
|
||||
#include "graphics.h"
|
||||
#include "keyboard.h"
|
||||
|
||||
#define NO_PALETTE_CHANGE 255
|
||||
|
||||
uint16_t palette[256];
|
||||
bool toggleBacklight = false;
|
||||
|
||||
key_t keysDown()
|
||||
{
|
||||
key_t buttons = 0;
|
||||
getKeys(&buttons);
|
||||
return buttons;
|
||||
}
|
||||
//
|
||||
// I_StartTic
|
||||
//
|
||||
void I_StartTic(void)
|
||||
{
|
||||
static uint16_t oldGameKeyState = 0;
|
||||
// get which keys are currently pressed
|
||||
key_t hwKeyState = keysDown();
|
||||
// translate between the hardware key state and the game key state
|
||||
uint16_t gameKeyState = 0;
|
||||
|
||||
if (hwKeyState & KEY_ALT)
|
||||
{
|
||||
if (hwKeyState & KEY_RIGHT)
|
||||
gameKeyState |= 1 << KEYD_SR;
|
||||
if (hwKeyState & KEY_LEFT)
|
||||
gameKeyState |= 1 << KEYD_SL;
|
||||
if (hwKeyState & KEY_USE)
|
||||
#if KEYBOARD == I2C_GAMEPAD
|
||||
// USE negates always run setting, so with a dedicated MENU key the USE button
|
||||
// can be freed from the ALT combo allowing it to be dual-purpose USE and SPEED button
|
||||
gameKeyState |= 1 << KEYD_USE;
|
||||
#else
|
||||
gameKeyState |= 1 << KEYD_MENU;
|
||||
#endif
|
||||
if (hwKeyState & KEY_CHGW)
|
||||
gameKeyState |= 1 << KEYD_CHGWDOWN;
|
||||
#if OLD_KEYMAP // it was not wise setting ALT with fire to trigger automap...
|
||||
if (hwKeyState & KEY_FIRE)
|
||||
gameKeyState |= 1 << KEYD_MAP1;
|
||||
#else
|
||||
if (hwKeyState & KEY_FIRE)
|
||||
gameKeyState |= 1 << KEYD_FIRE;
|
||||
#endif
|
||||
if (! (hwKeyState & (KEY_RIGHT | KEY_LEFT | KEY_USE | KEY_CHGW | KEY_FIRE)))
|
||||
gameKeyState |= 1 << KEYD_ALT;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (hwKeyState & KEY_RIGHT)
|
||||
gameKeyState |= 1 << KEYD_RIGHT;
|
||||
if (hwKeyState & KEY_LEFT)
|
||||
gameKeyState |= 1 << KEYD_LEFT;
|
||||
if (hwKeyState & KEY_FIRE)
|
||||
gameKeyState |= 1 << KEYD_FIRE;
|
||||
#if KEYBOARD == I2C_GAMEPAD
|
||||
// remap USE+CHGW from MAP1 in other keymaps to CHGWDOWN
|
||||
if ((hwKeyState & (KEY_USE | KEY_CHGW)) == (KEY_USE | KEY_CHGW))
|
||||
gameKeyState |= 1 << KEYD_CHGWDOWN;
|
||||
else
|
||||
{
|
||||
#endif
|
||||
if (hwKeyState & KEY_USE)
|
||||
gameKeyState |= 1 << KEYD_USE;
|
||||
if (hwKeyState & KEY_CHGW)
|
||||
gameKeyState |= 1 << KEYD_CHGW;
|
||||
#if KEYBOARD == I2C_GAMEPAD
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (hwKeyState & KEY_UP)
|
||||
gameKeyState |= 1 << KEYD_UP;
|
||||
if (hwKeyState & KEY_DOWN)
|
||||
gameKeyState |= 1 << KEYD_DOWN;
|
||||
#if KEYBOARD == I2C_GAMEPAD
|
||||
// Gamepad has 10 total buttons, with extra byte for key data can have MAP1 and MENU as dedicated buttons
|
||||
if (hwKeyState & KEY_MAP)
|
||||
gameKeyState |= 1 << KEYD_MAP1;
|
||||
if (hwKeyState & KEY_MENU)
|
||||
gameKeyState |= 1 << KEYD_MENU;
|
||||
#endif
|
||||
#if !OLD_KEYMAP && KEYBOARD != I2C_GAMEPAD
|
||||
// automap is now enabled when use and change weapon are pressed at the same time (or chgwdown for i2c gamepad)
|
||||
if ((hwKeyState & (KEY_USE | KEY_CHGW)) == (KEY_USE | KEY_CHGW))
|
||||
gameKeyState |= 1 << KEYD_MAP1;
|
||||
#endif
|
||||
// Get which keys have changed since last time
|
||||
uint16_t keys_changed = oldGameKeyState ^ gameKeyState;
|
||||
|
||||
event_t ev;
|
||||
ev.type = ev_keydown;
|
||||
for (int i = 0; i < NUMKEYS; i++)
|
||||
{
|
||||
if ((1 & (keys_changed >> i)) && (1 & (gameKeyState >> i)))
|
||||
{
|
||||
ev.data1 = i;
|
||||
D_PostEvent(&ev);
|
||||
}
|
||||
}
|
||||
ev.type = ev_keyup;
|
||||
for (int i = 0; i < NUMKEYS; i++)
|
||||
{
|
||||
if ((1 & (keys_changed >> i)) && !(1 & (gameKeyState >> i)))
|
||||
{
|
||||
ev.data1 = i;
|
||||
D_PostEvent(&ev);
|
||||
}
|
||||
}
|
||||
oldGameKeyState = gameKeyState;
|
||||
|
||||
#if 0
|
||||
// handle onboard clue buttons for gamma adjust and toggling backlight
|
||||
static bool aBtnWasDown = false;
|
||||
static bool bBtnWasDown = false;
|
||||
bool aDown = !(GPIO_PORT(PORT_NUM_BTN_A)->IN & (1 << PIN_NUM_BTN_A));
|
||||
bool bDown = !(GPIO_PORT(PORT_NUM_BTN_B)->IN & (1 << PIN_NUM_BTN_B));
|
||||
|
||||
if (aDown && bDown && (!aBtnWasDown || !bBtnWasDown))
|
||||
toggleBacklight = true;
|
||||
else if (aDown && !aBtnWasDown)
|
||||
M_ChangeGamma(0);
|
||||
else if (bDown && !bBtnWasDown)
|
||||
M_ChangeGamma(1);
|
||||
|
||||
aBtnWasDown = aDown;
|
||||
bBtnWasDown = bDown;
|
||||
#endif
|
||||
}
|
||||
|
||||
boolean I_StartDisplay(void)
|
||||
{
|
||||
_g->screens[0].data = displayData.displayFrameBuffer[displayData.workingBuffer];
|
||||
// Same with base row offset.
|
||||
drawvars.byte_topleft = _g->screens[0].data;
|
||||
return true;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// Palette stuff.
|
||||
//
|
||||
|
||||
static void I_UploadNewPalette(int pal)
|
||||
{
|
||||
#ifdef PARADISE_DEV
|
||||
static int lastpal = -1, lastgamma = -1;
|
||||
if (pal == lastpal && _g->gamma == lastgamma && _g->current_palette == palette)
|
||||
return;
|
||||
lastpal = pal; lastgamma = _g->gamma;
|
||||
#endif
|
||||
_g->current_palette = palette;
|
||||
//
|
||||
if (_g->gamma)
|
||||
{
|
||||
|
||||
for (int i = 0; i < 256; i++)
|
||||
{
|
||||
uint16_t r = gammatable[_g->gamma][p_wad_immutable_flash_data->palette_lump[pal * 256 * 3 + 3 * i]] >> 3;
|
||||
uint16_t g = gammatable[_g->gamma][p_wad_immutable_flash_data->palette_lump[pal * 256 * 3 + 3 * i + 1]] >> 2;
|
||||
uint16_t b = gammatable[_g->gamma][p_wad_immutable_flash_data->palette_lump[pal * 256 * 3 + 3 * i + 2]] >> 3;
|
||||
uint16_t rgb = (r << (6 + 5)) | (g << 5) | (b << (0));
|
||||
rgb = (rgb >> 8) | (rgb << 8);
|
||||
_g->current_palette[i] = rgb;
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // save some cycles for those playing with 0 gamma.
|
||||
for (int i = 0; i < 256; i++)
|
||||
{
|
||||
uint16_t r = p_wad_immutable_flash_data->palette_lump[pal * 256 * 3 + 3 * i] >> 3;
|
||||
uint16_t g = p_wad_immutable_flash_data->palette_lump[pal * 256 * 3 + 3 * i + 1] >> 2;
|
||||
uint16_t b = p_wad_immutable_flash_data->palette_lump[pal * 256 * 3 + 3 * i + 2] >> 3;
|
||||
uint16_t rgb = (r << (6 + 5)) | (g << 5) | (b << (0));
|
||||
rgb = (rgb >> 8) | (rgb << 8);
|
||||
_g->current_palette[i] = rgb;
|
||||
}
|
||||
}
|
||||
displayData.pPalette = _g->current_palette;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Graphics API
|
||||
//
|
||||
|
||||
void I_FinishUpdateBlock(void)
|
||||
{
|
||||
I_UploadNewPalette(_g->newpal);
|
||||
|
||||
startDisplayRefresh(displayData.workingBuffer);
|
||||
displayData.workingBuffer = 1 - displayData.workingBuffer;
|
||||
}
|
||||
|
||||
//
|
||||
// I_SetPalette
|
||||
//
|
||||
void I_SetPalette(int pal)
|
||||
{
|
||||
_g->newpal = pal;
|
||||
}
|
||||
|
||||
void handleDisplayBacklightToggle() {
|
||||
static bool backlightOn = true;
|
||||
|
||||
if (toggleBacklight)
|
||||
{
|
||||
toggleBacklight = false;
|
||||
backlightOn = !backlightOn;
|
||||
SetBacklight(backlightOn);
|
||||
}
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* DOOM graphics stuff.
|
||||
* next-hack: and also key handling, don't ask me why they were put in
|
||||
* i_video.c. Key handling and graphics I/O modified according HW...
|
||||
*
|
||||
*-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "main.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <math.h>
|
||||
#include "main.h"
|
||||
|
||||
#include "doomstat.h"
|
||||
#include "doomdef.h"
|
||||
#include "doomtype.h"
|
||||
#include "v_video.h"
|
||||
#include "r_draw.h"
|
||||
#include "d_main.h"
|
||||
#include "d_event.h"
|
||||
#include "i_video.h"
|
||||
#include "i_sound.h"
|
||||
#include "m_menu.h"
|
||||
#include "z_zone.h"
|
||||
#include "s_sound.h"
|
||||
#include "sounds.h"
|
||||
#include "w_wad.h"
|
||||
#include "st_stuff.h"
|
||||
#include "lprintf.h"
|
||||
#include "doomdef.h"
|
||||
|
||||
#include "global_data.h"
|
||||
#include "display.h"
|
||||
#include "graphics.h"
|
||||
#include "keyboard.h"
|
||||
|
||||
#define NO_PALETTE_CHANGE 255
|
||||
|
||||
uint16_t palette[256];
|
||||
bool toggleBacklight = false;
|
||||
|
||||
key_t keysDown()
|
||||
{
|
||||
key_t buttons = 0;
|
||||
getKeys(&buttons);
|
||||
return buttons;
|
||||
}
|
||||
//
|
||||
// I_StartTic
|
||||
//
|
||||
void I_StartTic(void)
|
||||
{
|
||||
static uint16_t oldGameKeyState = 0;
|
||||
// get which keys are currently pressed
|
||||
key_t hwKeyState = keysDown();
|
||||
// translate between the hardware key state and the game key state
|
||||
uint16_t gameKeyState = 0;
|
||||
|
||||
if (hwKeyState & KEY_ALT)
|
||||
{
|
||||
if (hwKeyState & KEY_RIGHT)
|
||||
gameKeyState |= 1 << KEYD_SR;
|
||||
if (hwKeyState & KEY_LEFT)
|
||||
gameKeyState |= 1 << KEYD_SL;
|
||||
if (hwKeyState & KEY_USE)
|
||||
#if KEYBOARD == I2C_GAMEPAD
|
||||
// USE negates always run setting, so with a dedicated MENU key the USE button
|
||||
// can be freed from the ALT combo allowing it to be dual-purpose USE and SPEED button
|
||||
gameKeyState |= 1 << KEYD_USE;
|
||||
#else
|
||||
gameKeyState |= 1 << KEYD_MENU;
|
||||
#endif
|
||||
if (hwKeyState & KEY_CHGW)
|
||||
gameKeyState |= 1 << KEYD_CHGWDOWN;
|
||||
#if OLD_KEYMAP // it was not wise setting ALT with fire to trigger automap...
|
||||
if (hwKeyState & KEY_FIRE)
|
||||
gameKeyState |= 1 << KEYD_MAP1;
|
||||
#else
|
||||
if (hwKeyState & KEY_FIRE)
|
||||
gameKeyState |= 1 << KEYD_FIRE;
|
||||
#endif
|
||||
if (! (hwKeyState & (KEY_RIGHT | KEY_LEFT | KEY_USE | KEY_CHGW | KEY_FIRE)))
|
||||
gameKeyState |= 1 << KEYD_ALT;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (hwKeyState & KEY_RIGHT)
|
||||
gameKeyState |= 1 << KEYD_RIGHT;
|
||||
if (hwKeyState & KEY_LEFT)
|
||||
gameKeyState |= 1 << KEYD_LEFT;
|
||||
if (hwKeyState & KEY_FIRE)
|
||||
gameKeyState |= 1 << KEYD_FIRE;
|
||||
#if KEYBOARD == I2C_GAMEPAD
|
||||
// remap USE+CHGW from MAP1 in other keymaps to CHGWDOWN
|
||||
if ((hwKeyState & (KEY_USE | KEY_CHGW)) == (KEY_USE | KEY_CHGW))
|
||||
gameKeyState |= 1 << KEYD_CHGWDOWN;
|
||||
else
|
||||
{
|
||||
#endif
|
||||
if (hwKeyState & KEY_USE)
|
||||
gameKeyState |= 1 << KEYD_USE;
|
||||
if (hwKeyState & KEY_CHGW)
|
||||
gameKeyState |= 1 << KEYD_CHGW;
|
||||
#if KEYBOARD == I2C_GAMEPAD
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (hwKeyState & KEY_UP)
|
||||
gameKeyState |= 1 << KEYD_UP;
|
||||
if (hwKeyState & KEY_DOWN)
|
||||
gameKeyState |= 1 << KEYD_DOWN;
|
||||
#if KEYBOARD == I2C_GAMEPAD
|
||||
// Gamepad has 10 total buttons, with extra byte for key data can have MAP1 and MENU as dedicated buttons
|
||||
if (hwKeyState & KEY_MAP)
|
||||
gameKeyState |= 1 << KEYD_MAP1;
|
||||
if (hwKeyState & KEY_MENU)
|
||||
gameKeyState |= 1 << KEYD_MENU;
|
||||
#endif
|
||||
#if !OLD_KEYMAP && KEYBOARD != I2C_GAMEPAD
|
||||
// automap is now enabled when use and change weapon are pressed at the same time (or chgwdown for i2c gamepad)
|
||||
if ((hwKeyState & (KEY_USE | KEY_CHGW)) == (KEY_USE | KEY_CHGW))
|
||||
gameKeyState |= 1 << KEYD_MAP1;
|
||||
#endif
|
||||
// Get which keys have changed since last time
|
||||
uint16_t keys_changed = oldGameKeyState ^ gameKeyState;
|
||||
|
||||
event_t ev;
|
||||
ev.type = ev_keydown;
|
||||
for (int i = 0; i < NUMKEYS; i++)
|
||||
{
|
||||
if ((1 & (keys_changed >> i)) && (1 & (gameKeyState >> i)))
|
||||
{
|
||||
ev.data1 = i;
|
||||
D_PostEvent(&ev);
|
||||
}
|
||||
}
|
||||
ev.type = ev_keyup;
|
||||
for (int i = 0; i < NUMKEYS; i++)
|
||||
{
|
||||
if ((1 & (keys_changed >> i)) && !(1 & (gameKeyState >> i)))
|
||||
{
|
||||
ev.data1 = i;
|
||||
D_PostEvent(&ev);
|
||||
}
|
||||
}
|
||||
oldGameKeyState = gameKeyState;
|
||||
|
||||
#if 0
|
||||
// handle onboard clue buttons for gamma adjust and toggling backlight
|
||||
static bool aBtnWasDown = false;
|
||||
static bool bBtnWasDown = false;
|
||||
bool aDown = !(GPIO_PORT(PORT_NUM_BTN_A)->IN & (1 << PIN_NUM_BTN_A));
|
||||
bool bDown = !(GPIO_PORT(PORT_NUM_BTN_B)->IN & (1 << PIN_NUM_BTN_B));
|
||||
|
||||
if (aDown && bDown && (!aBtnWasDown || !bBtnWasDown))
|
||||
toggleBacklight = true;
|
||||
else if (aDown && !aBtnWasDown)
|
||||
M_ChangeGamma(0);
|
||||
else if (bDown && !bBtnWasDown)
|
||||
M_ChangeGamma(1);
|
||||
|
||||
aBtnWasDown = aDown;
|
||||
bBtnWasDown = bDown;
|
||||
#endif
|
||||
}
|
||||
|
||||
boolean I_StartDisplay(void)
|
||||
{
|
||||
_g->screens[0].data = displayData.displayFrameBuffer[displayData.workingBuffer];
|
||||
// Same with base row offset.
|
||||
drawvars.byte_topleft = _g->screens[0].data;
|
||||
return true;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// Palette stuff.
|
||||
//
|
||||
|
||||
static void I_UploadNewPalette(int pal)
|
||||
{
|
||||
#ifdef PARADISE_DEV
|
||||
static int lastpal = -1, lastgamma = -1;
|
||||
if (pal == lastpal && _g->gamma == lastgamma && _g->current_palette == palette)
|
||||
return;
|
||||
lastpal = pal; lastgamma = _g->gamma;
|
||||
#endif
|
||||
_g->current_palette = palette;
|
||||
//
|
||||
if (_g->gamma)
|
||||
{
|
||||
|
||||
for (int i = 0; i < 256; i++)
|
||||
{
|
||||
uint16_t r = gammatable[_g->gamma][p_wad_immutable_flash_data->palette_lump[pal * 256 * 3 + 3 * i]] >> 3;
|
||||
uint16_t g = gammatable[_g->gamma][p_wad_immutable_flash_data->palette_lump[pal * 256 * 3 + 3 * i + 1]] >> 2;
|
||||
uint16_t b = gammatable[_g->gamma][p_wad_immutable_flash_data->palette_lump[pal * 256 * 3 + 3 * i + 2]] >> 3;
|
||||
uint16_t rgb = (r << (6 + 5)) | (g << 5) | (b << (0));
|
||||
rgb = (rgb >> 8) | (rgb << 8);
|
||||
_g->current_palette[i] = rgb;
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // save some cycles for those playing with 0 gamma.
|
||||
for (int i = 0; i < 256; i++)
|
||||
{
|
||||
uint16_t r = p_wad_immutable_flash_data->palette_lump[pal * 256 * 3 + 3 * i] >> 3;
|
||||
uint16_t g = p_wad_immutable_flash_data->palette_lump[pal * 256 * 3 + 3 * i + 1] >> 2;
|
||||
uint16_t b = p_wad_immutable_flash_data->palette_lump[pal * 256 * 3 + 3 * i + 2] >> 3;
|
||||
uint16_t rgb = (r << (6 + 5)) | (g << 5) | (b << (0));
|
||||
rgb = (rgb >> 8) | (rgb << 8);
|
||||
_g->current_palette[i] = rgb;
|
||||
}
|
||||
}
|
||||
displayData.pPalette = _g->current_palette;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Graphics API
|
||||
//
|
||||
|
||||
void I_FinishUpdateBlock(void)
|
||||
{
|
||||
I_UploadNewPalette(_g->newpal);
|
||||
|
||||
startDisplayRefresh(displayData.workingBuffer);
|
||||
displayData.workingBuffer = 1 - displayData.workingBuffer;
|
||||
}
|
||||
|
||||
//
|
||||
// I_SetPalette
|
||||
//
|
||||
void I_SetPalette(int pal)
|
||||
{
|
||||
_g->newpal = pal;
|
||||
}
|
||||
|
||||
void handleDisplayBacklightToggle() {
|
||||
static bool backlightOn = true;
|
||||
|
||||
if (toggleBacklight)
|
||||
{
|
||||
toggleBacklight = false;
|
||||
backlightOn = !backlightOn;
|
||||
SetBacklight(backlightOn);
|
||||
}
|
||||
}
|
||||
+4835
-4835
File diff suppressed because it is too large.
Load diff
@@ -1,71 +1,71 @@
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
|
||||
* DESCRIPTION:
|
||||
* Main loop menu stuff.
|
||||
* Random number LUT.
|
||||
* Default Config File.
|
||||
* PCX Screenshots.
|
||||
*
|
||||
* next-hack: I don't think the description is accurate...
|
||||
* Just box structure
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "m_bbox.h"
|
||||
#endif
|
||||
#include "m_bbox.h"
|
||||
|
||||
void M_ClearBox(fixed_t *box)
|
||||
{
|
||||
box[BOXTOP] = box[BOXRIGHT] = INT_MIN;
|
||||
box[BOXBOTTOM] = box[BOXLEFT] = INT_MAX;
|
||||
}
|
||||
|
||||
void M_AddToBox(fixed_t *box, fixed_t x, fixed_t y)
|
||||
{
|
||||
if (x < box[BOXLEFT])
|
||||
box[BOXLEFT] = x;
|
||||
else if (x > box[BOXRIGHT])
|
||||
box[BOXRIGHT] = x;
|
||||
if (y < box[BOXBOTTOM])
|
||||
box[BOXBOTTOM] = y;
|
||||
else if (y > box[BOXTOP])
|
||||
box[BOXTOP] = y;
|
||||
}
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
|
||||
* DESCRIPTION:
|
||||
* Main loop menu stuff.
|
||||
* Random number LUT.
|
||||
* Default Config File.
|
||||
* PCX Screenshots.
|
||||
*
|
||||
* next-hack: I don't think the description is accurate...
|
||||
* Just box structure
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "m_bbox.h"
|
||||
#endif
|
||||
#include "m_bbox.h"
|
||||
|
||||
void M_ClearBox(fixed_t *box)
|
||||
{
|
||||
box[BOXTOP] = box[BOXRIGHT] = INT_MIN;
|
||||
box[BOXBOTTOM] = box[BOXLEFT] = INT_MAX;
|
||||
}
|
||||
|
||||
void M_AddToBox(fixed_t *box, fixed_t x, fixed_t y)
|
||||
{
|
||||
if (x < box[BOXLEFT])
|
||||
box[BOXLEFT] = x;
|
||||
else if (x > box[BOXRIGHT])
|
||||
box[BOXRIGHT] = x;
|
||||
if (y < box[BOXBOTTOM])
|
||||
box[BOXBOTTOM] = y;
|
||||
else if (y > box[BOXTOP])
|
||||
box[BOXTOP] = y;
|
||||
}
|
||||
@@ -1,307 +1,307 @@
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
|
||||
* DESCRIPTION:
|
||||
* Cheat (by doomhack?)
|
||||
*
|
||||
* next-hack: cheat not supported yet, need to clean up.
|
||||
*/
|
||||
#include "m_cheat.h"
|
||||
#include "doomdef.h"
|
||||
#include "d_englsh.h"
|
||||
#include "p_inter.h"
|
||||
#include "g_game.h"
|
||||
#include "global_data.h"
|
||||
|
||||
static void cheat_god(void);
|
||||
static void cheat_choppers(void);
|
||||
static void cheat_idkfa(void);
|
||||
static void cheat_ammo(void);
|
||||
static void cheat_noclip(void);
|
||||
static void cheat_invincibility(void);
|
||||
static void cheat_beserk(void);
|
||||
static void cheat_invisibility(void);
|
||||
static void cheat_map(void);
|
||||
static void cheat_goggles(void);
|
||||
static void cheat_exit(void);
|
||||
static void cheat_rockets(void);
|
||||
static void cheat_fps(void);
|
||||
|
||||
typedef struct c_cheat
|
||||
{
|
||||
char *name;
|
||||
byte sequence[8];
|
||||
unsigned int packed_sequence;
|
||||
void (*cheat_function)(void);
|
||||
} c_cheat;
|
||||
|
||||
#define CHEAT_PACK(a,b,c,d,e,f,g,h) ((a << 28)|(b << 24)|(c << 20)|(d << 16)|(e << 12)|(f << 8)|(g << 4)|(h))
|
||||
|
||||
#define CHEAT_SEQ(a,b,c,d,e,f,g,h) {a,b,c,d,e,f,g,h}, CHEAT_PACK(a,b,c,d,e,f,g,h)
|
||||
|
||||
static const c_cheat cheat_def[] =
|
||||
{
|
||||
{ "Chainsaw", CHEAT_SEQ(KEYD_ALT, KEYD_UP, KEYD_UP, KEYD_LEFT, KEYD_ALT, KEYD_USE, KEYD_USE, KEYD_UP), cheat_choppers },
|
||||
{ "Auto-map", CHEAT_SEQ(KEYD_DOWN, KEYD_DOWN, KEYD_LEFT, KEYD_LEFT, KEYD_RIGHT, KEYD_RIGHT, KEYD_LEFT, KEYD_UP), cheat_map },
|
||||
{ "God mode", CHEAT_SEQ(KEYD_UP, KEYD_UP, KEYD_DOWN, KEYD_DOWN, KEYD_LEFT, KEYD_LEFT, KEYD_RIGHT, KEYD_RIGHT), cheat_god },
|
||||
{ "Ammo & Keys", CHEAT_SEQ(KEYD_ALT, KEYD_LEFT, KEYD_USE, KEYD_RIGHT, KEYD_USE, KEYD_UP, KEYD_ALT, KEYD_UP), cheat_idkfa },
|
||||
{ "Ammo", CHEAT_SEQ(KEYD_ALT, KEYD_CHGW, KEYD_ALT, KEYD_CHGW, KEYD_ALT, KEYD_UP, KEYD_UP, KEYD_LEFT), cheat_ammo },
|
||||
{ "No Clipping", CHEAT_SEQ(KEYD_ALT, KEYD_DOWN, KEYD_LEFT, KEYD_RIGHT, KEYD_UP, KEYD_DOWN, KEYD_LEFT, KEYD_RIGHT), cheat_noclip },
|
||||
{ "Invincibility", CHEAT_SEQ(KEYD_ALT, KEYD_CHGW, KEYD_ALT, KEYD_RIGHT, KEYD_LEFT, KEYD_RIGHT, KEYD_ALT, KEYD_ALT), cheat_invincibility },
|
||||
{ "Berserk", CHEAT_SEQ(KEYD_ALT, KEYD_CHGW, KEYD_ALT, KEYD_UP, KEYD_LEFT, KEYD_ALT, KEYD_RIGHT, KEYD_ALT), cheat_beserk },
|
||||
{ "Invisibility", CHEAT_SEQ(KEYD_CHGW, KEYD_ALT, KEYD_CHGW, KEYD_LEFT, KEYD_LEFT, KEYD_ALT, KEYD_LEFT, KEYD_ALT), cheat_invisibility },
|
||||
{ "Lite-Amp Goggles", CHEAT_SEQ(KEYD_DOWN, KEYD_LEFT, KEYD_RIGHT, KEYD_ALT, KEYD_RIGHT, KEYD_LEFT, KEYD_LEFT, KEYD_RIGHT), cheat_goggles },
|
||||
{ "Exit Level", CHEAT_SEQ(KEYD_LEFT, KEYD_LEFT, KEYD_LEFT, KEYD_ALT, KEYD_CHGW, KEYD_USE, KEYD_RIGHT, KEYD_FIRE), cheat_exit },
|
||||
//Because Goldeneye!
|
||||
{ "Enemy Rockets", CHEAT_SEQ(KEYD_CHGW, KEYD_ALT, KEYD_CHGW, KEYD_ALT, KEYD_RIGHT, KEYD_ALT, KEYD_ALT, KEYD_RIGHT), cheat_rockets },
|
||||
{ "FPS Counter Ammo", CHEAT_SEQ(KEYD_RIGHT, KEYD_RIGHT, KEYD_ALT, KEYD_UP, KEYD_DOWN, KEYD_ALT, KEYD_LEFT, KEYD_LEFT), cheat_fps },
|
||||
};
|
||||
|
||||
static const unsigned int num_cheats = sizeof(cheat_def) / sizeof(c_cheat);
|
||||
|
||||
static boolean CheckCheats(unsigned int keybuff)
|
||||
{
|
||||
for (int i = 0; i < num_cheats; i++)
|
||||
{
|
||||
if (cheat_def[i].packed_sequence == keybuff)
|
||||
{
|
||||
if (cheat_def[i].cheat_function)
|
||||
cheat_def[i].cheat_function();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean C_Responder(event_t *ev)
|
||||
{
|
||||
if (ev->type == ev_keydown)
|
||||
{
|
||||
//To enable fast cheat searching without having to
|
||||
//maintain buffer of keypresses, we ensure that
|
||||
//cheats are 8 keys long and the key-code is less
|
||||
//than 16 so they fit in 4 bits.
|
||||
|
||||
//We can store a full 8 presses in a 32bit int.
|
||||
|
||||
//Adding a press to the list just means shifting the
|
||||
//whole thing by 4 and ORing the next press into the
|
||||
//low bits.
|
||||
|
||||
//We can test a cheat sequence with a simple int comparison.
|
||||
|
||||
unsigned int cb = _g->cheat_buffer << 4;
|
||||
cb |= ev->data1 & 0xf;
|
||||
|
||||
_g->cheat_buffer = cb;
|
||||
|
||||
if (CheckCheats(cb))
|
||||
return true; //eat last cheat key.
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static void cheat_god()
|
||||
{
|
||||
_g->player.cheats ^= CF_GODMODE;
|
||||
|
||||
if (_g->player.cheats & CF_GODMODE)
|
||||
{
|
||||
_g->player.health = god_health;
|
||||
|
||||
_g->player.message = STSTR_DQDON;
|
||||
}
|
||||
else
|
||||
{
|
||||
_g->player.message = STSTR_DQDOFF;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
static void cheat_choppers()
|
||||
{
|
||||
_g->player.weaponowned[wp_chainsaw] = true;
|
||||
_g->player.pendingweapon = wp_chainsaw;
|
||||
|
||||
P_GivePower(&_g->player, pw_invulnerability);
|
||||
|
||||
_g->player.message = STSTR_CHOPPERS;
|
||||
}
|
||||
|
||||
static void cheat_idkfa()
|
||||
{
|
||||
int i;
|
||||
|
||||
player_t *plyr = &_g->player;
|
||||
|
||||
if (!plyr->backpack)
|
||||
{
|
||||
for (i = 0; i < NUMAMMO; i++)
|
||||
plyr->maxammo[i] *= 2;
|
||||
|
||||
plyr->backpack = true;
|
||||
}
|
||||
|
||||
plyr->armorpoints = idfa_armor; // Ty 03/09/98 - deh
|
||||
plyr->armortype = idfa_armor_class; // Ty 03/09/98 - deh
|
||||
|
||||
// You can't own weapons that aren't in the game // phares 02/27/98
|
||||
for (i = 0; i < NUMWEAPONS; i++)
|
||||
if (!(((i == wp_plasma || i == wp_bfg) && _g->gamemode == shareware) || (i == wp_supershotgun && _g->gamemode != commercial)))
|
||||
plyr->weaponowned[i] = true;
|
||||
|
||||
for (i = 0; i < NUMAMMO; i++)
|
||||
if (i != am_cell || _g->gamemode != shareware)
|
||||
plyr->ammo[i] = plyr->maxammo[i];
|
||||
|
||||
for (i = 0; i < NUMCARDS; i++)
|
||||
plyr->cards[i] = true;
|
||||
|
||||
plyr->message = STSTR_KFAADDED;
|
||||
}
|
||||
|
||||
static void cheat_ammo()
|
||||
{
|
||||
int i;
|
||||
player_t *plyr = &_g->player;
|
||||
|
||||
if (!plyr->backpack)
|
||||
{
|
||||
for (i = 0; i < NUMAMMO; i++)
|
||||
plyr->maxammo[i] *= 2;
|
||||
|
||||
plyr->backpack = true;
|
||||
}
|
||||
|
||||
plyr->armorpoints = idfa_armor; // Ty 03/09/98 - deh
|
||||
plyr->armortype = idfa_armor_class; // Ty 03/09/98 - deh
|
||||
|
||||
// You can't own weapons that aren't in the game // phares 02/27/98
|
||||
for (i = 0; i < NUMWEAPONS; i++)
|
||||
if (!(((i == wp_plasma || i == wp_bfg) && _g->gamemode == shareware) || (i == wp_supershotgun && _g->gamemode != commercial)))
|
||||
plyr->weaponowned[i] = true;
|
||||
|
||||
for (i = 0; i < NUMAMMO; i++)
|
||||
if (i != am_cell || _g->gamemode != shareware)
|
||||
plyr->ammo[i] = plyr->maxammo[i];
|
||||
|
||||
plyr->message = STSTR_FAADDED;
|
||||
}
|
||||
|
||||
static void cheat_noclip()
|
||||
{
|
||||
_g->player.cheats ^= CF_NOCLIP;
|
||||
|
||||
if (_g->player.cheats & CF_NOCLIP)
|
||||
{
|
||||
_g->player.message = STSTR_NCON;
|
||||
}
|
||||
else
|
||||
{
|
||||
_g->player.message = STSTR_NCOFF;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
static void cheat_invincibility()
|
||||
{
|
||||
P_GivePower(&_g->player, pw_invulnerability);
|
||||
}
|
||||
|
||||
static void cheat_beserk()
|
||||
{
|
||||
P_GivePower(&_g->player, pw_strength);
|
||||
}
|
||||
|
||||
static void cheat_invisibility()
|
||||
{
|
||||
P_GivePower(&_g->player, pw_invisibility);
|
||||
}
|
||||
|
||||
static void cheat_map()
|
||||
{
|
||||
P_GivePower(&_g->player, pw_allmap);
|
||||
}
|
||||
|
||||
static void cheat_goggles()
|
||||
{
|
||||
P_GivePower(&_g->player, pw_infrared);
|
||||
}
|
||||
|
||||
static void cheat_exit()
|
||||
{
|
||||
G_ExitLevel();
|
||||
}
|
||||
|
||||
static void cheat_rockets()
|
||||
{
|
||||
_g->player.cheats ^= CF_ENEMY_ROCKETS;
|
||||
|
||||
if (_g->player.cheats & CF_ENEMY_ROCKETS)
|
||||
{
|
||||
_g->player.health = god_health;
|
||||
|
||||
_g->player.weaponowned[wp_missile] = true;
|
||||
_g->player.ammo[am_misl] = _g->player.maxammo[am_misl];
|
||||
|
||||
_g->player.pendingweapon = wp_missile;
|
||||
|
||||
_g->player.message = STSTR_ROCKETON;
|
||||
}
|
||||
else
|
||||
{
|
||||
_g->player.message = STSTR_ROCKETOFF;
|
||||
}
|
||||
}
|
||||
|
||||
static void cheat_fps()
|
||||
{
|
||||
_g->fps_show = !_g->fps_show;
|
||||
if (_g->fps_show)
|
||||
{
|
||||
_g->player.message = STSTR_FPSON;
|
||||
}
|
||||
else
|
||||
{
|
||||
_g->player.message = STSTR_FPSOFF;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
|
||||
* DESCRIPTION:
|
||||
* Cheat (by doomhack?)
|
||||
*
|
||||
* next-hack: cheat not supported yet, need to clean up.
|
||||
*/
|
||||
#include "m_cheat.h"
|
||||
#include "doomdef.h"
|
||||
#include "d_englsh.h"
|
||||
#include "p_inter.h"
|
||||
#include "g_game.h"
|
||||
#include "global_data.h"
|
||||
|
||||
static void cheat_god(void);
|
||||
static void cheat_choppers(void);
|
||||
static void cheat_idkfa(void);
|
||||
static void cheat_ammo(void);
|
||||
static void cheat_noclip(void);
|
||||
static void cheat_invincibility(void);
|
||||
static void cheat_beserk(void);
|
||||
static void cheat_invisibility(void);
|
||||
static void cheat_map(void);
|
||||
static void cheat_goggles(void);
|
||||
static void cheat_exit(void);
|
||||
static void cheat_rockets(void);
|
||||
static void cheat_fps(void);
|
||||
|
||||
typedef struct c_cheat
|
||||
{
|
||||
char *name;
|
||||
byte sequence[8];
|
||||
unsigned int packed_sequence;
|
||||
void (*cheat_function)(void);
|
||||
} c_cheat;
|
||||
|
||||
#define CHEAT_PACK(a,b,c,d,e,f,g,h) ((a << 28)|(b << 24)|(c << 20)|(d << 16)|(e << 12)|(f << 8)|(g << 4)|(h))
|
||||
|
||||
#define CHEAT_SEQ(a,b,c,d,e,f,g,h) {a,b,c,d,e,f,g,h}, CHEAT_PACK(a,b,c,d,e,f,g,h)
|
||||
|
||||
static const c_cheat cheat_def[] =
|
||||
{
|
||||
{ "Chainsaw", CHEAT_SEQ(KEYD_ALT, KEYD_UP, KEYD_UP, KEYD_LEFT, KEYD_ALT, KEYD_USE, KEYD_USE, KEYD_UP), cheat_choppers },
|
||||
{ "Auto-map", CHEAT_SEQ(KEYD_DOWN, KEYD_DOWN, KEYD_LEFT, KEYD_LEFT, KEYD_RIGHT, KEYD_RIGHT, KEYD_LEFT, KEYD_UP), cheat_map },
|
||||
{ "God mode", CHEAT_SEQ(KEYD_UP, KEYD_UP, KEYD_DOWN, KEYD_DOWN, KEYD_LEFT, KEYD_LEFT, KEYD_RIGHT, KEYD_RIGHT), cheat_god },
|
||||
{ "Ammo & Keys", CHEAT_SEQ(KEYD_ALT, KEYD_LEFT, KEYD_USE, KEYD_RIGHT, KEYD_USE, KEYD_UP, KEYD_ALT, KEYD_UP), cheat_idkfa },
|
||||
{ "Ammo", CHEAT_SEQ(KEYD_ALT, KEYD_CHGW, KEYD_ALT, KEYD_CHGW, KEYD_ALT, KEYD_UP, KEYD_UP, KEYD_LEFT), cheat_ammo },
|
||||
{ "No Clipping", CHEAT_SEQ(KEYD_ALT, KEYD_DOWN, KEYD_LEFT, KEYD_RIGHT, KEYD_UP, KEYD_DOWN, KEYD_LEFT, KEYD_RIGHT), cheat_noclip },
|
||||
{ "Invincibility", CHEAT_SEQ(KEYD_ALT, KEYD_CHGW, KEYD_ALT, KEYD_RIGHT, KEYD_LEFT, KEYD_RIGHT, KEYD_ALT, KEYD_ALT), cheat_invincibility },
|
||||
{ "Berserk", CHEAT_SEQ(KEYD_ALT, KEYD_CHGW, KEYD_ALT, KEYD_UP, KEYD_LEFT, KEYD_ALT, KEYD_RIGHT, KEYD_ALT), cheat_beserk },
|
||||
{ "Invisibility", CHEAT_SEQ(KEYD_CHGW, KEYD_ALT, KEYD_CHGW, KEYD_LEFT, KEYD_LEFT, KEYD_ALT, KEYD_LEFT, KEYD_ALT), cheat_invisibility },
|
||||
{ "Lite-Amp Goggles", CHEAT_SEQ(KEYD_DOWN, KEYD_LEFT, KEYD_RIGHT, KEYD_ALT, KEYD_RIGHT, KEYD_LEFT, KEYD_LEFT, KEYD_RIGHT), cheat_goggles },
|
||||
{ "Exit Level", CHEAT_SEQ(KEYD_LEFT, KEYD_LEFT, KEYD_LEFT, KEYD_ALT, KEYD_CHGW, KEYD_USE, KEYD_RIGHT, KEYD_FIRE), cheat_exit },
|
||||
//Because Goldeneye!
|
||||
{ "Enemy Rockets", CHEAT_SEQ(KEYD_CHGW, KEYD_ALT, KEYD_CHGW, KEYD_ALT, KEYD_RIGHT, KEYD_ALT, KEYD_ALT, KEYD_RIGHT), cheat_rockets },
|
||||
{ "FPS Counter Ammo", CHEAT_SEQ(KEYD_RIGHT, KEYD_RIGHT, KEYD_ALT, KEYD_UP, KEYD_DOWN, KEYD_ALT, KEYD_LEFT, KEYD_LEFT), cheat_fps },
|
||||
};
|
||||
|
||||
static const unsigned int num_cheats = sizeof(cheat_def) / sizeof(c_cheat);
|
||||
|
||||
static boolean CheckCheats(unsigned int keybuff)
|
||||
{
|
||||
for (int i = 0; i < num_cheats; i++)
|
||||
{
|
||||
if (cheat_def[i].packed_sequence == keybuff)
|
||||
{
|
||||
if (cheat_def[i].cheat_function)
|
||||
cheat_def[i].cheat_function();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean C_Responder(event_t *ev)
|
||||
{
|
||||
if (ev->type == ev_keydown)
|
||||
{
|
||||
//To enable fast cheat searching without having to
|
||||
//maintain buffer of keypresses, we ensure that
|
||||
//cheats are 8 keys long and the key-code is less
|
||||
//than 16 so they fit in 4 bits.
|
||||
|
||||
//We can store a full 8 presses in a 32bit int.
|
||||
|
||||
//Adding a press to the list just means shifting the
|
||||
//whole thing by 4 and ORing the next press into the
|
||||
//low bits.
|
||||
|
||||
//We can test a cheat sequence with a simple int comparison.
|
||||
|
||||
unsigned int cb = _g->cheat_buffer << 4;
|
||||
cb |= ev->data1 & 0xf;
|
||||
|
||||
_g->cheat_buffer = cb;
|
||||
|
||||
if (CheckCheats(cb))
|
||||
return true; //eat last cheat key.
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static void cheat_god()
|
||||
{
|
||||
_g->player.cheats ^= CF_GODMODE;
|
||||
|
||||
if (_g->player.cheats & CF_GODMODE)
|
||||
{
|
||||
_g->player.health = god_health;
|
||||
|
||||
_g->player.message = STSTR_DQDON;
|
||||
}
|
||||
else
|
||||
{
|
||||
_g->player.message = STSTR_DQDOFF;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
static void cheat_choppers()
|
||||
{
|
||||
_g->player.weaponowned[wp_chainsaw] = true;
|
||||
_g->player.pendingweapon = wp_chainsaw;
|
||||
|
||||
P_GivePower(&_g->player, pw_invulnerability);
|
||||
|
||||
_g->player.message = STSTR_CHOPPERS;
|
||||
}
|
||||
|
||||
static void cheat_idkfa()
|
||||
{
|
||||
int i;
|
||||
|
||||
player_t *plyr = &_g->player;
|
||||
|
||||
if (!plyr->backpack)
|
||||
{
|
||||
for (i = 0; i < NUMAMMO; i++)
|
||||
plyr->maxammo[i] *= 2;
|
||||
|
||||
plyr->backpack = true;
|
||||
}
|
||||
|
||||
plyr->armorpoints = idfa_armor; // Ty 03/09/98 - deh
|
||||
plyr->armortype = idfa_armor_class; // Ty 03/09/98 - deh
|
||||
|
||||
// You can't own weapons that aren't in the game // phares 02/27/98
|
||||
for (i = 0; i < NUMWEAPONS; i++)
|
||||
if (!(((i == wp_plasma || i == wp_bfg) && _g->gamemode == shareware) || (i == wp_supershotgun && _g->gamemode != commercial)))
|
||||
plyr->weaponowned[i] = true;
|
||||
|
||||
for (i = 0; i < NUMAMMO; i++)
|
||||
if (i != am_cell || _g->gamemode != shareware)
|
||||
plyr->ammo[i] = plyr->maxammo[i];
|
||||
|
||||
for (i = 0; i < NUMCARDS; i++)
|
||||
plyr->cards[i] = true;
|
||||
|
||||
plyr->message = STSTR_KFAADDED;
|
||||
}
|
||||
|
||||
static void cheat_ammo()
|
||||
{
|
||||
int i;
|
||||
player_t *plyr = &_g->player;
|
||||
|
||||
if (!plyr->backpack)
|
||||
{
|
||||
for (i = 0; i < NUMAMMO; i++)
|
||||
plyr->maxammo[i] *= 2;
|
||||
|
||||
plyr->backpack = true;
|
||||
}
|
||||
|
||||
plyr->armorpoints = idfa_armor; // Ty 03/09/98 - deh
|
||||
plyr->armortype = idfa_armor_class; // Ty 03/09/98 - deh
|
||||
|
||||
// You can't own weapons that aren't in the game // phares 02/27/98
|
||||
for (i = 0; i < NUMWEAPONS; i++)
|
||||
if (!(((i == wp_plasma || i == wp_bfg) && _g->gamemode == shareware) || (i == wp_supershotgun && _g->gamemode != commercial)))
|
||||
plyr->weaponowned[i] = true;
|
||||
|
||||
for (i = 0; i < NUMAMMO; i++)
|
||||
if (i != am_cell || _g->gamemode != shareware)
|
||||
plyr->ammo[i] = plyr->maxammo[i];
|
||||
|
||||
plyr->message = STSTR_FAADDED;
|
||||
}
|
||||
|
||||
static void cheat_noclip()
|
||||
{
|
||||
_g->player.cheats ^= CF_NOCLIP;
|
||||
|
||||
if (_g->player.cheats & CF_NOCLIP)
|
||||
{
|
||||
_g->player.message = STSTR_NCON;
|
||||
}
|
||||
else
|
||||
{
|
||||
_g->player.message = STSTR_NCOFF;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
static void cheat_invincibility()
|
||||
{
|
||||
P_GivePower(&_g->player, pw_invulnerability);
|
||||
}
|
||||
|
||||
static void cheat_beserk()
|
||||
{
|
||||
P_GivePower(&_g->player, pw_strength);
|
||||
}
|
||||
|
||||
static void cheat_invisibility()
|
||||
{
|
||||
P_GivePower(&_g->player, pw_invisibility);
|
||||
}
|
||||
|
||||
static void cheat_map()
|
||||
{
|
||||
P_GivePower(&_g->player, pw_allmap);
|
||||
}
|
||||
|
||||
static void cheat_goggles()
|
||||
{
|
||||
P_GivePower(&_g->player, pw_infrared);
|
||||
}
|
||||
|
||||
static void cheat_exit()
|
||||
{
|
||||
G_ExitLevel();
|
||||
}
|
||||
|
||||
static void cheat_rockets()
|
||||
{
|
||||
_g->player.cheats ^= CF_ENEMY_ROCKETS;
|
||||
|
||||
if (_g->player.cheats & CF_ENEMY_ROCKETS)
|
||||
{
|
||||
_g->player.health = god_health;
|
||||
|
||||
_g->player.weaponowned[wp_missile] = true;
|
||||
_g->player.ammo[am_misl] = _g->player.maxammo[am_misl];
|
||||
|
||||
_g->player.pendingweapon = wp_missile;
|
||||
|
||||
_g->player.message = STSTR_ROCKETON;
|
||||
}
|
||||
else
|
||||
{
|
||||
_g->player.message = STSTR_ROCKETOFF;
|
||||
}
|
||||
}
|
||||
|
||||
static void cheat_fps()
|
||||
{
|
||||
_g->fps_show = !_g->fps_show;
|
||||
if (_g->fps_show)
|
||||
{
|
||||
_g->player.message = STSTR_FPSON;
|
||||
}
|
||||
else
|
||||
{
|
||||
_g->player.message = STSTR_FPSOFF;
|
||||
}
|
||||
}
|
||||
+1291
-1291
File diff suppressed because it is too large.
Load diff
@@ -1,97 +1,97 @@
|
||||
/* Emacs style mode select -*- C++ -*-
|
||||
*-----------------------------------------------------------------------------
|
||||
*
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Random number LUT.
|
||||
*
|
||||
* 1/19/98 killough: Rewrote random number generator for better randomness,
|
||||
* while at the same time maintaining demo sync and backward compatibility.
|
||||
*
|
||||
* 2/16/98 killough: Made each RNG local to each control-equivalent block,
|
||||
* to reduce the chances of demo sync problems.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#include "doomstat.h"
|
||||
#include "m_random.h"
|
||||
#include "lprintf.h"
|
||||
|
||||
#include "global_data.h"
|
||||
|
||||
//
|
||||
// M_Random
|
||||
// Returns a 0-255 number
|
||||
// next-hack: why using 18 rows of 14 numbers and then 4 ? 16 by 16 was bad?
|
||||
static const unsigned char rndtable[256] =
|
||||
{
|
||||
0, 8, 109, 220, 222, 241, 149, 107, 75, 248, 254, 140, 16, 66 ,
|
||||
74, 21, 211, 47, 80, 242, 154, 27, 205, 128, 161, 89, 77, 36 ,
|
||||
95, 110, 85, 48, 212, 140, 211, 249, 22, 79, 200, 50, 28, 188 ,
|
||||
52, 140, 202, 120, 68, 145, 62, 70, 184, 190, 91, 197, 152, 224 ,
|
||||
149, 104, 25, 178, 252, 182, 202, 182, 141, 197, 4, 81, 181, 242 ,
|
||||
145, 42, 39, 227, 156, 198, 225, 193, 219, 93, 122, 175, 249, 0 ,
|
||||
175, 143, 70, 239, 46, 246, 163, 53, 163, 109, 168, 135, 2, 235 ,
|
||||
25, 92, 20, 145, 138, 77, 69, 166, 78, 176, 173, 212, 166, 113 ,
|
||||
94, 161, 41, 50, 239, 49, 111, 164, 70, 60, 2, 37, 171, 75 ,
|
||||
136, 156, 11, 56, 42, 146, 138, 229, 73, 146, 77, 61, 98, 196 ,
|
||||
135, 106, 63, 197, 195, 86, 96, 203, 113, 101, 170, 247, 181, 113 ,
|
||||
80, 250, 108, 7, 255, 237, 129, 226, 79, 107, 112, 166, 103, 241 ,
|
||||
24, 223, 239, 120, 198, 58, 60, 82, 128, 3, 184, 66, 143, 224 ,
|
||||
145, 224, 81, 206, 163, 45, 63, 90, 168, 114, 59, 33, 159, 95 ,
|
||||
28, 139, 123, 98, 125, 196, 15, 70, 194, 253, 54, 14, 109, 226 ,
|
||||
71, 17, 161, 93, 186, 87, 244, 138, 20, 52, 123, 251, 26, 36 ,
|
||||
17, 46, 52, 231, 232, 76, 31, 221, 84, 37, 216, 165, 212, 106 ,
|
||||
197, 242, 98, 43, 39, 175, 254, 145, 190, 84, 118, 222, 187, 136 ,
|
||||
120, 163, 236, 249
|
||||
};
|
||||
// Which one is deterministic?
|
||||
int P_Random(const char *file, int line, const char *func)
|
||||
{
|
||||
_g->prndindex = (_g->prndindex + 1) & 0xff;
|
||||
if (PRND_SCAN && _g->gametic >= MIN_DEMO_GAMETIC_TO_PRINT)
|
||||
{
|
||||
// get only last path
|
||||
int l = strlen(file);
|
||||
file += l - 1;
|
||||
while (*file != '\\')
|
||||
file--;
|
||||
demodbgprintf ("File %s, Line %d, func %s MR %x\r\n", file, line, func, _g->prndindex);
|
||||
}
|
||||
return rndtable[_g->prndindex];
|
||||
}
|
||||
|
||||
int M_Random(void)
|
||||
{
|
||||
_g->rndindex = (_g->rndindex + 1) & 0xff;
|
||||
return rndtable[_g->rndindex];
|
||||
}
|
||||
|
||||
void M_ClearRandom(void)
|
||||
{
|
||||
_g->rndindex = _g->prndindex = 0;
|
||||
}
|
||||
/* Emacs style mode select -*- C++ -*-
|
||||
*-----------------------------------------------------------------------------
|
||||
*
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Random number LUT.
|
||||
*
|
||||
* 1/19/98 killough: Rewrote random number generator for better randomness,
|
||||
* while at the same time maintaining demo sync and backward compatibility.
|
||||
*
|
||||
* 2/16/98 killough: Made each RNG local to each control-equivalent block,
|
||||
* to reduce the chances of demo sync problems.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#include "doomstat.h"
|
||||
#include "m_random.h"
|
||||
#include "lprintf.h"
|
||||
|
||||
#include "global_data.h"
|
||||
|
||||
//
|
||||
// M_Random
|
||||
// Returns a 0-255 number
|
||||
// next-hack: why using 18 rows of 14 numbers and then 4 ? 16 by 16 was bad?
|
||||
static const unsigned char rndtable[256] =
|
||||
{
|
||||
0, 8, 109, 220, 222, 241, 149, 107, 75, 248, 254, 140, 16, 66 ,
|
||||
74, 21, 211, 47, 80, 242, 154, 27, 205, 128, 161, 89, 77, 36 ,
|
||||
95, 110, 85, 48, 212, 140, 211, 249, 22, 79, 200, 50, 28, 188 ,
|
||||
52, 140, 202, 120, 68, 145, 62, 70, 184, 190, 91, 197, 152, 224 ,
|
||||
149, 104, 25, 178, 252, 182, 202, 182, 141, 197, 4, 81, 181, 242 ,
|
||||
145, 42, 39, 227, 156, 198, 225, 193, 219, 93, 122, 175, 249, 0 ,
|
||||
175, 143, 70, 239, 46, 246, 163, 53, 163, 109, 168, 135, 2, 235 ,
|
||||
25, 92, 20, 145, 138, 77, 69, 166, 78, 176, 173, 212, 166, 113 ,
|
||||
94, 161, 41, 50, 239, 49, 111, 164, 70, 60, 2, 37, 171, 75 ,
|
||||
136, 156, 11, 56, 42, 146, 138, 229, 73, 146, 77, 61, 98, 196 ,
|
||||
135, 106, 63, 197, 195, 86, 96, 203, 113, 101, 170, 247, 181, 113 ,
|
||||
80, 250, 108, 7, 255, 237, 129, 226, 79, 107, 112, 166, 103, 241 ,
|
||||
24, 223, 239, 120, 198, 58, 60, 82, 128, 3, 184, 66, 143, 224 ,
|
||||
145, 224, 81, 206, 163, 45, 63, 90, 168, 114, 59, 33, 159, 95 ,
|
||||
28, 139, 123, 98, 125, 196, 15, 70, 194, 253, 54, 14, 109, 226 ,
|
||||
71, 17, 161, 93, 186, 87, 244, 138, 20, 52, 123, 251, 26, 36 ,
|
||||
17, 46, 52, 231, 232, 76, 31, 221, 84, 37, 216, 165, 212, 106 ,
|
||||
197, 242, 98, 43, 39, 175, 254, 145, 190, 84, 118, 222, 187, 136 ,
|
||||
120, 163, 236, 249
|
||||
};
|
||||
// Which one is deterministic?
|
||||
int P_Random(const char *file, int line, const char *func)
|
||||
{
|
||||
_g->prndindex = (_g->prndindex + 1) & 0xff;
|
||||
if (PRND_SCAN && _g->gametic >= MIN_DEMO_GAMETIC_TO_PRINT)
|
||||
{
|
||||
// get only last path
|
||||
int l = strlen(file);
|
||||
file += l - 1;
|
||||
while (*file != '\\')
|
||||
file--;
|
||||
demodbgprintf ("File %s, Line %d, func %s MR %x\r\n", file, line, func, _g->prndindex);
|
||||
}
|
||||
return rndtable[_g->prndindex];
|
||||
}
|
||||
|
||||
int M_Random(void)
|
||||
{
|
||||
_g->rndindex = (_g->rndindex + 1) & 0xff;
|
||||
return rndtable[_g->rndindex];
|
||||
}
|
||||
|
||||
void M_ClearRandom(void)
|
||||
{
|
||||
_g->rndindex = _g->prndindex = 0;
|
||||
}
|
||||
@@ -1,467 +1,467 @@
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Ceiling aninmation (lowering, crushing, raising)
|
||||
*
|
||||
* next-hack: modified code to work with short pointers.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#include "doomstat.h"
|
||||
#include "r_main.h"
|
||||
#include "p_spec.h"
|
||||
#include "p_tick.h"
|
||||
#include "s_sound.h"
|
||||
#include "sounds.h"
|
||||
|
||||
#include "global_data.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Ceiling action routine and linedef type handler
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////
|
||||
|
||||
//
|
||||
// T_MoveCeiling
|
||||
//
|
||||
// Action routine that moves ceilings. Called once per tick.
|
||||
//
|
||||
// Passed a ceiling_t structure that contains all the info about the move.
|
||||
// see P_SPEC.H for fields. No return.
|
||||
//
|
||||
// jff 02/08/98 all cases with labels beginning with gen added to support
|
||||
// generalized line type behaviors.
|
||||
//
|
||||
void T_MoveCeiling(ceiling_t *ceiling)
|
||||
{
|
||||
result_e res;
|
||||
|
||||
switch (ceiling->direction)
|
||||
{
|
||||
case 0:
|
||||
// If ceiling in stasis, do nothing
|
||||
break;
|
||||
|
||||
case 1:
|
||||
// Ceiling is moving up
|
||||
res = T_MovePlane(ceiling->sector, ceiling->speed, ceiling->topheight,
|
||||
false, 1, ceiling->direction);
|
||||
|
||||
// if not a silent crusher, make moving sound
|
||||
if (!(_g->leveltime & 7))
|
||||
{
|
||||
switch (ceiling->type)
|
||||
{
|
||||
case silentCrushAndRaise:
|
||||
case genSilentCrusher:
|
||||
break;
|
||||
default:
|
||||
S_StartSound2(&ceiling->sector->soundorg, sfx_stnmov);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// handle reaching destination height
|
||||
if (res == pastdest)
|
||||
{
|
||||
switch (ceiling->type)
|
||||
{
|
||||
// plain movers are just removed
|
||||
case raiseToHighest:
|
||||
case genCeiling:
|
||||
P_RemoveActiveCeiling(ceiling);
|
||||
break;
|
||||
|
||||
// movers with texture change, change the texture then get removed
|
||||
case genCeilingChgT:
|
||||
case genCeilingChg0:
|
||||
ceiling->sector->special = ceiling->newspecial;
|
||||
//jff 3/14/98 transfer old special field as well
|
||||
ceiling->sector->oldspecial = ceiling->oldspecial;
|
||||
case genCeilingChg:
|
||||
ceiling->sector->ceilingpic = ceiling->texture;
|
||||
P_RemoveActiveCeiling(ceiling);
|
||||
break;
|
||||
|
||||
// crushers reverse direction at the top
|
||||
case silentCrushAndRaise:
|
||||
S_StartSound2(&ceiling->sector->soundorg, sfx_pstop);
|
||||
case genSilentCrusher:
|
||||
case genCrusher:
|
||||
case fastCrushAndRaise:
|
||||
case crushAndRaise:
|
||||
ceiling->direction = -1;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case -1:
|
||||
// Ceiling moving down
|
||||
res = T_MovePlane(ceiling->sector, ceiling->speed, ceiling->bottomheight, ceiling->crush, 1, ceiling->direction);
|
||||
|
||||
// if not silent crusher type make moving sound
|
||||
if (!(_g->leveltime & 7))
|
||||
{
|
||||
switch (ceiling->type)
|
||||
{
|
||||
case silentCrushAndRaise:
|
||||
case genSilentCrusher:
|
||||
break;
|
||||
default:
|
||||
S_StartSound2(&ceiling->sector->soundorg, sfx_stnmov);
|
||||
}
|
||||
}
|
||||
|
||||
// handle reaching destination height
|
||||
if (res == pastdest)
|
||||
{
|
||||
switch (ceiling->type)
|
||||
{
|
||||
// 02/09/98 jff change slow crushers' speed back to normal
|
||||
// start back up
|
||||
case genSilentCrusher:
|
||||
case genCrusher:
|
||||
if (ceiling->oldspeed < CEILSPEED * 3)
|
||||
ceiling->speed = ceiling->oldspeed;
|
||||
ceiling->direction = 1; //jff 2/22/98 make it go back up!
|
||||
break;
|
||||
|
||||
// make platform stop at bottom of all crusher strokes
|
||||
// except generalized ones, reset speed, start back up
|
||||
case silentCrushAndRaise:
|
||||
S_StartSound2(&ceiling->sector->soundorg, sfx_pstop);
|
||||
case crushAndRaise:
|
||||
ceiling->speed = CEILSPEED;
|
||||
case fastCrushAndRaise:
|
||||
ceiling->direction = 1;
|
||||
break;
|
||||
|
||||
// in the case of ceiling mover/changer, change the texture
|
||||
// then remove the active ceiling
|
||||
case genCeilingChgT:
|
||||
case genCeilingChg0:
|
||||
ceiling->sector->special = ceiling->newspecial;
|
||||
//jff add to fix bug in special transfers from changes
|
||||
ceiling->sector->oldspecial = ceiling->oldspecial;
|
||||
case genCeilingChg:
|
||||
ceiling->sector->ceilingpic = ceiling->texture;
|
||||
P_RemoveActiveCeiling(ceiling);
|
||||
break;
|
||||
|
||||
// all other case, just remove the active ceiling
|
||||
case lowerAndCrush:
|
||||
case lowerToFloor:
|
||||
case lowerToLowest:
|
||||
case lowerToMaxFloor:
|
||||
case genCeiling:
|
||||
P_RemoveActiveCeiling(ceiling);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else // ( res != pastdest )
|
||||
{
|
||||
// handle the crusher encountering an obstacle
|
||||
if (res == crushed)
|
||||
{
|
||||
switch (ceiling->type)
|
||||
{
|
||||
//jff 02/08/98 slow down slow crushers on obstacle
|
||||
case genCrusher:
|
||||
case genSilentCrusher:
|
||||
if (ceiling->oldspeed < CEILSPEED * 3)
|
||||
ceiling->speed = CEILSPEED / 8;
|
||||
break;
|
||||
case silentCrushAndRaise:
|
||||
case crushAndRaise:
|
||||
case lowerAndCrush:
|
||||
ceiling->speed = CEILSPEED / 8;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// EV_DoCeiling
|
||||
//
|
||||
// Move a ceiling up/down or start a crusher
|
||||
//
|
||||
// Passed the linedef activating the function and the type of function desired
|
||||
// returns true if a thinker started
|
||||
//
|
||||
int EV_DoCeiling(const line_t *line, ceiling_e type)
|
||||
{
|
||||
int secnum;
|
||||
int rtn;
|
||||
sector_t *sec;
|
||||
ceiling_t *ceiling;
|
||||
|
||||
secnum = -1;
|
||||
rtn = 0;
|
||||
|
||||
// Reactivate in-stasis ceilings...for certain types.
|
||||
// This restarts a crusher after it has been stopped
|
||||
switch (type)
|
||||
{
|
||||
case fastCrushAndRaise:
|
||||
case silentCrushAndRaise:
|
||||
case crushAndRaise:
|
||||
//jff 4/5/98 return if activated
|
||||
rtn = P_ActivateInStasisCeiling(line);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// affects all sectors with the same tag as the linedef
|
||||
while ((secnum = P_FindSectorFromLineTag(line, secnum)) >= 0)
|
||||
{
|
||||
sec = &_g->sectors[secnum];
|
||||
|
||||
// if ceiling already moving, don't start a second function on it
|
||||
if (P_SectorActive(ceiling_special, sec)) //jff 2/22/98
|
||||
continue;
|
||||
|
||||
// create a new ceiling thinker
|
||||
rtn = 1;
|
||||
ceiling = Z_Malloc(sizeof(*ceiling), PU_LEVSPEC, 0);
|
||||
memset(ceiling, 0, sizeof(*ceiling));
|
||||
P_AddThinker(&ceiling->thinker);
|
||||
sec->ceilingdata_sptr = getShortPtr(ceiling); //jff 2/22/98
|
||||
ceiling->thinker.function = T_MoveCeiling;
|
||||
ceiling->sector = sec;
|
||||
ceiling->crush = false;
|
||||
|
||||
// setup ceiling structure according to type of function
|
||||
switch (type)
|
||||
{
|
||||
case fastCrushAndRaise:
|
||||
ceiling->crush = true;
|
||||
ceiling->topheight = sec->ceilingheight;
|
||||
ceiling->bottomheight = sec->floorheight + (8 * FRACUNIT);
|
||||
ceiling->direction = -1;
|
||||
ceiling->speed = CEILSPEED * 2;
|
||||
break;
|
||||
|
||||
case silentCrushAndRaise:
|
||||
case crushAndRaise:
|
||||
ceiling->crush = true;
|
||||
ceiling->topheight = sec->ceilingheight;
|
||||
case lowerAndCrush:
|
||||
case lowerToFloor:
|
||||
ceiling->bottomheight = sec->floorheight;
|
||||
if (type != lowerToFloor)
|
||||
ceiling->bottomheight += 8 * FRACUNIT;
|
||||
ceiling->direction = -1;
|
||||
ceiling->speed = CEILSPEED;
|
||||
break;
|
||||
|
||||
case raiseToHighest:
|
||||
ceiling->topheight = P_FindHighestCeilingSurrounding(sec);
|
||||
ceiling->direction = 1;
|
||||
ceiling->speed = CEILSPEED;
|
||||
break;
|
||||
|
||||
case lowerToLowest:
|
||||
ceiling->bottomheight = P_FindLowestCeilingSurrounding(sec);
|
||||
ceiling->direction = -1;
|
||||
ceiling->speed = CEILSPEED;
|
||||
break;
|
||||
|
||||
case lowerToMaxFloor:
|
||||
ceiling->bottomheight = P_FindHighestFloorSurrounding(sec);
|
||||
ceiling->direction = -1;
|
||||
ceiling->speed = CEILSPEED;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// add the ceiling to the active list
|
||||
ceiling->tag = sec->tag;
|
||||
ceiling->type = type;
|
||||
P_AddActiveCeiling(ceiling);
|
||||
}
|
||||
return rtn;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Active ceiling list primitives
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
// jff 2/22/98 - modified Lee's plat code to work for ceilings
|
||||
//
|
||||
// The following were all rewritten by Lee Killough
|
||||
// to use the new structure which places no limits
|
||||
// on active ceilings. It also avoids spending as much
|
||||
// time searching for active ceilings. Previously a
|
||||
// fixed-size array was used, with NULL indicating
|
||||
// empty entries, while now a doubly-linked list
|
||||
// is used.
|
||||
|
||||
//
|
||||
// P_ActivateInStasisCeiling()
|
||||
//
|
||||
// Reactivates all stopped crushers with the right tag
|
||||
//
|
||||
// Passed the line reactivating the crusher
|
||||
// Returns true if a ceiling reactivated
|
||||
//
|
||||
//jff 4/5/98 return if activated
|
||||
int P_ActivateInStasisCeiling(const line_t *line)
|
||||
{
|
||||
ceilinglist_t *cl;
|
||||
int rtn = 0;
|
||||
|
||||
for (cl = _g->activeceilings; cl; cl = cl->next)
|
||||
{
|
||||
ceiling_t *ceiling = cl->ceiling;
|
||||
if (ceiling->tag == line->tag && ceiling->direction == 0)
|
||||
{
|
||||
ceiling->direction = ceiling->olddirection;
|
||||
ceiling->thinker.function = T_MoveCeiling;
|
||||
//jff 4/5/98 return if activated
|
||||
rtn = 1;
|
||||
}
|
||||
}
|
||||
return rtn;
|
||||
}
|
||||
|
||||
//
|
||||
// EV_CeilingCrushStop()
|
||||
//
|
||||
// Stops all active ceilings with the right tag
|
||||
//
|
||||
// Passed the linedef stopping the ceilings
|
||||
// Returns true if a ceiling put in stasis
|
||||
//
|
||||
int EV_CeilingCrushStop(const line_t *line)
|
||||
{
|
||||
int rtn = 0;
|
||||
|
||||
ceilinglist_t *cl;
|
||||
for (cl = _g->activeceilings; cl; cl = cl->next)
|
||||
{
|
||||
ceiling_t *ceiling = cl->ceiling;
|
||||
if (ceiling->direction != 0 && ceiling->tag == line->tag)
|
||||
{
|
||||
ceiling->olddirection = ceiling->direction;
|
||||
ceiling->direction = 0;
|
||||
ceiling->thinker.function = NULL;
|
||||
rtn = 1;
|
||||
}
|
||||
}
|
||||
return rtn;
|
||||
}
|
||||
|
||||
//
|
||||
// P_AddActiveCeiling()
|
||||
//
|
||||
// Adds a ceiling to the head of the list of active ceilings
|
||||
//
|
||||
// Passed the ceiling motion structure
|
||||
// Returns nothing
|
||||
//
|
||||
void P_AddActiveCeiling(ceiling_t *ceiling)
|
||||
{
|
||||
ceilinglist_t *old_head = _g->activeceilings;
|
||||
|
||||
ceilinglist_t *list = Z_Malloc(sizeof *list, PU_LEVEL, (void** ) &_g->activeceilings);
|
||||
list->ceiling = ceiling;
|
||||
ceiling->list = list;
|
||||
|
||||
if ((list->next = old_head))
|
||||
list->next->prev = &list->next;
|
||||
|
||||
list->prev = (ceilinglist_t**) old_head;
|
||||
}
|
||||
|
||||
//
|
||||
// P_RemoveActiveCeiling()
|
||||
//
|
||||
// Removes a ceiling from the list of active ceilings
|
||||
//
|
||||
// Passed the ceiling motion structure
|
||||
// Returns nothing
|
||||
//
|
||||
void P_RemoveActiveCeiling(ceiling_t *ceiling)
|
||||
{
|
||||
ceilinglist_t *list = ceiling->list;
|
||||
ceiling->sector->ceilingdata_sptr = 0; //jff 2/22/98
|
||||
|
||||
P_RemoveThinker(&ceiling->thinker);
|
||||
|
||||
if ((list->prev && (*list->prev = list->next)))
|
||||
list->next->prev = list->prev;
|
||||
|
||||
free(list);
|
||||
}
|
||||
|
||||
//
|
||||
// P_RemoveAllActiveCeilings()
|
||||
//
|
||||
// Removes all ceilings from the active ceiling list
|
||||
//
|
||||
// Passed nothing, returns nothing
|
||||
//
|
||||
void P_RemoveAllActiveCeilings(void)
|
||||
{
|
||||
while (_g->activeceilings)
|
||||
{
|
||||
ceilinglist_t *next = _g->activeceilings->next;
|
||||
free(_g->activeceilings);
|
||||
_g->activeceilings = next;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Ceiling aninmation (lowering, crushing, raising)
|
||||
*
|
||||
* next-hack: modified code to work with short pointers.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#include "doomstat.h"
|
||||
#include "r_main.h"
|
||||
#include "p_spec.h"
|
||||
#include "p_tick.h"
|
||||
#include "s_sound.h"
|
||||
#include "sounds.h"
|
||||
|
||||
#include "global_data.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Ceiling action routine and linedef type handler
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////
|
||||
|
||||
//
|
||||
// T_MoveCeiling
|
||||
//
|
||||
// Action routine that moves ceilings. Called once per tick.
|
||||
//
|
||||
// Passed a ceiling_t structure that contains all the info about the move.
|
||||
// see P_SPEC.H for fields. No return.
|
||||
//
|
||||
// jff 02/08/98 all cases with labels beginning with gen added to support
|
||||
// generalized line type behaviors.
|
||||
//
|
||||
void T_MoveCeiling(ceiling_t *ceiling)
|
||||
{
|
||||
result_e res;
|
||||
|
||||
switch (ceiling->direction)
|
||||
{
|
||||
case 0:
|
||||
// If ceiling in stasis, do nothing
|
||||
break;
|
||||
|
||||
case 1:
|
||||
// Ceiling is moving up
|
||||
res = T_MovePlane(ceiling->sector, ceiling->speed, ceiling->topheight,
|
||||
false, 1, ceiling->direction);
|
||||
|
||||
// if not a silent crusher, make moving sound
|
||||
if (!(_g->leveltime & 7))
|
||||
{
|
||||
switch (ceiling->type)
|
||||
{
|
||||
case silentCrushAndRaise:
|
||||
case genSilentCrusher:
|
||||
break;
|
||||
default:
|
||||
S_StartSound2(&ceiling->sector->soundorg, sfx_stnmov);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// handle reaching destination height
|
||||
if (res == pastdest)
|
||||
{
|
||||
switch (ceiling->type)
|
||||
{
|
||||
// plain movers are just removed
|
||||
case raiseToHighest:
|
||||
case genCeiling:
|
||||
P_RemoveActiveCeiling(ceiling);
|
||||
break;
|
||||
|
||||
// movers with texture change, change the texture then get removed
|
||||
case genCeilingChgT:
|
||||
case genCeilingChg0:
|
||||
ceiling->sector->special = ceiling->newspecial;
|
||||
//jff 3/14/98 transfer old special field as well
|
||||
ceiling->sector->oldspecial = ceiling->oldspecial;
|
||||
case genCeilingChg:
|
||||
ceiling->sector->ceilingpic = ceiling->texture;
|
||||
P_RemoveActiveCeiling(ceiling);
|
||||
break;
|
||||
|
||||
// crushers reverse direction at the top
|
||||
case silentCrushAndRaise:
|
||||
S_StartSound2(&ceiling->sector->soundorg, sfx_pstop);
|
||||
case genSilentCrusher:
|
||||
case genCrusher:
|
||||
case fastCrushAndRaise:
|
||||
case crushAndRaise:
|
||||
ceiling->direction = -1;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case -1:
|
||||
// Ceiling moving down
|
||||
res = T_MovePlane(ceiling->sector, ceiling->speed, ceiling->bottomheight, ceiling->crush, 1, ceiling->direction);
|
||||
|
||||
// if not silent crusher type make moving sound
|
||||
if (!(_g->leveltime & 7))
|
||||
{
|
||||
switch (ceiling->type)
|
||||
{
|
||||
case silentCrushAndRaise:
|
||||
case genSilentCrusher:
|
||||
break;
|
||||
default:
|
||||
S_StartSound2(&ceiling->sector->soundorg, sfx_stnmov);
|
||||
}
|
||||
}
|
||||
|
||||
// handle reaching destination height
|
||||
if (res == pastdest)
|
||||
{
|
||||
switch (ceiling->type)
|
||||
{
|
||||
// 02/09/98 jff change slow crushers' speed back to normal
|
||||
// start back up
|
||||
case genSilentCrusher:
|
||||
case genCrusher:
|
||||
if (ceiling->oldspeed < CEILSPEED * 3)
|
||||
ceiling->speed = ceiling->oldspeed;
|
||||
ceiling->direction = 1; //jff 2/22/98 make it go back up!
|
||||
break;
|
||||
|
||||
// make platform stop at bottom of all crusher strokes
|
||||
// except generalized ones, reset speed, start back up
|
||||
case silentCrushAndRaise:
|
||||
S_StartSound2(&ceiling->sector->soundorg, sfx_pstop);
|
||||
case crushAndRaise:
|
||||
ceiling->speed = CEILSPEED;
|
||||
case fastCrushAndRaise:
|
||||
ceiling->direction = 1;
|
||||
break;
|
||||
|
||||
// in the case of ceiling mover/changer, change the texture
|
||||
// then remove the active ceiling
|
||||
case genCeilingChgT:
|
||||
case genCeilingChg0:
|
||||
ceiling->sector->special = ceiling->newspecial;
|
||||
//jff add to fix bug in special transfers from changes
|
||||
ceiling->sector->oldspecial = ceiling->oldspecial;
|
||||
case genCeilingChg:
|
||||
ceiling->sector->ceilingpic = ceiling->texture;
|
||||
P_RemoveActiveCeiling(ceiling);
|
||||
break;
|
||||
|
||||
// all other case, just remove the active ceiling
|
||||
case lowerAndCrush:
|
||||
case lowerToFloor:
|
||||
case lowerToLowest:
|
||||
case lowerToMaxFloor:
|
||||
case genCeiling:
|
||||
P_RemoveActiveCeiling(ceiling);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else // ( res != pastdest )
|
||||
{
|
||||
// handle the crusher encountering an obstacle
|
||||
if (res == crushed)
|
||||
{
|
||||
switch (ceiling->type)
|
||||
{
|
||||
//jff 02/08/98 slow down slow crushers on obstacle
|
||||
case genCrusher:
|
||||
case genSilentCrusher:
|
||||
if (ceiling->oldspeed < CEILSPEED * 3)
|
||||
ceiling->speed = CEILSPEED / 8;
|
||||
break;
|
||||
case silentCrushAndRaise:
|
||||
case crushAndRaise:
|
||||
case lowerAndCrush:
|
||||
ceiling->speed = CEILSPEED / 8;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// EV_DoCeiling
|
||||
//
|
||||
// Move a ceiling up/down or start a crusher
|
||||
//
|
||||
// Passed the linedef activating the function and the type of function desired
|
||||
// returns true if a thinker started
|
||||
//
|
||||
int EV_DoCeiling(const line_t *line, ceiling_e type)
|
||||
{
|
||||
int secnum;
|
||||
int rtn;
|
||||
sector_t *sec;
|
||||
ceiling_t *ceiling;
|
||||
|
||||
secnum = -1;
|
||||
rtn = 0;
|
||||
|
||||
// Reactivate in-stasis ceilings...for certain types.
|
||||
// This restarts a crusher after it has been stopped
|
||||
switch (type)
|
||||
{
|
||||
case fastCrushAndRaise:
|
||||
case silentCrushAndRaise:
|
||||
case crushAndRaise:
|
||||
//jff 4/5/98 return if activated
|
||||
rtn = P_ActivateInStasisCeiling(line);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// affects all sectors with the same tag as the linedef
|
||||
while ((secnum = P_FindSectorFromLineTag(line, secnum)) >= 0)
|
||||
{
|
||||
sec = &_g->sectors[secnum];
|
||||
|
||||
// if ceiling already moving, don't start a second function on it
|
||||
if (P_SectorActive(ceiling_special, sec)) //jff 2/22/98
|
||||
continue;
|
||||
|
||||
// create a new ceiling thinker
|
||||
rtn = 1;
|
||||
ceiling = Z_Malloc(sizeof(*ceiling), PU_LEVSPEC, 0);
|
||||
memset(ceiling, 0, sizeof(*ceiling));
|
||||
P_AddThinker(&ceiling->thinker);
|
||||
sec->ceilingdata_sptr = getShortPtr(ceiling); //jff 2/22/98
|
||||
ceiling->thinker.function = T_MoveCeiling;
|
||||
ceiling->sector = sec;
|
||||
ceiling->crush = false;
|
||||
|
||||
// setup ceiling structure according to type of function
|
||||
switch (type)
|
||||
{
|
||||
case fastCrushAndRaise:
|
||||
ceiling->crush = true;
|
||||
ceiling->topheight = sec->ceilingheight;
|
||||
ceiling->bottomheight = sec->floorheight + (8 * FRACUNIT);
|
||||
ceiling->direction = -1;
|
||||
ceiling->speed = CEILSPEED * 2;
|
||||
break;
|
||||
|
||||
case silentCrushAndRaise:
|
||||
case crushAndRaise:
|
||||
ceiling->crush = true;
|
||||
ceiling->topheight = sec->ceilingheight;
|
||||
case lowerAndCrush:
|
||||
case lowerToFloor:
|
||||
ceiling->bottomheight = sec->floorheight;
|
||||
if (type != lowerToFloor)
|
||||
ceiling->bottomheight += 8 * FRACUNIT;
|
||||
ceiling->direction = -1;
|
||||
ceiling->speed = CEILSPEED;
|
||||
break;
|
||||
|
||||
case raiseToHighest:
|
||||
ceiling->topheight = P_FindHighestCeilingSurrounding(sec);
|
||||
ceiling->direction = 1;
|
||||
ceiling->speed = CEILSPEED;
|
||||
break;
|
||||
|
||||
case lowerToLowest:
|
||||
ceiling->bottomheight = P_FindLowestCeilingSurrounding(sec);
|
||||
ceiling->direction = -1;
|
||||
ceiling->speed = CEILSPEED;
|
||||
break;
|
||||
|
||||
case lowerToMaxFloor:
|
||||
ceiling->bottomheight = P_FindHighestFloorSurrounding(sec);
|
||||
ceiling->direction = -1;
|
||||
ceiling->speed = CEILSPEED;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// add the ceiling to the active list
|
||||
ceiling->tag = sec->tag;
|
||||
ceiling->type = type;
|
||||
P_AddActiveCeiling(ceiling);
|
||||
}
|
||||
return rtn;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Active ceiling list primitives
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
// jff 2/22/98 - modified Lee's plat code to work for ceilings
|
||||
//
|
||||
// The following were all rewritten by Lee Killough
|
||||
// to use the new structure which places no limits
|
||||
// on active ceilings. It also avoids spending as much
|
||||
// time searching for active ceilings. Previously a
|
||||
// fixed-size array was used, with NULL indicating
|
||||
// empty entries, while now a doubly-linked list
|
||||
// is used.
|
||||
|
||||
//
|
||||
// P_ActivateInStasisCeiling()
|
||||
//
|
||||
// Reactivates all stopped crushers with the right tag
|
||||
//
|
||||
// Passed the line reactivating the crusher
|
||||
// Returns true if a ceiling reactivated
|
||||
//
|
||||
//jff 4/5/98 return if activated
|
||||
int P_ActivateInStasisCeiling(const line_t *line)
|
||||
{
|
||||
ceilinglist_t *cl;
|
||||
int rtn = 0;
|
||||
|
||||
for (cl = _g->activeceilings; cl; cl = cl->next)
|
||||
{
|
||||
ceiling_t *ceiling = cl->ceiling;
|
||||
if (ceiling->tag == line->tag && ceiling->direction == 0)
|
||||
{
|
||||
ceiling->direction = ceiling->olddirection;
|
||||
ceiling->thinker.function = T_MoveCeiling;
|
||||
//jff 4/5/98 return if activated
|
||||
rtn = 1;
|
||||
}
|
||||
}
|
||||
return rtn;
|
||||
}
|
||||
|
||||
//
|
||||
// EV_CeilingCrushStop()
|
||||
//
|
||||
// Stops all active ceilings with the right tag
|
||||
//
|
||||
// Passed the linedef stopping the ceilings
|
||||
// Returns true if a ceiling put in stasis
|
||||
//
|
||||
int EV_CeilingCrushStop(const line_t *line)
|
||||
{
|
||||
int rtn = 0;
|
||||
|
||||
ceilinglist_t *cl;
|
||||
for (cl = _g->activeceilings; cl; cl = cl->next)
|
||||
{
|
||||
ceiling_t *ceiling = cl->ceiling;
|
||||
if (ceiling->direction != 0 && ceiling->tag == line->tag)
|
||||
{
|
||||
ceiling->olddirection = ceiling->direction;
|
||||
ceiling->direction = 0;
|
||||
ceiling->thinker.function = NULL;
|
||||
rtn = 1;
|
||||
}
|
||||
}
|
||||
return rtn;
|
||||
}
|
||||
|
||||
//
|
||||
// P_AddActiveCeiling()
|
||||
//
|
||||
// Adds a ceiling to the head of the list of active ceilings
|
||||
//
|
||||
// Passed the ceiling motion structure
|
||||
// Returns nothing
|
||||
//
|
||||
void P_AddActiveCeiling(ceiling_t *ceiling)
|
||||
{
|
||||
ceilinglist_t *old_head = _g->activeceilings;
|
||||
|
||||
ceilinglist_t *list = Z_Malloc(sizeof *list, PU_LEVEL, (void** ) &_g->activeceilings);
|
||||
list->ceiling = ceiling;
|
||||
ceiling->list = list;
|
||||
|
||||
if ((list->next = old_head))
|
||||
list->next->prev = &list->next;
|
||||
|
||||
list->prev = (ceilinglist_t**) old_head;
|
||||
}
|
||||
|
||||
//
|
||||
// P_RemoveActiveCeiling()
|
||||
//
|
||||
// Removes a ceiling from the list of active ceilings
|
||||
//
|
||||
// Passed the ceiling motion structure
|
||||
// Returns nothing
|
||||
//
|
||||
void P_RemoveActiveCeiling(ceiling_t *ceiling)
|
||||
{
|
||||
ceilinglist_t *list = ceiling->list;
|
||||
ceiling->sector->ceilingdata_sptr = 0; //jff 2/22/98
|
||||
|
||||
P_RemoveThinker(&ceiling->thinker);
|
||||
|
||||
if ((list->prev && (*list->prev = list->next)))
|
||||
list->next->prev = list->prev;
|
||||
|
||||
free(list);
|
||||
}
|
||||
|
||||
//
|
||||
// P_RemoveAllActiveCeilings()
|
||||
//
|
||||
// Removes all ceilings from the active ceiling list
|
||||
//
|
||||
// Passed nothing, returns nothing
|
||||
//
|
||||
void P_RemoveAllActiveCeilings(void)
|
||||
{
|
||||
while (_g->activeceilings)
|
||||
{
|
||||
ceilinglist_t *next = _g->activeceilings->next;
|
||||
free(_g->activeceilings);
|
||||
_g->activeceilings = next;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
+2197
-2197
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
+1148
-1148
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -1,447 +1,447 @@
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Action routines for lighting thinkers
|
||||
* Spawn sector based lighting effects.
|
||||
* Handle lighting linedef types
|
||||
*
|
||||
* next-hack: modified code to work with short pointers.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#include "doomstat.h" //jff 5/18/98
|
||||
#include "doomdef.h"
|
||||
#include "m_random.h"
|
||||
#include "r_main.h"
|
||||
#include "p_spec.h"
|
||||
#include "p_tick.h"
|
||||
|
||||
#include "global_data.h"
|
||||
|
||||
//////////////////////////////////////////////////////////
|
||||
//
|
||||
// Lighting action routines, called once per tick
|
||||
//
|
||||
//////////////////////////////////////////////////////////
|
||||
|
||||
//
|
||||
// T_FireFlicker()
|
||||
//
|
||||
// Firelight flicker action routine, called once per tick
|
||||
//
|
||||
// Passed a fireflicker_t structure containing light levels and timing
|
||||
// Returns nothing
|
||||
//
|
||||
void T_FireFlicker(fireflicker_t *flick)
|
||||
{
|
||||
int amount;
|
||||
|
||||
if (--flick->count)
|
||||
return;
|
||||
|
||||
amount = (P_Random(__FILE__, __LINE__, __FUNCTION__) & 3) * 16;
|
||||
|
||||
if (flick->sector->lightlevel - amount < flick->minlight)
|
||||
flick->sector->lightlevel = flick->minlight;
|
||||
else
|
||||
flick->sector->lightlevel = flick->maxlight - amount;
|
||||
|
||||
flick->count = 4;
|
||||
}
|
||||
|
||||
//
|
||||
// T_LightFlash()
|
||||
//
|
||||
// Broken light flashing action routine, called once per tick
|
||||
//
|
||||
// Passed a lightflash_t structure containing light levels and timing
|
||||
// Returns nothing
|
||||
//
|
||||
void T_LightFlash(lightflash_t *flash)
|
||||
{
|
||||
if (--flash->count)
|
||||
return;
|
||||
|
||||
if (flash->sector->lightlevel == flash->maxlight)
|
||||
{
|
||||
flash->sector->lightlevel = flash->minlight;
|
||||
flash->count = (P_Random(__FILE__, __LINE__, __FUNCTION__) & flash->mintime) + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
flash->sector->lightlevel = flash->maxlight;
|
||||
flash->count = (P_Random(__FILE__, __LINE__, __FUNCTION__) & flash->maxtime) + 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// T_StrobeFlash()
|
||||
//
|
||||
// Strobe light flashing action routine, called once per tick
|
||||
//
|
||||
// Passed a strobe_t structure containing light levels and timing
|
||||
// Returns nothing
|
||||
//
|
||||
void T_StrobeFlash(strobe_t *flash)
|
||||
{
|
||||
if (--flash->count)
|
||||
return;
|
||||
|
||||
if (flash->sector->lightlevel == flash->minlight)
|
||||
{
|
||||
flash->sector->lightlevel = flash->maxlight;
|
||||
flash->count = flash->brighttime;
|
||||
}
|
||||
else
|
||||
{
|
||||
flash->sector->lightlevel = flash->minlight;
|
||||
flash->count = flash->darktime;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// T_Glow()
|
||||
//
|
||||
// Glowing light action routine, called once per tick
|
||||
//
|
||||
// Passed a glow_t structure containing light levels and timing
|
||||
// Returns nothing
|
||||
//
|
||||
|
||||
void T_Glow(glow_t *g)
|
||||
{
|
||||
switch (g->direction)
|
||||
{
|
||||
case -1:
|
||||
// light dims
|
||||
g->sector->lightlevel -= GLOWSPEED;
|
||||
if (g->sector->lightlevel <= g->minlight)
|
||||
{
|
||||
g->sector->lightlevel += GLOWSPEED;
|
||||
g->direction = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case 1:
|
||||
// light brightens
|
||||
g->sector->lightlevel += GLOWSPEED;
|
||||
if (g->sector->lightlevel >= g->maxlight)
|
||||
{
|
||||
g->sector->lightlevel -= GLOWSPEED;
|
||||
g->direction = -1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////
|
||||
//
|
||||
// Sector lighting type spawners
|
||||
//
|
||||
// After the map has been loaded, each sector is scanned
|
||||
// for specials that spawn thinkers
|
||||
//
|
||||
//////////////////////////////////////////////////////////
|
||||
|
||||
//
|
||||
// P_SpawnFireFlicker()
|
||||
//
|
||||
// Spawns a fire flicker lighting thinker
|
||||
//
|
||||
// Passed the sector that spawned the thinker
|
||||
// Returns nothing
|
||||
//
|
||||
void P_SpawnFireFlicker(sector_t *sector)
|
||||
{
|
||||
fireflicker_t *flick;
|
||||
|
||||
// Note that we are resetting sector attributes.
|
||||
// Nothing special about it during gameplay.
|
||||
sector->special &= ~31; //jff 3/14/98 clear non-generalized sector type
|
||||
|
||||
flick = Z_Malloc(sizeof(*flick), PU_LEVSPEC, 0);
|
||||
|
||||
memset(flick, 0, sizeof(*flick));
|
||||
P_AddThinker(&flick->thinker);
|
||||
|
||||
flick->thinker.function = T_FireFlicker;
|
||||
flick->sector = sector;
|
||||
flick->maxlight = sector->lightlevel;
|
||||
flick->minlight = P_FindMinSurroundingLight(sector, sector->lightlevel) + 16;
|
||||
flick->count = 4;
|
||||
}
|
||||
|
||||
//
|
||||
// P_SpawnLightFlash()
|
||||
//
|
||||
// Spawns a broken light flash lighting thinker
|
||||
//
|
||||
// Passed the sector that spawned the thinker
|
||||
// Returns nothing
|
||||
//
|
||||
void P_SpawnLightFlash(sector_t *sector)
|
||||
{
|
||||
lightflash_t *flash;
|
||||
|
||||
// nothing special about it during gameplay
|
||||
sector->special &= ~31; //jff 3/14/98 clear non-generalized sector type
|
||||
|
||||
flash = Z_Malloc(sizeof(*flash), PU_LEVSPEC, 0);
|
||||
|
||||
memset(flash, 0, sizeof(*flash));
|
||||
P_AddThinker(&flash->thinker);
|
||||
|
||||
flash->thinker.function = T_LightFlash;
|
||||
flash->sector = sector;
|
||||
flash->maxlight = sector->lightlevel;
|
||||
|
||||
flash->minlight = P_FindMinSurroundingLight(sector, sector->lightlevel);
|
||||
flash->maxtime = 64;
|
||||
flash->mintime = 7;
|
||||
flash->count = (P_Random(__FILE__, __LINE__, __FUNCTION__) & flash->maxtime) + 1;
|
||||
}
|
||||
|
||||
//
|
||||
// P_SpawnStrobeFlash
|
||||
//
|
||||
// Spawns a blinking light thinker
|
||||
//
|
||||
// Passed the sector that spawned the thinker, speed of blinking
|
||||
// and whether blinking is to by syncrhonous with other sectors
|
||||
//
|
||||
// Returns nothing
|
||||
//
|
||||
void P_SpawnStrobeFlash(sector_t *sector, int fastOrSlow, int inSync)
|
||||
{
|
||||
strobe_t *flash;
|
||||
|
||||
flash = Z_Malloc(sizeof(*flash), PU_LEVSPEC, 0);
|
||||
|
||||
memset(flash, 0, sizeof(*flash));
|
||||
P_AddThinker(&flash->thinker);
|
||||
|
||||
flash->sector = sector;
|
||||
flash->darktime = fastOrSlow;
|
||||
flash->brighttime = STROBEBRIGHT;
|
||||
flash->thinker.function = T_StrobeFlash;
|
||||
flash->maxlight = sector->lightlevel;
|
||||
flash->minlight = P_FindMinSurroundingLight(sector, sector->lightlevel);
|
||||
|
||||
if (flash->minlight == flash->maxlight)
|
||||
flash->minlight = 0;
|
||||
|
||||
// nothing special about it during gameplay
|
||||
sector->special &= ~31; //jff 3/14/98 clear non-generalized sector type
|
||||
|
||||
if (!inSync)
|
||||
flash->count = (P_Random(__FILE__, __LINE__, __FUNCTION__) & 7) + 1;
|
||||
else
|
||||
flash->count = 1;
|
||||
}
|
||||
|
||||
//
|
||||
// P_SpawnGlowingLight()
|
||||
//
|
||||
// Spawns a glowing light (smooth oscillation from min to max) thinker
|
||||
//
|
||||
// Passed the sector that spawned the thinker
|
||||
// Returns nothing
|
||||
//
|
||||
void P_SpawnGlowingLight(sector_t *sector)
|
||||
{
|
||||
glow_t *g;
|
||||
|
||||
g = Z_Malloc(sizeof(*g), PU_LEVSPEC, 0);
|
||||
|
||||
memset(g, 0, sizeof(*g));
|
||||
P_AddThinker(&g->thinker);
|
||||
|
||||
g->sector = sector;
|
||||
g->minlight = P_FindMinSurroundingLight(sector, sector->lightlevel);
|
||||
g->maxlight = sector->lightlevel;
|
||||
g->thinker.function = T_Glow;
|
||||
g->direction = -1;
|
||||
|
||||
sector->special &= ~31; //jff 3/14/98 clear non-generalized sector type
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////
|
||||
//
|
||||
// Linedef lighting function handlers
|
||||
//
|
||||
//////////////////////////////////////////////////////////
|
||||
|
||||
//
|
||||
// EV_StartLightStrobing()
|
||||
//
|
||||
// Start strobing lights (usually from a trigger)
|
||||
//
|
||||
// Passed the line that activated the strobing
|
||||
// Returns true
|
||||
//
|
||||
// jff 2/12/98 added int return value, fixed return
|
||||
//
|
||||
int EV_StartLightStrobing(const line_t *line)
|
||||
{
|
||||
int secnum;
|
||||
sector_t *sec;
|
||||
|
||||
secnum = -1;
|
||||
// start lights strobing in all sectors tagged same as line
|
||||
while ((secnum = P_FindSectorFromLineTag(line, secnum)) >= 0)
|
||||
{
|
||||
sec = &_g->sectors[secnum];
|
||||
// if already doing a lighting function, don't start a second
|
||||
if (P_SectorActive(lighting_special, sec)) //jff 2/22/98
|
||||
continue;
|
||||
|
||||
P_SpawnStrobeFlash(sec, SLOWDARK, 0);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
//
|
||||
// EV_TurnTagLightsOff()
|
||||
//
|
||||
// Turn line's tagged sector's lights to min adjacent neighbor level
|
||||
//
|
||||
// Passed the line that activated the lights being turned off
|
||||
// Returns true
|
||||
//
|
||||
// jff 2/12/98 added int return value, fixed return
|
||||
//
|
||||
int EV_TurnTagLightsOff(const line_t *line)
|
||||
{
|
||||
int j;
|
||||
|
||||
// search sectors for those with same tag as activating line
|
||||
|
||||
// killough 10/98: replaced inefficient search with fast search
|
||||
for (j = -1; (j = P_FindSectorFromLineTag(line, j)) >= 0;)
|
||||
{
|
||||
sector_t *sector = _g->sectors + j, *tsec;
|
||||
int i, min = sector->lightlevel;
|
||||
// find min neighbor light level
|
||||
for (i = 0; i < sector->linecount; i++)
|
||||
if ((tsec = getNextSector(getSectorLineByIndex(sector, i), sector)) && tsec->lightlevel < min)
|
||||
min = tsec->lightlevel;
|
||||
sector->lightlevel = min;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
//
|
||||
// EV_LightTurnOn()
|
||||
//
|
||||
// Turn sectors tagged to line lights on to specified or max neighbor level
|
||||
//
|
||||
// Passed the activating line, and a level to set the light to
|
||||
// If level passed is 0, the maximum neighbor lighting is used
|
||||
// Returns true
|
||||
//
|
||||
// jff 2/12/98 added int return value, fixed return
|
||||
//
|
||||
int EV_LightTurnOn(const line_t *line, int bright)
|
||||
{
|
||||
int i;
|
||||
// search all sectors for ones with same tag as activating line
|
||||
// killough 10/98: replace inefficient search with fast search
|
||||
for (i = -1; (i = P_FindSectorFromLineTag(line, i)) >= 0;)
|
||||
{
|
||||
sector_t *temp, *sector = _g->sectors + i;
|
||||
int j, tbright = bright; //jff 5/17/98 search for maximum PER sector
|
||||
// bright = 0 means to search for highest light level surrounding sector
|
||||
if (!bright)
|
||||
for (j = 0; j < sector->linecount; j++)
|
||||
{
|
||||
if ((temp = getNextSector(getSectorLineByIndex(sector, j), sector)) && temp->lightlevel > tbright)
|
||||
{
|
||||
tbright = temp->lightlevel;
|
||||
}
|
||||
sector->lightlevel = tbright;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* killough 10/98:
|
||||
*
|
||||
* EV_LightTurnOnPartway()
|
||||
*
|
||||
* Turn sectors tagged to line lights on to specified or max neighbor level
|
||||
*
|
||||
* Passed the activating line, and a light level fraction between 0 and 1.
|
||||
* Sets the light to min on 0, max on 1, and interpolates in-between.
|
||||
* Used for doors with gradual lighting effects.
|
||||
*
|
||||
* Returns true
|
||||
*/
|
||||
|
||||
int EV_LightTurnOnPartway(const line_t *line, fixed_t level)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (level < 0) // clip at extremes
|
||||
level = 0;
|
||||
if (level > FRACUNIT)
|
||||
level = FRACUNIT;
|
||||
|
||||
// search all sectors for ones with same tag as activating line
|
||||
for (i = -1; (i = P_FindSectorFromLineTag(line, i)) >= 0;)
|
||||
{
|
||||
sector_t *temp, *sector = _g->sectors + i;
|
||||
int j, bright = 0, min = sector->lightlevel;
|
||||
|
||||
for (j = 0; j < sector->linecount; j++)
|
||||
if ((temp = getNextSector(getSectorLineByIndex(sector, j), sector)))
|
||||
{
|
||||
if (temp->lightlevel > bright)
|
||||
bright = temp->lightlevel;
|
||||
if (temp->lightlevel < min)
|
||||
min = temp->lightlevel;
|
||||
}
|
||||
|
||||
sector->lightlevel = // Set level in-between extremes
|
||||
(level * bright + (FRACUNIT - level) * min) >> FRACBITS;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Doom Port to the nRF52840 by Nicola Wrachien (next-hack in the comments)
|
||||
*
|
||||
* This port is based on the excellent doomhack's GBA Doom Port,
|
||||
* with Kippykip additions.
|
||||
*
|
||||
* Several data structures and functions have been optimized
|
||||
* to fit in only 256kB RAM of nRF52840 (GBA has 384 kB RAM).
|
||||
* Z-Depth Light has been restored with almost no RAM consumption!
|
||||
* Tons of speed optimizations have been done, and the game now
|
||||
* runs extremely fast, despite the much higher 3D resolution with
|
||||
* respect to GBA.
|
||||
*
|
||||
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||
* based on BOOM, a modified and improved DOOM engine
|
||||
* Copyright (C) 1999 by
|
||||
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
* Copyright (C) 1999-2000 by
|
||||
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||
* Copyright 2005, 2006 by
|
||||
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||
* Copyright (C) 2021 Nicola Wrachien (next-hack in the comments)
|
||||
* on nRF52840 port.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Action routines for lighting thinkers
|
||||
* Spawn sector based lighting effects.
|
||||
* Handle lighting linedef types
|
||||
*
|
||||
* next-hack: modified code to work with short pointers.
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
#include "doomstat.h" //jff 5/18/98
|
||||
#include "doomdef.h"
|
||||
#include "m_random.h"
|
||||
#include "r_main.h"
|
||||
#include "p_spec.h"
|
||||
#include "p_tick.h"
|
||||
|
||||
#include "global_data.h"
|
||||
|
||||
//////////////////////////////////////////////////////////
|
||||
//
|
||||
// Lighting action routines, called once per tick
|
||||
//
|
||||
//////////////////////////////////////////////////////////
|
||||
|
||||
//
|
||||
// T_FireFlicker()
|
||||
//
|
||||
// Firelight flicker action routine, called once per tick
|
||||
//
|
||||
// Passed a fireflicker_t structure containing light levels and timing
|
||||
// Returns nothing
|
||||
//
|
||||
void T_FireFlicker(fireflicker_t *flick)
|
||||
{
|
||||
int amount;
|
||||
|
||||
if (--flick->count)
|
||||
return;
|
||||
|
||||
amount = (P_Random(__FILE__, __LINE__, __FUNCTION__) & 3) * 16;
|
||||
|
||||
if (flick->sector->lightlevel - amount < flick->minlight)
|
||||
flick->sector->lightlevel = flick->minlight;
|
||||
else
|
||||
flick->sector->lightlevel = flick->maxlight - amount;
|
||||
|
||||
flick->count = 4;
|
||||
}
|
||||
|
||||
//
|
||||
// T_LightFlash()
|
||||
//
|
||||
// Broken light flashing action routine, called once per tick
|
||||
//
|
||||
// Passed a lightflash_t structure containing light levels and timing
|
||||
// Returns nothing
|
||||
//
|
||||
void T_LightFlash(lightflash_t *flash)
|
||||
{
|
||||
if (--flash->count)
|
||||
return;
|
||||
|
||||
if (flash->sector->lightlevel == flash->maxlight)
|
||||
{
|
||||
flash->sector->lightlevel = flash->minlight;
|
||||
flash->count = (P_Random(__FILE__, __LINE__, __FUNCTION__) & flash->mintime) + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
flash->sector->lightlevel = flash->maxlight;
|
||||
flash->count = (P_Random(__FILE__, __LINE__, __FUNCTION__) & flash->maxtime) + 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// T_StrobeFlash()
|
||||
//
|
||||
// Strobe light flashing action routine, called once per tick
|
||||
//
|
||||
// Passed a strobe_t structure containing light levels and timing
|
||||
// Returns nothing
|
||||
//
|
||||
void T_StrobeFlash(strobe_t *flash)
|
||||
{
|
||||
if (--flash->count)
|
||||
return;
|
||||
|
||||
if (flash->sector->lightlevel == flash->minlight)
|
||||
{
|
||||
flash->sector->lightlevel = flash->maxlight;
|
||||
flash->count = flash->brighttime;
|
||||
}
|
||||
else
|
||||
{
|
||||
flash->sector->lightlevel = flash->minlight;
|
||||
flash->count = flash->darktime;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// T_Glow()
|
||||
//
|
||||
// Glowing light action routine, called once per tick
|
||||
//
|
||||
// Passed a glow_t structure containing light levels and timing
|
||||
// Returns nothing
|
||||
//
|
||||
|
||||
void T_Glow(glow_t *g)
|
||||
{
|
||||
switch (g->direction)
|
||||
{
|
||||
case -1:
|
||||
// light dims
|
||||
g->sector->lightlevel -= GLOWSPEED;
|
||||
if (g->sector->lightlevel <= g->minlight)
|
||||
{
|
||||
g->sector->lightlevel += GLOWSPEED;
|
||||
g->direction = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case 1:
|
||||
// light brightens
|
||||
g->sector->lightlevel += GLOWSPEED;
|
||||
if (g->sector->lightlevel >= g->maxlight)
|
||||
{
|
||||
g->sector->lightlevel -= GLOWSPEED;
|
||||
g->direction = -1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////
|
||||
//
|
||||
// Sector lighting type spawners
|
||||
//
|
||||
// After the map has been loaded, each sector is scanned
|
||||
// for specials that spawn thinkers
|
||||
//
|
||||
//////////////////////////////////////////////////////////
|
||||
|
||||
//
|
||||
// P_SpawnFireFlicker()
|
||||
//
|
||||
// Spawns a fire flicker lighting thinker
|
||||
//
|
||||
// Passed the sector that spawned the thinker
|
||||
// Returns nothing
|
||||
//
|
||||
void P_SpawnFireFlicker(sector_t *sector)
|
||||
{
|
||||
fireflicker_t *flick;
|
||||
|
||||
// Note that we are resetting sector attributes.
|
||||
// Nothing special about it during gameplay.
|
||||
sector->special &= ~31; //jff 3/14/98 clear non-generalized sector type
|
||||
|
||||
flick = Z_Malloc(sizeof(*flick), PU_LEVSPEC, 0);
|
||||
|
||||
memset(flick, 0, sizeof(*flick));
|
||||
P_AddThinker(&flick->thinker);
|
||||
|
||||
flick->thinker.function = T_FireFlicker;
|
||||
flick->sector = sector;
|
||||
flick->maxlight = sector->lightlevel;
|
||||
flick->minlight = P_FindMinSurroundingLight(sector, sector->lightlevel) + 16;
|
||||
flick->count = 4;
|
||||
}
|
||||
|
||||
//
|
||||
// P_SpawnLightFlash()
|
||||
//
|
||||
// Spawns a broken light flash lighting thinker
|
||||
//
|
||||
// Passed the sector that spawned the thinker
|
||||
// Returns nothing
|
||||
//
|
||||
void P_SpawnLightFlash(sector_t *sector)
|
||||
{
|
||||
lightflash_t *flash;
|
||||
|
||||
// nothing special about it during gameplay
|
||||
sector->special &= ~31; //jff 3/14/98 clear non-generalized sector type
|
||||
|
||||
flash = Z_Malloc(sizeof(*flash), PU_LEVSPEC, 0);
|
||||
|
||||
memset(flash, 0, sizeof(*flash));
|
||||
P_AddThinker(&flash->thinker);
|
||||
|
||||
flash->thinker.function = T_LightFlash;
|
||||
flash->sector = sector;
|
||||
flash->maxlight = sector->lightlevel;
|
||||
|
||||
flash->minlight = P_FindMinSurroundingLight(sector, sector->lightlevel);
|
||||
flash->maxtime = 64;
|
||||
flash->mintime = 7;
|
||||
flash->count = (P_Random(__FILE__, __LINE__, __FUNCTION__) & flash->maxtime) + 1;
|
||||
}
|
||||
|
||||
//
|
||||
// P_SpawnStrobeFlash
|
||||
//
|
||||
// Spawns a blinking light thinker
|
||||
//
|
||||
// Passed the sector that spawned the thinker, speed of blinking
|
||||
// and whether blinking is to by syncrhonous with other sectors
|
||||
//
|
||||
// Returns nothing
|
||||
//
|
||||
void P_SpawnStrobeFlash(sector_t *sector, int fastOrSlow, int inSync)
|
||||
{
|
||||
strobe_t *flash;
|
||||
|
||||
flash = Z_Malloc(sizeof(*flash), PU_LEVSPEC, 0);
|
||||
|
||||
memset(flash, 0, sizeof(*flash));
|
||||
P_AddThinker(&flash->thinker);
|
||||
|
||||
flash->sector = sector;
|
||||
flash->darktime = fastOrSlow;
|
||||
flash->brighttime = STROBEBRIGHT;
|
||||
flash->thinker.function = T_StrobeFlash;
|
||||
flash->maxlight = sector->lightlevel;
|
||||
flash->minlight = P_FindMinSurroundingLight(sector, sector->lightlevel);
|
||||
|
||||
if (flash->minlight == flash->maxlight)
|
||||
flash->minlight = 0;
|
||||
|
||||
// nothing special about it during gameplay
|
||||
sector->special &= ~31; //jff 3/14/98 clear non-generalized sector type
|
||||
|
||||
if (!inSync)
|
||||
flash->count = (P_Random(__FILE__, __LINE__, __FUNCTION__) & 7) + 1;
|
||||
else
|
||||
flash->count = 1;
|
||||
}
|
||||
|
||||
//
|
||||
// P_SpawnGlowingLight()
|
||||
//
|
||||
// Spawns a glowing light (smooth oscillation from min to max) thinker
|
||||
//
|
||||
// Passed the sector that spawned the thinker
|
||||
// Returns nothing
|
||||
//
|
||||
void P_SpawnGlowingLight(sector_t *sector)
|
||||
{
|
||||
glow_t *g;
|
||||
|
||||
g = Z_Malloc(sizeof(*g), PU_LEVSPEC, 0);
|
||||
|
||||
memset(g, 0, sizeof(*g));
|
||||
P_AddThinker(&g->thinker);
|
||||
|
||||
g->sector = sector;
|
||||
g->minlight = P_FindMinSurroundingLight(sector, sector->lightlevel);
|
||||
g->maxlight = sector->lightlevel;
|
||||
g->thinker.function = T_Glow;
|
||||
g->direction = -1;
|
||||
|
||||
sector->special &= ~31; //jff 3/14/98 clear non-generalized sector type
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////
|
||||
//
|
||||
// Linedef lighting function handlers
|
||||
//
|
||||
//////////////////////////////////////////////////////////
|
||||
|
||||
//
|
||||
// EV_StartLightStrobing()
|
||||
//
|
||||
// Start strobing lights (usually from a trigger)
|
||||
//
|
||||
// Passed the line that activated the strobing
|
||||
// Returns true
|
||||
//
|
||||
// jff 2/12/98 added int return value, fixed return
|
||||
//
|
||||
int EV_StartLightStrobing(const line_t *line)
|
||||
{
|
||||
int secnum;
|
||||
sector_t *sec;
|
||||
|
||||
secnum = -1;
|
||||
// start lights strobing in all sectors tagged same as line
|
||||
while ((secnum = P_FindSectorFromLineTag(line, secnum)) >= 0)
|
||||
{
|
||||
sec = &_g->sectors[secnum];
|
||||
// if already doing a lighting function, don't start a second
|
||||
if (P_SectorActive(lighting_special, sec)) //jff 2/22/98
|
||||
continue;
|
||||
|
||||
P_SpawnStrobeFlash(sec, SLOWDARK, 0);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
//
|
||||
// EV_TurnTagLightsOff()
|
||||
//
|
||||
// Turn line's tagged sector's lights to min adjacent neighbor level
|
||||
//
|
||||
// Passed the line that activated the lights being turned off
|
||||
// Returns true
|
||||
//
|
||||
// jff 2/12/98 added int return value, fixed return
|
||||
//
|
||||
int EV_TurnTagLightsOff(const line_t *line)
|
||||
{
|
||||
int j;
|
||||
|
||||
// search sectors for those with same tag as activating line
|
||||
|
||||
// killough 10/98: replaced inefficient search with fast search
|
||||
for (j = -1; (j = P_FindSectorFromLineTag(line, j)) >= 0;)
|
||||
{
|
||||
sector_t *sector = _g->sectors + j, *tsec;
|
||||
int i, min = sector->lightlevel;
|
||||
// find min neighbor light level
|
||||
for (i = 0; i < sector->linecount; i++)
|
||||
if ((tsec = getNextSector(getSectorLineByIndex(sector, i), sector)) && tsec->lightlevel < min)
|
||||
min = tsec->lightlevel;
|
||||
sector->lightlevel = min;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
//
|
||||
// EV_LightTurnOn()
|
||||
//
|
||||
// Turn sectors tagged to line lights on to specified or max neighbor level
|
||||
//
|
||||
// Passed the activating line, and a level to set the light to
|
||||
// If level passed is 0, the maximum neighbor lighting is used
|
||||
// Returns true
|
||||
//
|
||||
// jff 2/12/98 added int return value, fixed return
|
||||
//
|
||||
int EV_LightTurnOn(const line_t *line, int bright)
|
||||
{
|
||||
int i;
|
||||
// search all sectors for ones with same tag as activating line
|
||||
// killough 10/98: replace inefficient search with fast search
|
||||
for (i = -1; (i = P_FindSectorFromLineTag(line, i)) >= 0;)
|
||||
{
|
||||
sector_t *temp, *sector = _g->sectors + i;
|
||||
int j, tbright = bright; //jff 5/17/98 search for maximum PER sector
|
||||
// bright = 0 means to search for highest light level surrounding sector
|
||||
if (!bright)
|
||||
for (j = 0; j < sector->linecount; j++)
|
||||
{
|
||||
if ((temp = getNextSector(getSectorLineByIndex(sector, j), sector)) && temp->lightlevel > tbright)
|
||||
{
|
||||
tbright = temp->lightlevel;
|
||||
}
|
||||
sector->lightlevel = tbright;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* killough 10/98:
|
||||
*
|
||||
* EV_LightTurnOnPartway()
|
||||
*
|
||||
* Turn sectors tagged to line lights on to specified or max neighbor level
|
||||
*
|
||||
* Passed the activating line, and a light level fraction between 0 and 1.
|
||||
* Sets the light to min on 0, max on 1, and interpolates in-between.
|
||||
* Used for doors with gradual lighting effects.
|
||||
*
|
||||
* Returns true
|
||||
*/
|
||||
|
||||
int EV_LightTurnOnPartway(const line_t *line, fixed_t level)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (level < 0) // clip at extremes
|
||||
level = 0;
|
||||
if (level > FRACUNIT)
|
||||
level = FRACUNIT;
|
||||
|
||||
// search all sectors for ones with same tag as activating line
|
||||
for (i = -1; (i = P_FindSectorFromLineTag(line, i)) >= 0;)
|
||||
{
|
||||
sector_t *temp, *sector = _g->sectors + i;
|
||||
int j, bright = 0, min = sector->lightlevel;
|
||||
|
||||
for (j = 0; j < sector->linecount; j++)
|
||||
if ((temp = getNextSector(getSectorLineByIndex(sector, j), sector)))
|
||||
{
|
||||
if (temp->lightlevel > bright)
|
||||
bright = temp->lightlevel;
|
||||
if (temp->lightlevel < min)
|
||||
min = temp->lightlevel;
|
||||
}
|
||||
|
||||
sector->lightlevel = // Set level in-between extremes
|
||||
(level * bright + (FRACUNIT - level) * min) >> FRACBITS;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
+1885
-1885
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
Loaded 100 of 623 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user