Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8cf2395d42 | ||
|
|
f578781418 | ||
|
|
0bb63ee0af | ||
|
|
3abe74de86 | ||
|
|
5a61ebf325 | ||
|
|
2ae9563ab3 | ||
|
|
6b429e4388 | ||
|
|
0321b0d94a | ||
|
|
ac57b7fd2d | ||
|
|
7013e63142 | ||
|
|
4e1ef7c0cd | ||
|
|
892f2253ea | ||
|
|
bebe62346f | ||
|
|
834a94e429 | ||
|
|
fcf833ff48 | ||
|
|
f2a27539d3 | ||
|
|
05d26654df | ||
|
|
cee6a27340 | ||
|
|
66e35a9d67 | ||
|
|
ad096ccd42 | ||
|
|
7a9e81828a | ||
|
|
71e7dacb56 | ||
|
|
f9c0ee865f | ||
|
|
154eaaf027 | ||
|
|
66f5f9b2a2 | ||
|
|
b27275b887 | ||
|
|
c81c2c1d8d | ||
|
|
ccfab57a8c | ||
|
|
56d1343f1b | ||
|
|
b273bc3ca8 | ||
|
|
d4f58a885b | ||
|
|
04458f18f8 | ||
|
|
64152eea0d | ||
|
|
0e0a690e3c | ||
|
|
f283d3ca43 | ||
|
|
982fff959f | ||
|
|
b0e968e3c3 | ||
|
|
e5bbb14ce0 | ||
|
|
327cca2e8e | ||
|
|
e02e9a12d7 | ||
|
|
9e2fd091a8 | ||
|
|
0a04fca634 | ||
|
|
8a3f793324 | ||
|
|
e91892849c | ||
|
|
6b4e3c9d13 | ||
|
|
5f55b81fbf | ||
|
|
ca68bab002 | ||
|
|
339eb1879e | ||
|
|
1adb49c65c | ||
|
|
1d33a05a85 | ||
|
|
cfcd20d44a | ||
|
|
204607e272 | ||
|
|
b89a8ca6f9 | ||
|
|
d4aa352d59 | ||
|
|
c489841732 | ||
|
|
a6a97b4c4f | ||
|
|
fba070f82e | ||
|
|
10c117f95f | ||
|
|
bceda5beb4 | ||
|
|
c50c936b1f |
No files matched your search
+8
-1
@@ -13,10 +13,12 @@ Mainly for use in visual-only addons like secondcolor.
|
||||
|
||||
**Not netsafe**. Returns player's current sliptide roll angle, taking sliptideroll cvar value into account.
|
||||
|
||||
## hud.setVoteBackground(name)
|
||||
## hud.setVoteBackground(name[, time\_per\_frame])
|
||||
|
||||
Changes vote background texture prefix (game looks for PREFIX + "W" or "C" (depends on resolution) + FRAME\_NUMBER).
|
||||
|
||||
If time\_per\_frame is set, each frame will last this amount of tics, default value is 2
|
||||
|
||||
## hud.add(fn, "vote") and hud.add(fn, "intermission")
|
||||
|
||||
Hud hooks for vote screen and intermission screen. They only get drawer (`v`) as argument.
|
||||
@@ -120,6 +122,11 @@ v.interpLatch(false)
|
||||
```
|
||||
When using a custom string drawer, enable this mode to avoid interpolation artifacting when the string changes.
|
||||
|
||||
## cameras[] global array
|
||||
|
||||
Local player cameras that can be accessed outside of hud hooks.
|
||||
`#cameras` will return amount of available cameras. (0 on dedicated server, 1 with 1 player, 4 with 4p splitscreen, etc)
|
||||
|
||||
## mobj.spritexscale, mobj.spriteyscale, mobj.spritexoffset, mobj.spriteyoffset, mobj.rollangle, mobj.sloperoll, mobj.rollmodel fields
|
||||
|
||||
Same fields as in SRB2 2.2
|
||||
|
||||
@@ -972,14 +972,6 @@ Public License instead of this License. But first, please read
|
||||
Copyright (C) 1995-2018 Free Software Foundation, Inc.
|
||||
https://www.gnu.org/software/gettext/
|
||||
|
||||
- FluidSynth
|
||||
Copyright (C) 2000-2025 Peter Hanappe and others.
|
||||
https://www.fluidsynth.org/
|
||||
|
||||
- libsndfile
|
||||
Copyright (C) 1999-2016 Erik de Castro Lopo
|
||||
https://libsndfile.github.io/libsndfile/
|
||||
|
||||
- mpg123
|
||||
Copyright (c) 1995-2013 by Michael Hipp and others,
|
||||
free software under the terms of the LGPL v2.1
|
||||
@@ -1707,8 +1699,12 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
zlib License
|
||||
applies to:
|
||||
- Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
|
||||
https://libsdl.org/
|
||||
Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
|
||||
https://www.libsdl.org/hg.php
|
||||
|
||||
- SDL_mixer: An audio mixer library based on the SDL library
|
||||
Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
|
||||
https://www.libsdl.org/projects/SDL_mixer/
|
||||
|
||||
- zlib
|
||||
Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
# Find FluidSynth
|
||||
# Once done, this will define
|
||||
#
|
||||
# FLUIDSYNTH_FOUND - system has FluidSynth
|
||||
# FLUIDSYNTH_INCLUDE_DIRS - FluidSynth include directories
|
||||
# FLUIDSYNTH_LIBRARIES - link libraries
|
||||
|
||||
include(LibFindMacros)
|
||||
|
||||
libfind_pkg_check_modules(FLUIDSYNTH_PKGCONF FLUIDSYNTH)
|
||||
|
||||
# includes
|
||||
find_path(FLUIDSYNTH_INCLUDE_DIR
|
||||
NAMES fluidsynth.h
|
||||
PATHS
|
||||
${FLUIDSYNTH_PKGCONF_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
# library
|
||||
find_library(FLUIDSYNTH_LIBRARY
|
||||
NAMES fluidsynth
|
||||
PATHS
|
||||
${FLUIDSYNTH_PKGCONF_LIBRARY_DIRS}
|
||||
"/usr/lib"
|
||||
"/usr/local/lib"
|
||||
)
|
||||
|
||||
# set include dir variables
|
||||
set(FLUIDSYNTH_PROCESS_INCLUDES FLUIDSYNTH_INCLUDE_DIR)
|
||||
set(FLUIDSYNTH_PROCESS_LIBS FLUIDSYNTH_LIBRARY)
|
||||
libfind_process(FLUIDSYNTH)
|
||||
|
||||
if(FLUIDSYNTH_FOUND AND NOT TARGET FluidSynth::libfluidsynth)
|
||||
add_library(FluidSynth::libfluidsynth UNKNOWN IMPORTED)
|
||||
set_target_properties(
|
||||
FluidSynth::libfluidsynth
|
||||
PROPERTIES
|
||||
IMPORTED_LOCATION "${FLUIDSYNTH_LIBRARY}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${FLUIDSYNTH_INCLUDE_DIR}"
|
||||
)
|
||||
endif()
|
||||
@@ -1,3 +1,4 @@
|
||||
/cscope.out
|
||||
*.json
|
||||
*.idx
|
||||
*.gdb_history
|
||||
@@ -8,7 +8,6 @@ passthru_opts+=\
|
||||
HAVE_MINIUPNPC\
|
||||
HAVE_DISCORDRPC DEVELOP\
|
||||
NOHOLEPUNCH\
|
||||
NOOPENMPT\
|
||||
|
||||
# build with debugging information
|
||||
ifdef DEBUGMODE
|
||||
@@ -92,6 +91,7 @@ endif
|
||||
|
||||
default_packages:=\
|
||||
LIBGME/libgme/LIBGME\
|
||||
OPENMPT/libopenmpt/LIBOPENMPT\
|
||||
ZLIB/zlib\
|
||||
|
||||
$(foreach p,$(default_packages),\
|
||||
|
||||
+9
-13
@@ -29,19 +29,8 @@ ifndef NOHW
|
||||
sources+=sdl/ogl_sdl.c
|
||||
endif
|
||||
|
||||
ifndef NOOPENMPT
|
||||
LIBOPENMPT_PKGCONFIG?=libopenmpt
|
||||
$(eval $(call Use_pkg_config,LIBOPENMPT))
|
||||
opts+=-DHAVE_OPENMPT
|
||||
endif
|
||||
|
||||
NOMIXER=1
|
||||
|
||||
ifdef NOMIXER
|
||||
#sources+=sdl/dummy_sound.c
|
||||
sources+=sdl/sdl_sound.c
|
||||
SNDFILE_PKGCONFIG?=sndfile
|
||||
$(eval $(call Use_pkg_config,SNDFILE))
|
||||
sources+=sdl/dummy_sound.c
|
||||
else
|
||||
opts+=-DHAVE_MIXER
|
||||
sources+=sdl/mixer_sound.c
|
||||
@@ -56,8 +45,15 @@ opts+=-DHAVE_THREADS
|
||||
sources+=sdl/i_threads.c
|
||||
endif
|
||||
|
||||
SDL_PKGCONFIG?=sdl3
|
||||
ifdef SDL_PKGCONFIG
|
||||
$(eval $(call Use_pkg_config,SDL))
|
||||
else
|
||||
SDL_CONFIG?=$(call Prefix,sdl2-config)
|
||||
SDL_CFLAGS?=$(shell $(SDL_CONFIG) --cflags)
|
||||
SDL_LDFLAGS?=$(shell $(SDL_CONFIG) \
|
||||
$(if $(STATIC),--static-libs,--libs))
|
||||
$(eval $(call Propogate_flags,SDL))
|
||||
endif
|
||||
|
||||
ifdef MINGW
|
||||
ifndef NOSDLMAIN
|
||||
|
||||
@@ -79,14 +79,14 @@ $(eval $(call _set,LIBOPENMPT))
|
||||
lib:=../libs/SDL2_mixer/$(mingw)
|
||||
|
||||
ifdef SDL
|
||||
mixer_opts:=-I$(lib)/include/SDL3
|
||||
mixer_opts:=-I$(lib)/include/SDL2
|
||||
mixer_libs:=-L$(lib)/lib
|
||||
|
||||
lib:=../libs/SDL2/$(mingw)
|
||||
SDL_opts:=-I$(lib)/include/SDL3\
|
||||
SDL_opts:=-I$(lib)/include/SDL2\
|
||||
$(mixer_opts) -Dmain=SDL_main
|
||||
SDL_libs:=-L$(lib)/lib $(mixer_libs)\
|
||||
-lmingw32 -lSDL3main -lSDL3 -mwindows
|
||||
-lmingw32 -lSDL2main -lSDL2 -mwindows
|
||||
$(eval $(call _set,SDL))
|
||||
endif
|
||||
|
||||
|
||||
+1
-1
@@ -1,3 +1,4 @@
|
||||
string.c
|
||||
am_map.c
|
||||
b_bot.c
|
||||
command.c
|
||||
@@ -42,7 +43,6 @@ s_sound.c
|
||||
screen.c
|
||||
sounds.c
|
||||
st_stuff.c
|
||||
string.c
|
||||
tables.c
|
||||
v_video.c
|
||||
w_wad.c
|
||||
|
||||
+11
-11
@@ -47,7 +47,7 @@ static inline void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cm
|
||||
if (sonic->player->pflags & (PF_MACESPIN|PF_ITEMHANG))
|
||||
{
|
||||
cmd->forwardmove = sonic->player->cmd.forwardmove;
|
||||
cmd->angleturn = abs((signed)(tails->angle - sonic->angle))>>16;
|
||||
cmd->angleturn = abs((signed)(tails->angle - sonic->angle)) >> TICCMD_REDUCE;
|
||||
if (sonic->angle < tails->angle)
|
||||
cmd->angleturn = -cmd->angleturn;
|
||||
} else if (dist > FixedMul(512*FRACUNIT, tails->scale))
|
||||
@@ -139,13 +139,13 @@ void B_KeysToTiccmd(mobj_t *mo, ticcmd_t *cmd, boolean forward, boolean backward
|
||||
// Don't mess with bot inputs during these unhandled movement conditions.
|
||||
// The normal AI doesn't use abilities, so custom AI should be sending us exactly what it wants anyway.
|
||||
if (forward)
|
||||
cmd->forwardmove += MAXPLMOVE<<FRACBITS>>16;
|
||||
cmd->forwardmove += MAXPLMOVE << FRACBITS >> TICCMD_REDUCE;
|
||||
if (backward)
|
||||
cmd->forwardmove -= MAXPLMOVE<<FRACBITS>>16;
|
||||
cmd->forwardmove -= MAXPLMOVE<<FRACBITS >> TICCMD_REDUCE;
|
||||
if (left || strafeleft)
|
||||
cmd->sidemove -= MAXPLMOVE<<FRACBITS>>16;
|
||||
cmd->sidemove -= MAXPLMOVE << FRACBITS >> TICCMD_REDUCE;
|
||||
if (right || straferight)
|
||||
cmd->sidemove += MAXPLMOVE<<FRACBITS>>16;
|
||||
cmd->sidemove += MAXPLMOVE << FRACBITS >> TICCMD_REDUCE;
|
||||
} else {
|
||||
// In standard 2D mode, interpret "forward" as "the way you're facing" and everything else as "the way you're not facing"
|
||||
if (left || right)
|
||||
@@ -163,23 +163,23 @@ void B_KeysToTiccmd(mobj_t *mo, ticcmd_t *cmd, boolean forward, boolean backward
|
||||
right = true;
|
||||
}
|
||||
if (left || strafeleft)
|
||||
cmd->sidemove -= MAXPLMOVE<<FRACBITS>>16;
|
||||
cmd->sidemove -= MAXPLMOVE << FRACBITS >> TICCMD_REDUCE;
|
||||
if (right || straferight)
|
||||
cmd->sidemove += MAXPLMOVE<<FRACBITS>>16;
|
||||
cmd->sidemove += MAXPLMOVE << FRACBITS >> TICCMD_REDUCE;
|
||||
}
|
||||
} else {
|
||||
if (forward)
|
||||
cmd->forwardmove += MAXPLMOVE<<FRACBITS>>16;
|
||||
cmd->forwardmove += MAXPLMOVE << FRACBITS >> TICCMD_REDUCE;
|
||||
if (backward)
|
||||
cmd->forwardmove -= MAXPLMOVE<<FRACBITS>>16;
|
||||
cmd->forwardmove -= MAXPLMOVE << FRACBITS >> TICCMD_REDUCE;
|
||||
if (left)
|
||||
cmd->angleturn += 1280;
|
||||
if (right)
|
||||
cmd->angleturn -= 1280;
|
||||
if (strafeleft)
|
||||
cmd->sidemove -= MAXPLMOVE<<FRACBITS>>16;
|
||||
cmd->sidemove -= MAXPLMOVE << FRACBITS >> TICCMD_REDUCE;
|
||||
if (straferight)
|
||||
cmd->sidemove += MAXPLMOVE<<FRACBITS>>16;
|
||||
cmd->sidemove += MAXPLMOVE << FRACBITS >> TICCMD_REDUCE;
|
||||
}
|
||||
if (jump)
|
||||
cmd->buttons |= BT_DRIFT;
|
||||
|
||||
@@ -93,6 +93,57 @@ LUALIB_API int luaL_error (lua_State *L, const char *fmt, ...) {
|
||||
/* }====================================================== */
|
||||
|
||||
|
||||
/*
|
||||
** {======================================================
|
||||
** 'luaL_resourcetryagain'
|
||||
** This function uses 'errno' to check whether the last error was
|
||||
** related to lack of resources (e.g., not enough memory or too many
|
||||
** open files). If so, the function performs a full garbage collection
|
||||
** to try to release resources, and then it returns 1 to signal to
|
||||
** the caller that it is worth trying again the failed operation.
|
||||
** Otherwise, it returns 0. Because error codes are not ANSI C, the
|
||||
** code must handle any combination of error codes that are defined.
|
||||
** =======================================================
|
||||
*/
|
||||
|
||||
LUALIB_API int luaL_resourcetryagain (lua_State *L) {
|
||||
|
||||
/* these are the resource-related errors in Linux */
|
||||
#if defined(EMFILE) || defined(ENFILE) || defined(ENOMEM)
|
||||
|
||||
#if !defined(EMFILE) /* too many open files in the process */
|
||||
#define EMFILE -1 /* if not defined, use an impossible value */
|
||||
#endif
|
||||
|
||||
#if !defined(ENFILE) /* too many open files in the system */
|
||||
#define ENFILE -1
|
||||
#endif
|
||||
|
||||
#if !defined(ENOMEM) /* not enough memory */
|
||||
#define ENOMEM -1
|
||||
#endif
|
||||
|
||||
if (errno == EMFILE || errno == ENFILE || errno == ENOMEM) {
|
||||
CONS_Alert(CONS_WARNING, "%s, force calling lua garbage collector\n", strerror(errno));
|
||||
lua_gc(L, LUA_GCCOLLECT, 0); /* try to release resources with a full GC */
|
||||
return 1; /* signal to try again the creation */
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
return 0; /* else, asume errors are not due to lack of resources */
|
||||
|
||||
}
|
||||
|
||||
/* }====================================================== */
|
||||
|
||||
|
||||
/*
|
||||
** {======================================================
|
||||
** Userdata's metatable manipulation
|
||||
** =======================================================
|
||||
*/
|
||||
|
||||
LUALIB_API int luaL_checkoption (lua_State *L, int narg, const char *def,
|
||||
const char *const lst[]) {
|
||||
const char *name = (def) ? luaL_optstring(L, narg, def) :
|
||||
|
||||
@@ -95,6 +95,8 @@ LUALIB_API FUNCREPORT int (luaL_error) (lua_State *L, const char *fmt, ...);
|
||||
LUALIB_API int (luaL_checkoption) (lua_State *L, int narg, const char *def,
|
||||
const char *const lst[]);
|
||||
|
||||
LUALIB_API int (luaL_resourcetryagain) (lua_State *L);
|
||||
|
||||
LUALIB_API int (luaL_ref) (lua_State *L, int t);
|
||||
LUALIB_API void (luaL_unref) (lua_State *L, int t, int ref);
|
||||
|
||||
|
||||
+23
-15
@@ -58,12 +58,6 @@ static int pushresult (lua_State *L, int i, const char *filename) {
|
||||
}
|
||||
|
||||
|
||||
static void fileerror (lua_State *L, int arg, const char *filename) {
|
||||
lua_pushfstring(L, "%s: %s", filename, strerror(errno));
|
||||
luaL_argerror(L, arg, lua_tostring(L, -1));
|
||||
}
|
||||
|
||||
|
||||
#define tofilep(L) ((FILE **)luaL_checkudata(L, 1, LUA_FILEHANDLE))
|
||||
|
||||
|
||||
@@ -165,6 +159,24 @@ static int StartsWith(const char *a, const char *b) // this is wolfs being lazy
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
** Equivalent to 'fopen', but if it fails due to a lack of resources
|
||||
** (see 'luaL_resourcetryagain'), do an "emergency" garbage collection to try
|
||||
** to close some files and then tries to open the file again.
|
||||
*/
|
||||
static FILE *trytoopen (lua_State *L, const char *path, const char *mode) {
|
||||
FILE *f = fopen(path, mode);
|
||||
if (f == NULL && luaL_resourcetryagain(L)) /* resource failure? */
|
||||
f = fopen(path, mode); /* try to open again */
|
||||
return f;
|
||||
}
|
||||
|
||||
static void opencheck (lua_State *L, const char *fname, const char *mode) {
|
||||
FILE **p = newfile(L);
|
||||
*p = trytoopen(L, fname, mode);
|
||||
if (l_unlikely(*p == NULL))
|
||||
luaL_error(L, "cannot open file '%s' (%s)", fname, strerror(errno));
|
||||
}
|
||||
|
||||
static int io_open(lua_State *L)
|
||||
{
|
||||
@@ -212,7 +224,7 @@ static int io_open(lua_State *L)
|
||||
}
|
||||
|
||||
pf = newfile(L);
|
||||
*pf = fopen(destFilename, mode);
|
||||
*pf = trytoopen(L, destFilename, mode);
|
||||
return (*pf == NULL) ? pushresult(L, 0, filename) : 1;
|
||||
}
|
||||
|
||||
@@ -220,6 +232,8 @@ static int io_open(lua_State *L)
|
||||
static int io_tmpfile (lua_State *L) {
|
||||
FILE **pf = newfile(L);
|
||||
*pf = tmpfile();
|
||||
if (*pf == NULL && luaL_resourcetryagain(L)) /* resource failure? */
|
||||
*pf = tmpfile(); /* try to open again */
|
||||
return (*pf == NULL) ? pushresult(L, 0, NULL) : 1;
|
||||
}
|
||||
|
||||
@@ -238,10 +252,7 @@ static int g_iofile (lua_State *L, int f, const char *mode) {
|
||||
if (!lua_isnoneornil(L, 1)) {
|
||||
const char *filename = lua_tostring(L, 1);
|
||||
if (filename) {
|
||||
FILE **pf = newfile(L);
|
||||
*pf = fopen(filename, mode);
|
||||
if (l_unlikely(*pf == NULL))
|
||||
fileerror(L, 1, filename);
|
||||
opencheck(L, filename, mode);
|
||||
}
|
||||
else {
|
||||
tofile(L); /* check that it's a valid file handle */
|
||||
@@ -290,10 +301,7 @@ static int io_lines (lua_State *L) {
|
||||
}
|
||||
else {
|
||||
const char *filename = luaL_checkstring(L, 1);
|
||||
FILE **pf = newfile(L);
|
||||
*pf = fopen(filename, "r");
|
||||
if (l_unlikely(*pf == NULL))
|
||||
fileerror(L, 1, filename);
|
||||
opencheck(L, filename, "r");
|
||||
aux_lines(L, lua_gettop(L), 1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
+2
-5
@@ -237,13 +237,10 @@ void COM_ImmedExecute(const char *ptext)
|
||||
char line[1024] = "";
|
||||
INT32 quotes;
|
||||
|
||||
const size_t txtlength = strlen(ptext);
|
||||
|
||||
while (i < txtlength)
|
||||
while (i < strlen(ptext))
|
||||
{
|
||||
quotes = 0;
|
||||
|
||||
for (j = 0; i < txtlength; i++,j++)
|
||||
for (j = 0; i < strlen(ptext); i++,j++)
|
||||
{
|
||||
if (ptext[i] == '\"' && !quotes && i > 0 && ptext[i-1] != ' ') // Malformed command
|
||||
return;
|
||||
|
||||
+12
-4
@@ -169,6 +169,8 @@ static CV_PossibleValue_t menuhighlight_cons_t[] =
|
||||
};
|
||||
consvar_t cons_menuhighlight = {"menuhighlight", "Gametype Default", CV_SAVE, menuhighlight_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cons_consoleprintinmenu = {"consoleprintinmenu", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
static void CON_Print(char *msg);
|
||||
|
||||
//
|
||||
@@ -426,6 +428,7 @@ void CON_Init(void)
|
||||
CV_RegisterVar(&cons_backpic);
|
||||
CV_RegisterVar(&cons_backcolor);
|
||||
CV_RegisterVar(&cons_menuhighlight);
|
||||
CV_RegisterVar(&cons_consoleprintinmenu);
|
||||
COM_AddCommand("bind", CONS_Bind_f);
|
||||
}
|
||||
else
|
||||
@@ -586,12 +589,18 @@ static void CON_ChangeHeight(void)
|
||||
|
||||
// Handles Console moves in/out of screen (per frame)
|
||||
//
|
||||
static void CON_MoveConsole(void)
|
||||
void CON_MoveConsole(void)
|
||||
{
|
||||
static fixed_t fracmovement = 0;
|
||||
|
||||
Lock_state();
|
||||
|
||||
if (con_curlines == con_destlines)
|
||||
{
|
||||
Unlock_state();
|
||||
return;
|
||||
}
|
||||
|
||||
// instant
|
||||
if (!cons_speed.value)
|
||||
{
|
||||
@@ -1584,13 +1593,12 @@ void CON_Drawer(void)
|
||||
}
|
||||
|
||||
// console movement
|
||||
if (con_curlines != con_destlines)
|
||||
CON_MoveConsole();
|
||||
CON_MoveConsole();
|
||||
|
||||
if (con_curlines > 0)
|
||||
CON_DrawConsole();
|
||||
else if (gamestate == GS_LEVEL || gamestate == GS_INTERMISSION || gamestate == GS_CUTSCENE || gamestate == GS_CREDITS
|
||||
|| gamestate == GS_VOTING || gamestate == GS_EVALUATION || gamestate == GS_WAITINGPLAYERS)
|
||||
|| gamestate == GS_VOTING || gamestate == GS_EVALUATION || gamestate == GS_WAITINGPLAYERS || (cons_consoleprintinmenu.value && gamestate == GS_TITLESCREEN))
|
||||
CON_DrawHudlines();
|
||||
|
||||
Unlock_state();
|
||||
|
||||
@@ -36,6 +36,7 @@ extern INT32 con_destlines;
|
||||
extern UINT32 con_scalefactor; // console text scale factor
|
||||
|
||||
extern consvar_t cons_backcolor, cons_menuhighlight;
|
||||
extern consvar_t cons_consoleprintinmenu;
|
||||
|
||||
extern UINT8 *yellowmap, *purplemap, *greenmap, *bluemap, *graymap, *redmap, *orangemap,\
|
||||
*skymap, *goldmap, *lavendermap, *teamap, *steelmap, *pinkmap, *brownmap, *peachmap;
|
||||
@@ -51,6 +52,7 @@ void CON_ClearHUD(void); // clear heads up messages
|
||||
|
||||
void CON_Ticker(void);
|
||||
void CON_Drawer(void);
|
||||
void CON_MoveConsole(void);
|
||||
void CONS_Error(const char *msg); // print out error msg, and wait a key
|
||||
|
||||
// force console to move out
|
||||
|
||||
+25
-55
@@ -1457,14 +1457,12 @@ static inline void CL_DrawConnectionStatus(void)
|
||||
V_DrawFill(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-58, dldlength, 8, 160);
|
||||
|
||||
memset(tempname, 0, sizeof(tempname));
|
||||
|
||||
// offset filename to just the name only part
|
||||
filename += strlen(filename) - nameonlylength(filename);
|
||||
const size_t filenamelength = strlen(filename);
|
||||
|
||||
if (filenamelength > sizeof(tempname)-1) // too long to display fully
|
||||
if (strlen(filename) > sizeof(tempname)-1) // too long to display fully
|
||||
{
|
||||
size_t endhalfpos = filenamelength-10;
|
||||
size_t endhalfpos = strlen(filename)-10;
|
||||
// display as first 14 chars + ... + last 10 chars
|
||||
// which should add up to 27 if our math(s) is correct
|
||||
snprintf(tempname, sizeof(tempname), "%.14s...%.10s", filename, filename+endhalfpos);
|
||||
@@ -2071,6 +2069,7 @@ static void CL_LoadReceivedSavegame(boolean reloading)
|
||||
length = FIL_ReadFile(tmpsave, &save.buffer);
|
||||
|
||||
CONS_Printf(M_GetText("Loading savegame length %s\n"), sizeu1(length));
|
||||
|
||||
if (!length)
|
||||
{
|
||||
I_Error("Can't read savegame sent");
|
||||
@@ -2154,7 +2153,7 @@ static void CL_ReloadReceivedSavegame(void)
|
||||
// we dont have P_ForceLocalAngle so were setting it manually here
|
||||
for (i = 0; i <= splitscreen; i++)
|
||||
{
|
||||
P_ForceLocalAngle(&players[displayplayers[i]], (angle_t)(players[displayplayers[i]].cmd.angleturn << 16));
|
||||
P_ForceLocalAngle(&players[displayplayers[i]], (angle_t)(players[displayplayers[i]].cmd.angleturn << TICCMD_REDUCE));
|
||||
}
|
||||
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
@@ -2193,12 +2192,8 @@ static void SendAskInfo(INT32 node)
|
||||
HSendPacket(node, false, 0, sizeof (askinfo_pak));
|
||||
}
|
||||
|
||||
serverelem_t serverlist[MAXSERVERLIST];
|
||||
serverelem_t serverlist[MAXSERVERLIST] = {};
|
||||
UINT32 serverlistcount = 0;
|
||||
UINT32 serverlistultimatecount = 0;
|
||||
|
||||
static boolean resendserverlistnode[MAXNETNODES];
|
||||
static tic_t serverlistepoch;
|
||||
|
||||
static void SL_ClearServerList(INT32 connectedserver)
|
||||
{
|
||||
@@ -2211,8 +2206,7 @@ static void SL_ClearServerList(INT32 connectedserver)
|
||||
serverlist[i].node = 0;
|
||||
}
|
||||
serverlistcount = 0;
|
||||
|
||||
memset(resendserverlistnode, 0, sizeof resendserverlistnode);
|
||||
//memset(serverlist, 0, sizeof(serverlist));
|
||||
}
|
||||
|
||||
static UINT32 SL_SearchServer(INT32 node)
|
||||
@@ -2229,8 +2223,6 @@ static void SL_InsertServer(serverinfo_pak* info, SINT8 node)
|
||||
{
|
||||
UINT32 i;
|
||||
|
||||
resendserverlistnode[node] = false;
|
||||
|
||||
// search if not already on it
|
||||
i = SL_SearchServer(node);
|
||||
if (i == UINT32_MAX)
|
||||
@@ -2264,7 +2256,7 @@ static void SL_InsertServer(serverinfo_pak* info, SINT8 node)
|
||||
M_SortServerList();
|
||||
}
|
||||
|
||||
void CL_UpdateServerList (void)
|
||||
void CL_UpdateServerList(void)
|
||||
{
|
||||
SL_ClearServerList(0);
|
||||
|
||||
@@ -2282,14 +2274,12 @@ void CL_UpdateServerList (void)
|
||||
SendAskInfo(BROADCASTADDR);
|
||||
}
|
||||
|
||||
void CL_QueryServerList (msg_server_t *server_list)
|
||||
void CL_QueryServerList(msg_server_t *server_list)
|
||||
{
|
||||
INT32 i;
|
||||
|
||||
CL_UpdateServerList();
|
||||
|
||||
serverlistepoch = I_GetTime();
|
||||
|
||||
for (i = 0; server_list[i].header.buffer[0]; i++)
|
||||
{
|
||||
// Make sure MS version matches our own, to
|
||||
@@ -2302,42 +2292,20 @@ void CL_QueryServerList (msg_server_t *server_list)
|
||||
if (node == -1)
|
||||
continue; // no more node free, or resolution failure
|
||||
SendAskInfo(node);
|
||||
resendserverlistnode[node] = true;
|
||||
// Leave this node open. It'll be closed if the
|
||||
// request times out (CL_TimeoutServerList).
|
||||
}
|
||||
}
|
||||
|
||||
serverlistultimatecount = i;
|
||||
}
|
||||
|
||||
#define SERVERLISTRESENDRATE NEWTICRATE
|
||||
|
||||
void CL_TimeoutServerList(void)
|
||||
{
|
||||
if (netgame && serverlistultimatecount > serverlistcount)
|
||||
{
|
||||
const tic_t timediff = I_GetTime() - serverlistepoch;
|
||||
const tic_t timetoresend = timediff % SERVERLISTRESENDRATE;
|
||||
const boolean timedout = timediff > connectiontimeout;
|
||||
|
||||
if (timedout || (timediff > 0 && timetoresend == 0))
|
||||
{
|
||||
INT32 node;
|
||||
|
||||
for (node = 1; node < MAXNETNODES; ++node)
|
||||
{
|
||||
if (resendserverlistnode[node])
|
||||
{
|
||||
if (timedout)
|
||||
Net_CloseConnection(node|FORCECLOSE);
|
||||
else
|
||||
SendAskInfo(node);
|
||||
}
|
||||
}
|
||||
|
||||
if (timedout)
|
||||
serverlistultimatecount = serverlistcount;
|
||||
// Force close the connection so that servers can't eat
|
||||
// up nodes forever if we never get a reply back from them
|
||||
// (usually when they've not forwarded their ports).
|
||||
//
|
||||
// Don't worry, we'll get in contact with the working
|
||||
// servers again when they send SERVERINFO to us later!
|
||||
//
|
||||
// (Note: as a side effect this probably means every
|
||||
// server in the list will probably be using the same node (e.g. node 1),
|
||||
// not that it matters which nodes they use when
|
||||
// the connections are closed afterwards anyway)
|
||||
// -- Monster Iestyn 12/11/18
|
||||
Net_CloseConnection(node|FORCECLOSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4527,7 +4495,7 @@ static void Got_AddPlayer(const UINT8 **p, INT32 playernum)
|
||||
DEBFILE("spawning me\n");
|
||||
}
|
||||
|
||||
P_ForceLocalAngle(&players[newplayernum], (angle_t)(players[newplayernum].cmd.angleturn << 16));
|
||||
P_ForceLocalAngle(&players[newplayernum], (angle_t)(players[newplayernum].cmd.angleturn << TICCMD_REDUCE));
|
||||
|
||||
D_SendPlayerConfig();
|
||||
addedtogame = true;
|
||||
@@ -6474,6 +6442,7 @@ static void SV_SendTics(void)
|
||||
continue;
|
||||
DEBFILE(va("Sent %d anyway\n", realfirsttic));
|
||||
}
|
||||
|
||||
realfirsttic = max(realfirsttic, firstticstosend);
|
||||
|
||||
// compute the length of the packet and cut it if too large
|
||||
@@ -6619,7 +6588,8 @@ void SV_SpawnPlayer(INT32 playernum, INT32 x, INT32 y, angle_t angle)
|
||||
// -- Monster Iestyn 16/01/18
|
||||
break;
|
||||
}
|
||||
netcmds[tic%BACKUPTICS][playernum].angleturn = (INT16)((angle>>16) | TICCMD_RECEIVED);
|
||||
|
||||
netcmds[tic%BACKUPTICS][playernum].angleturn = (INT16)((angle >> TICCMD_REDUCE) | TICCMD_RECEIVED);
|
||||
|
||||
if (!tic) // failsafe for gametic == 0 -- Monster Iestyn 16/01/18
|
||||
break;
|
||||
|
||||
@@ -516,7 +516,6 @@ typedef struct
|
||||
|
||||
extern serverelem_t serverlist[MAXSERVERLIST];
|
||||
extern UINT32 serverlistcount;
|
||||
extern UINT32 serverlistultimatecount;
|
||||
extern INT32 mapchangepending;
|
||||
|
||||
// Points inside doomcom
|
||||
@@ -627,7 +626,6 @@ void CL_ClearPlayer(INT32 playernum);
|
||||
void CL_RemovePlayer(INT32 playernum, INT32 reason);
|
||||
void CL_QueryServerList(msg_server_t *list);
|
||||
void CL_UpdateServerList(void);
|
||||
void CL_TimeoutServerList(void);
|
||||
|
||||
void CL_AbortConnection(void);
|
||||
|
||||
|
||||
+4
-5
@@ -792,9 +792,9 @@ void D_SRB2Loop(void)
|
||||
}
|
||||
else if (!dedicated)
|
||||
{
|
||||
// always update console and hud
|
||||
// otherwise it may take minutes to open it
|
||||
CON_Drawer();
|
||||
// always update console movement
|
||||
// otherwise it will takes literal ages to open
|
||||
CON_MoveConsole();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -885,7 +885,6 @@ void D_ClearState(void)
|
||||
CURLAbortFile();
|
||||
SV_StopServer();
|
||||
SV_ResetServer();
|
||||
serverlistultimatecount = 0;
|
||||
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
CL_ClearPlayer(i);
|
||||
@@ -1264,7 +1263,7 @@ static void IdentifyVersion(void)
|
||||
if (AddIWAD("extra3.kart", srb2waddir))
|
||||
found_extra3_kart = true;
|
||||
|
||||
#if defined (HAVE_SDL)
|
||||
#if !defined (HAVE_SDL) || defined (HAVE_MIXER)
|
||||
#define MUSICTEST(str) \
|
||||
musicpath = va(pandf, srb2waddir, str);\
|
||||
handle = W_OpenWadFile(&musicpath, false); \
|
||||
|
||||
+7
-1
@@ -492,6 +492,7 @@ void Net_AckTicker(void)
|
||||
ackpak[i].acknum = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
DEBFILE(va("Resend ack %d, %u<%d at %u\n", ackpak[i].acknum, ackpak[i].senttime,
|
||||
NODETIMEOUT, I_GetTime()));
|
||||
memcpy(netbuffer, ackpak[i].pak.raw, ackpak[i].length);
|
||||
@@ -1224,7 +1225,7 @@ void D_SetDoomcom(void)
|
||||
if (doomcom)
|
||||
return;
|
||||
|
||||
doomcom = Z_Calloc(sizeof (doomcom_t), PU_STATIC, NULL);
|
||||
doomcom = Z_Calloc(sizeof(doomcom_t), PU_STATIC, NULL);
|
||||
doomcom->id = DOOMCOM_ID;
|
||||
doomcom->numslots = doomcom->numnodes = 1;
|
||||
}
|
||||
@@ -1266,6 +1267,7 @@ boolean D_CheckNetGame(void)
|
||||
ret = true;
|
||||
if (client && netgame)
|
||||
netgame = false;
|
||||
|
||||
server = true; // WTF? server always true???
|
||||
// no! The deault mode is server. Client is set elsewhere
|
||||
// when the client executes connect command.
|
||||
@@ -1301,6 +1303,7 @@ boolean D_CheckNetGame(void)
|
||||
|
||||
if (doomcom->id != DOOMCOM_ID)
|
||||
I_Error("Doomcom buffer invalid!");
|
||||
|
||||
if (doomcom->numnodes > MAXNETNODES)
|
||||
I_Error("Too many nodes (%d), max:%d", doomcom->numnodes, MAXNETNODES);
|
||||
|
||||
@@ -1309,14 +1312,17 @@ boolean D_CheckNetGame(void)
|
||||
{
|
||||
char filename[21];
|
||||
INT32 k = doomcom->consoleplayer - 1;
|
||||
|
||||
if (M_IsNextParm())
|
||||
k = atoi(M_GetNextParm()) - 1;
|
||||
|
||||
while (!debugfile && k < MAXPLAYERS)
|
||||
{
|
||||
k++;
|
||||
sprintf(filename, "debug%d.txt", k);
|
||||
debugfile = fopen(va("%s" PATHSEP "%s", srb2home, filename), "w");
|
||||
}
|
||||
|
||||
if (debugfile)
|
||||
CONS_Printf(M_GetText("debug output to: %s\n"), va("%s" PATHSEP "%s", srb2home, filename));
|
||||
else
|
||||
|
||||
+32
-3
@@ -144,6 +144,7 @@ static void Command_Addfile(void);
|
||||
static void Command_Addskins(void);
|
||||
static void Command_GLocalSkin(void);
|
||||
static void Command_ListWADS_f(void);
|
||||
static void Command_LocateLump_f(void);
|
||||
static void Command_ListDoomednums_f(void);
|
||||
static void Command_ListUnusedSprites_f(void);
|
||||
static void Command_RunSOC(void);
|
||||
@@ -270,7 +271,7 @@ consvar_t cv_skin4 = {"skin4", DEFAULTSKIN4, CV_SAVE|CV_CALL|CV_NOINIT, NULL, Sk
|
||||
// haha I've beaten you now, ONLINE
|
||||
consvar_t cv_localskin = {"internal___localskin", "none", CV_HIDEN, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_showlocalskinmenus = {"showlocalskinmenus", "Yes", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_showlocalskinmenus = {"showlocalskinmenus", "Yes", CV_SAVE|CV_CALL, CV_YesNo, ShowLocalskinMenu_Onchange, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_skipmapcheck = {"skipmapcheck", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
@@ -638,6 +639,7 @@ void D_RegisterServerCommands(void)
|
||||
COM_AddCommand("addfile", Command_Addfile);
|
||||
COM_AddCommand("addskins", Command_Addskins);
|
||||
COM_AddCommand("listwad", Command_ListWADS_f);
|
||||
COM_AddCommand("locatelump", Command_LocateLump_f);
|
||||
COM_AddCommand("listmapthings", Command_ListDoomednums_f);
|
||||
COM_AddCommand("listunusedsprites", Command_ListUnusedSprites_f);
|
||||
|
||||
@@ -937,6 +939,7 @@ void D_RegisterClientCommands(void)
|
||||
CV_RegisterVar(&cv_chatbacktint);
|
||||
CV_RegisterVar(&cv_chatcentertext);
|
||||
CV_RegisterVar(&cv_songcredits);
|
||||
CV_RegisterVar(&cv_pausesongcredits);
|
||||
CV_RegisterVar(&cv_showfreeplay);
|
||||
CV_RegisterVar(&cv_skinselectspin);
|
||||
CV_RegisterVar(&cv_showallmaps);
|
||||
@@ -1003,7 +1006,7 @@ void D_RegisterClientCommands(void)
|
||||
|
||||
CV_RegisterVar(&cv_usemouse);
|
||||
CV_RegisterVar(&cv_invertmouse);
|
||||
CV_RegisterVar(&cv_mousesens);
|
||||
CV_RegisterVar(&cv_mousexsens);
|
||||
CV_RegisterVar(&cv_mouseysens);
|
||||
CV_RegisterVar(&cv_mousevisible);
|
||||
|
||||
@@ -2647,7 +2650,6 @@ static void Command_Map_f(void)
|
||||
return;
|
||||
}
|
||||
|
||||
M_ClearMenus(true);
|
||||
|
||||
last_map_cmd = I_GetTime();
|
||||
|
||||
@@ -2830,6 +2832,8 @@ static void Command_Map_f(void)
|
||||
|
||||
fromlevelselect = false;
|
||||
|
||||
M_ClearMenus(true);
|
||||
|
||||
D_MapChange(newmapnum, newgametype, newencoremode, newresetplayers, 0, false, false);
|
||||
}
|
||||
|
||||
@@ -4720,6 +4724,31 @@ static void Command_ListWADS_f(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void Command_LocateLump_f(void)
|
||||
{
|
||||
if (COM_Argc() == 1)
|
||||
{
|
||||
CONS_Printf("Usage: locatelump <lump1>[ <lump2>[ ...]]\n");
|
||||
return;
|
||||
}
|
||||
|
||||
for (size_t i = 1; i < COM_Argc(); ++i)
|
||||
{
|
||||
const char *name = COM_Argv(i);
|
||||
|
||||
lumpnum_t num = W_CheckNumForName(name);
|
||||
|
||||
const char *wadname = "(not found)";
|
||||
|
||||
if (num != LUMPERROR)
|
||||
{
|
||||
wadname = wadfiles[WADFILENUM(num)]->filename;
|
||||
}
|
||||
|
||||
CONS_Printf("%s - %s\n", name, wadname);
|
||||
}
|
||||
}
|
||||
|
||||
#define MAXDOOMEDNUM 4095
|
||||
|
||||
static void Command_ListDoomednums_f(void)
|
||||
|
||||
+5
-6
@@ -1079,14 +1079,12 @@ void CloseNetFile(void)
|
||||
|
||||
// Receiving a file?
|
||||
for (i = 0; i < MAX_WADFILES; i++)
|
||||
{
|
||||
if (fileneeded[i].status == FS_DOWNLOADING && fileneeded[i].file)
|
||||
{
|
||||
fclose(fileneeded[i].file);
|
||||
// File is not complete delete it
|
||||
remove(fileneeded[i].filename);
|
||||
}
|
||||
}
|
||||
|
||||
// Remove PT_FILEFRAGMENT from acknowledge list
|
||||
Net_AbortPacketType(PT_FILEFRAGMENT);
|
||||
@@ -1100,16 +1098,17 @@ void nameonly(char *s)
|
||||
void *ns;
|
||||
|
||||
for (j = strlen(s); j != (size_t)-1; j--)
|
||||
{
|
||||
if ((s[j] == '\\') || (s[j] == ':') || (s[j] == '/'))
|
||||
{
|
||||
ns = &(s[j+1]);
|
||||
len = strlen(ns);
|
||||
memmove(s, ns, len+1);
|
||||
|
||||
#if 0
|
||||
memcpy(s, ns, len+1);
|
||||
#else
|
||||
memmove(s, ns, len+1);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Returns the length in characters of the last element of a path.
|
||||
|
||||
+8
-3
@@ -46,15 +46,20 @@ typedef enum
|
||||
// Mainly movements/button commands per game tick,
|
||||
// plus a checksum for internal state consistency.
|
||||
|
||||
// ticcmd turning bits
|
||||
#define TICCMD_REDUCE 16
|
||||
|
||||
// ticcmd latency mask
|
||||
#define TICCMD_LATENCYMASK 0xFF
|
||||
|
||||
// bits in angleturn
|
||||
#define TICCMD_RECEIVED 1
|
||||
#define TICCMD_XY 2
|
||||
#define TICCMD_RECEIVED (0x01) /* Actual tic recieved from client */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
SINT8 forwardmove; // -MAXPLMOVE to MAXPLMOVE (50)
|
||||
SINT8 sidemove; // -MAXPLMOVE to MAXPLMOVE (50)
|
||||
INT16 angleturn; // <<16 for angle delta - saved as 1 byte into demos
|
||||
INT16 angleturn; // << TICCMD_REDUCE for angle delta - saved as 1 byte into demos
|
||||
INT16 aiming; // vertical aiming, see G_BuildTicCmd
|
||||
UINT16 buttons;
|
||||
INT16 driftturn; // SRB2Kart: Used for getting drift turn speed
|
||||
|
||||
@@ -115,10 +115,6 @@ INT32 VID_GetModeForSize(INT32 w, INT32 h)
|
||||
return -1;
|
||||
}
|
||||
|
||||
void VID_RefreshModeList(void)
|
||||
{
|
||||
}
|
||||
|
||||
void VID_PrepareModeList(void)
|
||||
{
|
||||
}
|
||||
|
||||
+4
-5
@@ -20,7 +20,6 @@
|
||||
// but I can't stand that gibberish. D:
|
||||
#define SOUND_DUMMY 0
|
||||
#define SOUND_MIXER 1
|
||||
#define SOUND_SDL 2
|
||||
|
||||
#ifndef SOUND
|
||||
#ifdef HAVE_SDL
|
||||
@@ -28,7 +27,7 @@
|
||||
#ifdef HAVE_MIXER
|
||||
#define SOUND SOUND_MIXER
|
||||
#else
|
||||
#define SOUND SOUND_SDL
|
||||
#define SOUND SOUND_DUMMY
|
||||
#endif
|
||||
#else
|
||||
#define SOUND SOUND_DUMMY
|
||||
@@ -108,10 +107,10 @@ extern char logfilename[1024];
|
||||
#else
|
||||
#define VERSION 1 // Game version
|
||||
#define SUBVERSION 6 // more precise version number
|
||||
#define VERSIONSTRING "Saturn v9.x - Testing"
|
||||
#define VERSIONSTRINGW L"Saturn v9.x - Testing "
|
||||
#define VERSIONSTRING "Saturn v9.2"
|
||||
#define VERSIONSTRINGW L"Saturn v9.2"
|
||||
|
||||
#define SATURN_TESTING // comment out for saturn release builds!
|
||||
//#define SATURN_TESTING // comment out for saturn release builds!
|
||||
|
||||
// Hey! If you change this, add 1 to the MODVERSION below! Otherwise we can't force updates!
|
||||
// And change CMakeLists.txt (not src/, but in root), for CMake users!
|
||||
|
||||
+1
-1
@@ -542,7 +542,7 @@ extern mapthing_t *redctfstarts[MAXPLAYERS]; // CTF
|
||||
#else
|
||||
#define DEBUGFILE
|
||||
#ifdef DEBUGFILE
|
||||
#define DEBFILE(msg) { if (debugfile) { fputs(msg, debugfile); fflush(debugfile); } }
|
||||
#define DEBFILE(msg) { if (UNLIKELY(debugfile)) { fputs(msg, debugfile); fflush(debugfile); } }
|
||||
#else
|
||||
#define DEBFILE(msg) {}
|
||||
#endif
|
||||
|
||||
+1
-1
@@ -644,7 +644,7 @@ void F_CreditDrawer(void)
|
||||
sc = FRACUNIT; // quick hack so I don't have to add another field to credits_pics
|
||||
}
|
||||
|
||||
V_DrawFixedPatch(credits_pics[i].x<<FRACBITS, (credits_pics[i].y<<FRACBITS) - 4*(animtimer<<FRACBITS)/5, sc, 0, W_CachePatchName(credits_pics[i].patch, PU_PATCH_LOWPRIORITY), colormap);
|
||||
V_DrawFixedPatch(credits_pics[i].x<<FRACBITS, (credits_pics[i].y<<FRACBITS) - 4*(animtimer<<FRACBITS)/5, sc, 0, W_CachePatchName(credits_pics[i].patch, PU_PATCH), colormap);
|
||||
}
|
||||
|
||||
// Dim the background
|
||||
|
||||
+93
-63
@@ -246,10 +246,12 @@ void G_ReadDemoExtraData(void)
|
||||
{
|
||||
extradata = READUINT8(demobuf.p);
|
||||
|
||||
player_t *player = &players[p];
|
||||
|
||||
if (extradata & DXD_RESPAWN)
|
||||
{
|
||||
if (players[p].mo)
|
||||
P_DamageMobj(players[p].mo, NULL, NULL, DMG_INSTAKILL); // Is this how this should work..?
|
||||
if (player->mo)
|
||||
P_DamageMobj(player->mo, NULL, NULL, DMG_INSTAKILL); // Is this how this should work..?
|
||||
}
|
||||
|
||||
if (extradata & DXD_SKIN)
|
||||
@@ -264,11 +266,11 @@ void G_ReadDemoExtraData(void)
|
||||
kartspeed = READUINT8(demobuf.p);
|
||||
kartweight = READUINT8(demobuf.p);
|
||||
|
||||
if (!fasticmp(skins[players[p].skin].name, name))
|
||||
if (!fasticmp(skins[player->skin].name, name))
|
||||
FindClosestSkinForStats(p, kartspeed, kartweight);
|
||||
|
||||
players[p].kartspeed = kartspeed;
|
||||
players[p].kartweight = kartweight;
|
||||
player->kartspeed = kartspeed;
|
||||
player->kartweight = kartweight;
|
||||
}
|
||||
|
||||
if (extradata & DXD_COLOR)
|
||||
@@ -279,9 +281,9 @@ void G_ReadDemoExtraData(void)
|
||||
for (i = 0; i < MAXSKINCOLORS; i++)
|
||||
if (fasticmp(KartColor_Names[i], name)) // SRB2kart
|
||||
{
|
||||
players[p].skincolor = i;
|
||||
if (players[p].mo)
|
||||
players[p].mo->color = i;
|
||||
player->skincolor = i;
|
||||
if (player->mo)
|
||||
player->mo->color = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -300,17 +302,17 @@ void G_ReadDemoExtraData(void)
|
||||
switch (extradata)
|
||||
{
|
||||
case DXD_PST_PLAYING:
|
||||
players[p].pflags |= PF_WANTSTOJOIN; // fuck you
|
||||
player->pflags |= PF_WANTSTOJOIN; // fuck you
|
||||
break;
|
||||
case DXD_PST_SPECTATING:
|
||||
players[p].pflags &= ~PF_WANTSTOJOIN; // double-fuck you
|
||||
player->pflags &= ~PF_WANTSTOJOIN; // double-fuck you
|
||||
|
||||
if (!playeringame[p])
|
||||
{
|
||||
CL_ClearPlayer(p);
|
||||
playeringame[p] = true;
|
||||
G_AddPlayer(p);
|
||||
players[p].spectator = true;
|
||||
player->spectator = true;
|
||||
|
||||
// There's likely an off-by-one error in timing recording or playback of joins. This hacks around it so I don't have to find out where that is. \o/
|
||||
if (oldcmd[p].forwardmove)
|
||||
@@ -318,11 +320,11 @@ void G_ReadDemoExtraData(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
players[p].spectator = true;
|
||||
if (players[p].mo)
|
||||
P_DamageMobj(players[p].mo, NULL, NULL, DMG_INSTAKILL);
|
||||
player->spectator = true;
|
||||
if (player->mo)
|
||||
P_DamageMobj(player->mo, NULL, NULL, DMG_INSTAKILL);
|
||||
else
|
||||
players[p].playerstate = PST_REBORN;
|
||||
player->playerstate = PST_REBORN;
|
||||
}
|
||||
break;
|
||||
case DXD_PST_LEFT:
|
||||
@@ -330,7 +332,7 @@ void G_ReadDemoExtraData(void)
|
||||
break;
|
||||
}
|
||||
|
||||
G_ResetViews();
|
||||
G_ResetViews(false); // dont reset our freecam pls thx!
|
||||
|
||||
// maybe these are necessary?
|
||||
if (G_BattleGametype())
|
||||
@@ -1132,7 +1134,29 @@ void G_GhostTicker(void)
|
||||
for (g = ghosts, p = NULL; g; g = g->next)
|
||||
{
|
||||
// Skip normal demo data.
|
||||
UINT8 ziptic = READUINT8(g->p);
|
||||
UINT8 ziptic;
|
||||
|
||||
if (g->done)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
ziptic = READUINT8(g->p);
|
||||
|
||||
fadeghost:
|
||||
// Demo ends after ghost data.
|
||||
if (ziptic == DEMOMARKER)
|
||||
{
|
||||
g->mo->momx = g->mo->momy = g->mo->momz = 0;
|
||||
|
||||
g->done = true;
|
||||
if (p)
|
||||
{
|
||||
p->next = g->next;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
#ifdef DEMO_COMPAT_100
|
||||
if (g->version != 0x0001)
|
||||
@@ -1140,8 +1164,14 @@ void G_GhostTicker(void)
|
||||
#endif
|
||||
while (ziptic != DW_END) // Get rid of extradata stuff
|
||||
{
|
||||
if (ziptic == 0) // Only support player 0 info for now
|
||||
if (ziptic < MAXPLAYERS)
|
||||
{
|
||||
#ifdef DEVELOP
|
||||
UINT8 playerid = ziptic;
|
||||
#endif
|
||||
// We want to skip *any* player extradata because some demos have extradata for bogus players,
|
||||
// but if there is tic data later for those players *then* we'll consider it invalid.
|
||||
|
||||
ziptic = READUINT8(g->p);
|
||||
|
||||
if (ziptic & DXD_SKIN)
|
||||
@@ -1153,13 +1183,26 @@ void G_GhostTicker(void)
|
||||
if (ziptic & DXD_NAME)
|
||||
g->p += 16; // yea
|
||||
|
||||
if (ziptic & DXD_PLAYSTATE && READUINT8(g->p) != DXD_PST_PLAYING)
|
||||
I_Error("Ghost is not a record attack ghost"); //@TODO lmao don't blow up like this
|
||||
if (ziptic & DXD_PLAYSTATE)
|
||||
{
|
||||
UINT8 playstate = READUINT8(g->p);
|
||||
if (playstate != DXD_PST_PLAYING)
|
||||
{
|
||||
#ifdef DEVELOP
|
||||
CONS_Alert(CONS_WARNING, "Ghost demo has non-playing playstate for player %d\n", playerid + 1);
|
||||
#endif
|
||||
;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (ziptic == DW_RNG)
|
||||
{
|
||||
g->p += 4; // RNG seed
|
||||
}
|
||||
else
|
||||
I_Error("Ghost is not a record attack ghost"); //@TODO lmao don't blow up like this
|
||||
{
|
||||
I_Error("Ghost is not a record attack ghost DXD (ziptic = %u)", ziptic); //@TODO lmao don't blow up like this
|
||||
}
|
||||
|
||||
ziptic = READUINT8(g->p);
|
||||
}
|
||||
@@ -1182,7 +1225,7 @@ void G_GhostTicker(void)
|
||||
if (ziptic & ZT_DRIFT)
|
||||
g->p += 2;
|
||||
if (ziptic & ZT_LATENCY)
|
||||
g->p += 1;
|
||||
g->p++;
|
||||
|
||||
// Grab ghost data.
|
||||
ziptic = READUINT8(g->p);
|
||||
@@ -1191,10 +1234,12 @@ void G_GhostTicker(void)
|
||||
if (g->version != 0x0001)
|
||||
{
|
||||
#endif
|
||||
if (ziptic == DEMOMARKER) // Had to end early for some reason
|
||||
goto fadeghost;
|
||||
if (ziptic == 0xFF)
|
||||
goto skippedghosttic; // Didn't write ghost info this frame
|
||||
else if (ziptic != 0)
|
||||
I_Error("Ghost is not a record attack ghost"); //@TODO lmao don't blow up like this
|
||||
if (ziptic != 0)
|
||||
I_Error("Ghost is not a record attack ghost ZIPTIC"); //@TODO lmao don't blow up like this
|
||||
ziptic = READUINT8(g->p);
|
||||
#ifdef DEMO_COMPAT_100
|
||||
}
|
||||
@@ -1365,7 +1410,7 @@ void G_GhostTicker(void)
|
||||
{
|
||||
#endif
|
||||
if (READUINT8(g->p) != 0xFF) // Make sure there isn't other ghost data here.
|
||||
I_Error("Ghost is not a record attack ghost"); //@TODO lmao don't blow up like this
|
||||
I_Error("Ghost is not a record attack ghost GHOSTEND"); //@TODO lmao don't blow up like this
|
||||
#ifdef DEMO_COMPAT_100
|
||||
}
|
||||
#endif
|
||||
@@ -1385,20 +1430,6 @@ skippedghosttic:
|
||||
break;
|
||||
}
|
||||
|
||||
// Demo ends after ghost data.
|
||||
if (*g->p == DEMOMARKER)
|
||||
{
|
||||
g->mo->momx = g->mo->momy = g->mo->momz = 0;
|
||||
|
||||
if (p)
|
||||
p->next = g->next;
|
||||
else
|
||||
ghosts = g->next;
|
||||
|
||||
Z_Free(g);
|
||||
continue;
|
||||
}
|
||||
|
||||
p = g;
|
||||
}
|
||||
}
|
||||
@@ -1593,7 +1624,7 @@ void G_ConfirmRewind(tic_t rewindtime)
|
||||
displayplayers[2] = olddp3;
|
||||
displayplayers[3] = olddp4;
|
||||
R_ExecuteSetViewSize();
|
||||
G_ResetViews();
|
||||
G_ResetViews(true);
|
||||
|
||||
for (i = splitscreen; i >= 0; i--)
|
||||
P_ResetCamera(&players[displayplayers[i]], &camera[i]);
|
||||
@@ -2581,7 +2612,7 @@ void G_DoPlayDemo(char *defdemoname)
|
||||
snprintf(msg, 1024, M_GetText("Failed to read file '%s'.\n"), defdemoname);
|
||||
CONS_Alert(CONS_ERROR, "%s", msg);
|
||||
gameaction = ga_nothing;
|
||||
M_StartMessage(msg, NULL, MM_NOTHING);
|
||||
M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2593,7 +2624,7 @@ void G_DoPlayDemo(char *defdemoname)
|
||||
snprintf(msg, 1024, M_GetText("Failed to read lump '%s'.\n"), defdemoname);
|
||||
CONS_Alert(CONS_ERROR, "%s", msg);
|
||||
gameaction = ga_nothing;
|
||||
M_StartMessage(msg, NULL, MM_NOTHING);
|
||||
M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER);
|
||||
return;
|
||||
}
|
||||
else // it's an internal demo
|
||||
@@ -2613,7 +2644,7 @@ void G_DoPlayDemo(char *defdemoname)
|
||||
{
|
||||
snprintf(msg, 1024, M_GetText("%s is not a SRB2Kart replay file.\n"), pdemoname);
|
||||
CONS_Alert(CONS_ERROR, "%s", msg);
|
||||
M_StartMessage(msg, NULL, MM_NOTHING);
|
||||
M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER);
|
||||
G_ResetDemoPlayback();
|
||||
return;
|
||||
}
|
||||
@@ -2639,7 +2670,7 @@ void G_DoPlayDemo(char *defdemoname)
|
||||
default:
|
||||
snprintf(msg, 1024, M_GetText("%s is an incompatible replay format and cannot be played.\n"), pdemoname);
|
||||
CONS_Alert(CONS_ERROR, "%s", msg);
|
||||
M_StartMessage(msg, NULL, MM_NOTHING);
|
||||
M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER);
|
||||
G_ResetDemoPlayback();
|
||||
return;
|
||||
}
|
||||
@@ -2650,7 +2681,7 @@ void G_DoPlayDemo(char *defdemoname)
|
||||
{
|
||||
snprintf(msg, 1024, M_GetText("%s is the wrong type of recording and cannot be played.\n"), pdemoname);
|
||||
CONS_Alert(CONS_ERROR, "%s", msg);
|
||||
M_StartMessage(msg, NULL, MM_NOTHING);
|
||||
M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER);
|
||||
G_ResetDemoPlayback();
|
||||
return;
|
||||
}
|
||||
@@ -2667,7 +2698,7 @@ void G_DoPlayDemo(char *defdemoname)
|
||||
{
|
||||
snprintf(msg, 1024, M_GetText("%s is an alpha multiplayer replay and cannot be played.\n"), pdemoname);
|
||||
CONS_Alert(CONS_ERROR, "%s", msg);
|
||||
M_StartMessage(msg, NULL, MM_NOTHING);
|
||||
M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER);
|
||||
G_ResetDemoPlayback();
|
||||
return;
|
||||
}
|
||||
@@ -2725,7 +2756,7 @@ void G_DoPlayDemo(char *defdemoname)
|
||||
CONS_Alert(CONS_ERROR, "%s", msg);
|
||||
|
||||
if (!CON_Ready()) // In the console they'll just see the notice there! No point pulling them out.
|
||||
M_StartMessage(msg, NULL, MM_NOTHING);
|
||||
M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER);
|
||||
|
||||
G_ResetDemoPlayback();
|
||||
return;
|
||||
@@ -2763,6 +2794,16 @@ void G_DoPlayDemo(char *defdemoname)
|
||||
#endif
|
||||
demobuf.p += 4; // Extrainfo location
|
||||
|
||||
// ...*map* not loaded?
|
||||
if (!gamemap || (gamemap > NUMMAPS) || !mapheaderinfo[gamemap-1] || !(mapheaderinfo[gamemap-1]->menuflags & LF2_EXISTSHACK))
|
||||
{
|
||||
snprintf(msg, 1024, M_GetText("%s features a course that is not currently loaded.\n"), pdemoname);
|
||||
CONS_Alert(CONS_ERROR, "%s", msg);
|
||||
M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER);
|
||||
G_ResetDemoPlayback();
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef DEMO_COMPAT_100
|
||||
if (demo.version == 0x0001)
|
||||
{
|
||||
@@ -2790,17 +2831,7 @@ void G_DoPlayDemo(char *defdemoname)
|
||||
{
|
||||
snprintf(msg, 1024, M_GetText("%s features a character that is not currently loaded.\n"), pdemoname);
|
||||
CONS_Alert(CONS_ERROR, "%s", msg);
|
||||
M_StartMessage(msg, NULL, MM_NOTHING);
|
||||
G_ResetDemoPlayback();
|
||||
return;
|
||||
}
|
||||
|
||||
// ...*map* not loaded?
|
||||
if (!gamemap || (gamemap > NUMMAPS) || !mapheaderinfo[gamemap-1] || !(mapheaderinfo[gamemap-1]->menuflags & LF2_EXISTSHACK))
|
||||
{
|
||||
snprintf(msg, 1024, M_GetText("%s features a course that is not currently loaded.\n"), pdemoname);
|
||||
CONS_Alert(CONS_ERROR, "%s", msg);
|
||||
M_StartMessage(msg, NULL, MM_NOTHING);
|
||||
M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER);
|
||||
G_ResetDemoPlayback();
|
||||
return;
|
||||
}
|
||||
@@ -2823,7 +2854,7 @@ void G_DoPlayDemo(char *defdemoname)
|
||||
{
|
||||
snprintf(msg, 1024, M_GetText("%s contains no data to be played.\n"), pdemoname);
|
||||
CONS_Alert(CONS_ERROR, "%s", msg);
|
||||
M_StartMessage(msg, NULL, MM_NOTHING);
|
||||
M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER);
|
||||
G_ResetDemoPlayback();
|
||||
return;
|
||||
}
|
||||
@@ -2861,7 +2892,7 @@ void G_DoPlayDemo(char *defdemoname)
|
||||
{
|
||||
snprintf(msg, 1024, M_GetText("%s contains no data to be played.\n"), pdemoname);
|
||||
CONS_Alert(CONS_ERROR, "%s", msg);
|
||||
M_StartMessage(msg, NULL, MM_NOTHING);
|
||||
M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER);
|
||||
G_ResetDemoPlayback();
|
||||
return;
|
||||
}
|
||||
@@ -2910,7 +2941,7 @@ void G_DoPlayDemo(char *defdemoname)
|
||||
{
|
||||
snprintf(msg, 1024, M_GetText("%s is a Record Attack replay with spectators, and is thus invalid.\n"), pdemoname);
|
||||
CONS_Alert(CONS_ERROR, "%s", msg);
|
||||
M_StartMessage(msg, NULL, MM_NOTHING);
|
||||
M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER);
|
||||
G_ResetDemoPlayback();
|
||||
return;
|
||||
}
|
||||
@@ -2922,7 +2953,7 @@ void G_DoPlayDemo(char *defdemoname)
|
||||
{
|
||||
snprintf(msg, 1024, M_GetText("%s is a Record Attack replay with multiple players, and is thus invalid.\n"), pdemoname);
|
||||
CONS_Alert(CONS_ERROR, "%s", msg);
|
||||
M_StartMessage(msg, NULL, MM_NOTHING);
|
||||
M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER);
|
||||
G_ResetDemoPlayback();
|
||||
return;
|
||||
}
|
||||
@@ -3532,7 +3563,6 @@ void G_FreeGhosts(void)
|
||||
ghosts = NULL;
|
||||
}
|
||||
|
||||
|
||||
boolean G_CheckDemoStatus(void)
|
||||
{
|
||||
G_FreeGhosts();
|
||||
|
||||
@@ -149,6 +149,7 @@ typedef struct demoghost {
|
||||
UINT8 checksum[16];
|
||||
UINT8 *buffer, *p, color;
|
||||
UINT16 version;
|
||||
boolean done;
|
||||
mobj_t oldmo, *mo;
|
||||
struct demoghost *next;
|
||||
} demoghost;
|
||||
|
||||
+16
-14
@@ -312,6 +312,8 @@ consvar_t cv_pauseifunfocused = {"pauseifunfocused", "Yes", CV_SAVE, CV_YesNo, N
|
||||
static CV_PossibleValue_t songcredits_cons_t[] = {{0, "Off"}, {1, "Default"}, {2, "Box"}, {0, NULL}};
|
||||
consvar_t cv_songcredits = {"songcredits", "Default", CV_SAVE, songcredits_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_pausesongcredits = {"pausesongcredits", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
// Show "FREE PLAY" when you're alone. :(
|
||||
consvar_t cv_showfreeplay = { "showfreeplay", "Yes", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
@@ -662,7 +664,7 @@ INT16 G_ClipAimingPitch(INT32 *aiming)
|
||||
else if (*aiming < -limitangle)
|
||||
*aiming = -limitangle;
|
||||
|
||||
return (INT16)((*aiming)>>16);
|
||||
return (INT16)((*aiming) >> TICCMD_REDUCE);
|
||||
}
|
||||
|
||||
INT16 G_SoftwareClipAimingPitch(INT32 *aiming)
|
||||
@@ -675,7 +677,7 @@ INT16 G_SoftwareClipAimingPitch(INT32 *aiming)
|
||||
else if (*aiming < -limitangle)
|
||||
*aiming = -limitangle;
|
||||
|
||||
return (INT16)((*aiming)>>16);
|
||||
return (INT16)((*aiming) >> TICCMD_REDUCE);
|
||||
}
|
||||
|
||||
INT32 JoyAxis(axis_input_e axissel, UINT8 player)
|
||||
@@ -959,7 +961,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
||||
// Kart, don't build a ticcmd if someone is resynching or the server is stopped too so we don't fly off course in bad conditions
|
||||
if (paused || P_AutoPause() || (gamestate == GS_LEVEL && player->playerstate == PST_REBORN) || hu_resynching)
|
||||
{
|
||||
cmd->angleturn = (INT16)(lang >> 16);
|
||||
cmd->angleturn = (INT16)(lang >> TICCMD_REDUCE);
|
||||
cmd->aiming = G_ClipAimingPitch(&laim);
|
||||
return;
|
||||
}
|
||||
@@ -967,7 +969,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
||||
// dumbass thing so we can use a few buttons but dont accidentally drive away
|
||||
if (player->spectator || freecam)
|
||||
{
|
||||
cmd->angleturn = (INT16)(lang >> 16);
|
||||
cmd->angleturn = (INT16)(lang >> TICCMD_REDUCE);
|
||||
G_BuildLocalTiccmd(cmd, ssplayer, freecam);
|
||||
|
||||
// let lua override everything
|
||||
@@ -1127,7 +1129,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
||||
|
||||
cmd->aiming = G_ClipAimingPitch(&laim);
|
||||
|
||||
mousex = mousey = mlooky = 0;
|
||||
mousex = mousey = 0;
|
||||
|
||||
if (forward > MAXPLMOVE)
|
||||
forward = MAXPLMOVE;
|
||||
@@ -1166,10 +1168,10 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
||||
|| (leveltime > starttime && (cmd->buttons & BT_ACCELERATE && cmd->buttons & BT_BRAKE)) // Rubber-burn turn
|
||||
|| (player->kartstuff[k_respawn]) // Respawning
|
||||
|| (player->spectator || objectplacing))) // Not a physical player
|
||||
lang += (cmd->angleturn<<16);
|
||||
lang += (cmd->angleturn << TICCMD_REDUCE);
|
||||
|
||||
cmd->angleturn = (INT16)(lang >> 16);
|
||||
cmd->latency = modeattacking ? 0 : (leveltime & 0xFF); // Send leveltime when this tic was generated to the server for control lag calculations
|
||||
cmd->angleturn = (INT16)(lang >> TICCMD_REDUCE);
|
||||
cmd->latency = modeattacking ? 0 : (leveltime & TICCMD_LATENCYMASK); // Send leveltime when this tic was generated to the server for control lag calculations
|
||||
|
||||
if (!hu_stopped)
|
||||
{
|
||||
@@ -1750,14 +1752,15 @@ void G_ResetView(UINT8 viewnum, INT32 playernum, boolean onlyactive)
|
||||
// Increment a viewpoint by offset from the current player. A negative value
|
||||
// decrements.
|
||||
//
|
||||
void G_AdjustView(UINT8 viewnum, INT32 offset, boolean onlyactive)
|
||||
void G_AdjustViewEx(UINT8 viewnum, INT32 offset, boolean onlyactive, boolean resetfreecam)
|
||||
{
|
||||
INT32 *displayplayerp, oldview;
|
||||
displayplayerp = &displayplayers[viewnum-1];
|
||||
oldview = (*displayplayerp);
|
||||
|
||||
// turn off the freecam
|
||||
camera[viewnum-1].freecam = false;
|
||||
if (resetfreecam)
|
||||
camera[viewnum-1].freecam = false;
|
||||
|
||||
G_ResetView(viewnum, ( (*displayplayerp) + offset ), onlyactive);
|
||||
|
||||
@@ -1771,7 +1774,7 @@ void G_AdjustView(UINT8 viewnum, INT32 offset, boolean onlyactive)
|
||||
// Ensures all viewpoints are valid
|
||||
// Also demotes splitscreen down to one player.
|
||||
//
|
||||
void G_ResetViews(void)
|
||||
void G_ResetViews(boolean resetfreecam)
|
||||
{
|
||||
UINT8 splits;
|
||||
UINT8 viewd;
|
||||
@@ -1795,7 +1798,7 @@ void G_ResetViews(void)
|
||||
*/
|
||||
for (viewd = 1; viewd <= splits; ++viewd)
|
||||
{
|
||||
G_AdjustView(viewd, 0, false);
|
||||
G_AdjustViewEx(viewd, 0, false, resetfreecam);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1876,7 +1879,7 @@ void G_Ticker(boolean run)
|
||||
G_CopyTiccmd(cmd, &netcmds[buf][i], 1);
|
||||
|
||||
// Use the leveltime sent in the player's ticcmd to determine control lag
|
||||
cmd->latency = modeattacking ? 0 : min(((leveltime & 0xFF) - cmd->latency) & 0xFF, MAXPREDICTTICS-1); //@TODO add a cvar to allow setting this max
|
||||
cmd->latency = modeattacking ? 0 : min(((leveltime & TICCMD_LATENCYMASK) - cmd->latency) & TICCMD_LATENCYMASK, MAXPREDICTTICS-1); //@TODO add a cvar to allow setting this max
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1884,7 +1887,6 @@ void G_Ticker(boolean run)
|
||||
switch (gamestate)
|
||||
{
|
||||
case GS_LEVEL:
|
||||
|
||||
for (; ra_timeskip < starttime - TICRATE*4; ra_timeskip++) // this looks weird but this is done to not break compability with older demos for now.
|
||||
{
|
||||
if (demo.title)
|
||||
|
||||
+4
-3
@@ -50,7 +50,7 @@ extern INT16 rw_maximums[NUM_WEAPONS];
|
||||
|
||||
// used in game menu
|
||||
extern consvar_t cv_chatwidth, cv_chatnotifications, cv_chatheight, cv_chattime, cv_consolechat, cv_chatbacktint, cv_chatspamprotection, cv_chatcentertext/*, cv_compactscoreboard*/;
|
||||
extern consvar_t cv_songcredits;
|
||||
extern consvar_t cv_songcredits, cv_pausesongcredits;
|
||||
extern consvar_t cv_showfreeplay;
|
||||
extern consvar_t cv_growmusic, cv_supermusic;
|
||||
extern consvar_t cv_pauseifunfocused;
|
||||
@@ -262,9 +262,10 @@ boolean G_CanView(INT32 playernum, UINT8 viewnum, boolean onlyactive);
|
||||
INT32 G_FindView(INT32 startview, UINT8 viewnum, boolean onlyactive, boolean reverse);
|
||||
INT32 G_CountPlayersPotentiallyViewable(boolean active);
|
||||
|
||||
void G_ResetViews(void);
|
||||
void G_ResetViews(boolean resetfreecam);
|
||||
void G_ResetView(UINT8 viewnum, INT32 playernum, boolean onlyactive);
|
||||
void G_AdjustView(UINT8 viewnum, INT32 offset, boolean onlyactive);
|
||||
void G_AdjustViewEx(UINT8 viewnum, INT32 offset, boolean onlyactive, boolean resetfreecam);
|
||||
#define G_AdjustView(v,o,oa) G_AdjustViewEx(v,o,oa, true)
|
||||
|
||||
void G_AddPlayer(INT32 playernum);
|
||||
|
||||
|
||||
+15
-11
@@ -34,7 +34,7 @@ static CV_PossibleValue_t onecontrolperkey_cons_t[] = {{1, "One"}, {2, "Several"
|
||||
static CV_PossibleValue_t turnsmooth_cons_t[] = {{2, "Slow"}, {1, "Fast"}, {0, "Off"}, {0, NULL}};
|
||||
|
||||
// mouse values are used once
|
||||
consvar_t cv_mousesens = {"mousesens", "20", CV_SAVE, mousesens_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_mousexsens = {"mousexsens", "20", CV_SAVE, mousesens_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_mouseysens = {"mouseysens", "20", CV_SAVE, mousesens_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_controlperkey = {"controlperkey", "One", CV_SAVE, onecontrolperkey_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
@@ -125,17 +125,17 @@ static void led_off_handle4(void)
|
||||
G_ResetPlayerGamepadIndicatorColor(3);
|
||||
}
|
||||
|
||||
INT32 mousex, mousey;
|
||||
INT32 mlooky; // like mousey but with a custom sensitivity for mlook
|
||||
INT32 mousex = 0, mousey = 0;
|
||||
|
||||
// joystick values are repeated
|
||||
INT32 joyxmove[MAXSPLITSCREENPLAYERS][JOYAXISSET], joyymove[MAXSPLITSCREENPLAYERS][JOYAXISSET];
|
||||
INT32 joyxmove[MAXSPLITSCREENPLAYERS][JOYAXISSET] = {};
|
||||
INT32 joyymove[MAXSPLITSCREENPLAYERS][JOYAXISSET] = {};
|
||||
|
||||
// current state of the keys: true if pushed
|
||||
UINT8 gamekeydown[NUMINPUTS];
|
||||
UINT8 gamekeydown[NUMINPUTS] = {};
|
||||
|
||||
// two key codes (or virtual key) per game control
|
||||
INT32 gamecontrol[MAXSPLITSCREENPLAYERS][num_gamecontrols][2];
|
||||
INT32 gamecontrol[MAXSPLITSCREENPLAYERS][num_gamecontrols][2] = {};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@@ -192,9 +192,8 @@ void G_MapEventsToControls(event_t *ev)
|
||||
case ev_mouse: // buttons are virtual keys
|
||||
if (menuactive || CON_Ready() || chat_on)
|
||||
break;
|
||||
mousex = (INT32)(ev->data2*((cv_mousesens.value*cv_mousesens.value)/110.0f + 0.1f));
|
||||
mousey = (INT32)(ev->data3*((cv_mousesens.value*cv_mousesens.value)/110.0f + 0.1f));
|
||||
mlooky = (INT32)(ev->data3*((cv_mouseysens.value*cv_mousesens.value)/110.0f + 0.1f));
|
||||
mousex = (INT32)(ev->data2*((cv_mousexsens.value*cv_mousexsens.value)/110.0f + 0.1f));
|
||||
mousey = (INT32)(ev->data3*((cv_mouseysens.value*cv_mouseysens.value)/110.0f + 0.1f));
|
||||
break;
|
||||
|
||||
case ev_joystick: // buttons are virtual keys
|
||||
@@ -215,7 +214,7 @@ void G_MapEventsToControls(event_t *ev)
|
||||
|
||||
case ev_joystick3:
|
||||
i = ev->data1;
|
||||
if (i >= JOYAXISSET)
|
||||
if (i >= JOYAXISSET || menuactive)
|
||||
break;
|
||||
if (ev->data2 != INT32_MAX) joyxmove[2][i] = ev->data2;
|
||||
if (ev->data3 != INT32_MAX) joyymove[2][i] = ev->data3;
|
||||
@@ -223,7 +222,7 @@ void G_MapEventsToControls(event_t *ev)
|
||||
|
||||
case ev_joystick4:
|
||||
i = ev->data1;
|
||||
if (i >= JOYAXISSET)
|
||||
if (i >= JOYAXISSET || menuactive)
|
||||
break;
|
||||
if (ev->data2 != INT32_MAX) joyxmove[3][i] = ev->data2;
|
||||
if (ev->data3 != INT32_MAX) joyymove[3][i] = ev->data3;
|
||||
@@ -974,8 +973,13 @@ void G_DeviceLEDTick(void)
|
||||
|
||||
newcolor = G_GetSkinColorForGamepad(i);
|
||||
|
||||
// compiler be absolutely tripping
|
||||
// delet this if this gets fixed within gcc
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Warray-bounds"
|
||||
if (curcolor[i] == newcolor) // dont update if same colour
|
||||
continue;
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
G_SetPlayerGamepadIndicatorColor(i, newcolor);
|
||||
curcolor[i] = newcolor;
|
||||
|
||||
+1
-2
@@ -109,7 +109,7 @@ typedef enum
|
||||
} gamecontrols_e;
|
||||
|
||||
// mouse values are used once
|
||||
extern consvar_t cv_mousesens, cv_mouseysens;
|
||||
extern consvar_t cv_mousexsens, cv_mouseysens;
|
||||
extern consvar_t cv_controlperkey;
|
||||
extern consvar_t cv_turnsmooth[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_rumble[MAXSPLITSCREENPLAYERS];
|
||||
@@ -117,7 +117,6 @@ extern consvar_t cv_rumblestrength[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_gamepadled[MAXSPLITSCREENPLAYERS];
|
||||
|
||||
extern INT32 mousex, mousey;
|
||||
extern INT32 mlooky; //mousey with mlookSensitivity
|
||||
|
||||
extern INT32 joyxmove[MAXSPLITSCREENPLAYERS][JOYAXISSET], joyymove[MAXSPLITSCREENPLAYERS][JOYAXISSET];
|
||||
|
||||
|
||||
@@ -214,7 +214,7 @@ static int comparePolygonsNoShaders(const void *p1, const void *p2)
|
||||
const PolygonArrayEntry *poly2 = *(PolygonArrayEntry *const *)p2;
|
||||
|
||||
const GLMipmap_t *texture1 = poly1->hash & 0x80000000 ? NULL : poly1->texture;
|
||||
const GLMipmap_t *texture2 = poly1->hash & 0x80000000 ? NULL : poly2->texture;
|
||||
const GLMipmap_t *texture2 = poly2->hash & 0x80000000 ? NULL : poly2->texture;
|
||||
|
||||
// skywalls and horizon lines must retain their order for horizon lines to work
|
||||
if (!texture1 && !texture2)
|
||||
@@ -237,7 +237,7 @@ static int comparePolygonsNoShaders(const void *p1, const void *p2)
|
||||
|
||||
// This function organizes the geometry collected by HWR_ProcessPolygon calls into batches and uses
|
||||
// the rendering backend to draw them.
|
||||
void HWR_RenderBatches(boolean sort)
|
||||
void HWR_RenderBatches(void)
|
||||
{
|
||||
int finalVertexWritePos = 0; // position in finalVertexArray
|
||||
int finalIndexWritePos = 0; // position in finalVertexIndexArray
|
||||
@@ -288,13 +288,10 @@ void HWR_RenderBatches(boolean sort)
|
||||
polygonArraySorted[i] = &polygonArray[i];
|
||||
}
|
||||
|
||||
if (sort)
|
||||
{
|
||||
// sort polygons
|
||||
PS_START_TIMING(ps_hw_batchsorttime);
|
||||
qs22j(polygonArraySorted, polygonArraySize, sizeof(PolygonArrayEntry *), (useshader ? comparePolygons : comparePolygonsNoShaders));
|
||||
PS_STOP_TIMING(ps_hw_batchsorttime);
|
||||
}
|
||||
// sort polygons
|
||||
PS_START_TIMING(ps_hw_batchsorttime);
|
||||
qs22j(polygonArraySorted, polygonArraySize, sizeof(PolygonArrayEntry *), (useshader ? comparePolygons : comparePolygonsNoShaders));
|
||||
PS_STOP_TIMING(ps_hw_batchsorttime);
|
||||
|
||||
// sort order
|
||||
// 1. shader
|
||||
@@ -303,9 +300,7 @@ void HWR_RenderBatches(boolean sort)
|
||||
// 4. colors + light level
|
||||
// not sure about what order of the last 2 should be, or if it even matters
|
||||
|
||||
// dont overwrite this on consecutive calls
|
||||
if (!sort)
|
||||
PS_START_TIMING(ps_hw_batchdrawtime);
|
||||
PS_START_TIMING(ps_hw_batchdrawtime);
|
||||
|
||||
currentShader = polygonArraySorted[0]->shader;
|
||||
currentTexture = polygonArraySorted[0]->texture;
|
||||
@@ -500,8 +495,7 @@ void HWR_RenderBatches(boolean sort)
|
||||
polygonArraySize = 0;
|
||||
unsortedVertexArraySize = 0;
|
||||
|
||||
if (!sort)
|
||||
PS_STOP_TIMING(ps_hw_batchdrawtime);
|
||||
PS_STOP_TIMING(ps_hw_batchdrawtime);
|
||||
}
|
||||
|
||||
#endif // HWRENDER
|
||||
@@ -37,7 +37,7 @@ typedef struct
|
||||
void HWR_StartBatching(void);
|
||||
void HWR_SetCurrentTexture(GLMipmap_t *texture);
|
||||
void HWR_ProcessPolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags, int shader, boolean horizonSpecial);
|
||||
void HWR_RenderBatches(boolean sort);
|
||||
void HWR_RenderBatches(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
|
||||
+149
-164
@@ -14,7 +14,6 @@
|
||||
#ifdef HWRENDER
|
||||
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
|
||||
#include "../doomstat.h"
|
||||
#include "../doomdef.h"
|
||||
@@ -643,8 +642,8 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
|
||||
pv = planepoly->pts;
|
||||
|
||||
// reference point for flat texture coord for each vertex around the polygon
|
||||
flatxref = (float)(((fixed_t)pv->x & (~flatflag)) / fflatsize);
|
||||
flatyref = (float)(((fixed_t)pv->y & (~flatflag)) / fflatsize);
|
||||
flatxref = static_cast<float>(static_cast<fixed_t>(pv->x) & (~flatflag)) / fflatsize;
|
||||
flatyref = static_cast<float>(static_cast<fixed_t>(pv->y) & (~flatflag)) / fflatsize;
|
||||
|
||||
if (!isceiling) // it's a floor
|
||||
{
|
||||
@@ -661,9 +660,13 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
|
||||
|
||||
if (angle) // Only needs to be done if there's an altered angle
|
||||
{
|
||||
// This needs to be done so that it scrolls in a different direction after rotation like software
|
||||
tempxsow = flatxref;
|
||||
tempytow = flatyref;
|
||||
anglef = ANG2RAD(InvAngle(angle));
|
||||
|
||||
// This needs to be done so everything aligns after rotation
|
||||
// It would be done so that rotation is done, THEN the translation, but I couldn't get it to rotate AND scroll like software does
|
||||
cosangf = cosf(anglef);
|
||||
sinangf = sinf(anglef);
|
||||
flatxref = (tempxsow * cosangf) - (tempytow * sinangf);
|
||||
@@ -807,6 +810,7 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
|
||||
}
|
||||
}
|
||||
}
|
||||
#undef SETUP3DVERT
|
||||
}
|
||||
|
||||
#ifdef WALLSPLATS
|
||||
@@ -1366,8 +1370,8 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
|
||||
// x offset the texture
|
||||
const fixed_t texturehpeg = gl_sidedef->textureoffset + gl_curline->offset;
|
||||
const float cliplow = (float)texturehpeg;
|
||||
const float cliphigh = ((float)texturehpeg + (float)gl_curline->length);
|
||||
const float cliplow = static_cast<float>(texturehpeg);
|
||||
const float cliphigh = static_cast<float>(texturehpeg) + static_cast<float>(gl_curline->length);
|
||||
|
||||
FUINT lightnum = gl_frontsector->lightlevel;
|
||||
extracolormap_t *colormap = gl_frontsector->extra_colormap;
|
||||
@@ -1381,8 +1385,8 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
const INT32 gl_midtexture = R_GetTextureNum(gl_sidedef->midtexture);
|
||||
GLMapTexture_t *glTex = NULL;
|
||||
|
||||
static constexpr float FLOATMAX = (float)INT32_MAX / (float)FRACUNIT;
|
||||
static constexpr float FLOATMIN = (float)INT32_MIN / (float)FRACUNIT;
|
||||
static constexpr float FLOATMAX = static_cast<float>(INT32_MAX) / static_cast<float>(FRACUNIT);
|
||||
static constexpr float FLOATMIN = static_cast<float>(INT32_MIN) / static_cast<float>(FRACUNIT);
|
||||
|
||||
// two sided line
|
||||
if (gl_backsector)
|
||||
@@ -1495,8 +1499,8 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
|
||||
glTex = HWR_GetTexture(gl_toptexture, noencore);
|
||||
|
||||
wallVerts[3].t = wallVerts[2].t = texturevpeg * glTex->scaleY;
|
||||
wallVerts[0].t = wallVerts[1].t = (texturevpeg + gl_frontsector->ceilingheight - gl_backsector->ceilingheight) * glTex->scaleY;
|
||||
wallVerts[3].t = wallVerts[2].t = static_cast<float>(texturevpeg) * glTex->scaleY;
|
||||
wallVerts[0].t = wallVerts[1].t = static_cast<float>(texturevpeg + gl_frontsector->ceilingheight - gl_backsector->ceilingheight) * glTex->scaleY;
|
||||
wallVerts[0].s = wallVerts[3].s = cliplow * glTex->scaleX;
|
||||
wallVerts[2].s = wallVerts[1].s = cliphigh * glTex->scaleX;
|
||||
|
||||
@@ -1504,23 +1508,23 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
if (!(gl_linedef->flags & ML_EFFECT1))
|
||||
{
|
||||
// Unskewed
|
||||
wallVerts[3].t -= (worldtop - gl_frontsector->ceilingheight) * glTex->scaleY;
|
||||
wallVerts[2].t -= (worldtopslope - gl_frontsector->ceilingheight) * glTex->scaleY;
|
||||
wallVerts[0].t -= (worldhigh - gl_backsector->ceilingheight) * glTex->scaleY;
|
||||
wallVerts[1].t -= (worldhighslope - gl_backsector->ceilingheight) * glTex->scaleY;
|
||||
wallVerts[3].t -= static_cast<float>(worldtop - gl_frontsector->ceilingheight) * glTex->scaleY;
|
||||
wallVerts[2].t -= static_cast<float>(worldtopslope - gl_frontsector->ceilingheight) * glTex->scaleY;
|
||||
wallVerts[0].t -= static_cast<float>(worldhigh - gl_backsector->ceilingheight) * glTex->scaleY;
|
||||
wallVerts[1].t -= static_cast<float>(worldhighslope - gl_backsector->ceilingheight) * glTex->scaleY;
|
||||
}
|
||||
else if (gl_linedef->flags & ML_DONTPEGTOP)
|
||||
{
|
||||
// Skewed by top
|
||||
wallVerts[0].t = (texturevpeg + (worldtop - worldhigh)) * glTex->scaleY;
|
||||
wallVerts[1].t = (texturevpeg + (worldtopslope - worldhighslope)) * glTex->scaleY;
|
||||
wallVerts[0].t = static_cast<float>(texturevpeg + (worldtop - worldhigh)) * glTex->scaleY;
|
||||
wallVerts[1].t = static_cast<float>(texturevpeg + (worldtopslope - worldhighslope)) * glTex->scaleY;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Skewed by bottom
|
||||
wallVerts[0].t = wallVerts[1].t = (texturevpeg + (worldtop - worldhigh)) * glTex->scaleY;
|
||||
wallVerts[3].t = wallVerts[0].t - (worldtop - worldhigh) * glTex->scaleY;
|
||||
wallVerts[2].t = wallVerts[1].t - (worldtopslope - worldhighslope) * glTex->scaleY;
|
||||
wallVerts[0].t = wallVerts[1].t = static_cast<float>(texturevpeg + (worldtop - worldhigh)) * glTex->scaleY;
|
||||
wallVerts[3].t = wallVerts[0].t - static_cast<float>(worldtop - worldhigh) * glTex->scaleY;
|
||||
wallVerts[2].t = wallVerts[1].t - static_cast<float>(worldtopslope - worldhighslope) * glTex->scaleY;
|
||||
}
|
||||
|
||||
// set top/bottom coords
|
||||
@@ -1557,8 +1561,8 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
|
||||
glTex = HWR_GetTexture(gl_bottomtexture, noencore);
|
||||
|
||||
wallVerts[3].t = wallVerts[2].t = texturevpeg * glTex->scaleY;
|
||||
wallVerts[0].t = wallVerts[1].t = (texturevpeg + (gl_backsector->floorheight - gl_frontsector->floorheight)) * glTex->scaleY;
|
||||
wallVerts[3].t = wallVerts[2].t = static_cast<float>(texturevpeg * glTex->scaleY);
|
||||
wallVerts[0].t = wallVerts[1].t = static_cast<float>(texturevpeg + (gl_backsector->floorheight - gl_frontsector->floorheight)) * glTex->scaleY;
|
||||
wallVerts[0].s = wallVerts[3].s = cliplow * glTex->scaleX;
|
||||
wallVerts[2].s = wallVerts[1].s = cliphigh * glTex->scaleX;
|
||||
|
||||
@@ -1566,22 +1570,22 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
if (!(gl_linedef->flags & ML_EFFECT1))
|
||||
{
|
||||
// Unskewed
|
||||
wallVerts[0].t -= (worldbottom - gl_frontsector->floorheight) * glTex->scaleY;
|
||||
wallVerts[1].t -= (worldbottomslope - gl_frontsector->floorheight) * glTex->scaleY;
|
||||
wallVerts[3].t -= (worldlow - gl_backsector->floorheight) * glTex->scaleY;
|
||||
wallVerts[2].t -= (worldlowslope - gl_backsector->floorheight) * glTex->scaleY;
|
||||
wallVerts[0].t -= static_cast<float>(worldbottom - gl_frontsector->floorheight) * glTex->scaleY;
|
||||
wallVerts[1].t -= static_cast<float>(worldbottomslope - gl_frontsector->floorheight) * glTex->scaleY;
|
||||
wallVerts[3].t -= static_cast<float>(worldlow - gl_backsector->floorheight) * glTex->scaleY;
|
||||
wallVerts[2].t -= static_cast<float>(worldlowslope - gl_backsector->floorheight) * glTex->scaleY;
|
||||
}
|
||||
else if (gl_linedef->flags & ML_DONTPEGBOTTOM)
|
||||
{
|
||||
// Skewed by bottom
|
||||
wallVerts[0].t = wallVerts[1].t = (texturevpeg + (worldlow - worldbottom)) * glTex->scaleY;
|
||||
wallVerts[2].t = wallVerts[1].t - (worldlowslope - worldbottomslope) * glTex->scaleY;
|
||||
wallVerts[0].t = wallVerts[1].t = static_cast<float>(texturevpeg + (worldlow - worldbottom)) * glTex->scaleY;
|
||||
wallVerts[2].t = wallVerts[1].t - static_cast<float>(worldlowslope - worldbottomslope) * glTex->scaleY;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Skewed by top
|
||||
wallVerts[0].t = (texturevpeg + (worldlow - worldbottom)) * glTex->scaleY;
|
||||
wallVerts[1].t = (texturevpeg + (worldlowslope - worldbottomslope)) * glTex->scaleY;
|
||||
wallVerts[0].t = static_cast<float>(texturevpeg + (worldlow - worldbottom)) * glTex->scaleY;
|
||||
wallVerts[1].t = static_cast<float>(texturevpeg + (worldlowslope - worldbottomslope)) * glTex->scaleY;
|
||||
}
|
||||
|
||||
// set top/bottom coords
|
||||
@@ -1743,13 +1747,13 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
glTex = HWR_GetTexture(gl_midtexture, noencore);
|
||||
|
||||
// Left side
|
||||
wallVerts[3].t = texturevpeg * glTex->scaleY;
|
||||
wallVerts[0].t = (h - l + texturevpeg) * glTex->scaleY;
|
||||
wallVerts[3].t = static_cast<float>(texturevpeg * glTex->scaleY);
|
||||
wallVerts[0].t = static_cast<float>(h - l + texturevpeg) * glTex->scaleY;
|
||||
wallVerts[0].s = wallVerts[3].s = cliplow * glTex->scaleX;
|
||||
|
||||
// Right side
|
||||
wallVerts[2].t = texturevpegslope * glTex->scaleY;
|
||||
wallVerts[1].t = (hS - lS + texturevpegslope) * glTex->scaleY;
|
||||
wallVerts[1].t = static_cast<float>(hS - lS + texturevpegslope) * glTex->scaleY;
|
||||
wallVerts[2].s = wallVerts[1].s = cliphigh * glTex->scaleX;
|
||||
|
||||
// set top/bottom coords
|
||||
@@ -1792,28 +1796,28 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
else
|
||||
texturevpeg = gl_sidedef->rowoffset; // top of texture at top
|
||||
|
||||
wallVerts[3].t = wallVerts[2].t = texturevpeg * glTex->scaleY;
|
||||
wallVerts[0].t = wallVerts[1].t = (texturevpeg + gl_frontsector->ceilingheight - gl_frontsector->floorheight) * glTex->scaleY;
|
||||
wallVerts[3].t = wallVerts[2].t = (static_cast<float>(texturevpeg) * glTex->scaleY);
|
||||
wallVerts[0].t = wallVerts[1].t = static_cast<float>(texturevpeg + gl_frontsector->ceilingheight - gl_frontsector->floorheight) * glTex->scaleY;
|
||||
wallVerts[0].s = wallVerts[3].s = cliplow * glTex->scaleX;
|
||||
wallVerts[2].s = wallVerts[1].s = cliphigh * glTex->scaleX;
|
||||
|
||||
// Texture correction for slopes
|
||||
if (gl_linedef->flags & ML_EFFECT2)
|
||||
{
|
||||
wallVerts[3].t += (gl_frontsector->ceilingheight - worldtop) * glTex->scaleY;
|
||||
wallVerts[2].t += (gl_frontsector->ceilingheight - worldtopslope) * glTex->scaleY;
|
||||
wallVerts[0].t += (gl_frontsector->floorheight - worldbottom) * glTex->scaleY;
|
||||
wallVerts[1].t += (gl_frontsector->floorheight - worldbottomslope) * glTex->scaleY;
|
||||
wallVerts[3].t += static_cast<float>(gl_frontsector->ceilingheight - worldtop) * glTex->scaleY;
|
||||
wallVerts[2].t += static_cast<float>(gl_frontsector->ceilingheight - worldtopslope) * glTex->scaleY;
|
||||
wallVerts[0].t += static_cast<float>(gl_frontsector->floorheight - worldbottom) * glTex->scaleY;
|
||||
wallVerts[1].t += static_cast<float>(gl_frontsector->floorheight - worldbottomslope) * glTex->scaleY;
|
||||
}
|
||||
else if (gl_linedef->flags & ML_DONTPEGBOTTOM)
|
||||
{
|
||||
wallVerts[3].t = wallVerts[0].t + (worldbottom - worldtop) * glTex->scaleY;
|
||||
wallVerts[2].t = wallVerts[1].t + ((worldbottomslope - worldtopslope)) * glTex->scaleY;
|
||||
wallVerts[3].t = wallVerts[0].t + static_cast<float>(worldbottom - worldtop) * glTex->scaleY;
|
||||
wallVerts[2].t = wallVerts[1].t + static_cast<float>((worldbottomslope - worldtopslope)) * glTex->scaleY;
|
||||
}
|
||||
else
|
||||
{
|
||||
wallVerts[0].t = wallVerts[3].t - (worldbottom - worldtop) * glTex->scaleY;
|
||||
wallVerts[1].t = wallVerts[2].t - (worldbottomslope - worldtopslope) * glTex->scaleY;
|
||||
wallVerts[0].t = wallVerts[3].t - static_cast<float>(worldbottom - worldtop) * glTex->scaleY;
|
||||
wallVerts[1].t = wallVerts[2].t - static_cast<float>(worldbottomslope - worldtopslope) * glTex->scaleY;
|
||||
}
|
||||
|
||||
//Set textures properly on single sided walls that are sloped
|
||||
@@ -1978,24 +1982,24 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
if (dont_peg_bottom)
|
||||
texturevpeg -= (*rover->topheight - *rover->bottomheight);
|
||||
|
||||
wallVerts[3].t = ((*rover->topheight - h) + texturevpeg) * glTex->scaleY;
|
||||
wallVerts[2].t = ((*rover->topheight - hS) + texturevpeg) * glTex->scaleY;
|
||||
wallVerts[0].t = ((*rover->topheight - l) + texturevpeg) * glTex->scaleY;
|
||||
wallVerts[1].t = ((*rover->topheight - lS) + texturevpeg) * glTex->scaleY;
|
||||
wallVerts[3].t = static_cast<float>((*rover->topheight - h) + texturevpeg) * glTex->scaleY;
|
||||
wallVerts[2].t = static_cast<float>((*rover->topheight - hS) + texturevpeg) * glTex->scaleY;
|
||||
wallVerts[0].t = static_cast<float>((*rover->topheight - l) + texturevpeg) * glTex->scaleY;
|
||||
wallVerts[1].t = static_cast<float>((*rover->topheight - lS) + texturevpeg) * glTex->scaleY;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!dont_peg_bottom) // skew by top
|
||||
{
|
||||
wallVerts[3].t = wallVerts[2].t = texturevpeg * glTex->scaleY;
|
||||
wallVerts[0].t = ((h - l) + texturevpeg) * glTex->scaleY;
|
||||
wallVerts[1].t = ((hS - lS) + texturevpeg) * glTex->scaleY;
|
||||
wallVerts[3].t = wallVerts[2].t = (static_cast<float>(texturevpeg) * glTex->scaleY);
|
||||
wallVerts[0].t = static_cast<float>((h - l) + texturevpeg) * glTex->scaleY;
|
||||
wallVerts[1].t = static_cast<float>((hS - lS) + texturevpeg) * glTex->scaleY;
|
||||
}
|
||||
else // skew by bottom
|
||||
{
|
||||
wallVerts[0].t = wallVerts[1].t = texturevpeg * glTex->scaleY;
|
||||
wallVerts[3].t = wallVerts[0].t - (h - l) * glTex->scaleY;
|
||||
wallVerts[2].t = wallVerts[1].t - (hS - lS) * glTex->scaleY;
|
||||
wallVerts[0].t = wallVerts[1].t = (static_cast<float>(texturevpeg) * glTex->scaleY);
|
||||
wallVerts[3].t = wallVerts[0].t - static_cast<float>(h - l) * glTex->scaleY;
|
||||
wallVerts[2].t = wallVerts[1].t - static_cast<float>(hS - lS) * glTex->scaleY;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2138,24 +2142,24 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
if (dont_peg_bottom)
|
||||
texturevpeg -= (*rover->topheight - *rover->bottomheight);
|
||||
|
||||
wallVerts[3].t = ((*rover->topheight - h) + texturevpeg) * glTex->scaleY;
|
||||
wallVerts[2].t = ((*rover->topheight - hS) + texturevpeg) * glTex->scaleY;
|
||||
wallVerts[0].t = ((*rover->topheight - l) + texturevpeg) * glTex->scaleY;
|
||||
wallVerts[1].t = ((*rover->topheight - lS) + texturevpeg) * glTex->scaleY;
|
||||
wallVerts[3].t = static_cast<float>((*rover->topheight - h) + texturevpeg) * glTex->scaleY;
|
||||
wallVerts[2].t = static_cast<float>((*rover->topheight - hS) + texturevpeg) * glTex->scaleY;
|
||||
wallVerts[0].t = static_cast<float>((*rover->topheight - l) + texturevpeg) * glTex->scaleY;
|
||||
wallVerts[1].t = static_cast<float>((*rover->topheight - lS) + texturevpeg) * glTex->scaleY;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!dont_peg_bottom) // skew by top
|
||||
{
|
||||
wallVerts[3].t = wallVerts[2].t = texturevpeg * glTex->scaleY;
|
||||
wallVerts[0].t = ((h - l) + texturevpeg) * glTex->scaleY;
|
||||
wallVerts[1].t = ((hS - lS) + texturevpeg) * glTex->scaleY;
|
||||
wallVerts[3].t = wallVerts[2].t = (static_cast<float>(texturevpeg) * glTex->scaleY);
|
||||
wallVerts[0].t = static_cast<float>((h - l) + texturevpeg) * glTex->scaleY;
|
||||
wallVerts[1].t = static_cast<float>((hS - lS) + texturevpeg) * glTex->scaleY;
|
||||
}
|
||||
else // skew by bottom
|
||||
{
|
||||
wallVerts[0].t = wallVerts[1].t = texturevpeg * glTex->scaleY;
|
||||
wallVerts[3].t = wallVerts[0].t - (h - l) * glTex->scaleY;
|
||||
wallVerts[2].t = wallVerts[1].t - (hS - lS) * glTex->scaleY;
|
||||
wallVerts[0].t = wallVerts[1].t = (static_cast<float>(texturevpeg) * glTex->scaleY);
|
||||
wallVerts[3].t = wallVerts[0].t - static_cast<float>(h - l) * glTex->scaleY;
|
||||
wallVerts[2].t = wallVerts[1].t - static_cast<float>(hS - lS) * glTex->scaleY;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2496,8 +2500,10 @@ static boolean HWR_CheckBBox(const fixed_t *bspcoord)
|
||||
|
||||
// Find the corners of the box
|
||||
// that define the edges from current viewpoint.
|
||||
const INT32 boxpos = (viewx <= bspcoord[BOXLEFT] ? 0 : viewx < bspcoord[BOXRIGHT] ? 1 : 2) +
|
||||
(viewy >= bspcoord[BOXTOP] ? 0 : viewy > bspcoord[BOXBOTTOM] ? 4 : 8);
|
||||
const INT32 boxpos = (viewx <= bspcoord[BOXLEFT] ? 0 :
|
||||
viewx < bspcoord[BOXRIGHT] ? 1 : 2) +
|
||||
(viewy >= bspcoord[BOXTOP] ? 0 :
|
||||
viewy > bspcoord[BOXBOTTOM] ? 4 : 8);
|
||||
|
||||
if (boxpos == 5)
|
||||
return true;
|
||||
@@ -2617,6 +2623,7 @@ static void HWR_RenderPolyObjectPlane(polyobj_t *polysector, boolean isceiling,
|
||||
INT32 flatflag;
|
||||
size_t len;
|
||||
float scrollx = 0.0f, scrolly = 0.0f;
|
||||
float anglef = 0.0f, cosangf = 0.0f, sinangf = 0.0f;
|
||||
angle_t angle = 0;
|
||||
FSurfaceInfo Surf;
|
||||
fixed_t tempxsow, tempytow;
|
||||
@@ -2638,12 +2645,14 @@ static void HWR_RenderPolyObjectPlane(polyobj_t *polysector, boolean isceiling,
|
||||
return;
|
||||
}
|
||||
|
||||
const sector_t *sec = FOFsector ? FOFsector : gl_frontsector;
|
||||
|
||||
// Allocate plane-vertex buffer if we need to
|
||||
if (!planeVerts || nrPlaneVerts > numAllocedPlaneVerts)
|
||||
{
|
||||
numAllocedPlaneVerts = (UINT16)nrPlaneVerts;
|
||||
Z_Free(planeVerts);
|
||||
Z_Malloc(numAllocedPlaneVerts * sizeof (FOutVector), PU_LEVEL, &planeVerts);
|
||||
Z_Malloc(numAllocedPlaneVerts * sizeof(FOutVector), PU_LEVEL, &planeVerts);
|
||||
}
|
||||
|
||||
height = FixedToFloat(fixedheight);
|
||||
@@ -2686,72 +2695,51 @@ static void HWR_RenderPolyObjectPlane(polyobj_t *polysector, boolean isceiling,
|
||||
flatxref = FixedToFloat(polysector->origVerts[0].x);
|
||||
flatyref = FixedToFloat(polysector->origVerts[0].y);
|
||||
|
||||
flatxref = (float)(((fixed_t)flatxref & (~flatflag)) / fflatsize);
|
||||
flatyref = (float)(((fixed_t)flatyref & (~flatflag)) / fflatsize);
|
||||
flatxref = static_cast<float>(static_cast<fixed_t>(flatxref) & (~flatflag)) / fflatsize;
|
||||
flatyref = static_cast<float>(static_cast<fixed_t>(flatyref) & (~flatflag)) / fflatsize;
|
||||
|
||||
// transform
|
||||
v3d = planeVerts;
|
||||
|
||||
if (FOFsector != NULL)
|
||||
if (!isceiling) // it's a floor
|
||||
{
|
||||
if (!isceiling) // it's a floor
|
||||
{
|
||||
scrollx = FixedToFloat(FOFsector->floor_xoffs)/fflatsize;
|
||||
scrolly = FixedToFloat(FOFsector->floor_yoffs)/fflatsize;
|
||||
angle = FOFsector->floorpic_angle>>ANGLETOFINESHIFT;
|
||||
}
|
||||
else // it's a ceiling
|
||||
{
|
||||
scrollx = FixedToFloat(FOFsector->ceiling_xoffs)/fflatsize;
|
||||
scrolly = FixedToFloat(FOFsector->ceiling_yoffs)/fflatsize;
|
||||
angle = FOFsector->ceilingpic_angle>>ANGLETOFINESHIFT;
|
||||
}
|
||||
scrollx = FixedToFloat(sec->floor_xoffs)/fflatsize;
|
||||
scrolly = FixedToFloat(sec->floor_yoffs)/fflatsize;
|
||||
angle = sec->floorpic_angle;
|
||||
}
|
||||
else if (gl_frontsector)
|
||||
else // it's a ceiling
|
||||
{
|
||||
if (!isceiling) // it's a floor
|
||||
{
|
||||
scrollx = FixedToFloat(gl_frontsector->floor_xoffs)/fflatsize;
|
||||
scrolly = FixedToFloat(gl_frontsector->floor_yoffs)/fflatsize;
|
||||
angle = gl_frontsector->floorpic_angle>>ANGLETOFINESHIFT;
|
||||
}
|
||||
else // it's a ceiling
|
||||
{
|
||||
scrollx = FixedToFloat(gl_frontsector->ceiling_xoffs)/fflatsize;
|
||||
scrolly = FixedToFloat(gl_frontsector->ceiling_yoffs)/fflatsize;
|
||||
angle = gl_frontsector->ceilingpic_angle>>ANGLETOFINESHIFT;
|
||||
}
|
||||
scrollx = FixedToFloat(sec->ceiling_xoffs)/fflatsize;
|
||||
scrolly = FixedToFloat(sec->ceiling_yoffs)/fflatsize;
|
||||
angle = sec->ceilingpic_angle;
|
||||
}
|
||||
|
||||
if (angle) // Only needs to be done if there's an altered angle
|
||||
{
|
||||
// This needs to be done so that it scrolls in a different direction after rotation like software
|
||||
tempxsow = FloatToFixed(scrollx);
|
||||
tempytow = FloatToFixed(scrolly);
|
||||
scrollx = (FixedToFloat(FixedMul(tempxsow, FINECOSINE(angle)) - FixedMul(tempytow, FINESINE(angle))));
|
||||
scrolly = (FixedToFloat(FixedMul(tempxsow, FINESINE(angle)) + FixedMul(tempytow, FINECOSINE(angle))));
|
||||
tempxsow = flatxref;
|
||||
tempytow = flatyref;
|
||||
anglef = ANG2RAD(InvAngle(angle));
|
||||
|
||||
// This needs to be done so everything aligns after rotation
|
||||
// It would be done so that rotation is done, THEN the translation, but I couldn't get it to rotate AND scroll like software does
|
||||
tempxsow = FloatToFixed(flatxref);
|
||||
tempytow = FloatToFixed(flatyref);
|
||||
flatxref = (FixedToFloat(FixedMul(tempxsow, FINECOSINE(angle)) - FixedMul(tempytow, FINESINE(angle))));
|
||||
flatyref = (FixedToFloat(FixedMul(tempxsow, FINESINE(angle)) + FixedMul(tempytow, FINECOSINE(angle))));
|
||||
cosangf = cosf(anglef);
|
||||
sinangf = sinf(anglef);
|
||||
flatxref = (tempxsow * cosangf) - (tempytow * sinangf);
|
||||
flatyref = (tempxsow * sinangf) + (tempytow * cosangf);
|
||||
}
|
||||
|
||||
for (i = 0; i < (INT32)nrPlaneVerts; i++,v3d++)
|
||||
for (i = 0, v3d = planeVerts; i < (INT32)nrPlaneVerts; i++, v3d++)
|
||||
{
|
||||
// Hurdler: add scrolling texture on floor/ceiling
|
||||
v3d->s = (float)((FixedToFloat(polysector->origVerts[i].x) / fflatsize) - flatxref + scrollx); // Go from the polysector's original vertex locations
|
||||
v3d->t = (float)(flatyref - (FixedToFloat(polysector->origVerts[i].y) / fflatsize) + scrolly); // Means the flat is offset based on the original vertex locations
|
||||
// Go from the polysector's original vertex locations
|
||||
// Means the flat is offset based on the original vertex locations
|
||||
v3d->s = ((FixedToFloat(polysector->origVerts[i].x) / fflatsize) - flatxref + scrollx);
|
||||
v3d->t = (flatyref - (FixedToFloat(polysector->origVerts[i].y) / fflatsize) + scrolly);
|
||||
|
||||
// Need to rotate before translate
|
||||
if (angle) // Only needs to be done if there's an altered angle
|
||||
{
|
||||
tempxsow = FloatToFixed(v3d->s);
|
||||
tempytow = FloatToFixed(v3d->t);
|
||||
v3d->s = (FixedToFloat(FixedMul(tempxsow, FINECOSINE(angle)) - FixedMul(tempytow, FINESINE(angle))));
|
||||
v3d->t = (FixedToFloat(-FixedMul(tempxsow, FINESINE(angle)) - FixedMul(tempytow, FINECOSINE(angle))));
|
||||
tempxsow = v3d->s;
|
||||
tempytow = v3d->t;
|
||||
v3d->s = (tempxsow * cosangf) - (tempytow * sinangf);
|
||||
v3d->t = (tempxsow * sinangf) + (tempytow * cosangf);
|
||||
}
|
||||
|
||||
v3d->x = FixedToFloat(polysector->vertices[i]->x);
|
||||
@@ -3458,13 +3446,13 @@ static void HWR_DrawSpriteShadow(gl_vissprite_t *spr, patch_t *gpatch, GLPatch_t
|
||||
if (spr->mobj && fabsf(this_scale - 1.0f) > 1.0E-36f)
|
||||
{
|
||||
// Always a pixel above the floor, perfectly flat.
|
||||
swallVerts[0].y = swallVerts[1].y = swallVerts[2].y = swallVerts[3].y = spr->gzt - gpatch->topoffset * this_scale - (floorheight+3);
|
||||
swallVerts[0].y = swallVerts[1].y = swallVerts[2].y = swallVerts[3].y = spr->gzt - static_cast<float>(gpatch->topoffset) * this_scale - static_cast<float>(floorheight+3);
|
||||
|
||||
// Now transform the TOP vertices along the floor in the direction of the camera
|
||||
swallVerts[3].x = spr->x1 + ((gpatch->height * this_scale) + offset) * gl_viewcos;
|
||||
swallVerts[2].x = spr->x2 + ((gpatch->height * this_scale) + offset) * gl_viewcos;
|
||||
swallVerts[3].z = spr->z1 + ((gpatch->height * this_scale) + offset) * gl_viewsin;
|
||||
swallVerts[2].z = spr->z2 + ((gpatch->height * this_scale) + offset) * gl_viewsin;
|
||||
swallVerts[3].x = spr->x1 + ((static_cast<float>(gpatch->height) * this_scale) + offset) * gl_viewcos;
|
||||
swallVerts[2].x = spr->x2 + ((static_cast<float>(gpatch->height) * this_scale) + offset) * gl_viewcos;
|
||||
swallVerts[3].z = spr->z1 + ((static_cast<float>(gpatch->height) * this_scale) + offset) * gl_viewsin;
|
||||
swallVerts[2].z = spr->z2 + ((static_cast<float>(gpatch->height) * this_scale) + offset) * gl_viewsin;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -3472,10 +3460,10 @@ static void HWR_DrawSpriteShadow(gl_vissprite_t *spr, patch_t *gpatch, GLPatch_t
|
||||
swallVerts[0].y = swallVerts[1].y = swallVerts[2].y = swallVerts[3].y = spr->gzt - gpatch->topoffset - (floorheight+3);
|
||||
|
||||
// Now transform the TOP vertices along the floor in the direction of the camera
|
||||
swallVerts[3].x = spr->x1 + (gpatch->height + offset) * gl_viewcos;
|
||||
swallVerts[2].x = spr->x2 + (gpatch->height + offset) * gl_viewcos;
|
||||
swallVerts[3].z = spr->z1 + (gpatch->height + offset) * gl_viewsin;
|
||||
swallVerts[2].z = spr->z2 + (gpatch->height + offset) * gl_viewsin;
|
||||
swallVerts[3].x = spr->x1 + (static_cast<float>(gpatch->height) + offset) * gl_viewcos;
|
||||
swallVerts[2].x = spr->x2 + (static_cast<float>(gpatch->height) + offset) * gl_viewcos;
|
||||
swallVerts[3].z = spr->z1 + (static_cast<float>(gpatch->height) + offset) * gl_viewsin;
|
||||
swallVerts[2].z = spr->z2 + (static_cast<float>(gpatch->height) + offset) * gl_viewsin;
|
||||
}
|
||||
|
||||
// We also need to move the bottom ones away when shadowoffs is on
|
||||
@@ -4186,7 +4174,6 @@ static int CompareVisSprites(const void *p1, const void *p2)
|
||||
static void HWR_SortVisSprites(void)
|
||||
{
|
||||
UINT32 i;
|
||||
|
||||
for (i = 0; i < gl_visspritecount; i++)
|
||||
{
|
||||
gl_vsprorder[i] = HWR_GetVisSprite(i);
|
||||
@@ -4255,29 +4242,38 @@ typedef struct
|
||||
|
||||
// initial size of drawnode array
|
||||
#define DRAWNODES_INIT_SIZE 64
|
||||
// no reason to waste all the allocations since every map will have atleast one translucent thing
|
||||
static std::vector<gl_drawnode_t> drawnodes;
|
||||
gl_drawnode_t *drawnodes = NULL;
|
||||
INT32 numdrawnodes = 0;
|
||||
INT32 alloceddrawnodes = 0;
|
||||
|
||||
static void *HWR_CreateDrawNode(gl_drawnode_type_t type)
|
||||
{
|
||||
// if we didnt alloc anything yet, reserve atleast 64 nodes
|
||||
// dont declare with it as we want our size to be 0!
|
||||
drawnodes.reserve(DRAWNODES_INIT_SIZE);
|
||||
gl_drawnode_t *drawnode;
|
||||
|
||||
drawnodes.emplace_back();
|
||||
drawnodes.back().type = type;
|
||||
if (!drawnodes)
|
||||
{
|
||||
alloceddrawnodes = DRAWNODES_INIT_SIZE;
|
||||
drawnodes = static_cast<gl_drawnode_t*>(Z_Malloc(alloceddrawnodes * sizeof(gl_drawnode_t), PU_LEVEL, &drawnodes));
|
||||
}
|
||||
else if (numdrawnodes >= alloceddrawnodes)
|
||||
{
|
||||
alloceddrawnodes *= 2;
|
||||
Z_Realloc(drawnodes, alloceddrawnodes * sizeof(gl_drawnode_t), PU_LEVEL, &drawnodes);
|
||||
}
|
||||
|
||||
drawnode = &drawnodes[numdrawnodes++];
|
||||
drawnode->type = type;
|
||||
|
||||
// not sure if returning different pointers to a union is necessary
|
||||
switch (type)
|
||||
{
|
||||
case DRAWNODE_PLANE:
|
||||
return &drawnodes.back().u.plane;
|
||||
return &drawnode->u.plane;
|
||||
case DRAWNODE_POLYOBJECT_PLANE:
|
||||
return &drawnodes.back().u.polyplane;
|
||||
return &drawnode->u.polyplane;
|
||||
case DRAWNODE_WALL:
|
||||
return &drawnodes.back().u.wall;
|
||||
return &drawnode->u.wall;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -4341,15 +4337,11 @@ static int CompareDrawNodePlanes(const void *p1, const void *p2)
|
||||
// Sorts and renders the list of drawnodes for the scene being rendered.
|
||||
static void HWR_RenderDrawNodes(void)
|
||||
{
|
||||
size_t i = 0, run_start = 0;
|
||||
static std::vector<INT32> sortindex;
|
||||
|
||||
sortindex.reserve(DRAWNODES_INIT_SIZE);
|
||||
INT32 i = 0, run_start = 0;
|
||||
|
||||
// Array for storing the rendering order.
|
||||
// A list of indices into the drawnodes array.
|
||||
|
||||
const size_t numdrawnodes = drawnodes.size();
|
||||
INT32 *sortindex;
|
||||
|
||||
if (!numdrawnodes)
|
||||
return;
|
||||
@@ -4358,7 +4350,7 @@ static void HWR_RenderDrawNodes(void)
|
||||
|
||||
PS_START_TIMING(ps_hw_nodesorttime);
|
||||
|
||||
sortindex.resize(numdrawnodes);
|
||||
sortindex = static_cast<INT32*>(Z_Malloc(sizeof(INT32) * numdrawnodes, PU_STATIC, NULL));
|
||||
|
||||
// Reversed order
|
||||
for (i = 0; i < numdrawnodes; i++)
|
||||
@@ -4374,7 +4366,7 @@ static void HWR_RenderDrawNodes(void)
|
||||
if (drawnodes[sortindex[run_start]].type == DRAWNODE_PLANE)
|
||||
{
|
||||
// found it, now look for run end
|
||||
size_t run_end; // (inclusive)
|
||||
INT32 run_end; // (inclusive)
|
||||
|
||||
for (i = run_start+1; i < numdrawnodes; i++)
|
||||
{
|
||||
@@ -4387,7 +4379,7 @@ static void HWR_RenderDrawNodes(void)
|
||||
if (run_end > run_start) // if there are multiple consecutive planes, not just one
|
||||
{
|
||||
// consecutive run of planes found, now sort it
|
||||
qs22j(sortindex.data() + run_start, run_end - run_start + 1, sizeof(INT32), CompareDrawNodePlanes);
|
||||
qs22j(sortindex + run_start, run_end - run_start + 1, sizeof(INT32), CompareDrawNodePlanes);
|
||||
}
|
||||
|
||||
run_start = run_end + 1; // continue looking for runs coming right after this one
|
||||
@@ -4406,9 +4398,6 @@ static void HWR_RenderDrawNodes(void)
|
||||
// Okay! Let's draw it all! Woo!
|
||||
GL_SetTransform(&atransform);
|
||||
|
||||
if (LIKELY(cv_glbatching.value))
|
||||
HWR_StartBatching();
|
||||
|
||||
for (i = 0; i < numdrawnodes; i++)
|
||||
{
|
||||
gl_drawnode_t *drawnode = &drawnodes[sortindex[i]];
|
||||
@@ -4462,10 +4451,9 @@ static void HWR_RenderDrawNodes(void)
|
||||
|
||||
PS_STOP_TIMING(ps_hw_nodedrawtime);
|
||||
|
||||
if (LIKELY(cv_glbatching.value))
|
||||
HWR_RenderBatches(false);
|
||||
numdrawnodes = 0;
|
||||
|
||||
drawnodes.clear(); // clear so our size is 0 again!
|
||||
Z_Free(sortindex);
|
||||
}
|
||||
|
||||
|
||||
@@ -5153,6 +5141,8 @@ static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing)
|
||||
z2 = tr_y - x2 * rightsin;
|
||||
x1 = tr_x + x1 * rightcos;
|
||||
x2 = tr_x - x2 * rightcos;
|
||||
//y1 = tr_y + y1 * rightcos;
|
||||
//y2 = tr_y - y2 * rightcos;
|
||||
|
||||
//
|
||||
// store information in a vissprite
|
||||
@@ -5331,7 +5321,7 @@ void HWR_BuildSkyDome(void)
|
||||
}
|
||||
|
||||
// precompute to save a bit of division
|
||||
static constexpr float FINEDEGREE = (360.0f/(float)FINEANGLES);
|
||||
static constexpr float FINEDEGREE = (360.0f/static_cast<float>(FINEANGLES));
|
||||
|
||||
static void HWR_DrawSkyBackground(void)
|
||||
{
|
||||
@@ -5349,7 +5339,7 @@ static void HWR_DrawSkyBackground(void)
|
||||
//04/01/2000: Hurdler: added for T&L
|
||||
// It should replace all other gl_viewxxx when finished
|
||||
HWR_SetTransformAiming(&dometransform);
|
||||
dometransform.angley = (float)((viewangle-ANGLE_270)>>ANGLETOFINESHIFT)*(FINEDEGREE);
|
||||
dometransform.angley = static_cast<float>((viewangle-ANGLE_270) >> ANGLETOFINESHIFT)*(FINEDEGREE);
|
||||
|
||||
HWR_GetTexture(texturetranslation[skytexture], false);
|
||||
|
||||
@@ -5394,7 +5384,7 @@ static void HWR_SetTransformAiming(FTransform *trans)
|
||||
if (cv_glshearing.value)
|
||||
{
|
||||
fixed_t fixedaiming = AIMINGTODY(aimingangle);
|
||||
trans->viewaiming = FixedToFloat(fixedaiming) * ((float)vid.width / vid.height) / ((float)BASEVIDWIDTH / BASEVIDHEIGHT);
|
||||
trans->viewaiming = FixedToFloat(fixedaiming) * (static_cast<float>(vid.width) / static_cast<float>(vid.height)) / (static_cast<float>(BASEVIDWIDTH) / static_cast<float>(BASEVIDHEIGHT));
|
||||
if (splitscreen == 1) // only for 2 player splitscreen
|
||||
trans->viewaiming *= 2.125; // splitscreen adjusts fov with 0.8, so compensate (but only halfway, since splitscreen means only half the screen is used)
|
||||
trans->shearing = true;
|
||||
@@ -5406,7 +5396,7 @@ static void HWR_SetTransformAiming(FTransform *trans)
|
||||
gl_aimingangle = aimingangle;
|
||||
}
|
||||
|
||||
trans->anglex = (float)(gl_aimingangle>>ANGLETOFINESHIFT)*(FINEDEGREE);
|
||||
trans->anglex = static_cast<float>(gl_aimingangle >> ANGLETOFINESHIFT)*(FINEDEGREE);
|
||||
}
|
||||
|
||||
void HWR_SetTransform(float fpov)
|
||||
@@ -5425,11 +5415,11 @@ void HWR_SetTransform(float fpov)
|
||||
atransform.z = gl_viewz;
|
||||
|
||||
atransform.scalex = 1;
|
||||
atransform.scaley = (float)vid.width/vid.height;
|
||||
atransform.scaley = static_cast<float>(vid.width) / static_cast<float>(vid.height);
|
||||
atransform.scalez = 1;
|
||||
|
||||
HWR_SetTransformAiming(&atransform);
|
||||
atransform.angley = (float)(viewangle>>ANGLETOFINESHIFT)*(FINEDEGREE);
|
||||
atransform.angley = static_cast<float>(viewangle >> ANGLETOFINESHIFT)*(FINEDEGREE);
|
||||
|
||||
yaw = 270.0f - atransform.angley;
|
||||
inv_yaw = 180.0f - yaw;
|
||||
@@ -5440,8 +5430,8 @@ void HWR_SetTransform(float fpov)
|
||||
// only needed for sprite billboarding
|
||||
if (cv_glspritebillboarding.value && !cv_glshearing.value)
|
||||
{
|
||||
gl_viewludsin = FixedToFloat(FINECOSINE(gl_aimingangle>>ANGLETOFINESHIFT));
|
||||
gl_viewludcos = FixedToFloat(-FINESINE(gl_aimingangle>>ANGLETOFINESHIFT));
|
||||
gl_viewludsin = FixedToFloat(FINECOSINE(gl_aimingangle >> ANGLETOFINESHIFT));
|
||||
gl_viewludcos = FixedToFloat(-FINESINE(gl_aimingangle >> ANGLETOFINESHIFT));
|
||||
}
|
||||
|
||||
atransform.fovangle = fpov; // Tails
|
||||
@@ -5469,7 +5459,6 @@ void HWR_SetTransform(float fpov)
|
||||
void HWR_ClearClipper(void)
|
||||
{
|
||||
const angle_t a1 = gld_FrustumAngle(gl_aimingangle);
|
||||
|
||||
gld_clipper_Clear();
|
||||
gld_clipper_SafeAddClipRange(viewangle + a1, viewangle - a1);
|
||||
#ifdef HAVE_SPHEREFRUSTRUM
|
||||
@@ -5554,7 +5543,7 @@ static void HWR_RenderViewpoint(gl_portal_t *rootportal, int stencil_level, bool
|
||||
{
|
||||
if (allow_portals && rootportal)
|
||||
{
|
||||
HWR_PortalFrame(rootportal); // for portalclipsector, it could have gone null from search
|
||||
HWR_PortalFrame(rootportal);// for portalclipsector, it could have gone null from search
|
||||
HWR_PortalClipping(rootportal);
|
||||
}
|
||||
}
|
||||
@@ -5604,7 +5593,7 @@ static void HWR_RenderViewpoint(gl_portal_t *rootportal, int stencil_level, bool
|
||||
PS_STOP_TIMING(ps_bsptime);
|
||||
|
||||
if (LIKELY(cv_glbatching.value))
|
||||
HWR_RenderBatches(true);
|
||||
HWR_RenderBatches();
|
||||
|
||||
// Check for new console commands.
|
||||
NetUpdate();
|
||||
@@ -5631,15 +5620,11 @@ static void HWR_RenderViewpoint(gl_portal_t *rootportal, int stencil_level, bool
|
||||
HWR_SortVisSprites();
|
||||
PS_STOP_TIMING(ps_hw_spritesorttime);
|
||||
PS_START_TIMING(ps_hw_spritedrawtime);
|
||||
if (LIKELY(cv_glbatching.value))
|
||||
HWR_StartBatching();
|
||||
if (UNLIKELY(cv_glmdls.value))
|
||||
HWR_DrawSprites<DrawSpritesType::kModels>();
|
||||
else
|
||||
HWR_DrawSprites<DrawSpritesType::kSprites>();
|
||||
PS_STOP_TIMING(ps_hw_spritedrawtime);
|
||||
if (LIKELY(cv_glbatching.value))
|
||||
HWR_RenderBatches(false);
|
||||
|
||||
ps_numdrawnodes.value.i = 0;
|
||||
ps_hw_nodesorttime.value.p = 0;
|
||||
@@ -5707,7 +5692,7 @@ static void HWR_RollTransform(FTransform *tr, angle_t roll)
|
||||
{
|
||||
if (roll != 0)
|
||||
{
|
||||
tr->rollangle = roll / (float)ANG1;
|
||||
tr->rollangle = static_cast<float>(roll) / static_cast<float>(ANG1);
|
||||
tr->roll = true;
|
||||
tr->rollx = 1.0f;
|
||||
tr->rollz = 0.0f;
|
||||
@@ -6107,7 +6092,7 @@ static void HWR_DoPostProcessor(void)
|
||||
for (y = 0; y < SCREENVERTS; y++)
|
||||
{
|
||||
// Change X position based on its Y position.
|
||||
v[x][y][0] = x-4.5f + sinf(((disStart+((float)y * WAVELENGTH)) / FREQUENCY)) / AMPLITUDE; // (x / scale)
|
||||
v[x][y][0] = x-4.5f + sinf(((disStart+(static_cast<float>(y) * WAVELENGTH)) / FREQUENCY)) / AMPLITUDE; // (x / scale)
|
||||
v[x][y][1] = y-4.5f; // (y / scale)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2209,16 +2209,10 @@ static void GL_Shader_SetUniforms(FSurfaceInfo *Surface, GLRGBAFloat *poly, GLRG
|
||||
UNIFORM_1(shader->uniforms[gluniform_light_contrast], shader_light_contrast, pglUniform1f);
|
||||
UNIFORM_1(shader->uniforms[gluniform_light_backlight], shader_light_backlight, pglUniform1f);
|
||||
}
|
||||
else
|
||||
{
|
||||
UNIFORM_3(shader->uniforms[gluniform_light_dir], 0, 0, 0, pglUniform3f);
|
||||
UNIFORM_1(shader->uniforms[gluniform_light_contrast], 0, pglUniform1f);
|
||||
UNIFORM_1(shader->uniforms[gluniform_light_backlight], 0, pglUniform1f);
|
||||
}
|
||||
|
||||
UNIFORM_1(shader->uniforms[gluniform_leveltime], shader_leveltime, pglUniform1f);
|
||||
|
||||
UNIFORM_2(shader->uniforms[gluniform_scr_resolution], vid.width, vid.height, pglUniform2f);
|
||||
UNIFORM_2(shader->uniforms[gluniform_scr_resolution], (GLfloat)vid.width, (GLfloat)vid.height, pglUniform2f);
|
||||
|
||||
#undef UNIFORM_1
|
||||
#undef UNIFORM_2
|
||||
|
||||
@@ -27,7 +27,7 @@ extern "C" {
|
||||
#ifdef HAVE_SDL
|
||||
#define _MATH_DEFINES_DEFINED
|
||||
|
||||
#include <SDL3/SDL_opengl.h> //Alam_GBC: Simple, yes?
|
||||
#include "SDL_opengl.h" //Alam_GBC: Simple, yes?
|
||||
|
||||
#else
|
||||
#include <GL/gl.h>
|
||||
|
||||
+18
-25
@@ -596,12 +596,12 @@ static void DoSayCommand(SINT8 target, size_t usedargs, UINT8 flags)
|
||||
}
|
||||
|
||||
// Only servers/admins can CSAY.
|
||||
if (!server && !(IsPlayerAdmin(consoleplayer)))
|
||||
if(!server && !(IsPlayerAdmin(consoleplayer)))
|
||||
flags &= ~HU_CSAY;
|
||||
|
||||
// We handle HU_SERVER_SAY, not the caller.
|
||||
flags &= ~HU_SERVER_SAY;
|
||||
if (dedicated && !(flags & HU_CSAY))
|
||||
if(dedicated && !(flags & HU_CSAY))
|
||||
flags |= HU_SERVER_SAY;
|
||||
|
||||
buf[0] = target;
|
||||
@@ -615,20 +615,17 @@ static void DoSayCommand(SINT8 target, size_t usedargs, UINT8 flags)
|
||||
strlcat(msg, COM_Argv(ix + usedargs), msgspace);
|
||||
}
|
||||
|
||||
const size_t msglength = strlen(msg);
|
||||
|
||||
if (msglength > 4 && strnicmp(msg, "/pm", 3) == 0) // used /pm
|
||||
if (strlen(msg) > 4 && strnicmp(msg, "/pm", 3) == 0) // used /pm
|
||||
{
|
||||
// what we're gonna do now is check if the node exists
|
||||
// with that logic, characters 4 and 5 are our numbers:
|
||||
const char *newmsg;
|
||||
INT32 spc = 1; // used if nodenum[1] is a space.
|
||||
CLEANUP(pfree) char *nodenum = (char*) malloc(3);
|
||||
char *nodenum = (char*) malloc(3);
|
||||
memcpy(nodenum, msg+3, 2);
|
||||
nodenum[2] = '\0';
|
||||
|
||||
// check for undesirable characters in our "number"
|
||||
if (((nodenum[0] < '0') || (nodenum[0] > '9')) || ((nodenum[1] < '0') || (nodenum[1] > '9')))
|
||||
if (((nodenum[0] < '0') || (nodenum[0] > '9')) || ((nodenum[1] < '0') || (nodenum[1] > '9')))
|
||||
{
|
||||
// check if nodenum[1] is a space
|
||||
if (nodenum[1] == ' ')
|
||||
@@ -637,21 +634,23 @@ static void DoSayCommand(SINT8 target, size_t usedargs, UINT8 flags)
|
||||
else
|
||||
{
|
||||
HU_AddChatText("\x82NOTICE: \x80Invalid command format. Correct format is \'/pm<node> \'.", false);
|
||||
free(nodenum);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// I'm very bad at C, I swear I am, additional checks eww!
|
||||
if (spc != 0)
|
||||
{
|
||||
if (msg[5] != ' ')
|
||||
{
|
||||
HU_AddChatText("\x82NOTICE: \x80Invalid command format. Correct format is \'/pm<node> \'.", false);
|
||||
free(nodenum);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
target = atoi((const char*) nodenum); // turn that into a number
|
||||
free(nodenum);
|
||||
//CONS_Printf("%d\n", target);
|
||||
|
||||
// check for target player, if it doesn't exist then we can't send the message!
|
||||
@@ -662,13 +661,12 @@ static void DoSayCommand(SINT8 target, size_t usedargs, UINT8 flags)
|
||||
HU_AddChatText(va("\x82NOTICE: \x80Player %d does not exist.", target), false); // same
|
||||
return;
|
||||
}
|
||||
|
||||
buf[0] = target;
|
||||
newmsg = msg+5+spc;
|
||||
strlcpy(msg, newmsg, HU_MAXMSGLEN + 1);
|
||||
}
|
||||
|
||||
SendNetXCmd(XD_SAY, buf, msglength + 1 + msg-buf);
|
||||
SendNetXCmd(XD_SAY, buf, strlen(msg) + 1 + msg-buf);
|
||||
}
|
||||
|
||||
/** Send a message to everyone.
|
||||
@@ -919,12 +917,10 @@ static void Got_Saycmd(const UINT8 **p, INT32 playernum)
|
||||
return;
|
||||
}
|
||||
|
||||
const size_t msglength = strlen(msg);
|
||||
|
||||
//check for invalid characters (0x80 or above)
|
||||
{
|
||||
size_t i;
|
||||
const size_t j = msglength;
|
||||
const size_t j = strlen(msg);
|
||||
for (i = 0; i < j; i++)
|
||||
{
|
||||
if (msg[i] & 0x80)
|
||||
@@ -971,7 +967,7 @@ static void Got_Saycmd(const UINT8 **p, INT32 playernum)
|
||||
}
|
||||
|
||||
// Handle "/me" actions, but only in messages to everyone.
|
||||
if (target == 0 && msglength > 4 && strnicmp(msg, "/me ", 4) == 0)
|
||||
if (target == 0 && strlen(msg) > 4 && strnicmp(msg, "/me ", 4) == 0)
|
||||
{
|
||||
msg += 4;
|
||||
action = true;
|
||||
@@ -1153,12 +1149,10 @@ static boolean HU_clearChatSpaces(void)
|
||||
size_t i = 0; // Used to just check our message
|
||||
char c; // current character we're iterating.
|
||||
boolean nothingbutspaces = true;
|
||||
const size_t chatlength = strlen(w_chat_buf);
|
||||
|
||||
for (; i < chatlength; i++) // iterate through message and eradicate all spaces that don't belong.
|
||||
for (; i < strlen(w_chat_buf); i++) // iterate through message and eradicate all spaces that don't belong.
|
||||
{
|
||||
c = w_chat_buf[i];
|
||||
|
||||
if (!c)
|
||||
break; // if there's nothing, it's safe to assume our message has ended, so let's not waste any more time here.
|
||||
|
||||
@@ -1167,7 +1161,6 @@ static boolean HU_clearChatSpaces(void)
|
||||
nothingbutspaces = false;
|
||||
}
|
||||
}
|
||||
|
||||
return nothingbutspaces;
|
||||
}
|
||||
|
||||
@@ -1214,11 +1207,11 @@ static void HU_SendChatMessage(void)
|
||||
return;
|
||||
}
|
||||
|
||||
const size_t msglength = strlen(msg);
|
||||
size_t len = strlen(msg);
|
||||
|
||||
if (msglength >= 5 && strnicmp(msg, "/mute", 5) == 0) // Used /mute
|
||||
if (len >= 5 && strnicmp(msg, "/mute", 5) == 0) // Used /mute
|
||||
{
|
||||
if (msglength > 6)
|
||||
if (len > 6)
|
||||
DoMute(msg+6);
|
||||
else
|
||||
HU_AddChatText("\x82NOTICE: \x80Usage: /mute <name|node>", false);
|
||||
@@ -1226,7 +1219,7 @@ static void HU_SendChatMessage(void)
|
||||
return;
|
||||
}
|
||||
|
||||
if (msglength > 4 && strnicmp(msg, "/pm", 3) == 0) // used /pm
|
||||
if (len > 4 && strnicmp(msg, "/pm", 3) == 0) // used /pm
|
||||
{
|
||||
INT32 spc = 1; // used if nodenum[1] is a space.
|
||||
const char *newmsg;
|
||||
@@ -1738,7 +1731,7 @@ static void HU_drawChatLog(INT32 offset)
|
||||
{
|
||||
if ((y+dy+2 >= chat_topy) && (y+dy < (chat_bottomy)))
|
||||
{
|
||||
M_DrawEmote(x+dx+2, y+dy, emote, V_SNAPTOBOTTOM|V_SNAPTOLEFT);
|
||||
M_DrawEmote(x+dx+2, y+dy+1, emote, V_SNAPTOBOTTOM|V_SNAPTOLEFT);
|
||||
dx += EMOTEWIDTH - charwidth;
|
||||
}
|
||||
j += emotelen;
|
||||
@@ -1998,7 +1991,7 @@ static void HU_DrawChat(void)
|
||||
longest_name_length = max(longest_name_length, strlen(player_names[i]));
|
||||
}
|
||||
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
for(i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (!playeringame[i])
|
||||
continue;
|
||||
|
||||
+2
-2
@@ -80,6 +80,8 @@ typedef struct
|
||||
|
||||
#define DOOMCOM_DATA(d) (doomdata_t *)&(d)->data
|
||||
|
||||
extern doomcom_t *doomcom;
|
||||
|
||||
#ifdef HOLEPUNCH
|
||||
typedef struct
|
||||
{
|
||||
@@ -91,8 +93,6 @@ typedef struct
|
||||
#define HOLEPUNCH_DATA(d) (holepunch_t *)&(d)->data
|
||||
#endif
|
||||
|
||||
extern doomcom_t *doomcom;
|
||||
|
||||
/** \brief return packet in doomcom struct
|
||||
*/
|
||||
extern boolean (*I_NetGet)(void);
|
||||
|
||||
@@ -158,6 +158,8 @@ UINT32 I_GetSongLoopPoint(void);
|
||||
boolean I_SetSongPosition(UINT32 position);
|
||||
UINT32 I_GetSongPosition(void);
|
||||
|
||||
void I_UpdateSongLagThreshold (void);
|
||||
|
||||
/// ------------------------
|
||||
// MUSIC PLAYBACK
|
||||
/// ------------------------
|
||||
|
||||
+6
-5
@@ -568,13 +568,12 @@ void Command_Numnodes(void)
|
||||
|
||||
#ifdef HOLEPUNCH
|
||||
/* not one of the reserved "local" addresses */
|
||||
static boolean
|
||||
is_external_address (UINT32 p)
|
||||
static boolean is_external_address(UINT32 p)
|
||||
{
|
||||
UINT8 a = (p & 255);
|
||||
UINT8 b = ((p >> 8) & 255);
|
||||
|
||||
if (p == (UINT32)~0)/* 255.255.255.255 */
|
||||
if (p == (UINT32)~0) /* 255.255.255.255 */
|
||||
return 0;
|
||||
|
||||
switch (a)
|
||||
@@ -584,7 +583,7 @@ is_external_address (UINT32 p)
|
||||
case 127:
|
||||
return false;
|
||||
case 172:
|
||||
return (b & ~15) != 16;/* 16 - 31 */
|
||||
return (b & ~15) != 16; /* 16 - 31 */
|
||||
case 192:
|
||||
return b != 168;
|
||||
default:
|
||||
@@ -763,6 +762,7 @@ static void SOCK_Send(void)
|
||||
if (myfamily[i] == broadcastaddress[j].any.sa_family)
|
||||
{
|
||||
c = SOCK_SendToAddr(mysockets[i], &broadcastaddress[j]);
|
||||
|
||||
if (c == ERRSOCKET)
|
||||
{
|
||||
e = errno;
|
||||
@@ -780,6 +780,7 @@ static void SOCK_Send(void)
|
||||
if (myfamily[i] == clientaddress[doomcom->remotenode].any.sa_family)
|
||||
{
|
||||
c = SOCK_SendToAddr(mysockets[i], &clientaddress[doomcom->remotenode]);
|
||||
|
||||
if (c == ERRSOCKET)
|
||||
{
|
||||
e = errno;
|
||||
@@ -792,6 +793,7 @@ static void SOCK_Send(void)
|
||||
else
|
||||
{
|
||||
c = SOCK_SendToAddr(nodesocket[doomcom->remotenode], &clientaddress[doomcom->remotenode]);
|
||||
|
||||
if (c == ERRSOCKET)
|
||||
{
|
||||
e = errno;
|
||||
@@ -1060,7 +1062,6 @@ static boolean UDP_Socket(void)
|
||||
#endif
|
||||
const char *serv;
|
||||
|
||||
|
||||
for (s = 0; s < mysocketses; s++)
|
||||
mysockets[s] = ERRSOCKET;
|
||||
for (s = 0; s < MAXNETNODES+1; s++)
|
||||
|
||||
@@ -95,7 +95,6 @@ INT32 VID_SetMode(INT32 modenum);
|
||||
*/
|
||||
const char *VID_GetModeName(INT32 modenum);
|
||||
|
||||
void VID_RefreshModeList(void);
|
||||
void VID_PrepareModeList(void);
|
||||
|
||||
/** \brief can video system do fullscreen
|
||||
@@ -122,7 +121,6 @@ void I_ReadScreen(UINT8 * restrict scr, INT32 scale);
|
||||
|
||||
UINT32 I_GetRefreshRate(void);
|
||||
|
||||
boolean I_CheckAboveDesktopRes(INT32 width, INT32 height);
|
||||
boolean I_CheckNativeRes(void);
|
||||
|
||||
void I_SetBorderlessWindow(void);
|
||||
|
||||
+2
-4
@@ -568,7 +568,7 @@ static patch_t *kp_racefinish[6];
|
||||
static patch_t *kp_positionnum[NUMPOSNUMS][NUMPOSFRAMES];
|
||||
static patch_t *kp_winnernum[NUMPOSFRAMES];
|
||||
|
||||
static patch_t *kp_facenum[MAXPLAYERS+1];
|
||||
patch_t *kp_facenum[MAXPLAYERS+1];
|
||||
static patch_t *kp_facehighlight[8];
|
||||
|
||||
static patch_t *kp_rankbumper;
|
||||
@@ -4468,9 +4468,7 @@ static void K_drawLapStartAnim(void)
|
||||
V_DrawFixedPatch(leftx, y, FRACUNIT, vflags, kp_lapanim_lap[min(progress/2, 6)], NULL);
|
||||
|
||||
char *lapnum = va("%02d", stplyr->laps + 1);
|
||||
const size_t laplength = strlen(lapnum);
|
||||
|
||||
for (int i = 0; i < (int)laplength; i++)
|
||||
for (int i = 0; i < (int)strlen(lapnum); i++)
|
||||
{
|
||||
int digit = lapnum[i] - '0';
|
||||
int frame = min(2, progress/2 - 8 - (i*2));
|
||||
|
||||
@@ -41,6 +41,9 @@ extern consvar_t cv_battlespeedo;
|
||||
extern consvar_t cv_multiitemicon;
|
||||
extern consvar_t cv_huditemamount;
|
||||
|
||||
// for use in timeattack menu
|
||||
extern patch_t *kp_facenum[MAXPLAYERS+1];
|
||||
|
||||
#define NUMSPEEDOSTUFF 8
|
||||
extern CV_PossibleValue_t speedo_cons_t[NUMSPEEDOSTUFF];
|
||||
#define NUMDGAUGESTUFF 6
|
||||
|
||||
+50
-54
@@ -5179,6 +5179,24 @@ player_t *K_FindJawzTarget(mobj_t *actor, player_t *source)
|
||||
return wtarg;
|
||||
}
|
||||
|
||||
static INT32 K_GetEngineClass(const player_t *player)
|
||||
{
|
||||
INT32 speed, weight;
|
||||
|
||||
speed = (player->kartspeed - 1) / 3;
|
||||
weight = (player->kartweight - 1) / 3;
|
||||
|
||||
#define LOCKSTAT(stat) \
|
||||
if (stat < 0) { stat = 0; } \
|
||||
if (stat > 2) { stat = 2; }
|
||||
LOCKSTAT(speed);
|
||||
LOCKSTAT(weight);
|
||||
#undef LOCKSTAT
|
||||
|
||||
return (speed + (3*weight));
|
||||
}
|
||||
|
||||
|
||||
// Engine Sounds.
|
||||
static void K_UpdateEngineSounds(player_t *player, ticcmd_t *cmd)
|
||||
{
|
||||
@@ -5189,7 +5207,7 @@ static void K_UpdateEngineSounds(player_t *player, ticcmd_t *cmd)
|
||||
|
||||
static const UINT8 dampenval = 48; // 255 * 48 = close enough to FRACUNIT/6
|
||||
|
||||
INT32 class, s, w; // engine class number
|
||||
INT32 class; // engine class number
|
||||
|
||||
UINT8 volume = 255;
|
||||
fixed_t volumedampen = FRACUNIT;
|
||||
@@ -5225,7 +5243,7 @@ static void K_UpdateEngineSounds(player_t *player, ticcmd_t *cmd)
|
||||
targetsnd = (((6 * cmd->forwardmove) / 25) + ((player->speed / mapobjectscale) / 5)) / 2;
|
||||
}
|
||||
|
||||
if (targetsnd < 0) { targetsnd = 0; }
|
||||
if (targetsnd < 0) { targetsnd = 0; }
|
||||
if (targetsnd > 12) { targetsnd = 12; }
|
||||
|
||||
if (player->kartstuff[k_enginesnd] < targetsnd) { player->kartstuff[k_enginesnd]++; }
|
||||
@@ -5302,17 +5320,7 @@ static void K_UpdateEngineSounds(player_t *player, ticcmd_t *cmd)
|
||||
return;
|
||||
}
|
||||
|
||||
s = (player->kartspeed - 1) / 3;
|
||||
w = (player->kartweight - 1) / 3;
|
||||
|
||||
#define LOCKSTAT(stat) \
|
||||
if (stat < 0) { stat = 0; } \
|
||||
if (stat > 2) { stat = 2; }
|
||||
LOCKSTAT(s);
|
||||
LOCKSTAT(w);
|
||||
#undef LOCKSTAT
|
||||
|
||||
class = s + (3*w);
|
||||
class = K_GetEngineClass(player);
|
||||
|
||||
S_StartSoundAtVolume(player->mo, (sfx_krta00 + player->kartstuff[k_enginesnd]) + (class * numsnds), volume);
|
||||
}
|
||||
@@ -5731,7 +5739,7 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
|
||||
K_UpdateInvincibilitySounds(player); // Also thanks, VAda!
|
||||
|
||||
// Plays the music during and after the starting countdown.
|
||||
if (P_IsLocalPlayer(player))
|
||||
if ((leveltime <= MUSICSTARTTIME) && P_IsLocalPlayer(player))
|
||||
S_StartMapMusic();
|
||||
}
|
||||
|
||||
@@ -5911,45 +5919,33 @@ static void K_KartDrift(player_t *player, boolean onground)
|
||||
// Holding the Jump button will enable drifting.
|
||||
|
||||
// Drift Release (Moved here so you can't "chain" drifts)
|
||||
if ((player->kartstuff[k_drift] != -5 && player->kartstuff[k_drift] != 5)
|
||||
// || (player->kartstuff[k_drift] >= 1 && player->kartstuff[k_turndir] != 1) || (player->kartstuff[k_drift] <= -1 && player->kartstuff[k_turndir] != -1))
|
||||
&& player->kartstuff[k_driftcharge] < dsone
|
||||
&& onground)
|
||||
if (onground && player->kartstuff[k_drift] != -5 && player->kartstuff[k_drift] != 5)
|
||||
{
|
||||
player->kartstuff[k_driftcharge] = 0;
|
||||
}
|
||||
else if ((player->kartstuff[k_drift] != -5 && player->kartstuff[k_drift] != 5)
|
||||
// || (player->kartstuff[k_drift] >= 1 && player->kartstuff[k_turndir] != 1) || (player->kartstuff[k_drift] <= -1 && player->kartstuff[k_turndir] != -1))
|
||||
&& (player->kartstuff[k_driftcharge] >= dsone && player->kartstuff[k_driftcharge] < dstwo)
|
||||
&& onground)
|
||||
{
|
||||
if (player->kartstuff[k_driftboost] < 20)
|
||||
player->kartstuff[k_driftboost] = 20;
|
||||
S_StartSound(player->mo, sfx_s23c);
|
||||
//K_SpawnDashDustRelease(player);
|
||||
player->kartstuff[k_driftcharge] = 0;
|
||||
}
|
||||
else if ((player->kartstuff[k_drift] != -5 && player->kartstuff[k_drift] != 5)
|
||||
// || (player->kartstuff[k_drift] >= 1 && player->kartstuff[k_turndir] != 1) || (player->kartstuff[k_drift] <= -1 && player->kartstuff[k_turndir] != -1))
|
||||
&& player->kartstuff[k_driftcharge] < dsthree
|
||||
&& onground)
|
||||
{
|
||||
if (player->kartstuff[k_driftboost] < 50)
|
||||
player->kartstuff[k_driftboost] = 50;
|
||||
S_StartSound(player->mo, sfx_s23c);
|
||||
//K_SpawnDashDustRelease(player);
|
||||
player->kartstuff[k_driftcharge] = 0;
|
||||
}
|
||||
else if ((player->kartstuff[k_drift] != -5 && player->kartstuff[k_drift] != 5)
|
||||
// || (player->kartstuff[k_drift] >= 1 && player->kartstuff[k_turndir] != 1) || (player->kartstuff[k_drift] <= -1 && player->kartstuff[k_turndir] != -1))
|
||||
&& player->kartstuff[k_driftcharge] >= dsthree
|
||||
&& onground)
|
||||
{
|
||||
if (player->kartstuff[k_driftboost] < 125)
|
||||
player->kartstuff[k_driftboost] = 125;
|
||||
S_StartSound(player->mo, sfx_s23c);
|
||||
//K_SpawnDashDustRelease(player);
|
||||
player->kartstuff[k_driftcharge] = 0;
|
||||
if (player->kartstuff[k_driftcharge] < dsone)
|
||||
{
|
||||
player->kartstuff[k_driftcharge] = 0;
|
||||
}
|
||||
else if (player->kartstuff[k_driftcharge] >= dsone && player->kartstuff[k_driftcharge] < dstwo)
|
||||
{
|
||||
if (player->kartstuff[k_driftboost] < 20)
|
||||
player->kartstuff[k_driftboost] = 20;
|
||||
S_StartSound(player->mo, sfx_s23c);
|
||||
player->kartstuff[k_driftcharge] = 0;
|
||||
}
|
||||
else if (player->kartstuff[k_driftcharge] < dsthree)
|
||||
{
|
||||
if (player->kartstuff[k_driftboost] < 50)
|
||||
player->kartstuff[k_driftboost] = 50;
|
||||
S_StartSound(player->mo, sfx_s23c);
|
||||
player->kartstuff[k_driftcharge] = 0;
|
||||
}
|
||||
else if (player->kartstuff[k_driftcharge] >= dsthree)
|
||||
{
|
||||
if (player->kartstuff[k_driftboost] < 125)
|
||||
player->kartstuff[k_driftboost] = 125;
|
||||
S_StartSound(player->mo, sfx_s23c);
|
||||
player->kartstuff[k_driftcharge] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Drifting: left or right?
|
||||
@@ -6027,8 +6023,8 @@ static void K_KartDrift(player_t *player, boolean onground)
|
||||
|
||||
// Sound whenever you get a different tier of sparks
|
||||
if (driftblue
|
||||
|| driftred
|
||||
|| driftrainbow)
|
||||
|| driftred
|
||||
|| driftrainbow)
|
||||
{
|
||||
//S_StartSound(player->mo, sfx_s3ka2);
|
||||
if (P_IsLocalPlayer(player)) // UGHGHGH...
|
||||
|
||||
+65
-10
@@ -149,7 +149,8 @@ enum cameraf {
|
||||
camera_momx,
|
||||
camera_momy,
|
||||
camera_momz,
|
||||
camera_pnum
|
||||
camera_pnum,
|
||||
camera_freecam,
|
||||
};
|
||||
|
||||
|
||||
@@ -169,6 +170,7 @@ static const char *const camera_opt[] = {
|
||||
"momy",
|
||||
"momz",
|
||||
"pnum",
|
||||
"freecam",
|
||||
NULL};
|
||||
|
||||
enum hudpatch {
|
||||
@@ -387,10 +389,43 @@ static int camera_get(lua_State *L)
|
||||
case camera_pnum:
|
||||
lua_pushinteger(L, camnum);
|
||||
break;
|
||||
case camera_freecam:
|
||||
lua_pushboolean(L, cam->freecam);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lib_getCamera(lua_State *L)
|
||||
{
|
||||
// No cameras on dedicated
|
||||
if (dedicated)
|
||||
return 0;
|
||||
|
||||
if (lua_type(L, 2) == LUA_TNUMBER)
|
||||
{
|
||||
int i = lua_tonumber(L, 2);
|
||||
|
||||
if (i < 0 || i > splitscreen)
|
||||
return 0;
|
||||
|
||||
LUA_PushUserdata(L, &camera[i], META_CAMERA);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int lib_lenCamera(lua_State *L)
|
||||
{
|
||||
if (dedicated)
|
||||
lua_pushinteger(L, 0);
|
||||
else
|
||||
lua_pushinteger(L, splitscreen+1); // splitscreen == 0 -> 1 active camera, splitscreen == 1 -> 2 cameras and so on
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
//
|
||||
// lib_draw
|
||||
//
|
||||
@@ -1252,22 +1287,32 @@ extern int lib_hudadd(lua_State *L);
|
||||
|
||||
static int lib_hudsetvotebackground(lua_State *L)
|
||||
{
|
||||
// Reset to default
|
||||
memset(VoteScreen.luaPrefix, 0, sizeof(VoteScreen.luaPrefix));
|
||||
VoteScreen.timePerAnimFrame = 2;
|
||||
|
||||
if (lua_isnoneornil(L, 1))
|
||||
if (!lua_isnoneornil(L, 1))
|
||||
{
|
||||
return 0;
|
||||
const char *prefix = luaL_checkstring(L, 1);
|
||||
|
||||
if (strlen(prefix) != 4)
|
||||
{
|
||||
return luaL_argerror(L, 1, "prefix should 4 characters wide");
|
||||
}
|
||||
|
||||
strncpy(VoteScreen.luaPrefix, prefix, 4);
|
||||
strupr(VoteScreen.luaPrefix);
|
||||
}
|
||||
|
||||
const char *prefix = luaL_checkstring(L, 1);
|
||||
|
||||
if (strlen(prefix) != 4)
|
||||
if (!lua_isnoneornil(L, 2))
|
||||
{
|
||||
return luaL_argerror(L, 1, "prefix should 4 characters wide");
|
||||
}
|
||||
INT32 time_per_frame = luaL_checkinteger(L, 2);
|
||||
|
||||
strncpy(VoteScreen.luaPrefix, prefix, 4);
|
||||
strupr(VoteScreen.luaPrefix);
|
||||
if (time_per_frame <= 0)
|
||||
return luaL_argerror(L, 2, "time per frame should be 1 or more");
|
||||
|
||||
VoteScreen.timePerAnimFrame = time_per_frame;
|
||||
}
|
||||
|
||||
// Update background if we're already on vote screen
|
||||
if (gamestate == GS_VOTING)
|
||||
@@ -1371,6 +1416,16 @@ int LUA_HudLib(lua_State *L)
|
||||
lua_setfield(L, -2, "__index");
|
||||
lua_pop(L,1);
|
||||
|
||||
lua_newuserdata(L, 0);
|
||||
lua_createtable(L, 0, 2);
|
||||
lua_pushcfunction(L, lib_getCamera);
|
||||
lua_setfield(L, -2, "__index");
|
||||
|
||||
lua_pushcfunction(L, lib_lenCamera);
|
||||
lua_setfield(L, -2, "__len");
|
||||
lua_setmetatable(L, -2);
|
||||
lua_setglobal(L, "cameras");
|
||||
|
||||
camera_fields_ref = Lua_CreateFieldTable(L, camera_opt);
|
||||
|
||||
luaL_register(L, "hud", lib_hud);
|
||||
|
||||
+4
-6
@@ -49,19 +49,17 @@ aatree_t *M_AATreeAlloc(UINT32 flags)
|
||||
return aatree;
|
||||
}
|
||||
|
||||
static void M_AATreeFree_Node(aatree_node_t *node, bool is_string)
|
||||
static void M_AATreeFree_Node(aatree_node_t *node)
|
||||
{
|
||||
if (node->left) M_AATreeFree_Node(node->left, is_string);
|
||||
if (node->right) M_AATreeFree_Node(node->right, is_string);
|
||||
if (is_string)
|
||||
Z_Free(node->value);
|
||||
if (node->left) M_AATreeFree_Node(node->left);
|
||||
if (node->right) M_AATreeFree_Node(node->right);
|
||||
Z_Free(node);
|
||||
}
|
||||
|
||||
void M_AATreeFree(aatree_t *aatree)
|
||||
{
|
||||
if (aatree->root)
|
||||
M_AATreeFree_Node(aatree->root, (aatree->flags & AATREE_STRING) == AATREE_STRING);
|
||||
M_AATreeFree_Node(aatree->root);
|
||||
|
||||
Z_Free(aatree);
|
||||
}
|
||||
|
||||
+1
-1
@@ -908,7 +908,7 @@ void OP_ObjectplaceMovement(player_t *player)
|
||||
ticcmd_t *cmd = &player->cmd;
|
||||
|
||||
if (!player->climbing && (netgame || (player->pflags & PF_SPINNING)))
|
||||
player->mo->angle = (cmd->angleturn<<16 /* not FRACBITS */);
|
||||
player->mo->angle = (cmd->angleturn << TICCMD_REDUCE);
|
||||
|
||||
ticruned++;
|
||||
if (!(cmd->angleturn & TICCMD_RECEIVED))
|
||||
|
||||
+344
-261
@@ -88,8 +88,8 @@
|
||||
#include "z_zone.h"
|
||||
#include "mserv.h"
|
||||
|
||||
#if defined (HAVE_SDL)
|
||||
#include <SDL3/SDL.h>
|
||||
#if defined(HAVE_SDL)
|
||||
#include "SDL.h"
|
||||
#if SDL_VERSION_ATLEAST(2,0,0)
|
||||
#include "sdl/sdlmain.h" // JOYSTICK_HOTPLUG
|
||||
#endif
|
||||
@@ -197,7 +197,30 @@ static INT32 vidm_column_size;
|
||||
#define SETUPM_IP_MAXSIZE ((28-1)*8)
|
||||
static char setupm_ip[64];
|
||||
static textinput_t setupm_input_ip;
|
||||
static UINT8 setupm_pselect = 1;
|
||||
|
||||
|
||||
static fixed_t multi_tics;
|
||||
static state_t *multi_state;
|
||||
|
||||
// this is set before entering the MultiPlayer setup menu,
|
||||
// for either player 1 or 2
|
||||
static char setupm_name[MAXPLAYERNAME+1];
|
||||
static textinput_t setupm_input;
|
||||
static player_t *setupm_player;
|
||||
static consvar_t *setupm_cvskin;
|
||||
static consvar_t *setupm_cvcolor;
|
||||
static consvar_t *setupm_cvname;
|
||||
static UINT8 setupm_skinxpos;
|
||||
static INT32 setupm_fakeskin;
|
||||
static INT32 setupm_fakecolor;
|
||||
static UINT8 setupm_pselect = 1;
|
||||
|
||||
//variables used for other skin select menus
|
||||
static UINT8 setupm_skinypos;
|
||||
static INT32 setupm_skinselect;
|
||||
static boolean setupm_skinlockedselect;
|
||||
|
||||
static UINT8 setupm_playernum; //brap
|
||||
|
||||
//
|
||||
// PROTOTYPES
|
||||
@@ -233,6 +256,7 @@ static char *M_GetConditionString(condition_t cond);
|
||||
// Misc. Main Menu
|
||||
static void M_Options(INT32 choice);
|
||||
static void M_Multiplayer(INT32 choice);
|
||||
static void M_CameraMenu(INT32 choice);
|
||||
static void M_LocalSkinMenu(INT32 choice);
|
||||
static void M_LocalSkinChange(INT32 choice);
|
||||
static void M_Manual(INT32 choice);
|
||||
@@ -282,6 +306,7 @@ static void M_SetupMultiHandler(INT32 choice);
|
||||
|
||||
// Options
|
||||
// Split into multiple parts due to size
|
||||
static void M_VideoModeMenu(INT32 choice);
|
||||
static void M_Setup1PControlsMenu(void);
|
||||
static void M_Setup2PControlsMenu(void);
|
||||
static void M_Setup3PControlsMenu(void);
|
||||
@@ -504,6 +529,7 @@ static INT32 M_ShiftChar(INT32 ch)
|
||||
// Pretty and consistent ^u^
|
||||
// See also G_GetGametypeColor.
|
||||
//
|
||||
|
||||
static INT32 highlightflags, recommendedflags, warningflags;
|
||||
|
||||
inline static void M_GetGametypeColor(void)
|
||||
@@ -623,22 +649,28 @@ void Nextmap_OnChange(void)
|
||||
SP_ReplayMenu[i].status = IT_DISABLED;
|
||||
SP_GuestReplayMenu[i].status = IT_DISABLED;
|
||||
}
|
||||
|
||||
SP_ReplayMenu[4].status = IT_DISABLED;
|
||||
|
||||
SP_GhostMenu[3].status = IT_DISABLED;
|
||||
SP_GhostMenu[4].status = IT_DISABLED;
|
||||
|
||||
if (FIL_FileExists(va("%s-%s-time-best.lmp", gpath, cv_chooseskin.string))) {
|
||||
if (FIL_FileExists(va("%s-%s-time-best.lmp", gpath, cv_chooseskin.string)))
|
||||
{
|
||||
SP_ReplayMenu[0].status = IT_WHITESTRING|IT_CALL;
|
||||
SP_GuestReplayMenu[0].status = IT_WHITESTRING|IT_CALL;
|
||||
active |= 3;
|
||||
}
|
||||
if (FIL_FileExists(va("%s-%s-lap-best.lmp", gpath, cv_chooseskin.string))) {
|
||||
|
||||
if (FIL_FileExists(va("%s-%s-lap-best.lmp", gpath, cv_chooseskin.string)))
|
||||
{
|
||||
SP_ReplayMenu[1].status = IT_WHITESTRING|IT_CALL;
|
||||
SP_GuestReplayMenu[1].status = IT_WHITESTRING|IT_CALL;
|
||||
active |= 3;
|
||||
}
|
||||
if (FIL_FileExists(va("%s-%s-last.lmp", gpath, cv_chooseskin.string))) {
|
||||
|
||||
if (FIL_FileExists(va("%s-%s-last.lmp", gpath, cv_chooseskin.string)))
|
||||
{
|
||||
SP_ReplayMenu[2].status = IT_WHITESTRING|IT_CALL;
|
||||
SP_GuestReplayMenu[2].status = IT_WHITESTRING|IT_CALL;
|
||||
active |= 3;
|
||||
@@ -661,7 +693,8 @@ void Nextmap_OnChange(void)
|
||||
active |= 1;
|
||||
}
|
||||
|
||||
if (active) {
|
||||
if (active)
|
||||
{
|
||||
if (active & 1)
|
||||
SP_TimeAttackMenu[tareplay].status = IT_WHITESTRING|IT_SUBMENU;
|
||||
if (active & 2)
|
||||
@@ -773,6 +806,11 @@ static void Splitplayers_OnChange(void)
|
||||
setupm_pselect = 1;
|
||||
}
|
||||
|
||||
void ShowLocalskinMenu_Onchange(void)
|
||||
{
|
||||
OP_MainMenu[localskin].status = (!cv_showlocalskinmenus.value) ? (IT_DISABLED) : (IT_CALL|IT_STRING);
|
||||
}
|
||||
|
||||
// current menudef
|
||||
menu_t *currentMenu = &MainDef;
|
||||
|
||||
@@ -893,7 +931,7 @@ static void M_CheckStringItem(void)
|
||||
|
||||
// special case: name input, cap it to prevent writing outside the textbox
|
||||
// kinda ugly but itll work
|
||||
if (cv == &cv_playername)
|
||||
if (cv == setupm_cvname)
|
||||
M_TextInputInit(&menuinput, menu_text_input_buf, MAXPLAYERNAME +1);
|
||||
else
|
||||
M_TextInputInit(&menuinput, menu_text_input_buf, sizeof menu_text_input_buf);
|
||||
@@ -1004,18 +1042,6 @@ boolean M_Responder(event_t *ev)
|
||||
ch = KEY_RIGHTARROW;
|
||||
break;
|
||||
}
|
||||
|
||||
if (menuactive)
|
||||
{
|
||||
if (currentMenu == &MISC_ChangeLevelDef || currentMenu == &MP_OfflineServerDef || currentMenu == &MP_ServerDef)
|
||||
{
|
||||
if (ch == gamecontrol[0][gc_fire][0]
|
||||
|| ch == gamecontrol[0][gc_fire][1])
|
||||
{
|
||||
COM_ImmedExecute("add kartencore 1");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (menuactive)
|
||||
{
|
||||
@@ -1207,6 +1233,19 @@ boolean M_Responder(event_t *ev)
|
||||
if ((ch == gamecontrol[0][gc_brake][0] || ch == gamecontrol[0][gc_brake][1]) && ch >= KEY_MOUSE1) // do this here, otherwise brake opens the menu mid-game
|
||||
ch = KEY_ESCAPE;
|
||||
|
||||
if (currentMenu == &MISC_ChangeLevelDef ||
|
||||
currentMenu == &MP_OfflineServerDef ||
|
||||
currentMenu == &MP_ServerDef)
|
||||
{
|
||||
if (ch == gamecontrol[0][gc_fire][0]
|
||||
|| ch == gamecontrol[0][gc_fire][1])
|
||||
{
|
||||
if (M_SecretUnlocked(SECRET_ENCORE))
|
||||
COM_ImmedExecute("add kartencore 1");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
routine = currentMenu->menuitems[itemOn].itemaction;
|
||||
|
||||
// Handle menuitems which need a specific key handling
|
||||
@@ -1937,8 +1976,6 @@ void M_Ticker(void)
|
||||
}
|
||||
I_unlock_mutex(ms_ServerList_mutex);
|
||||
#endif
|
||||
|
||||
CL_TimeoutServerList();
|
||||
}
|
||||
|
||||
//
|
||||
@@ -2695,6 +2732,12 @@ static void M_DrawPauseMenu(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
musicdef_t *def;
|
||||
if (cv_pausesongcredits.value && (def = S_FindMusicCredit(S_MusicName())) != NULL)
|
||||
{
|
||||
V_DrawThinString(2, 2, V_SNAPTOTOP|V_SNAPTOLEFT|V_ALLOWLOWERCASE, va("\x1F"" %s", def->source));
|
||||
}
|
||||
|
||||
M_DrawGenericMenu();
|
||||
}
|
||||
|
||||
@@ -2825,9 +2868,8 @@ static void M_DrawCenteredMenu(void)
|
||||
static inline size_t M_StringHeight(const char *string)
|
||||
{
|
||||
size_t h = 8, i;
|
||||
const size_t strlength = strlen(string);
|
||||
|
||||
for (i = 0; i < strlength; i++)
|
||||
for (i = 0; i < strlen(string); i++)
|
||||
if (string[i] == '\n')
|
||||
h += 8;
|
||||
|
||||
@@ -3359,8 +3401,6 @@ static void M_DrawTemperature(INT32 x, fixed_t t)
|
||||
// bounds check
|
||||
if (t > FRACUNIT)
|
||||
t = FRACUNIT;
|
||||
/*else if (t < 0) -- not needed
|
||||
t = 0;*/
|
||||
|
||||
// scale
|
||||
if (t > 1)
|
||||
@@ -3967,6 +4007,7 @@ menudemo_t *demolist = NULL; // Replays that that have been checked to match wit
|
||||
|
||||
// Locked behind Lock_search_state
|
||||
menudemo_t *demolist_all = NULL; // All replays
|
||||
size_t demolist_all_size = 0;
|
||||
boolean replaynamesloaded = false;
|
||||
|
||||
#ifdef HAVE_THREADS
|
||||
@@ -3999,14 +4040,14 @@ static void ReplayNamesLoadThread(void* userdata)
|
||||
{
|
||||
Lock_search_state();
|
||||
|
||||
size_t demolist_all_size = sizedirmenu;
|
||||
menudemo_t *demolist_all_local = (menudemo_t*)malloc(sizeof(menudemo_t)*sizedirmenu);
|
||||
memcpy(demolist_all_local, demolist_all, sizeof(menudemo_t)*sizedirmenu);
|
||||
size_t demolist_all_size_local = demolist_all_size;
|
||||
menudemo_t *demolist_all_local = (menudemo_t*)malloc(sizeof(menudemo_t)*demolist_all_size_local);
|
||||
memcpy(demolist_all_local, demolist_all, sizeof(menudemo_t)*demolist_all_size_local);
|
||||
char *replaydirpath = (char*)userdata;
|
||||
|
||||
Unlock_search_state();
|
||||
|
||||
for (size_t i = 0; i < demolist_all_size; ++i)
|
||||
for (size_t i = 0; i < demolist_all_size_local; ++i)
|
||||
{
|
||||
if (demolist_all_local[i].type != MD_SUBDIR)
|
||||
{
|
||||
@@ -4022,9 +4063,9 @@ static void ReplayNamesLoadThread(void* userdata)
|
||||
|
||||
Lock_search_state();
|
||||
|
||||
if (fastcmp(menupath, replaydirpath))
|
||||
if (fastcmp(menupath, replaydirpath) && demolist_all)
|
||||
{
|
||||
memcpy(demolist_all, demolist_all_local, sizeof(menudemo_t)*sizedirmenu);
|
||||
memcpy(demolist_all, demolist_all_local, sizeof(menudemo_t)*demolist_all_size);
|
||||
replaynamesloaded = true;
|
||||
}
|
||||
|
||||
@@ -4158,6 +4199,7 @@ static void PrepReplayList(boolean reset)
|
||||
|
||||
Z_Free(demolist_all);
|
||||
demolist_all = Z_Calloc(sizeof(menudemo_t) * sizedirmenu, PU_STATIC, NULL);
|
||||
demolist_all_size = sizedirmenu;
|
||||
|
||||
for (i = 0; i < sizedirmenu; i++)
|
||||
{
|
||||
@@ -4206,6 +4248,7 @@ void M_ReplayHut(INT32 choice)
|
||||
}
|
||||
else if (!demo.inreplayhut)
|
||||
dir_on[menudepthleft] = 0;
|
||||
|
||||
demo.inreplayhut = true;
|
||||
|
||||
replayScrollTitle = 0; replayScrollDelay = TICRATE; replayScrollDir = 1;
|
||||
@@ -4297,6 +4340,9 @@ static void M_HandleReplayHutList(INT32 choice)
|
||||
if (!replaynamesloaded)
|
||||
return;
|
||||
|
||||
if (replayqueryfound == 0)
|
||||
return;
|
||||
|
||||
switch (dirmenu[dir_on[menudepthleft]][DIR_TYPE])
|
||||
{
|
||||
case EXT_FOLDER:
|
||||
@@ -4395,136 +4441,140 @@ static void DrawReplayHutReplayInfo(void)
|
||||
UINT8 *colormap;
|
||||
INT32 x, y, w, h;
|
||||
|
||||
switch (demolist[dir_on[menudepthleft]].type)
|
||||
const menudemo_t *replaydemolist = &demolist[dir_on[menudepthleft]];
|
||||
|
||||
switch (replaydemolist->type)
|
||||
{
|
||||
case MD_NOTLOADED:
|
||||
V_DrawCenteredString(160, 40, V_SNAPTOTOP|MENUCAPS, "Loading replay information...");
|
||||
break;
|
||||
|
||||
case MD_INVALID:
|
||||
V_DrawCenteredString(160, 40, V_SNAPTOTOP|warningflags|MENUCAPS, "This replay cannot be played.");
|
||||
break;
|
||||
|
||||
case MD_SUBDIR:
|
||||
break; // Can't think of anything to draw here right now
|
||||
|
||||
case MD_OUTDATED:
|
||||
V_DrawThinString(17, 64, V_SNAPTOTOP|V_ALLOWLOWERCASE|V_TRANSLUCENT|highlightflags, va("Recorded on an outdated version. %s", demolist[dir_on[menudepthleft]].version));
|
||||
/* FALLTHRU */
|
||||
default:
|
||||
// Draw level stuff
|
||||
x = 15; y = 15;
|
||||
|
||||
// A 160x100 image of the level as entry MAPxxP
|
||||
//CONS_Printf("%d %s\n", demolist[dir_on[menudepthleft]].map, G_BuildMapName(demolist[dir_on[menudepthleft]].map));
|
||||
lumpnum = W_CheckNumForName(va("%sP", G_BuildMapName(demolist[dir_on[menudepthleft]].map)));
|
||||
if (lumpnum != LUMPERROR)
|
||||
patch = (patch_t *)W_CachePatchNum(lumpnum, PU_PATCH);
|
||||
else
|
||||
patch = (patch_t *)W_CachePatchName("M_NOLVL", PU_PATCH);
|
||||
|
||||
if (!(demolist[dir_on[menudepthleft]].kartspeed & DF_ENCORE))
|
||||
V_DrawSmallScaledPatch(x, y, V_SNAPTOTOP, patch);
|
||||
else
|
||||
{
|
||||
w = patch->width;
|
||||
h = patch->height;
|
||||
V_DrawSmallScaledPatch(x+(w>>1), y, V_SNAPTOTOP|V_FLIP, patch);
|
||||
|
||||
{
|
||||
static angle_t rubyfloattime = 0;
|
||||
const fixed_t rubyheight = FINESINE(rubyfloattime>>ANGLETOFINESHIFT);
|
||||
V_DrawFixedPatch((x+(w>>2))<<FRACBITS, ((y+(h>>2))<<FRACBITS) - (rubyheight<<1), FRACUNIT, V_SNAPTOTOP, (patch_t *)W_CachePatchName("RUBYICON", PU_PATCH), NULL);
|
||||
rubyfloattime += FixedMul(ANGLE_MAX/NEWTICRATE, renderdeltatics);
|
||||
}
|
||||
}
|
||||
|
||||
x += 85;
|
||||
|
||||
if (mapheaderinfo[demolist[dir_on[menudepthleft]].map-1])
|
||||
{
|
||||
char *title = G_BuildMapTitle(demolist[dir_on[menudepthleft]].map);
|
||||
if (title)
|
||||
{
|
||||
V_DrawString(x, y, V_SNAPTOTOP|MENUCAPS, title);
|
||||
Z_Free(title);
|
||||
}
|
||||
}
|
||||
else
|
||||
V_DrawString(x, y, V_SNAPTOTOP|V_ALLOWLOWERCASE|V_TRANSLUCENT, "Level is not loaded.");
|
||||
|
||||
INT32 datew = 0;
|
||||
|
||||
if (demolist[dir_on[menudepthleft]].date[0] != '\0')
|
||||
{
|
||||
datew = V_StringWidth(demolist[dir_on[menudepthleft]].date, 0);
|
||||
V_DrawThinString(x, y+9, V_SNAPTOTOP|V_ALLOWLOWERCASE, va("%s", demolist[dir_on[menudepthleft]].date));
|
||||
}
|
||||
|
||||
if (demolist[dir_on[menudepthleft]].numlaps)
|
||||
V_DrawThinString(x+datew, y+9, V_SNAPTOTOP|V_ALLOWLOWERCASE, va("(%d laps)", demolist[dir_on[menudepthleft]].numlaps));
|
||||
|
||||
V_DrawString(x, y+20, V_SNAPTOTOP|V_ALLOWLOWERCASE, demolist[dir_on[menudepthleft]].gametype == GT_RACE ?
|
||||
va("Race (%s speed)", kartspeed_cons_t[demolist[dir_on[menudepthleft]].kartspeed & ~DF_ENCORE].strvalue) :
|
||||
"Battle Mode");
|
||||
|
||||
if (!demolist[dir_on[menudepthleft]].standings[0].ranking)
|
||||
{
|
||||
// No standings were loaded!
|
||||
V_DrawString(x, y+39, V_SNAPTOTOP|V_ALLOWLOWERCASE|V_TRANSLUCENT, "No standings available.");
|
||||
case MD_NOTLOADED:
|
||||
V_DrawCenteredString(160, 40, V_SNAPTOTOP|MENUCAPS, "Loading replay information...");
|
||||
break;
|
||||
}
|
||||
|
||||
V_DrawThinString(x, y+29, V_SNAPTOTOP|highlightflags|MENUCAPS, "Winner");
|
||||
V_DrawString(x+38, y+30, V_SNAPTOTOP|V_ALLOWLOWERCASE, demolist[dir_on[menudepthleft]].standings[0].name);
|
||||
case MD_INVALID:
|
||||
V_DrawCenteredString(160, 40, V_SNAPTOTOP|warningflags|MENUCAPS, "This replay cannot be played.");
|
||||
break;
|
||||
|
||||
if (demolist[dir_on[menudepthleft]].gametype == GT_RACE)
|
||||
{
|
||||
V_DrawThinString(x, y+39, V_SNAPTOTOP|highlightflags|MENUCAPS, "Time");
|
||||
}
|
||||
else
|
||||
{
|
||||
V_DrawThinString(x, y+39, V_SNAPTOTOP|highlightflags|MENUCAPS, "Score");
|
||||
}
|
||||
case MD_SUBDIR:
|
||||
break; // Can't think of anything to draw here right now
|
||||
|
||||
if (demolist[dir_on[menudepthleft]].standings[0].timeorscore == (UINT32_MAX-1))
|
||||
{
|
||||
V_DrawThinString(x+32, y+40-1, V_SNAPTOTOP|MENUCAPS, "No Contest");
|
||||
}
|
||||
else if (demolist[dir_on[menudepthleft]].gametype == GT_RACE)
|
||||
{
|
||||
V_DrawRightAlignedString(x+84, y+40, V_SNAPTOTOP, va("%d'%02d\"%02d",
|
||||
G_TicsToMinutes(demolist[dir_on[menudepthleft]].standings[0].timeorscore, true),
|
||||
G_TicsToSeconds(demolist[dir_on[menudepthleft]].standings[0].timeorscore),
|
||||
G_TicsToCentiseconds(demolist[dir_on[menudepthleft]].standings[0].timeorscore)
|
||||
));
|
||||
}
|
||||
else
|
||||
{
|
||||
V_DrawString(x+32, y+40, V_SNAPTOTOP, va("%d", demolist[dir_on[menudepthleft]].standings[0].timeorscore));
|
||||
}
|
||||
case MD_OUTDATED:
|
||||
V_DrawThinString(17, 64, V_SNAPTOTOP|V_ALLOWLOWERCASE|V_TRANSLUCENT|highlightflags, va("Recorded on an outdated version. %s", replaydemolist->version));
|
||||
/* FALLTHRU */
|
||||
default:
|
||||
// Draw level stuff
|
||||
x = 15; y = 15;
|
||||
|
||||
// Character face!
|
||||
if (demolist[dir_on[menudepthleft]].standings[0].skin < numskins && W_CheckNumForName(skins[demolist[dir_on[menudepthleft]].standings[0].skin].facewant) != LUMPERROR)
|
||||
{
|
||||
patch = facewantprefix[demolist[dir_on[menudepthleft]].standings[0].skin];
|
||||
colormap = R_GetTranslationColormap(
|
||||
demolist[dir_on[menudepthleft]].standings[0].skin,
|
||||
demolist[dir_on[menudepthleft]].standings[0].color,
|
||||
GTC_MENUCACHE);
|
||||
}
|
||||
else
|
||||
{
|
||||
patch = (patch_t *)W_CachePatchName("M_NOWANT", PU_PATCH);
|
||||
colormap = R_GetTranslationColormap(
|
||||
TC_RAINBOW,
|
||||
demolist[dir_on[menudepthleft]].standings[0].color,
|
||||
GTC_MENUCACHE);
|
||||
}
|
||||
// A 160x100 image of the level as entry MAPxxP
|
||||
//CONS_Printf("%d %s\n", replaydemolist->map, G_BuildMapName(replaydemolist->map));
|
||||
lumpnum = W_CheckNumForName(va("%sP", G_BuildMapName(replaydemolist->map)));
|
||||
if (lumpnum != LUMPERROR)
|
||||
patch = (patch_t *)W_CachePatchNum(lumpnum, PU_PATCH);
|
||||
else
|
||||
patch = (patch_t *)W_CachePatchName("M_NOLVL", PU_PATCH);
|
||||
|
||||
V_DrawMappedPatch(BASEVIDWIDTH-15 - patch->width, y+20, V_SNAPTOTOP, patch, colormap);
|
||||
if (!(replaydemolist->kartspeed & DF_ENCORE))
|
||||
V_DrawSmallScaledPatch(x, y, V_SNAPTOTOP, patch);
|
||||
else
|
||||
{
|
||||
w = patch->width;
|
||||
h = patch->height;
|
||||
V_DrawSmallScaledPatch(x+(w>>1), y, V_SNAPTOTOP|V_FLIP, patch);
|
||||
|
||||
break;
|
||||
{
|
||||
static angle_t rubyfloattime = 0;
|
||||
const fixed_t rubyheight = FINESINE(rubyfloattime>>ANGLETOFINESHIFT);
|
||||
V_DrawFixedPatch((x+(w>>2))<<FRACBITS, ((y+(h>>2))<<FRACBITS) - (rubyheight<<1), FRACUNIT, V_SNAPTOTOP, (patch_t *)W_CachePatchName("RUBYICON", PU_PATCH), NULL);
|
||||
rubyfloattime += FixedMul(ANGLE_MAX/NEWTICRATE, renderdeltatics);
|
||||
}
|
||||
}
|
||||
|
||||
x += 85;
|
||||
|
||||
if (mapheaderinfo[replaydemolist->map-1])
|
||||
{
|
||||
char *title = G_BuildMapTitle(replaydemolist->map);
|
||||
if (title)
|
||||
{
|
||||
V_DrawString(x, y, V_SNAPTOTOP|MENUCAPS, title);
|
||||
Z_Free(title);
|
||||
}
|
||||
}
|
||||
else
|
||||
V_DrawString(x, y, V_SNAPTOTOP|V_ALLOWLOWERCASE|V_TRANSLUCENT, "Level is not loaded.");
|
||||
|
||||
INT32 datew = 0;
|
||||
|
||||
if (replaydemolist->date[0] != '\0')
|
||||
{
|
||||
datew = V_StringWidth(replaydemolist->date, 0);
|
||||
V_DrawThinString(x, y+9, V_SNAPTOTOP|V_ALLOWLOWERCASE, va("%s", replaydemolist->date));
|
||||
}
|
||||
|
||||
if (replaydemolist->numlaps)
|
||||
V_DrawThinString(x+datew, y+9, V_SNAPTOTOP|V_ALLOWLOWERCASE, va("(%d laps)", replaydemolist->numlaps));
|
||||
|
||||
V_DrawString(x, y+20, V_SNAPTOTOP|V_ALLOWLOWERCASE, replaydemolist->gametype == GT_RACE ?
|
||||
va("Race (%s speed)", kartspeed_cons_t[replaydemolist->kartspeed & ~DF_ENCORE].strvalue) :
|
||||
"Battle Mode");
|
||||
|
||||
if (!replaydemolist->standings[0].ranking)
|
||||
{
|
||||
// No standings were loaded!
|
||||
V_DrawString(x, y+39, V_SNAPTOTOP|V_ALLOWLOWERCASE|V_TRANSLUCENT, "No standings available.");
|
||||
break;
|
||||
}
|
||||
|
||||
V_DrawThinString(x, y+29, V_SNAPTOTOP|highlightflags|MENUCAPS, "Winner");
|
||||
V_DrawString(x+38, y+30, V_SNAPTOTOP|V_ALLOWLOWERCASE, replaydemolist->standings[0].name);
|
||||
|
||||
if (replaydemolist->gametype == GT_RACE)
|
||||
{
|
||||
V_DrawThinString(x, y+39, V_SNAPTOTOP|highlightflags|MENUCAPS, "Time");
|
||||
}
|
||||
else
|
||||
{
|
||||
V_DrawThinString(x, y+39, V_SNAPTOTOP|highlightflags|MENUCAPS, "Score");
|
||||
}
|
||||
|
||||
const UINT32 timeorscore = replaydemolist->standings[0].timeorscore;
|
||||
|
||||
if (timeorscore == (UINT32_MAX-1))
|
||||
{
|
||||
V_DrawThinString(x+32, y+40-1, V_SNAPTOTOP|MENUCAPS, "No Contest");
|
||||
}
|
||||
else if (replaydemolist->gametype == GT_RACE)
|
||||
{
|
||||
V_DrawRightAlignedString(x+84, y+40, V_SNAPTOTOP, va("%d'%02d\"%02d",
|
||||
G_TicsToMinutes(timeorscore, true),
|
||||
G_TicsToSeconds(timeorscore),
|
||||
G_TicsToCentiseconds(timeorscore)
|
||||
));
|
||||
}
|
||||
else
|
||||
{
|
||||
V_DrawString(x+32, y+40, V_SNAPTOTOP, va("%d", timeorscore));
|
||||
}
|
||||
|
||||
// Character face!
|
||||
if (replaydemolist->standings[0].skin < numskins && W_CheckNumForName(skins[replaydemolist->standings[0].skin].facewant) != LUMPERROR)
|
||||
{
|
||||
patch = facewantprefix[replaydemolist->standings[0].skin];
|
||||
colormap = R_GetTranslationColormap(
|
||||
replaydemolist->standings[0].skin,
|
||||
replaydemolist->standings[0].color,
|
||||
GTC_MENUCACHE);
|
||||
}
|
||||
else
|
||||
{
|
||||
patch = (patch_t *)W_CachePatchName("M_NOWANT", PU_PATCH);
|
||||
colormap = R_GetTranslationColormap(
|
||||
TC_RAINBOW,
|
||||
replaydemolist->standings[0].color,
|
||||
GTC_MENUCACHE);
|
||||
}
|
||||
|
||||
V_DrawMappedPatch(BASEVIDWIDTH-15 - patch->width, y+20, V_SNAPTOTOP, patch, colormap);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4590,7 +4640,7 @@ static void M_DrawReplayHut(void)
|
||||
if (i == itemOn)
|
||||
cursory = localy;
|
||||
|
||||
if ((currentMenu->menuitems[i].status & IT_DISPLAY)==IT_STRING)
|
||||
if ((currentMenu->menuitems[i].status & IT_DISPLAY) == IT_STRING)
|
||||
V_DrawString(x, localy, V_SNAPTOTOP|V_SNAPTOLEFT, currentMenu->menuitems[i].text);
|
||||
else
|
||||
V_DrawString(x, localy, V_SNAPTOTOP|V_SNAPTOLEFT|highlightflags, currentMenu->menuitems[i].text);
|
||||
@@ -4670,8 +4720,7 @@ static void M_DrawReplayHut(void)
|
||||
}
|
||||
|
||||
// Draw the cursor
|
||||
V_DrawScaledPatch(currentMenu->x - 24, cursory, V_SNAPTOTOP|V_SNAPTOLEFT,
|
||||
(patch_t *)W_CachePatchName("M_CURSOR", PU_PATCH));
|
||||
V_DrawScaledPatch(currentMenu->x - 24, cursory, V_SNAPTOTOP|V_SNAPTOLEFT, (patch_t *)W_CachePatchName("M_CURSOR", PU_PATCH));
|
||||
V_DrawString(currentMenu->x, cursory, V_SNAPTOTOP|V_SNAPTOLEFT|highlightflags, currentMenu->menuitems[itemOn].text);
|
||||
|
||||
// Now draw some replay info!
|
||||
@@ -4703,34 +4752,38 @@ static void M_DrawReplayStartMenu(void)
|
||||
|
||||
M_DrawGenericBackgroundMenu();
|
||||
|
||||
const menudemo_t *replaydemolist = &demolist[dir_on[menudepthleft]];
|
||||
|
||||
#define STARTY 62-(replayScrollTitle>>1)
|
||||
// Draw rankings beyond first
|
||||
for (i = 1; i < MAXPLAYERS && demolist[dir_on[menudepthleft]].standings[i].ranking; i++)
|
||||
for (i = 1; i < MAXPLAYERS && replaydemolist->standings[i].ranking; i++)
|
||||
{
|
||||
patch_t *patch;
|
||||
UINT8 *colormap;
|
||||
|
||||
V_DrawRightAlignedString(BASEVIDWIDTH-100, STARTY + i*20, V_SNAPTOTOP|highlightflags, va("%2d", demolist[dir_on[menudepthleft]].standings[i].ranking));
|
||||
V_DrawThinString(BASEVIDWIDTH-96, STARTY + i*20, V_SNAPTOTOP|V_ALLOWLOWERCASE, demolist[dir_on[menudepthleft]].standings[i].name);
|
||||
V_DrawRightAlignedString(BASEVIDWIDTH-100, STARTY + i*20, V_SNAPTOTOP|highlightflags, va("%2d", replaydemolist->standings[i].ranking));
|
||||
V_DrawThinString(BASEVIDWIDTH-96, STARTY + i*20, V_SNAPTOTOP|V_ALLOWLOWERCASE, replaydemolist->standings[i].name);
|
||||
|
||||
if (demolist[dir_on[menudepthleft]].standings[i].timeorscore == UINT32_MAX-1)
|
||||
const UINT32 timeorscore = replaydemolist->standings[i].timeorscore;
|
||||
|
||||
if (timeorscore == UINT32_MAX-1)
|
||||
V_DrawThinString(BASEVIDWIDTH-92, STARTY + i*20 + 9, V_SNAPTOTOP, "NO CONTEST");
|
||||
else if (demolist[dir_on[menudepthleft]].gametype == GT_RACE)
|
||||
else if (replaydemolist->gametype == GT_RACE)
|
||||
V_DrawRightAlignedString(BASEVIDWIDTH-40, STARTY + i*20 + 9, V_SNAPTOTOP, va("%d'%02d\"%02d",
|
||||
G_TicsToMinutes(demolist[dir_on[menudepthleft]].standings[i].timeorscore, true),
|
||||
G_TicsToSeconds(demolist[dir_on[menudepthleft]].standings[i].timeorscore),
|
||||
G_TicsToCentiseconds(demolist[dir_on[menudepthleft]].standings[i].timeorscore)
|
||||
G_TicsToMinutes(timeorscore, true),
|
||||
G_TicsToSeconds(timeorscore),
|
||||
G_TicsToCentiseconds(timeorscore)
|
||||
));
|
||||
else
|
||||
V_DrawString(BASEVIDWIDTH-92, STARTY + i*20 + 9, V_SNAPTOTOP, va("%d", demolist[dir_on[menudepthleft]].standings[i].timeorscore));
|
||||
V_DrawString(BASEVIDWIDTH-92, STARTY + i*20 + 9, V_SNAPTOTOP, va("%d", timeorscore));
|
||||
|
||||
// Character face!
|
||||
if (demolist[dir_on[menudepthleft]].standings[i].skin < numskins && W_CheckNumForName(skins[demolist[dir_on[menudepthleft]].standings[i].skin].facerank) != LUMPERROR)
|
||||
if (replaydemolist->standings[i].skin < numskins && W_CheckNumForName(skins[replaydemolist->standings[i].skin].facerank) != LUMPERROR)
|
||||
{
|
||||
patch = facerankprefix[demolist[dir_on[menudepthleft]].standings[i].skin];
|
||||
patch = facerankprefix[replaydemolist->standings[i].skin];
|
||||
colormap = R_GetTranslationColormap(
|
||||
demolist[dir_on[menudepthleft]].standings[i].skin,
|
||||
demolist[dir_on[menudepthleft]].standings[i].color,
|
||||
replaydemolist->standings[i].skin,
|
||||
replaydemolist->standings[i].color,
|
||||
GTC_MENUCACHE);
|
||||
}
|
||||
else
|
||||
@@ -4738,7 +4791,7 @@ static void M_DrawReplayStartMenu(void)
|
||||
patch = (patch_t *)W_CachePatchName("M_NORANK", PU_PATCH);
|
||||
colormap = R_GetTranslationColormap(
|
||||
TC_RAINBOW,
|
||||
demolist[dir_on[menudepthleft]].standings[i].color,
|
||||
replaydemolist->standings[i].color,
|
||||
GTC_MENUCACHE);
|
||||
}
|
||||
|
||||
@@ -4775,10 +4828,10 @@ static void M_DrawReplayStartMenu(void)
|
||||
V_DrawFill(10, 10, 300, 60, V_SNAPTOTOP|239);
|
||||
DrawReplayHutReplayInfo();
|
||||
|
||||
V_DrawString(10, 72, V_SNAPTOTOP|highlightflags|V_ALLOWLOWERCASE, demolist[dir_on[menudepthleft]].title);
|
||||
V_DrawString(10, 72, V_SNAPTOTOP|highlightflags|V_ALLOWLOWERCASE, replaydemolist->title);
|
||||
|
||||
// Draw a warning prompt if needed
|
||||
switch (demolist[dir_on[menudepthleft]].addonstatus)
|
||||
switch (replaydemolist->addonstatus)
|
||||
{
|
||||
case DFILE_ERROR_CANNOTLOAD:
|
||||
warning = "Some addons in this replay cannot be loaded.\nYou can watch anyway, but desyncs may occur.";
|
||||
@@ -4807,6 +4860,9 @@ static void M_DrawReplayStartMenu(void)
|
||||
|
||||
void M_ResetDemoList(void)
|
||||
{
|
||||
Lock_search_state();
|
||||
replaynamesloaded = false;
|
||||
|
||||
Z_Free(demolist_all);
|
||||
demolist_all = NULL;
|
||||
|
||||
@@ -4814,6 +4870,8 @@ void M_ResetDemoList(void)
|
||||
demolist = NULL;
|
||||
|
||||
demo.inreplayhut = false;
|
||||
|
||||
Unlock_search_state();
|
||||
}
|
||||
|
||||
static boolean M_QuitReplayHut(void)
|
||||
@@ -4826,6 +4884,16 @@ static boolean M_QuitReplayHut(void)
|
||||
return true;
|
||||
}
|
||||
|
||||
// same as M_QuitReplayHut, but calls M_StopMessage
|
||||
void M_ReturnToTitleFromError(void)
|
||||
{
|
||||
M_StopMessage(0);
|
||||
// D_StartTitle does its own wipe, since GS_TIMEATTACK is now a complete gamestate.
|
||||
menuactive = false;
|
||||
D_StartTitle();
|
||||
M_ResetDemoList();
|
||||
}
|
||||
|
||||
static void M_HutStartReplay(INT32 choice)
|
||||
{
|
||||
(void)choice;
|
||||
@@ -6190,11 +6258,27 @@ void M_DrawTimeAttackMenu(void)
|
||||
|
||||
SHOWMODDEDGAME
|
||||
|
||||
const INT32 skinnum = max(cv_chooseskin.value-1, 0); // dont think its needed but better safe than sorry!
|
||||
const skin_t *skin = &skins[skinnum];
|
||||
|
||||
// Character face!
|
||||
if (W_CheckNumForName(skins[cv_chooseskin.value-1].facewant) != LUMPERROR)
|
||||
if (W_CheckNumForName(skin->facewant) != LUMPERROR)
|
||||
{
|
||||
UINT8 *colormap = R_GetTranslationColormap(cv_chooseskin.value-1, cv_playercolor.value, GTC_MENUCACHE);
|
||||
V_DrawMappedPatch(BASEVIDWIDTH-x - facewantprefix[cv_chooseskin.value-1]->width, y, 0, facewantprefix[cv_chooseskin.value-1], colormap);
|
||||
const INT32 charx = (BASEVIDWIDTH-x - facewantprefix[skinnum]->width);
|
||||
|
||||
UINT8 *colormap = NULL;
|
||||
|
||||
colormap = R_GetTranslationColormap(skinnum, cv_playercolor.value, GTC_MENUCACHE);
|
||||
V_DrawMappedPatch(charx, y, 0, facewantprefix[skinnum], colormap);
|
||||
|
||||
// draw stats
|
||||
// speed
|
||||
colormap = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_BLUEBERRY, GTC_CACHE);
|
||||
V_DrawFixedPatch((charx-6) << FRACBITS, (y-5) << FRACBITS, 3*FRACUNIT/2, 0, kp_facenum[min(9, max(1, skin->kartspeed))], colormap);
|
||||
// weight
|
||||
colormap = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_BURGUNDY, GTC_CACHE);
|
||||
V_DrawFixedPatch((charx+25) << FRACBITS, (y+25) << FRACBITS, 3*FRACUNIT/2, 0, kp_facenum[min(9, max(1, skin->kartweight))], colormap);
|
||||
// idk if kp_facenum are the best numbers for this case? but works with some scaling lul
|
||||
}
|
||||
|
||||
for (i = 0; i < currentMenu->numitems; ++i)
|
||||
@@ -6224,7 +6308,7 @@ void M_DrawTimeAttackMenu(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
const char *str = ((cv == &cv_chooseskin) ? skins[cv_chooseskin.value-1].realname : cv->string);
|
||||
const char *str = ((cv == &cv_chooseskin) ? skin->realname : cv->string);
|
||||
INT32 soffset = 40, strw = V_StringWidth(str, 0);
|
||||
|
||||
// hack to keep the menu from overlapping the level icon
|
||||
@@ -6269,10 +6353,12 @@ void M_DrawTimeAttackMenu(void)
|
||||
{
|
||||
tic_t lap = 0, time = 0;
|
||||
|
||||
if (mainrecords[cv_nextmap.value-1])
|
||||
const recorddata_t *currecord = mainrecords[cv_nextmap.value-1];
|
||||
|
||||
if (currecord)
|
||||
{
|
||||
lap = mainrecords[cv_nextmap.value-1]->lap;
|
||||
time = mainrecords[cv_nextmap.value-1]->time;
|
||||
lap = currecord->lap;
|
||||
time = currecord->time;
|
||||
}
|
||||
|
||||
V_DrawFill((BASEVIDWIDTH - vid.scaledwidth)>>1, 78, vid.scaledwidth, 36, 239);
|
||||
@@ -6294,6 +6380,7 @@ void M_DrawTimeAttackMenu(void)
|
||||
y = currentMenu->y+SP_TimeAttackMenu[i].alphaKey;
|
||||
V_DrawString(x, y, V_TRANSLUCENT|MENUCAPS, SP_TimeAttackMenu[i].text);
|
||||
ncv = (consvar_t *)SP_TimeAttackMenu[i].itemaction;
|
||||
|
||||
if (SP_TimeAttackMenu[i].status & IT_CV_STRING)
|
||||
{
|
||||
M_DrawTextBox(x + 32, y - 8, MAXPLAYERNAME, 1);
|
||||
@@ -6301,7 +6388,7 @@ void M_DrawTimeAttackMenu(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
const char *str = ((ncv == &cv_chooseskin) ? skins[cv_chooseskin.value-1].realname : ncv->string);
|
||||
const char *str = ((ncv == &cv_chooseskin) ? skin->realname : ncv->string);
|
||||
INT32 soffset = 40, strw = V_StringWidth(str, 0);
|
||||
|
||||
// hack to keep the menu from overlapping the level icon
|
||||
@@ -6806,12 +6893,22 @@ static void M_Connect(INT32 choice)
|
||||
COM_BufAddText(va("connect node %d\n", serverlist[serverlistsearched[choice-FIRSTSERVERLINE + serverlistpage * SERVERS_PER_PAGE]].node));
|
||||
}
|
||||
|
||||
static void M_ResetServerList(void)
|
||||
{
|
||||
serverlistpage = 0;
|
||||
oldserverlistpage = 0;
|
||||
|
||||
serverlistslidex = 0.0f;
|
||||
memset(serverlistsearched, 0, sizeof(serverlistsearched));
|
||||
serverlistsearchedcount = 0;
|
||||
}
|
||||
|
||||
static void M_Refresh(INT32 choice)
|
||||
{
|
||||
(void)choice;
|
||||
|
||||
// first page of servers
|
||||
serverlistpage = 0;
|
||||
M_ResetServerList();
|
||||
|
||||
CL_UpdateServerList();
|
||||
|
||||
@@ -6842,14 +6939,7 @@ static void M_DrawServerCountAndHorizontalBar(void)
|
||||
break;
|
||||
|
||||
default:
|
||||
if (serverlistultimatecount > serverlistcount)
|
||||
{
|
||||
text = va("%d/%d servers found%.*s",
|
||||
serverlistcount,
|
||||
serverlistultimatecount,
|
||||
I_GetTime() / NEWTICRATE % 4, "...");
|
||||
}
|
||||
else if (serverlistcount > 0)
|
||||
if (serverlistcount > 0)
|
||||
{
|
||||
text = va("%d servers found", serverlistcount);
|
||||
}
|
||||
@@ -7033,7 +7123,7 @@ static int ServerListEntryComparator_modified(const void *entry1, const void *en
|
||||
|
||||
void M_SortServerList(void)
|
||||
{
|
||||
switch(cv_serversort.value)
|
||||
switch (cv_serversort.value)
|
||||
{
|
||||
case 0: // Ping.
|
||||
qs22j(serverlist, serverlistcount, sizeof(serverelem_t), ServerListEntryComparator_time);
|
||||
@@ -7108,7 +7198,7 @@ static void M_ConnectMenu(INT32 choice)
|
||||
// we don't request a restart unless the filelist differs
|
||||
|
||||
// first page of servers
|
||||
serverlistpage = 0;
|
||||
M_ResetServerList();
|
||||
|
||||
CL_UpdateServerList();
|
||||
|
||||
@@ -7326,7 +7416,8 @@ static void M_DrawLevelSelectOnly(boolean leftfade, boolean rightfade)
|
||||
patch_t *PictureOfLevel;
|
||||
INT32 x, y, w, i, oldval, trans, dupadjust = (vid.scaledwidth - BASEVIDWIDTH)>>1;
|
||||
|
||||
if (levellistmode != LLM_RECORDATTACK) // so it doesent show in record attack menu
|
||||
// so it doesent show in record attack menu
|
||||
if (levellistmode != LLM_RECORDATTACK && M_SecretUnlocked(SECRET_ENCORE)) // gotta have it unlocked first ofc
|
||||
{
|
||||
char encoretoggle[32] = {0};
|
||||
const char *item1 = gamecontrol[0][gc_fire][0] != 0 ? G_KeynumToString(gamecontrol[0][gc_fire][0]) : NULL;
|
||||
@@ -7819,28 +7910,6 @@ static void M_HandleConnectIP(INT32 choice)
|
||||
// ========================
|
||||
// Tails 03-02-2002
|
||||
|
||||
static fixed_t multi_tics;
|
||||
static state_t *multi_state;
|
||||
|
||||
// this is set before entering the MultiPlayer setup menu,
|
||||
// for either player 1 or 2
|
||||
static char setupm_name[MAXPLAYERNAME+1];
|
||||
static textinput_t setupm_input;
|
||||
static player_t *setupm_player;
|
||||
static consvar_t *setupm_cvskin;
|
||||
static consvar_t *setupm_cvcolor;
|
||||
static consvar_t *setupm_cvname;
|
||||
static UINT8 setupm_skinxpos;
|
||||
static INT32 setupm_fakeskin;
|
||||
static INT32 setupm_fakecolor;
|
||||
|
||||
//variables used for other skin select menus
|
||||
static UINT8 setupm_skinypos;
|
||||
static INT32 setupm_skinselect;
|
||||
static boolean setupm_skinlockedselect;
|
||||
|
||||
static UINT8 setupm_playernum; //brap
|
||||
|
||||
#define SELECTEDSTATSCOUNT skinstatscount[setupm_skinxpos][setupm_skinypos]
|
||||
#define LASTSELECTEDSTAT skinstats[setupm_skinxpos][setupm_skinypos][skinstatscount[setupm_skinxpos][setupm_skinypos]]
|
||||
|
||||
@@ -8898,9 +8967,6 @@ static void M_DoSetupMultiPlayer(UINT8 pnum)
|
||||
multi_state = cv_skinselectspin.value == SKINSELECTSPIN_PAIN ? &states[S_KART_PAIN] : &states[mobjinfo[MT_PLAYER].seestate];
|
||||
multi_tics = multi_state->tics*FRACUNIT;
|
||||
|
||||
M_TextInputInit(&setupm_input, setupm_name, sizeof(setupm_name));
|
||||
M_TextInputSetString(&setupm_input, cv_playername.string);
|
||||
|
||||
switch (pnum)
|
||||
{
|
||||
case 1:
|
||||
@@ -8929,6 +8995,9 @@ static void M_DoSetupMultiPlayer(UINT8 pnum)
|
||||
break;
|
||||
}
|
||||
|
||||
M_TextInputInit(&setupm_input, setupm_name, sizeof(setupm_name));
|
||||
M_TextInputSetString(&setupm_input, setupm_cvname->string);
|
||||
|
||||
setupm_skinxpos = 4;
|
||||
setupm_skinypos = 0;
|
||||
setupm_skinlockedselect = false;
|
||||
@@ -9616,11 +9685,14 @@ static void M_ResetControls(INT32 choice)
|
||||
// ===============
|
||||
|
||||
//added : 30-01-98:
|
||||
#define MAXCOLUMNMODES 12 //max modes displayed in one column
|
||||
#define MAXMODEDESCS (MAXCOLUMNMODES*3)
|
||||
|
||||
static modedesc_t modedescs[MAXMODEDESCS];
|
||||
|
||||
void M_VideoModeMenu(INT32 choice)
|
||||
static void M_VideoModeMenu(INT32 choice)
|
||||
{
|
||||
INT32 i, nummodes, width, height;
|
||||
INT32 i, j, vdup, nummodes, width, height;
|
||||
const char *desc;
|
||||
|
||||
(void)choice;
|
||||
@@ -9634,30 +9706,54 @@ void M_VideoModeMenu(INT32 choice)
|
||||
nummodes = VID_NumModes();
|
||||
|
||||
// DOS does not skip mode 0, because mode 0 is ALWAYS present
|
||||
for (i = 0; i < nummodes && vidm_nummodes < MAXMODEDESCS; i++)
|
||||
i = 0;
|
||||
for (; i < nummodes && vidm_nummodes < MAXMODEDESCS; i++)
|
||||
{
|
||||
desc = VID_GetModeName(i);
|
||||
if (desc)
|
||||
{
|
||||
vdup = 0;
|
||||
|
||||
if (!desc)
|
||||
continue;
|
||||
// when a resolution exists both under VGA and VESA, keep the
|
||||
// VESA mode, which is always a higher modenum
|
||||
for (j = 0; j < vidm_nummodes; j++)
|
||||
{
|
||||
if (fastcmp(modedescs[j].desc, desc))
|
||||
{
|
||||
// mode(0): 320x200 is always standard VGA, not vesa
|
||||
if (modedescs[j].modenum)
|
||||
{
|
||||
modedescs[j].modenum = i;
|
||||
vdup = 1;
|
||||
|
||||
modedescs[vidm_nummodes].modenum = i;
|
||||
modedescs[vidm_nummodes].desc = desc;
|
||||
if (i == vid.modenum)
|
||||
vidm_selected = j;
|
||||
}
|
||||
else
|
||||
vdup = 1;
|
||||
|
||||
if (i == vid.modenum)
|
||||
vidm_selected = vidm_nummodes;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Pull out the width and height
|
||||
sscanf(desc, "%u%*c%u", &width, &height);
|
||||
if (!vdup)
|
||||
{
|
||||
modedescs[vidm_nummodes].modenum = i;
|
||||
modedescs[vidm_nummodes].desc = desc;
|
||||
|
||||
// Show resolutions above desktop res as red.
|
||||
if (I_CheckAboveDesktopRes(width, height))
|
||||
modedescs[vidm_nummodes].goodratio = 2;
|
||||
// Show multiples of 320x200 as green.
|
||||
else if (SCR_IsAspectCorrect(width, height))
|
||||
modedescs[vidm_nummodes].goodratio = 1;
|
||||
if (i == vid.modenum)
|
||||
vidm_selected = vidm_nummodes;
|
||||
|
||||
vidm_nummodes++;
|
||||
// Pull out the width and height
|
||||
sscanf(desc, "%u%*c%u", &width, &height);
|
||||
|
||||
// Show multiples of 320x200 as green.
|
||||
if (SCR_IsAspectCorrect(width, height))
|
||||
modedescs[vidm_nummodes].goodratio = 1;
|
||||
|
||||
vidm_nummodes++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
vidm_column_size = (vidm_nummodes+2) / 3;
|
||||
@@ -9696,6 +9792,13 @@ static void M_DrawHUDOptions(void)
|
||||
V_DrawRightAlignedString(x, y, highlightflags, "(");
|
||||
}
|
||||
|
||||
static void M_CameraMenu(INT32 choice)
|
||||
{
|
||||
(void)choice;
|
||||
OP_CamOptionsDef.prevMenu = currentMenu;
|
||||
M_SetupNextMenu(&OP_CamOptionsDef);
|
||||
}
|
||||
|
||||
static void M_LocalSkinMenu(INT32 choice)
|
||||
{
|
||||
(void)choice;
|
||||
@@ -9846,11 +9949,7 @@ static void M_DrawVideoMode(void)
|
||||
V_DrawString(row, col, highlightflags|MENUCAPS, modedescs[i].desc);
|
||||
// Show multiples of 320x200 as green.
|
||||
else
|
||||
{
|
||||
const UINT8 goodratio = modedescs[i].goodratio;
|
||||
const INT32 goodflag = ((goodratio == 2) ? warningflags : (goodratio == 1) ? recommendedflags : 0);
|
||||
V_DrawString(row, col, goodflag|MENUCAPS, modedescs[i].desc);
|
||||
}
|
||||
V_DrawString(row, col, ((modedescs[i].goodratio) ? recommendedflags : 0)|MENUCAPS, modedescs[i].desc);
|
||||
|
||||
col += 8;
|
||||
if ((i % vidm_column_size) == (vidm_column_size-1))
|
||||
@@ -9874,6 +9973,7 @@ static void M_DrawVideoMode(void)
|
||||
va("Wait %d second%s", testtime, (testtime > 1) ? "s" : ""));
|
||||
M_CentreText(OP_VideoModeDef.y + 158,
|
||||
"or press ESC to return");
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -9889,26 +9989,9 @@ static void M_DrawVideoMode(void)
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, OP_VideoModeDef.y + 138,
|
||||
recommendedflags|MENUCAPS, "Marked modes are recommended.");
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, OP_VideoModeDef.y + 146,
|
||||
warningflags|MENUCAPS, "Marked modes are above Desktop resolution");
|
||||
|
||||
if (rendermode == render_opengl)
|
||||
{
|
||||
#ifdef USE_FBO_OGL
|
||||
if (!cv_glframebuffer.value)
|
||||
#endif
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, OP_VideoModeDef.y + 154,
|
||||
warningflags|MENUCAPS, "and will have visual errors in OpenGL mode.");
|
||||
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, OP_VideoModeDef.y + 166,
|
||||
highlightflags|MENUCAPS, "Other modes may have visual errors.");
|
||||
}
|
||||
else
|
||||
{
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, OP_VideoModeDef.y + 154,
|
||||
highlightflags|MENUCAPS, "Other modes may have visual errors.");
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, OP_VideoModeDef.y + 166,
|
||||
highlightflags|MENUCAPS, "Larger modes may have performance issues.");
|
||||
}
|
||||
highlightflags|MENUCAPS, "Other modes may have visual errors.");
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, OP_VideoModeDef.y + 158,
|
||||
highlightflags|MENUCAPS, "Larger modes may have performance issues.");
|
||||
}
|
||||
|
||||
// Draw the cursor for the VidMode menu
|
||||
|
||||
+3
-5
@@ -223,11 +223,6 @@ extern menu_t *currentMenu;
|
||||
extern menu_t MainDef;
|
||||
extern menu_t SP_LoadDef;
|
||||
|
||||
#define MAXCOLUMNMODES 12 //max modes displayed in one column
|
||||
#define MAXMODEDESCS (MAXCOLUMNMODES*3)
|
||||
extern menu_t OP_VideoModeDef;
|
||||
void M_VideoModeMenu(INT32 choice);
|
||||
|
||||
// Call upon joystick hotplug
|
||||
void M_SetupJoystickMenu(INT32 choice);
|
||||
extern menu_t OP_JoystickSetDef;
|
||||
@@ -306,12 +301,15 @@ void SaturnHud_menu_Onchange(void);
|
||||
|
||||
void GameFocus_menu_Onchange (void);
|
||||
|
||||
void ShowLocalskinMenu_Onchange(void);
|
||||
|
||||
#ifdef HWRENDER
|
||||
void M_UpdateOGLMenu(void);
|
||||
#endif
|
||||
|
||||
void M_ResetDemoList(void);
|
||||
void M_ReplayHut(INT32 choice);
|
||||
void M_ReturnToTitleFromError(void);
|
||||
void M_SetPlaybackMenuPointer(void);
|
||||
|
||||
void Nextmap_OnChange(void);
|
||||
|
||||
+53
-56
@@ -600,7 +600,7 @@ static menuitem_t OP_MainMenu[] =
|
||||
{IT_SUBMENU|IT_STRING, NULL, "Game Focus Options...", &OP_FocusOptionsDef, 33},
|
||||
|
||||
{IT_SUBMENU|IT_STRING, NULL, "HUD Options...", &OP_HUDOptionsDef, 46},
|
||||
{IT_SUBMENU|IT_STRING, NULL, "Camera Options...", &OP_CamOptionsDef, 56},
|
||||
{IT_CALL|IT_STRING, NULL, "Camera Options...", M_CameraMenu, 56},
|
||||
{IT_SUBMENU|IT_STRING, NULL, "Gameplay Options...", &OP_GameOptionsDef, 66},
|
||||
{IT_SUBMENU|IT_STRING, NULL, "Server Options...", &OP_ServerOptionsDef, 76},
|
||||
|
||||
@@ -610,7 +610,7 @@ static menuitem_t OP_MainMenu[] =
|
||||
{IT_CALL|IT_STRING, NULL, "Tricks & Secrets (F1)", M_Manual, 109},
|
||||
{IT_CALL|IT_STRING, NULL, "Play Credits", M_Credits, 119},
|
||||
|
||||
{IT_SUBMENU|IT_STRING, NULL, "Accessibility Options...",&OP_AccessibilityDef, 132},
|
||||
{IT_SUBMENU|IT_STRING, NULL, "Accessibility Options...", &OP_AccessibilityDef, 132},
|
||||
{IT_SUBMENU|IT_STRING, NULL, "Saturn Options...", &OP_SaturnDef, 142},
|
||||
|
||||
{IT_SUBMENU|IT_STRING, NULL, "Bird...", &OP_BirdDef, 152},
|
||||
@@ -800,7 +800,7 @@ static menuitem_t OP_MouseOptionsMenu[] =
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Mouse Turning", &cv_mouseturn, 20},
|
||||
{IT_STRING | IT_CVAR, NULL, "Invert Mouse", &cv_invertmouse, 30},
|
||||
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Mouse X Speed", &cv_mousesens, 40},
|
||||
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Mouse X Speed", &cv_mousexsens, 40},
|
||||
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Mouse Y Speed", &cv_mouseysens, 50},
|
||||
};
|
||||
|
||||
@@ -1153,13 +1153,6 @@ static menuitem_t OP_SoundAdvancedMenu[] =
|
||||
{IT_STRING | IT_CVAR, NULL, "Stereo Seperation", &cv_stereosep, 35},
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_FLUIDSYNTH
|
||||
{IT_HEADER, NULL, "MIDI Settings", NULL, NULL, OPENMPT_MENUOFFSET},
|
||||
{IT_STRING | IT_CVAR | IT_CV_STRING, NULL, "Sound Font File", NULL, &cv_midisoundfontpath, OPENMPT_MENUOFFSET+12},
|
||||
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Chorus", NULL, &cv_midichorus, OPENMPT_MENUOFFSET+40},
|
||||
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Reverb", NULL, &cv_midireverb, OPENMPT_MENUOFFSET+50},
|
||||
#endif
|
||||
|
||||
{IT_HEADER, NULL, "Misc", NULL, 45},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Same Sound Limit", &cv_samesoundlimit, 55},
|
||||
@@ -1187,11 +1180,6 @@ static const char* OP_SoundAdvancedTooltips[] =
|
||||
"Which Amiga should be used for .mod playback?",
|
||||
#endif
|
||||
"How far should the four channels in .mod be panned?",
|
||||
#endif
|
||||
#ifdef HAVE_FLUIDSYNTH
|
||||
"Which MIDI soundfont to use",
|
||||
"Controls the chorus of MIDI playback\n setting this too high might cause some instruments to be overexposed",
|
||||
"Controls the reverb of MIDI playback\n setting this too high might cause notes to be drawn out",
|
||||
#endif
|
||||
NULL,
|
||||
"How many times is the same sound allowed to play at once?\nIf 0 theres no limit.",
|
||||
@@ -1337,13 +1325,14 @@ static menuitem_t OP_HUDOptionsMenu[] =
|
||||
{IT_STRING | IT_CVAR, NULL, "Menu Highlights", &cons_menuhighlight, 95},
|
||||
// highlight info - (GOOD HIGHLIGHT, WARNING HIGHLIGHT) - 110 (see M_DrawHUDOptions)
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Console Text Size", &cv_constextsize, 120},
|
||||
{IT_STRING | IT_CVAR, NULL, "Console Text Size", &cv_constextsize, 120},
|
||||
{IT_STRING | IT_CVAR, NULL, "Show Console Prints in Menu",&cons_consoleprintinmenu, 130},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Show Track Addon Name", &cv_showtrackaddon, 135},
|
||||
{IT_STRING | IT_CVAR, NULL, "Show Track Addon Name", &cv_showtrackaddon, 145},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Show All Maps", &cv_showallmaps, 145},
|
||||
{IT_STRING | IT_CVAR, NULL, "Show All Maps", &cv_showallmaps, 155},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "2D character select", &cv_skinselectmenu, 155},
|
||||
{IT_STRING | IT_CVAR, NULL, "2D character select", &cv_skinselectmenu, 165},
|
||||
};
|
||||
|
||||
static menuitem_t OP_CamOptionsMenu[] =
|
||||
@@ -1657,7 +1646,7 @@ static menuitem_t OP_AccessibilityMenu[] =
|
||||
|
||||
{IT_STRING|IT_CVAR, NULL, "Quake Screenshakes", &cv_screenquake, 60},
|
||||
|
||||
{IT_SUBMENU|IT_STRING, NULL, "Camera Options...", &OP_CamOptionsDef, 65},
|
||||
{IT_CALL|IT_STRING, NULL, "Camera Options...", M_CameraMenu, 65},
|
||||
|
||||
{IT_HEADER, NULL, "Audio", NULL, 75},
|
||||
|
||||
@@ -1860,15 +1849,16 @@ static menuitem_t OP_SaturnHudMenu[] =
|
||||
{IT_STRING|IT_CVAR, NULL, "Player Angle Visual", &cv_showminimapangle, 150},
|
||||
|
||||
{IT_STRING|IT_CVAR, NULL, "Music Credits", &cv_songcredits, 160},
|
||||
{IT_STRING|IT_CVAR, NULL, "Music Credits on Pause", &cv_pausesongcredits, 165},
|
||||
|
||||
{IT_STRING|IT_CVAR, NULL, "Beta Intermissionscreen", &cv_betainterscreen, 170},
|
||||
{IT_STRING|IT_CVAR, NULL, "Beta Intermissionscreen", &cv_betainterscreen, 175},
|
||||
|
||||
{IT_STRING|IT_CVAR, NULL, "Show Director Prompt", &cv_showdirectorhud, 180},
|
||||
{IT_STRING|IT_CVAR, NULL, "Show Director Prompt", &cv_showdirectorhud, 185},
|
||||
|
||||
{IT_STRING|IT_SUBMENU, NULL, "Nametags...", &OP_NametagDef, 190},
|
||||
{IT_STRING|IT_SUBMENU, NULL, "Driftgauge...", &OP_DriftGaugeDef, 195},
|
||||
{IT_STRING|IT_SUBMENU, NULL, "Nametags...", &OP_NametagDef, 195},
|
||||
{IT_STRING|IT_SUBMENU, NULL, "Driftgauge...", &OP_DriftGaugeDef, 200},
|
||||
|
||||
{IT_SUBMENU|IT_STRING, NULL, "Hud Offsets...", &OP_HudOffsetDef, 205},
|
||||
{IT_SUBMENU|IT_STRING, NULL, "Hud Offsets...", &OP_HudOffsetDef, 210},
|
||||
};
|
||||
|
||||
static const char* OP_SaturnHudTooltips[] =
|
||||
@@ -1895,6 +1885,7 @@ static const char* OP_SaturnHudTooltips[] =
|
||||
"Erratically rotate player icons during spinouts.",
|
||||
"Visualize the player facing angle.",
|
||||
"Show the Music Credits and which style.",
|
||||
"Show the Music Credits while in pause menu.",
|
||||
"Make the Intermission screen look like in beta versions of Kart!\nEither with background or just the rest.",
|
||||
"Show the Director Toggle prompt when spectating.",
|
||||
"Nametag Options.",
|
||||
@@ -1982,47 +1973,46 @@ static menuitem_t OP_HudOffsetMenu[] =
|
||||
// absolutely crazy how many people put work into this at this point <3
|
||||
static menuitem_t OP_SaturnCreditsMenu[] =
|
||||
{
|
||||
// in no particular order besides me and indev <3
|
||||
{IT_HEADER, NULL, "Thanks to all contributers <3", NULL, 0},
|
||||
|
||||
{IT_STRING2+IT_SPACE, NULL, "Alug", NULL, 10},
|
||||
{IT_STRING2+IT_SPACE, NULL, "Indev", NULL, 20},
|
||||
{IT_STRING2+IT_SPACE, NULL, "Haya", NULL, 30},
|
||||
{IT_STRING2+IT_SPACE, NULL, "Nepdisk", NULL, 40},
|
||||
{IT_STRING2+IT_SPACE, NULL, "GenericHeroGuy", NULL, 50},
|
||||
{IT_STRING2+IT_SPACE, NULL, "xyzzy", NULL, 60},
|
||||
{IT_STRING2+IT_SPACE, NULL, "Chearii", NULL, 70},
|
||||
{IT_STRING2+IT_SPACE, NULL, "riomccloud", NULL, 80},
|
||||
{IT_STRING2+IT_SPACE, NULL, "chromaticpipe", NULL, 90},
|
||||
{IT_STRING2+IT_SPACE, NULL, "PAS", NULL, 100},
|
||||
{IT_STRING2+IT_SPACE, NULL, "$HOME", NULL, 110},
|
||||
{IT_STRING2+IT_SPACE, NULL, "Achii", NULL, 120},
|
||||
{IT_STRING2+IT_SPACE, NULL, "Anonimus", NULL, 130},
|
||||
{IT_STRING2+IT_SPACE, NULL, "scizor300", NULL, 140},
|
||||
{IT_STRING2+IT_SPACE, NULL, "Lugent", NULL, 150},
|
||||
{IT_STRING2+IT_SPACE, NULL, "Alug Indev", NULL, 10},
|
||||
{IT_STRING2+IT_SPACE, NULL, "Haya Nepdisk", NULL, 20},
|
||||
{IT_STRING2+IT_SPACE, NULL, "GenericHeroGuy xyzzy", NULL, 30},
|
||||
{IT_STRING2+IT_SPACE, NULL, "Chearii riomccloud", NULL, 40},
|
||||
{IT_STRING2+IT_SPACE, NULL, "chromaticpipe PAS", NULL, 50},
|
||||
{IT_STRING2+IT_SPACE, NULL, "$HOME yama", NULL, 60},
|
||||
{IT_STRING2+IT_SPACE, NULL, "Achii scizor300", NULL, 70},
|
||||
{IT_STRING2+IT_SPACE, NULL, "Superjustinbros Lugent", NULL, 80},
|
||||
|
||||
{IT_HEADER, NULL, "", NULL, 124},
|
||||
{IT_HEADER, NULL, "", NULL, 74},
|
||||
|
||||
{IT_STRING2+IT_SPACE, NULL, "Sunflower Yuz", NULL, 180},
|
||||
{IT_STRING2+IT_SPACE, NULL, "Democrab EXpand", NULL, 190},
|
||||
{IT_STRING2+IT_SPACE, NULL, "Nexit Spee", NULL, 200},
|
||||
{IT_STRING2+IT_SPACE, NULL, "jin", NULL, 210},
|
||||
{IT_STRING2+IT_SPACE, NULL, "Sunflower Yuz", NULL, 110},
|
||||
{IT_STRING2+IT_SPACE, NULL, "Democrab EXpand", NULL, 120},
|
||||
{IT_STRING2+IT_SPACE, NULL, "Nexit Spee", NULL, 130},
|
||||
{IT_STRING2+IT_SPACE, NULL, "jin Mompi", NULL, 140},
|
||||
{IT_STRING2+IT_SPACE, NULL, "Phoenix", NULL, 150},
|
||||
|
||||
{IT_HEADER, NULL, "Special Thanks <3", NULL, 168},
|
||||
{IT_HEADER, NULL, "Special Thanks <3", NULL, 130},
|
||||
|
||||
{IT_STRING2+IT_SPACE, NULL, "All of Sunflower's Garden", NULL, 178},
|
||||
{IT_STRING2+IT_SPACE, NULL, "The Moe Mansion and Birdhouse Team", NULL, 188},
|
||||
{IT_STRING2+IT_SPACE, NULL, "Galactice for Galaxy", NULL, 198},
|
||||
{IT_STRING2+IT_SPACE, NULL, "All of Sunflower's Garden", NULL, 140},
|
||||
{IT_STRING2+IT_SPACE, NULL, "Blankart", NULL, 150},
|
||||
{IT_STRING2+IT_SPACE, NULL, "SRB2 Legacy", NULL, 160},
|
||||
{IT_STRING2+IT_SPACE, NULL, "SRB2 Classic", NULL, 170},
|
||||
{IT_STRING2+IT_SPACE, NULL, "The Moe Mansion and Birdhouse Team", NULL, 180},
|
||||
{IT_STRING2+IT_SPACE, NULL, "Galactice for Galaxy", NULL, 190},
|
||||
|
||||
{IT_STRING+IT_SPACE, NULL, "", NULL, 198}, // dummy text I
|
||||
{IT_STRING, NULL, "", NULL, 258}, // dummy text II
|
||||
{IT_STRING+IT_SPACE, NULL, "", NULL, 228}, // dummy text I
|
||||
{IT_STRING, NULL, "", NULL, 278}, // dummy text II
|
||||
};
|
||||
|
||||
// sry we dont have space for this anymore :c
|
||||
/*static const char* OP_CreditTooltips[] =
|
||||
// sry we dont have space for this anymore :c < now we have again, for now..... TODO: finally stop being a lazy ass and make a cool credits screen
|
||||
static const char* OP_CreditTooltips[] =
|
||||
{
|
||||
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
|
||||
// this sucks lol note to self: we need as many NULLs as we have entries in OP_SaturnCreditsMenu - 1
|
||||
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
|
||||
"Thanks everyone! <3"
|
||||
};*/
|
||||
};
|
||||
|
||||
|
||||
static menuitem_t OP_BirdMenu[] =
|
||||
@@ -2192,6 +2182,9 @@ static menuitem_t OP_AdvancedBirdMenu[] =
|
||||
{IT_STRING | IT_CVAR, NULL, "Fade Back from Grow", &cv_growmusicfade, 20},
|
||||
{IT_STRING | IT_CVAR, NULL, "Fade Out Before Respawning", &cv_respawnfademusicout, 30},
|
||||
{IT_STRING | IT_CVAR, NULL, "Fade Back In While Respawning", &cv_respawnfademusicback, 40},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Resync Threshold", &cv_music_resync_threshold, 60},
|
||||
{IT_STRING | IT_CVAR, NULL, "Resync Special Music Only", &cv_music_resync_powerups_only, 70},
|
||||
};
|
||||
|
||||
static const char* OP_AdvancedBirdTooltips[] =
|
||||
@@ -2201,6 +2194,8 @@ static const char* OP_AdvancedBirdTooltips[] =
|
||||
"Fade in music after Grow.",
|
||||
"Fade out music before respawning.",
|
||||
"Fade in music while respawning.",
|
||||
"Threshold for syncing music.",
|
||||
"Only sync special music.",
|
||||
};
|
||||
|
||||
enum
|
||||
@@ -2210,6 +2205,8 @@ enum
|
||||
fadegrow,
|
||||
respawnfadeout,
|
||||
respawnfadein,
|
||||
syncthreshold,
|
||||
syncspecialonly,
|
||||
};
|
||||
|
||||
menuitem_t OP_CustomCvarMenu[MAXMENUCCVARS];
|
||||
@@ -2622,7 +2619,7 @@ menu_t OP_EraseDataDef = DEFAULTMENUSTYLE("M_DATA", OP_EraseDataMenu, &O
|
||||
menu_t OP_AccessibilityDef = DEFAULTSCROLLSTYLE(NULL, OP_AccessibilityMenu, &OP_MainDef, 30, 30, OP_AccessibilityTooltips);
|
||||
|
||||
menu_t OP_SaturnDef = DEFAULTSCROLLSTYLE(NULL, OP_SaturnMenu, &OP_MainDef, 30, 30, OP_SaturnTooltips);
|
||||
menu_t OP_SaturnCreditsDef = DEFAULTMENUSTYLE(NULL, OP_SaturnCreditsMenu, &OP_SaturnDef, 30, 0, NULL); // OP_CreditTooltips no space :c
|
||||
menu_t OP_SaturnCreditsDef = DEFAULTMENUSTYLE(NULL, OP_SaturnCreditsMenu, &OP_SaturnDef, 30, 2, OP_CreditTooltips); // OP_CreditTooltips no space :c
|
||||
|
||||
menu_t OP_SaturnHudDef = DEFAULTSCROLLSTYLE(NULL, OP_SaturnHudMenu, &OP_SaturnDef, 30, 30, OP_SaturnHudTooltips);
|
||||
menu_t OP_PlayerDistortDef = DEFAULTSCROLLSTYLE("M_VIDEO", OP_PlayerDistortMenu, &OP_SaturnDef, 30, 30, OP_PlayerDistortTooltips);
|
||||
|
||||
+6
-7
@@ -1693,23 +1693,22 @@ char *M_GetToken(const char *inputString)
|
||||
}
|
||||
|
||||
|
||||
const char * M_Ftrim(double f)
|
||||
const char * M_Ftrim (double f)
|
||||
{
|
||||
static char dig[9];/* "0." + 6 digits (6 is printf's default) */
|
||||
int i;
|
||||
|
||||
/* I know I said it's the default, but just in case... */
|
||||
sprintf(dig, "%.6f", fabs(modf(f, &f)));
|
||||
|
||||
/* trim trailing zeroes */
|
||||
for (i = strlen(dig)-1; dig[i] == '0'; --i)
|
||||
;
|
||||
|
||||
if (dig[i] == '.')/* :NOTHING: */
|
||||
return "";
|
||||
|
||||
dig[i + 1] = '\0';
|
||||
return &dig[1];/* skip the 0 */
|
||||
else
|
||||
{
|
||||
dig[i + 1] = '\0';
|
||||
return &dig[1];/* skip the 0 */
|
||||
}
|
||||
}
|
||||
|
||||
/** Count bits in a number.
|
||||
|
||||
+1
-2
@@ -687,8 +687,7 @@ void T_ContinuousFalling(levelspecthink_t *faller)
|
||||
// P_SectorCheckWater
|
||||
//
|
||||
// Like P_MobjCheckWater, but takes a sector instead of a mobj.
|
||||
static fixed_t P_SectorCheckWater(sector_t *analyzesector,
|
||||
sector_t *elevatorsec)
|
||||
static fixed_t P_SectorCheckWater(sector_t *analyzesector, sector_t *elevatorsec)
|
||||
{
|
||||
fixed_t watertop;
|
||||
|
||||
|
||||
@@ -272,9 +272,6 @@ extern consvar_t cv_gravity;
|
||||
|
||||
void P_RespawnSpecials(void);
|
||||
|
||||
extern mobjtype_t g_doomednum_to_mobjtype[UINT16_MAX];
|
||||
void CalculateDoomednumToMobjtype(void);
|
||||
|
||||
mobj_t *P_AllocateMobj(void);
|
||||
mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type);
|
||||
|
||||
|
||||
+32
-39
@@ -10448,21 +10448,6 @@ void P_PrecipitationEffects(void)
|
||||
}
|
||||
}
|
||||
|
||||
mobjtype_t g_doomednum_to_mobjtype[UINT16_MAX];
|
||||
|
||||
void CalculateDoomednumToMobjtype(void)
|
||||
{
|
||||
memset(g_doomednum_to_mobjtype, MT_NULL, sizeof(g_doomednum_to_mobjtype));
|
||||
|
||||
for (size_t i = MT_NULL+1; i < NUMMOBJTYPES; i++)
|
||||
{
|
||||
if (mobjinfo[i].doomednum > 0 && mobjinfo[i].doomednum <= UINT16_MAX)
|
||||
{
|
||||
g_doomednum_to_mobjtype[ mobjinfo[i].doomednum ] = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// P_RespawnSpecials
|
||||
//
|
||||
@@ -10542,9 +10527,11 @@ void P_RespawnSpecials(void)
|
||||
ss = R_PointInSubsector(x, y);
|
||||
|
||||
// find which type to spawn
|
||||
i = g_doomednum_to_mobjtype[mthing->type];
|
||||
for (i = 0; i < NUMMOBJTYPES; i++)
|
||||
if (mthing->type == mobjinfo[i].doomednum)
|
||||
break;
|
||||
|
||||
if (i <= MT_NULL || i >= NUMMOBJTYPES) // prevent creation of objects with this type -- Monster Iestyn 17/12/17
|
||||
if (i == NUMMOBJTYPES) // prevent creation of objects with this type -- Monster Iestyn 17/12/17
|
||||
{
|
||||
// 3D Mode start Thing is unlikely to be added to the que,
|
||||
// so don't bother checking for that specific type
|
||||
@@ -10985,9 +10972,11 @@ void P_SpawnMapThing(mapthing_t *mthing)
|
||||
if (objectplacing)
|
||||
{
|
||||
// find which type to spawn
|
||||
i = g_doomednum_to_mobjtype[mthing->type];
|
||||
for (i = 0; i < NUMMOBJTYPES; i++)
|
||||
if (mthing->type == mobjinfo[i].doomednum)
|
||||
break;
|
||||
|
||||
if (i <= MT_NULL || i >= NUMMOBJTYPES)
|
||||
if (i == NUMMOBJTYPES)
|
||||
{
|
||||
if (mthing->type == 3328) // 3D Mode start Thing
|
||||
return;
|
||||
@@ -11055,9 +11044,13 @@ void P_SpawnMapThing(mapthing_t *mthing)
|
||||
}
|
||||
|
||||
// find which type to spawn
|
||||
i = g_doomednum_to_mobjtype[mthing->type];
|
||||
for (i = 0; i < NUMMOBJTYPES; i++)
|
||||
{
|
||||
if (mthing->type == mobjinfo[i].doomednum)
|
||||
break;
|
||||
}
|
||||
|
||||
if (i <= MT_NULL || i >= NUMMOBJTYPES)
|
||||
if (i == NUMMOBJTYPES)
|
||||
{
|
||||
if (mthing->type == 3328) // 3D Mode start Thing
|
||||
return;
|
||||
@@ -11750,32 +11743,32 @@ ML_NOCLIMB : Direction not controllable
|
||||
if (mobj->flags & MF_MONITOR)
|
||||
{
|
||||
// flag for strong/weak random boxes
|
||||
if (i == MT_SUPERRINGBOX || i == MT_PRUP ||
|
||||
i == MT_SNEAKERTV || i == MT_INV ||
|
||||
i == MT_WHITETV || i == MT_GREENTV ||
|
||||
i == MT_YELLOWTV || i == MT_BLUETV ||
|
||||
i == MT_BLACKTV || i == MT_PITYTV ||
|
||||
i == MT_RECYCLETV || i == MT_MIXUPBOX)
|
||||
if (mthing->type == mobjinfo[MT_SUPERRINGBOX].doomednum || mthing->type == mobjinfo[MT_PRUP].doomednum ||
|
||||
mthing->type == mobjinfo[MT_SNEAKERTV].doomednum || mthing->type == mobjinfo[MT_INV].doomednum ||
|
||||
mthing->type == mobjinfo[MT_WHITETV].doomednum || mthing->type == mobjinfo[MT_GREENTV].doomednum ||
|
||||
mthing->type == mobjinfo[MT_YELLOWTV].doomednum || mthing->type == mobjinfo[MT_BLUETV].doomednum ||
|
||||
mthing->type == mobjinfo[MT_BLACKTV].doomednum || mthing->type == mobjinfo[MT_PITYTV].doomednum ||
|
||||
mthing->type == mobjinfo[MT_RECYCLETV].doomednum || mthing->type == mobjinfo[MT_MIXUPBOX].doomednum)
|
||||
mobj->flags2 |= MF2_AMBUSH;
|
||||
}
|
||||
else if (
|
||||
i != MT_AXIS &&
|
||||
i != MT_AXISTRANSFER &&
|
||||
i != MT_AXISTRANSFERLINE &&
|
||||
i != MT_NIGHTSBUMPER &&
|
||||
i != MT_STARPOST)
|
||||
|
||||
else if (mthing->type != mobjinfo[MT_AXIS].doomednum &&
|
||||
mthing->type != mobjinfo[MT_AXISTRANSFER].doomednum &&
|
||||
mthing->type != mobjinfo[MT_AXISTRANSFERLINE].doomednum &&
|
||||
mthing->type != mobjinfo[MT_NIGHTSBUMPER].doomednum &&
|
||||
mthing->type != mobjinfo[MT_STARPOST].doomednum)
|
||||
mobj->flags2 |= MF2_AMBUSH;
|
||||
}
|
||||
|
||||
if (mthing->options & MTF_OBJECTSPECIAL)
|
||||
{
|
||||
// flag for strong/weak random boxes
|
||||
if (i == MT_SUPERRINGBOX || i == MT_PRUP ||
|
||||
i == MT_SNEAKERTV || i == MT_INV ||
|
||||
i == MT_WHITETV || i == MT_GREENTV ||
|
||||
i == MT_YELLOWTV || i == MT_BLUETV ||
|
||||
i == MT_BLACKTV || i == MT_PITYTV ||
|
||||
i == MT_RECYCLETV || i == MT_MIXUPBOX)
|
||||
if (mthing->type == mobjinfo[MT_SUPERRINGBOX].doomednum || mthing->type == mobjinfo[MT_PRUP].doomednum ||
|
||||
mthing->type == mobjinfo[MT_SNEAKERTV].doomednum || mthing->type == mobjinfo[MT_INV].doomednum ||
|
||||
mthing->type == mobjinfo[MT_WHITETV].doomednum || mthing->type == mobjinfo[MT_GREENTV].doomednum ||
|
||||
mthing->type == mobjinfo[MT_YELLOWTV].doomednum || mthing->type == mobjinfo[MT_BLUETV].doomednum ||
|
||||
mthing->type == mobjinfo[MT_BLACKTV].doomednum || mthing->type == mobjinfo[MT_PITYTV].doomednum ||
|
||||
mthing->type == mobjinfo[MT_RECYCLETV].doomednum || mthing->type == mobjinfo[MT_MIXUPBOX].doomednum)
|
||||
mobj->flags2 |= MF2_STRONGBOX;
|
||||
|
||||
// Requires you to be in bonus time to activate
|
||||
|
||||
+1
-6
@@ -285,7 +285,7 @@ typedef struct mobj_s
|
||||
// Info for drawing: position.
|
||||
fixed_t x, y, z;
|
||||
fixed_t old_x, old_y, old_z; // position interpolation
|
||||
fixed_t old_x2, old_y2, old_z2;
|
||||
fixed_t old_z2; // ok guess we need that...
|
||||
|
||||
// More list: links in sector (if needed)
|
||||
struct mobj_s *bnext;
|
||||
@@ -297,7 +297,6 @@ typedef struct mobj_s
|
||||
// More drawing info: to determine current sprite.
|
||||
angle_t angle, pitch, roll; // orientation
|
||||
angle_t old_angle, old_pitch, old_roll; // orientation interpolation
|
||||
angle_t old_angle2, old_pitch2, old_roll2;
|
||||
angle_t rollangle;
|
||||
spritenum_t sprite; // used to find patch_t and flip value
|
||||
UINT32 frame; // frame number, plus bits see p_pspr.h
|
||||
@@ -307,9 +306,7 @@ typedef struct mobj_s
|
||||
fixed_t spritexscale, spriteyscale;
|
||||
fixed_t spritexoffset, spriteyoffset;
|
||||
fixed_t old_spritexscale, old_spriteyscale;
|
||||
fixed_t old_spritexscale2, old_spriteyscale2;
|
||||
fixed_t old_spritexoffset, old_spriteyoffset;
|
||||
fixed_t old_spritexoffset2, old_spriteyoffset2;
|
||||
INT16 lightlevel; // Add to sector lightlevel, -255 - 255
|
||||
|
||||
fixed_t realxscale, realyscale; // funn-E streeetch
|
||||
@@ -320,7 +317,6 @@ typedef struct mobj_s
|
||||
//sloperollangle
|
||||
angle_t sloperoll, slopepitch;
|
||||
angle_t old_sloperoll, old_slopepitch;
|
||||
angle_t old_sloperoll2, old_slopepitch2;
|
||||
angle_t pitch_sprite, roll_sprite;
|
||||
|
||||
struct msecnode_s *touching_sectorlist; // a linked list of sectors where this object appears
|
||||
@@ -395,7 +391,6 @@ typedef struct mobj_s
|
||||
|
||||
fixed_t scale;
|
||||
fixed_t old_scale; // interpolation
|
||||
fixed_t old_scale2;
|
||||
fixed_t destscale;
|
||||
fixed_t scalespeed;
|
||||
|
||||
|
||||
@@ -1965,6 +1965,21 @@ FUNCINLINE static ATTRINLINE player_t *LoadPlayer(UINT32 player)
|
||||
// Loads a mobj_t from a save game
|
||||
//
|
||||
|
||||
static mobjtype_t g_doomednum_to_mobjtype[UINT16_MAX];
|
||||
|
||||
static void CalculateDoomednumToMobjtype(void)
|
||||
{
|
||||
memset(g_doomednum_to_mobjtype, MT_NULL, sizeof(g_doomednum_to_mobjtype));
|
||||
|
||||
for (size_t i = MT_NULL+1; i < NUMMOBJTYPES; i++)
|
||||
{
|
||||
if (mobjinfo[i].doomednum > 0 && mobjinfo[i].doomednum <= UINT16_MAX)
|
||||
{
|
||||
g_doomednum_to_mobjtype[ mobjinfo[i].doomednum ] = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void LoadMobjThinker(savebuffer_t *save, actionf_p1 thinker)
|
||||
{
|
||||
mobj_t *mobj;
|
||||
@@ -2864,6 +2879,10 @@ static void P_NetUnArchiveThinkers(savebuffer_t *save)
|
||||
if (READUINT32(save->p) != ARCHIVEBLOCK_THINKERS)
|
||||
I_Error("Bad $$$.sav at archive block Thinkers");
|
||||
|
||||
// Pre-calculate this lookup, because it was wasting
|
||||
// a shit ton of time loading mobj thinkers.
|
||||
CalculateDoomednumToMobjtype();
|
||||
|
||||
// remove all the current thinkers
|
||||
for (currentthinker = thinkercap.next; currentthinker != &thinkercap; currentthinker = next)
|
||||
{
|
||||
|
||||
+4
-10
@@ -680,11 +680,11 @@ INT32 P_AddLevelFlat(const char *flatname, levelflat_t *levelflat)
|
||||
if (i == numlevelflats)
|
||||
{
|
||||
// store the name
|
||||
strlcpy(levelflat->name, flatname, sizeof (levelflat->name));
|
||||
strlcpy(levelflat->name, flatname, sizeof(levelflat->name));
|
||||
strupr(levelflat->name);
|
||||
|
||||
// store the flat lump number
|
||||
levelflat->lumpnum = R_GetFlatNumForName(flatname);
|
||||
levelflat->lumpnum = R_GetFlatNumForName(levelflat->name);
|
||||
levelflat->baselumpnum = LUMPERROR;
|
||||
|
||||
P_CheckCyanFlat(levelflat);
|
||||
@@ -727,11 +727,11 @@ INT32 P_AddLevelFlatRuntime(const char *flatname)
|
||||
levelflat = levelflats+i;
|
||||
|
||||
// store the name
|
||||
strlcpy(levelflat->name, flatname, sizeof (levelflat->name));
|
||||
strlcpy(levelflat->name, flatname, sizeof(levelflat->name));
|
||||
strupr(levelflat->name);
|
||||
|
||||
// store the flat lump number
|
||||
levelflat->lumpnum = R_GetFlatNumForName(flatname);
|
||||
levelflat->lumpnum = R_GetFlatNumForName(levelflat->name);
|
||||
levelflat->baselumpnum = LUMPERROR;
|
||||
|
||||
P_CheckCyanFlat(levelflat);
|
||||
@@ -812,8 +812,6 @@ static void P_LoadSectors(UINT8 *data)
|
||||
ss->tag = SHORT(ms->tag);
|
||||
|
||||
ss->flags |= SF_FLIPSPECIAL_FLOOR;
|
||||
|
||||
ss->soundorg.thinker.function = (actionf_p1)P_MobjThinker;
|
||||
}
|
||||
|
||||
// set the sky flat num
|
||||
@@ -2863,10 +2861,6 @@ boolean P_SetupLevel(boolean fromnetsave, boolean reloadinggamestate)
|
||||
|
||||
P_ResetDynamicSlopes();
|
||||
|
||||
// Pre-calculate this lookup, because it was wasting
|
||||
// a shit ton of time loading mobj thinkers.
|
||||
CalculateDoomednumToMobjtype();
|
||||
|
||||
P_SpawnMapThings();
|
||||
|
||||
P_SpawnEmblems(!fromnetsave);
|
||||
|
||||
+7
-117
@@ -53,7 +53,7 @@ mobj_t *skyboxmo[2] = {};
|
||||
#define MAXFLATSIZE (2048<<FRACBITS)
|
||||
|
||||
/** Animated texture definition.
|
||||
* Used for ::harddefs and for loading an ANIMATED lump from a wad.
|
||||
* Used for loading an ANIMATED lump from a wad.
|
||||
*
|
||||
* Animations are defined by the first and last frame (i.e., flat or texture).
|
||||
* The animation sequence uses all flats between the start and end entry, in
|
||||
@@ -97,104 +97,6 @@ anim_t *lastanim = NULL;
|
||||
anim_t *anims = NULL; /// \todo free leak
|
||||
static size_t maxanims;
|
||||
|
||||
//
|
||||
// P_InitPicAnims
|
||||
//
|
||||
/** Hardcoded animation sequences.
|
||||
* Used if no ANIMATED lump is found in a loaded wad.
|
||||
*/
|
||||
static animdef_t harddefs[] =
|
||||
{
|
||||
// flat animations.
|
||||
{false, "LITEY3", "LITEY1", 4},
|
||||
{false, "FWATER16", "FWATER1", 4},
|
||||
{false, "BWATER16", "BWATER01", 4},
|
||||
{false, "LWATER16", "LWATER1", 4},
|
||||
{false, "WATER7", "WATER0", 4},
|
||||
{false, "LAVA4", "LAVA1", 8},
|
||||
{false, "DLAVA4", "DLAVA1", 8},
|
||||
{false, "RLAVA8", "RLAVA1", 8},
|
||||
{false, "LITER3", "LITER1", 8},
|
||||
{false, "SURF08", "SURF01", 4},
|
||||
|
||||
{false, "CHEMG16", "CHEMG01", 4}, // THZ Chemical gunk
|
||||
{false, "GOOP16", "GOOP01", 4}, // Green chemical gunk
|
||||
{false, "OIL16", "OIL01", 4}, // Oil
|
||||
{false, "THZBOXF4", "THZBOXF1", 2}, // Moved up with the flats
|
||||
{false, "ALTBOXF4", "ALTBOXF1", 2},
|
||||
|
||||
{false, "LITEB3", "LITEB1", 4},
|
||||
{false, "LITEN3", "LITEN1", 4},
|
||||
{false, "ACZRFL1H", "ACZRFL1A", 4},
|
||||
{false, "ACZRFL2H", "ACZRFL2A", 4},
|
||||
{false, "EGRIDF3", "EGRIDF1", 4},
|
||||
{false, "ERZFAN4", "ERZFAN1", 1},
|
||||
{false, "ERZFANR4", "ERZFANR1", 1},
|
||||
{false, "DISCO4", "DISCO1", 15},
|
||||
|
||||
// animated textures
|
||||
{true, "GFALL4", "GFALL1", 2}, // Short waterfall
|
||||
{true, "CFALL4", "CFALL1", 2}, // Long waterfall
|
||||
{true, "TFALL4", "TFALL1", 2}, // THZ Chemical fall
|
||||
{true, "AFALL4", "AFALL1", 2}, // Green Chemical fall
|
||||
{true, "QFALL4", "QFALL1", 2}, // Quicksand fall
|
||||
{true, "Q2FALL4", "Q2FALL1", 2},
|
||||
{true, "Q3FALL4", "Q3FALL1", 2},
|
||||
{true, "Q4FALL4", "Q4FALL1", 2},
|
||||
{true, "Q5FALL4", "Q5FALL1", 2},
|
||||
{true, "Q6FALL4", "Q6FALL1", 2},
|
||||
{true, "Q7FALL4", "Q7FALL1", 2},
|
||||
{true, "LFALL4", "LFALL1", 2},
|
||||
{true, "MFALL4", "MFALL1", 2},
|
||||
{true, "OFALL4", "OFALL1", 2},
|
||||
{true, "DLAVA4", "DLAVA1", 8},
|
||||
{true, "ERZLASA2", "ERZLASA1", 1},
|
||||
{true, "ERZLASB4", "ERZLASB1", 1},
|
||||
{true, "ERZLASC4", "ERZLASC1", 1},
|
||||
{true, "THZBOX04", "THZBOX01", 2},
|
||||
{true, "ALTBOX04", "ALTBOX01", 2},
|
||||
{true, "SFALL4", "SFALL1", 4}, // Lava fall
|
||||
{true, "RVZFALL8", "RVZFALL1", 4},
|
||||
{true, "BFALL4", "BFALL1", 2}, // HPZ waterfall
|
||||
{true, "GREYW3", "GREYW1", 4},
|
||||
{true, "BLUEW3", "BLUEW1", 4},
|
||||
{true, "COMP6", "COMP4", 4},
|
||||
{true, "RED3", "RED1", 4},
|
||||
{true, "YEL3", "YEL1", 4},
|
||||
{true, "ACWRFL1D", "ACWRFL1A", 1},
|
||||
{true, "ACWRFL2D", "ACWRFL2A", 1},
|
||||
{true, "ACWRFL3D", "ACWRFL3A", 1},
|
||||
{true, "ACWRFL4D", "ACWRFL4A", 1},
|
||||
{true, "ACWRP1D", "ACWRP1A", 1},
|
||||
{true, "ACWRP2D", "ACWRP2A", 1},
|
||||
{true, "ACZRP1D", "ACZRP1A", 1},
|
||||
{true, "ACZRP2D", "ACZRP2A", 1},
|
||||
{true, "OILFALL4", "OILFALL1", 2},
|
||||
{true, "SOLFALL4", "SOLFALL1", 2},
|
||||
{true, "DOWN1C", "DOWN1A", 4},
|
||||
{true, "DOWN2C", "DOWN2A", 4},
|
||||
{true, "DOWN3D", "DOWN3A", 4},
|
||||
{true, "DOWN4C", "DOWN4A", 4},
|
||||
{true, "DOWN5C", "DOWN5A", 4},
|
||||
{true, "UP1C", "UP1A", 4},
|
||||
{true, "UP2C", "UP2A", 4},
|
||||
{true, "UP3D", "UP3A", 4},
|
||||
{true, "UP4C", "UP4A", 4},
|
||||
{true, "UP5C", "UP5A", 4},
|
||||
{true, "EGRID3", "EGRID1", 4},
|
||||
{true, "ERFANW4", "ERFANW1", 1},
|
||||
{true, "ERFANX4", "ERFANX1", 1},
|
||||
{true, "DISCOD4", "DISCOD1", 15},
|
||||
{true, "DANCE4", "DANCE1", 8},
|
||||
{true, "SKY135", "SKY132", 2},
|
||||
{true, "APPLMS4", "APPLMS1", 2},
|
||||
{true, "APBOXW3", "APBOXW1", 2},
|
||||
{true, "ERZLAZC4", "ERZLAZC1", 4},
|
||||
|
||||
// End of line
|
||||
{ -1, "", "", 0},
|
||||
};
|
||||
|
||||
// Animating line specials
|
||||
|
||||
// Init animated textures
|
||||
@@ -208,7 +110,7 @@ void P_ParseAnimationDefintion(SINT8 istexture);
|
||||
|
||||
/** Sets up texture and flat animations.
|
||||
*
|
||||
* Converts an ::animdef_t array loaded from ::harddefs or a lump into
|
||||
* Converts an ::animdef_t array loaded from a lump into
|
||||
* ::anim_t format.
|
||||
*
|
||||
* Issues an error if any animation cycles are invalid.
|
||||
@@ -254,7 +156,9 @@ void P_InitPicAnims(void)
|
||||
{
|
||||
memcpy(&(animdefs[i].istexture), currentPos, 1); // istexture, 1 byte
|
||||
memcpy(animdefs[i].endname, (currentPos + 1), 9); // endname, 9 bytes
|
||||
animdefs[i].endname[8] = '\0';
|
||||
memcpy(animdefs[i].startname, (currentPos + 10), 9); // startname, 9 bytes
|
||||
animdefs[i].startname[8] = '\0';
|
||||
memcpy(&(animdefs[i].speed), (currentPos + 19), 4); // speed, 4 bytes
|
||||
}
|
||||
|
||||
@@ -275,11 +179,6 @@ void P_InitPicAnims(void)
|
||||
strncpy(animdefs[maxanims].startname, "", 9);
|
||||
animdefs[maxanims].speed = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
animdefs = harddefs;
|
||||
for (maxanims = 0; animdefs[maxanims].istexture != -1; maxanims++);
|
||||
}
|
||||
|
||||
if (anims)
|
||||
free(anims);
|
||||
@@ -318,10 +217,7 @@ void P_InitPicAnims(void)
|
||||
animdefs[i].startname, animdefs[i].endname);
|
||||
}
|
||||
|
||||
if (animdefs == harddefs)
|
||||
lastanim->speed = animdefs[i].speed;
|
||||
else
|
||||
lastanim->speed = LONG(animdefs[i].speed);
|
||||
lastanim->speed = LONG(animdefs[i].speed);
|
||||
lastanim++;
|
||||
}
|
||||
|
||||
@@ -330,8 +226,7 @@ void P_InitPicAnims(void)
|
||||
|
||||
// Clear animdefs now that we're done with it.
|
||||
// We'll only be using anims from now on.
|
||||
if (animdefs != harddefs)
|
||||
Z_Free(animdefs);
|
||||
Z_Free(animdefs);
|
||||
|
||||
animdefs = NULL;
|
||||
}
|
||||
@@ -3986,12 +3881,7 @@ DoneSection2:
|
||||
|
||||
player->tossdelay = 3;
|
||||
}
|
||||
#if 0
|
||||
// Event - Final Lap
|
||||
// Still works for GME, but disabled for consistency
|
||||
if (G_RaceGametype() && player->laps >= (UINT8)(cv_numlaps.value - 1))
|
||||
S_SpeedMusic(1.2f);
|
||||
#endif
|
||||
|
||||
if (player->laps >= (unsigned)cv_numlaps.value)
|
||||
{
|
||||
if (P_IsLocalPlayer(player))
|
||||
|
||||
+143
-133
@@ -78,7 +78,6 @@ void P_Thrust(mobj_t *mo, angle_t angle, fixed_t move)
|
||||
mo->momy += FixedMul(move, FINESINE(angle));
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// P_InstaThrust
|
||||
// Moves the given origin along a given angle instantly.
|
||||
@@ -239,10 +238,11 @@ void P_GiveEmerald(boolean spawnObj)
|
||||
if (spawnObj)
|
||||
{
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (playeringame[i])
|
||||
P_SetMobjState(P_SpawnMobj(players[i].mo->x, players[i].mo->y, players[i].mo->z + players[i].mo->info->height, MT_GOTEMERALD),
|
||||
mobjinfo[MT_GOTEMERALD].spawnstate + em);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -352,9 +352,9 @@ void P_DoPlayerPain(player_t *player, mobj_t *source, mobj_t *inflictor)
|
||||
player->mo->z++;
|
||||
|
||||
if (player->mo->eflags & MFE_UNDERWATER)
|
||||
P_SetObjectMomZ(player->mo, FixedDiv(10511*FRACUNIT,2600*FRACUNIT), false);
|
||||
P_SetObjectMomZ(player->mo, FixedDiv(10511*FRACUNIT, 2600*FRACUNIT), false);
|
||||
else
|
||||
P_SetObjectMomZ(player->mo, FixedDiv(69*FRACUNIT,10*FRACUNIT), false);
|
||||
P_SetObjectMomZ(player->mo, FixedDiv(69*FRACUNIT, 10*FRACUNIT), false);
|
||||
}
|
||||
|
||||
ang = R_PointToAngle2(inflictor->x, inflictor->y, player->mo->x, player->mo->y); // SRB2kart
|
||||
@@ -619,11 +619,11 @@ boolean P_EndingMusic(player_t *player)
|
||||
// Check for if this is valid or not
|
||||
if (splitscreen)
|
||||
{
|
||||
if (!((players[displayplayers[0]].exiting || (players[displayplayers[0]].pflags & PF_TIMEOVER))
|
||||
|| (players[displayplayers[1]].exiting || (players[displayplayers[1]].pflags & PF_TIMEOVER))
|
||||
|| ((splitscreen < 2) && (players[displayplayers[2]].exiting || (players[displayplayers[2]].pflags & PF_TIMEOVER)))
|
||||
|| ((splitscreen < 3) && (players[displayplayers[3]].exiting || (players[displayplayers[3]].pflags & PF_TIMEOVER)))))
|
||||
return false;
|
||||
for (UINT8 i = 0; i <= splitscreen; i++)
|
||||
{
|
||||
if (!(players[displayplayers[i]].exiting || (players[displayplayers[i]].pflags & PF_TIMEOVER)))
|
||||
return false;
|
||||
}
|
||||
|
||||
bestlocalplayer = &players[displayplayers[0]];
|
||||
bestlocalpos = ((players[displayplayers[0]].pflags & PF_TIMEOVER) ? MAXPLAYERS+1 : getPlayerPos(&players[displayplayers[0]]));
|
||||
@@ -703,71 +703,74 @@ void P_RestoreMusic(player_t *player)
|
||||
|
||||
// Event - Level Start
|
||||
if (leveltime < MUSICSTARTTIME)
|
||||
S_StartMapMusic();
|
||||
else // see also where time overs are handled - search for "lives = 2" in this file
|
||||
{
|
||||
INT32 wantedmus = 0; // 0 is level music, 1 is invincibility, 2 is grow
|
||||
S_StartMapMusic();
|
||||
return;
|
||||
}
|
||||
|
||||
if (splitscreen)
|
||||
{
|
||||
INT32 bestlocaltimer = 1;
|
||||
// see also where time overs are handled - search for "lives = 2" in this file
|
||||
INT32 wantedmus = 0; // 0 is level music, 1 is invincibility, 2 is grow
|
||||
|
||||
if (splitscreen)
|
||||
{
|
||||
INT32 bestlocaltimer = 1;
|
||||
|
||||
#define setbests(p) \
|
||||
if (players[p].playerstate == PST_LIVE) \
|
||||
{ \
|
||||
if (players[p].kartstuff[k_growshrinktimer] > bestlocaltimer) \
|
||||
{ wantedmus = 2; bestlocaltimer = players[p].kartstuff[k_growshrinktimer]; } \
|
||||
else if (players[p].kartstuff[k_invincibilitytimer] > bestlocaltimer) \
|
||||
{ wantedmus = 1; bestlocaltimer = players[p].kartstuff[k_invincibilitytimer]; } \
|
||||
}
|
||||
setbests(displayplayers[0]);
|
||||
setbests(displayplayers[1]);
|
||||
if (splitscreen > 1)
|
||||
setbests(displayplayers[2]);
|
||||
if (splitscreen > 2)
|
||||
setbests(displayplayers[3]);
|
||||
if (players[p].playerstate == PST_LIVE) \
|
||||
{ \
|
||||
if (players[p].kartstuff[k_growshrinktimer] > bestlocaltimer) \
|
||||
{ wantedmus = 2; bestlocaltimer = players[p].kartstuff[k_growshrinktimer]; } \
|
||||
else if (players[p].kartstuff[k_invincibilitytimer] > bestlocaltimer) \
|
||||
{ wantedmus = 1; bestlocaltimer = players[p].kartstuff[k_invincibilitytimer]; } \
|
||||
}
|
||||
|
||||
setbests(displayplayers[0]);
|
||||
setbests(displayplayers[1]);
|
||||
if (splitscreen > 1)
|
||||
setbests(displayplayers[2]);
|
||||
if (splitscreen > 2)
|
||||
setbests(displayplayers[3]);
|
||||
#undef setbests
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
if (player->playerstate == PST_LIVE)
|
||||
{
|
||||
if (player->playerstate == PST_LIVE)
|
||||
{
|
||||
if (player->kartstuff[k_growshrinktimer] > 1)
|
||||
wantedmus = 2;
|
||||
else if (player->kartstuff[k_invincibilitytimer] > 1)
|
||||
wantedmus = 1;
|
||||
}
|
||||
if (player->kartstuff[k_growshrinktimer] > 1)
|
||||
wantedmus = 2;
|
||||
else if (player->kartstuff[k_invincibilitytimer] > 1)
|
||||
wantedmus = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Item - Grow
|
||||
if (wantedmus == 2 && cv_growmusic.value == 1)
|
||||
{
|
||||
S_ChangeMusicInternal("kgrow", true);
|
||||
S_SetRestoreMusicFadeInCvar(&cv_growmusicfade);
|
||||
}
|
||||
// Item - Invincibility
|
||||
else if (wantedmus == 1 && cv_supermusic.value == 1)
|
||||
{
|
||||
S_ChangeMusicInternal("kinvnc", true);
|
||||
S_SetRestoreMusicFadeInCvar(&cv_invincmusicfade);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Item - Grow
|
||||
if (wantedmus == 2 && cv_growmusic.value == 1)
|
||||
{
|
||||
S_ChangeMusicInternal("kgrow", true);
|
||||
S_SetRestoreMusicFadeInCvar(&cv_growmusicfade);
|
||||
}
|
||||
// Item - Invincibility
|
||||
else if (wantedmus == 1 && cv_supermusic.value == 1)
|
||||
{
|
||||
S_ChangeMusicInternal("kinvnc", true);
|
||||
S_SetRestoreMusicFadeInCvar(&cv_invincmusicfade);
|
||||
}
|
||||
else
|
||||
{
|
||||
#if 0
|
||||
// Event - Final Lap
|
||||
// Still works for GME, but disabled for consistency
|
||||
if (G_RaceGametype() && player->laps >= (UINT8)(cv_numlaps.value - 1))
|
||||
S_SpeedMusic(1.2f);
|
||||
// Event - Final Lap
|
||||
// Still works for GME, but disabled for consistency
|
||||
if (G_RaceGametype() && player->laps >= (UINT8)(cv_numlaps.value - 1))
|
||||
S_SpeedMusic(1.2f);
|
||||
#endif
|
||||
if (mapmusic.resume && cv_resume.value) // mapmusresume will be 0 anyways when birdmusic stuff is disabled
|
||||
position = mapmusic.resume;
|
||||
else
|
||||
position = mapmusic.position;
|
||||
if (mapmusic.resume && cv_resume.value) // mapmusresume will be 0 anyways when birdmusic stuff is disabled
|
||||
position = mapmusic.resume;
|
||||
else
|
||||
position = mapmusic.position;
|
||||
|
||||
S_ChangeMusicEx(mapmusic.name, mapmusic.flags, true, position, 0, S_GetRestoreMusicFadeIn());
|
||||
S_ClearRestoreMusicFadeInCvar();
|
||||
mapmusic.resume = 0;
|
||||
}
|
||||
S_ChangeMusicEx(mapmusic.name, mapmusic.flags, true, position, 0, S_GetRestoreMusicFadeIn());
|
||||
S_ClearRestoreMusicFadeInCvar();
|
||||
mapmusic.resume = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -971,18 +974,7 @@ fixed_t P_GetPlayerHeight(player_t *player)
|
||||
//
|
||||
fixed_t P_GetPlayerSpinHeight(player_t *player)
|
||||
{
|
||||
return FixedMul(FixedMul(player->mo->info->height, player->mo->scale),2*FRACUNIT/3);
|
||||
}
|
||||
|
||||
//
|
||||
// P_GetLocalPlayerForNum
|
||||
//
|
||||
// Returns the player
|
||||
// on the local machine for given number.
|
||||
//
|
||||
player_t *P_GetLocalPlayerForNum(UINT8 pnum)
|
||||
{
|
||||
return (&players[P_GetLocalPlayerNumForNum(pnum)]);
|
||||
return FixedMul(FixedMul(player->mo->info->height, player->mo->scale), 2*FRACUNIT/3);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -996,6 +988,17 @@ INT32 P_GetLocalPlayerNumForNum(UINT8 pnum)
|
||||
return (pnum == 0 ? consoleplayer : displayplayers[pnum]);
|
||||
}
|
||||
|
||||
//
|
||||
// P_GetLocalPlayerForNum
|
||||
//
|
||||
// Returns the player
|
||||
// on the local machine for given number.
|
||||
//
|
||||
player_t *P_GetLocalPlayerForNum(UINT8 pnum)
|
||||
{
|
||||
return (&players[P_GetLocalPlayerNumForNum(pnum)]);
|
||||
}
|
||||
|
||||
INT32 P_GetLocalPlayerNumForPlayer(const player_t *player)
|
||||
{
|
||||
for (UINT8 i = 0; i <= splitscreen; i++)
|
||||
@@ -1022,7 +1025,9 @@ boolean P_IsLocalPlayer(const player_t *player)
|
||||
for (i = 0; i <= splitscreen; i++)
|
||||
{
|
||||
if (player == P_GetLocalPlayerForNum(i))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -1041,7 +1046,9 @@ boolean P_IsLocalPlayerNum(UINT8 pnum)
|
||||
for (i = 0; i <= splitscreen; i++)
|
||||
{
|
||||
if (pnum == P_GetLocalPlayerNumForNum(i))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -1069,7 +1076,9 @@ boolean P_IsDisplayPlayer(const player_t *player)
|
||||
}
|
||||
|
||||
if (player == &players[displayplayers[i]])
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -1229,19 +1238,20 @@ mobj_t *P_SpawnGhostMobj(mobj_t *mobj)
|
||||
mobj->flags &= ~MF_DONTENCOREMAP;
|
||||
|
||||
// Copy interpolation data :)
|
||||
ghost->old_x = mobj->old_x2;
|
||||
ghost->old_y = mobj->old_y2;
|
||||
ghost->old_z = mobj->old_z2;
|
||||
ghost->old_angle = (mobj->player ? mobj->player->old_frameangle2 : mobj->old_angle2);
|
||||
ghost->old_pitch = mobj->old_pitch2;
|
||||
ghost->old_roll = mobj->old_roll2;
|
||||
ghost->old_sloperoll = mobj->old_sloperoll2;
|
||||
ghost->old_slopepitch = mobj->old_slopepitch2;
|
||||
ghost->old_scale = mobj->old_scale2;
|
||||
ghost->old_spritexscale = mobj->old_spritexscale2;
|
||||
ghost->old_spriteyscale = mobj->old_spriteyscale2;
|
||||
ghost->old_spritexoffset = mobj->old_spritexoffset2;
|
||||
ghost->old_spriteyoffset = mobj->old_spriteyoffset2;
|
||||
// old_x - mobj->momx - hack to preserve vanilla look
|
||||
ghost->old_x = mobj->old_x - mobj->momx;
|
||||
ghost->old_y = mobj->old_y - mobj->momy;
|
||||
ghost->old_z = mobj->old_z2; // Slopes.....
|
||||
ghost->old_angle = (mobj->player ? mobj->player->old_frameangle : mobj->old_angle);
|
||||
ghost->old_pitch = mobj->old_pitch;
|
||||
ghost->old_roll = mobj->old_roll;
|
||||
ghost->old_sloperoll = mobj->old_sloperoll;
|
||||
ghost->old_slopepitch = mobj->old_slopepitch;
|
||||
ghost->old_scale = mobj->old_scale;
|
||||
ghost->old_spritexscale = mobj->old_spritexscale;
|
||||
ghost->old_spriteyscale = mobj->old_spriteyscale;
|
||||
ghost->old_spritexoffset = mobj->old_spritexoffset;
|
||||
ghost->old_spriteyoffset = mobj->old_spriteyoffset;
|
||||
|
||||
return ghost;
|
||||
}
|
||||
@@ -1255,7 +1265,9 @@ void P_DoPlayerExit(player_t *player)
|
||||
if (player->exiting || mapreset)
|
||||
return;
|
||||
|
||||
if (P_IsLocalPlayer(player) && (!player->spectator && !demo.playback))
|
||||
const boolean islocalplayer = P_IsLocalPlayer(player);
|
||||
|
||||
if (islocalplayer && (!player->spectator && !demo.playback))
|
||||
legitimateexit = true;
|
||||
|
||||
if (player->griefstrikes > 0)
|
||||
@@ -1270,7 +1282,7 @@ void P_DoPlayerExit(player_t *player)
|
||||
{
|
||||
const int soundid = K_IsPlayerLosing(player) ? sfx_klose: sfx_kwin; // fix godjjsa win sounds
|
||||
|
||||
if (P_IsLocalPlayer(player))
|
||||
if (islocalplayer)
|
||||
{
|
||||
sfxenum_t sfx_id = K_GetMobjSkin(player->mo)->soundsid[S_sfx[soundid].skinsound];
|
||||
S_StartSound(NULL, sfx_id);
|
||||
@@ -1324,12 +1336,13 @@ boolean P_InSpaceSector(mobj_t *mo) // Returns true if you are in space
|
||||
if (GETSECSPECIAL(rover->master->frontsector->special, 1) != SPACESPECIAL)
|
||||
continue;
|
||||
|
||||
topheight = P_GetFFloorTopZAt(rover, mo->x, mo->y);
|
||||
bottomheight = P_GetFFloorBottomZAt(rover, mo->x, mo->y);
|
||||
topheight = P_GetFFloorTopZAt(rover, mo->x, mo->y);
|
||||
|
||||
if (mo->z + (mo->height/2) > topheight)
|
||||
continue;
|
||||
|
||||
bottomheight = P_GetFFloorBottomZAt(rover, mo->x, mo->y);
|
||||
|
||||
if (mo->z + (mo->height/2) < bottomheight)
|
||||
continue;
|
||||
|
||||
@@ -1360,12 +1373,13 @@ boolean P_InQuicksand(mobj_t *mo) // Returns true if you are in quicksand
|
||||
if (!(rover->flags & FF_QUICKSAND))
|
||||
continue;
|
||||
|
||||
topheight = P_GetFFloorTopZAt(rover, mo->x, mo->y);
|
||||
bottomheight = P_GetFFloorBottomZAt(rover, mo->x, mo->y);
|
||||
topheight = P_GetFFloorTopZAt(rover, mo->x, mo->y);
|
||||
|
||||
if (mo->z + flipoffset > topheight)
|
||||
continue;
|
||||
|
||||
bottomheight = P_GetFFloorBottomZAt(rover, mo->x, mo->y);
|
||||
|
||||
if (mo->z + (mo->height/2) + flipoffset < bottomheight)
|
||||
continue;
|
||||
|
||||
@@ -1547,13 +1561,12 @@ static void P_CheckBouncySectors(player_t *player)
|
||||
if (top)
|
||||
{
|
||||
fixed_t newmom;
|
||||
|
||||
pslope_t *slope;
|
||||
if (abs(oldz - topheight) < abs(oldz + player->mo->height - bottomheight)) { // Hit top
|
||||
|
||||
if (abs(oldz - topheight) < abs(oldz + player->mo->height - bottomheight)) // Hit top
|
||||
slope = *rover->t_slope;
|
||||
} else { // Hit bottom
|
||||
else // Hit bottom
|
||||
slope = *rover->b_slope;
|
||||
}
|
||||
|
||||
momentum.x = player->mo->momx;
|
||||
momentum.y = player->mo->momy;
|
||||
@@ -1644,7 +1657,8 @@ static void P_CheckQuicksand(player_t *player)
|
||||
|
||||
for (rover = player->mo->subsector->sector->ffloors; rover; rover = rover->next)
|
||||
{
|
||||
if (!(rover->flags & FF_EXISTS)) continue;
|
||||
if (!(rover->flags & FF_EXISTS))
|
||||
continue;
|
||||
|
||||
if (!(rover->flags & FF_QUICKSAND))
|
||||
continue;
|
||||
@@ -1702,10 +1716,8 @@ static void P_CheckInvincibilityTimer(player_t *player)
|
||||
{
|
||||
if (!player->powers[pw_super])
|
||||
{
|
||||
{
|
||||
player->mo->color = player->skincolor;
|
||||
G_GhostAddColor((INT32) (player - players), GHC_NORMAL);
|
||||
}
|
||||
player->mo->color = player->skincolor;
|
||||
G_GhostAddColor((INT32)(player - players), GHC_NORMAL);
|
||||
|
||||
// If you had a shield, restore its visual significance
|
||||
P_SpawnShieldOrb(player);
|
||||
@@ -1730,7 +1742,7 @@ static void P_DoBubbleBreath(player_t *player)
|
||||
else
|
||||
zh = player->mo->z + FixedDiv(player->mo->height,5*(FRACUNIT/4));
|
||||
|
||||
if (!(player->mo->eflags & MFE_UNDERWATER) || ((player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL && !(player->pflags & PF_NIGHTSMODE)) || player->spectator)
|
||||
if (!(player->mo->eflags & MFE_UNDERWATER) || player->spectator || ((player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL && !(player->pflags & PF_NIGHTSMODE)))
|
||||
return;
|
||||
|
||||
if (P_RandomChance(FRACUNIT/16))
|
||||
@@ -1744,9 +1756,6 @@ static void P_DoBubbleBreath(player_t *player)
|
||||
bubble->destscale = player->mo->scale;
|
||||
P_SetScale(bubble, bubble->destscale);
|
||||
}
|
||||
|
||||
//if (player->pflags & PF_NIGHTSMODE) // NiGHTS Super doesn't spawn flight bubbles
|
||||
//return;
|
||||
}
|
||||
|
||||
//
|
||||
@@ -1859,10 +1868,10 @@ void P_Telekinesis(player_t *player, fixed_t thrust, fixed_t range)
|
||||
if (!P_CheckSight(player->mo, mo2))
|
||||
continue; // if your psychic powers can't "see" it don't bother
|
||||
|
||||
an = R_PointToAngle2(player->mo->x, player->mo->y, mo2->x, mo2->y);
|
||||
|
||||
if (mo2->health > 0)
|
||||
{
|
||||
an = R_PointToAngle2(player->mo->x, player->mo->y, mo2->x, mo2->y);
|
||||
|
||||
P_Thrust(mo2, an, thrust);
|
||||
|
||||
if (mo2->type == MT_GOLDBUZZ || mo2->type == MT_REDBUZZ)
|
||||
@@ -1912,7 +1921,7 @@ static void P_3dMovement(player_t *player)
|
||||
|
||||
if (analogmove)
|
||||
{
|
||||
movepushangle = (cmd->angleturn<<16 /* not FRACBITS */);
|
||||
movepushangle = (cmd->angleturn << TICCMD_REDUCE);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2012,12 +2021,17 @@ static void P_3dMovement(player_t *player)
|
||||
// The rest is unaffected.
|
||||
angle_t thrustangle = R_PointToAngle2(0, 0, totalthrust.x, totalthrust.y)-player->mo->standingslope->xydirection;
|
||||
|
||||
if (player->mo->standingslope->zdelta < 0) { // Direction goes down, so thrustangle needs to face toward
|
||||
if (thrustangle < ANGLE_90 || thrustangle > ANGLE_270) {
|
||||
if (player->mo->standingslope->zdelta < 0) // Direction goes down, so thrustangle needs to face toward
|
||||
{
|
||||
if (thrustangle < ANGLE_90 || thrustangle > ANGLE_270)
|
||||
{
|
||||
P_QuantizeMomentumToSlope(&totalthrust, player->mo->standingslope);
|
||||
}
|
||||
} else { // Direction goes up, so thrustangle needs to face away
|
||||
if (thrustangle > ANGLE_90 && thrustangle < ANGLE_270) {
|
||||
}
|
||||
else // Direction goes up, so thrustangle needs to face away
|
||||
{
|
||||
if (thrustangle > ANGLE_90 && thrustangle < ANGLE_270)
|
||||
{
|
||||
P_QuantizeMomentumToSlope(&totalthrust, player->mo->standingslope);
|
||||
}
|
||||
}
|
||||
@@ -2072,7 +2086,7 @@ static void P_SpectatorMovement(player_t *player)
|
||||
{
|
||||
ticcmd_t *cmd = &player->cmd;
|
||||
|
||||
player->mo->angle = (angle_t)(cmd->angleturn<<16 /* not FRACBITS */);
|
||||
player->mo->angle = (angle_t)(cmd->angleturn << TICCMD_REDUCE);
|
||||
|
||||
ticruned++;
|
||||
if (!(cmd->angleturn & TICCMD_RECEIVED))
|
||||
@@ -2100,10 +2114,6 @@ static void P_SpectatorMovement(player_t *player)
|
||||
// Quake-style flying spectators :D
|
||||
player->mo->momz += FixedMul(cmd->forwardmove*mapobjectscale, AIMINGTOSLOPE(player->aiming));
|
||||
}
|
||||
/*if (cmd->sidemove != 0) -- was disabled in practice anyways, since sidemove was suppressed
|
||||
{
|
||||
P_Thrust(player->mo, player->mo->angle-ANGLE_90, cmd->sidemove*mapobjectscale);
|
||||
}*/
|
||||
}
|
||||
|
||||
void P_BlackOw(player_t *player)
|
||||
@@ -2278,7 +2288,7 @@ static void P_MovePlayer(player_t *player)
|
||||
{
|
||||
// KART: Don't directly apply angleturn! It may have been either A) forged by a malicious client, or B) not be a smooth turn due to a player dropping frames.
|
||||
// Instead, turn the player only up to the amount they're supposed to turn accounting for latency. Allow exactly 1 extra turn unit to try to keep old replays synced.
|
||||
angle_diff = cmd->angleturn - (player->mo->angle>>16);
|
||||
angle_diff = cmd->angleturn - (player->mo->angle >> TICCMD_REDUCE);
|
||||
max_left_turn = player->lturn_max[(leveltime + MAXPREDICTTICS - cmd->latency) % MAXPREDICTTICS];
|
||||
max_right_turn = player->rturn_max[(leveltime + MAXPREDICTTICS - cmd->latency) % MAXPREDICTTICS];
|
||||
|
||||
@@ -2291,18 +2301,18 @@ static void P_MovePlayer(player_t *player)
|
||||
else
|
||||
{
|
||||
// Try to keep normal turning as accurate to 1.0.1 as possible to reduce replay desyncs.
|
||||
player->mo->angle = cmd->angleturn<<16;
|
||||
player->mo->angle = cmd->angleturn << TICCMD_REDUCE;
|
||||
add_delta = false;
|
||||
}
|
||||
//CONS_Printf("applied turn: %d\n", angle_diff);
|
||||
|
||||
if (add_delta) {
|
||||
player->mo->angle += angle_diff<<16;
|
||||
player->mo->angle += angle_diff << TICCMD_REDUCE;
|
||||
player->mo->angle &= ~0xFFFF; // Try to keep the turning somewhat similar to how it was before?
|
||||
//CONS_Printf("leftover turn (%s): %5d or %4d%%\n",
|
||||
// player_names[player-players],
|
||||
// (INT16) (cmd->angleturn - (player->mo->angle>>16)),
|
||||
// (INT16) (cmd->angleturn - (player->mo->angle>>16)) * 100 / (angle_diff ? angle_diff : 1));
|
||||
// (INT16) (cmd->angleturn - (player->mo->angle >> TICCMD_REDUCE)),
|
||||
// (INT16) (cmd->angleturn - (player->mo->angle >> TICCMD_REDUCE)) * 100 / (angle_diff ? angle_diff : 1));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2732,6 +2742,9 @@ boolean P_LookForEnemies(player_t *player)
|
||||
if (!(mo->flags & (MF_ENEMY|MF_BOSS|MF_MONITOR|MF_SPRING)))
|
||||
continue; // not a valid enemy
|
||||
|
||||
if (mo->type == MT_PLAYER) // Don't chase after other players!
|
||||
continue;
|
||||
|
||||
if (mo->health <= 0) // dead
|
||||
continue;
|
||||
|
||||
@@ -2759,9 +2772,6 @@ boolean P_LookForEnemies(player_t *player)
|
||||
&& abs(player->mo->y-mo->y) > player->mo->radius))
|
||||
continue; // not in your 2d plane
|
||||
|
||||
if (mo->type == MT_PLAYER) // Don't chase after other players!
|
||||
continue;
|
||||
|
||||
if (closestmo && P_AproxDistance(P_AproxDistance(player->mo->x-mo->x, player->mo->y-mo->y),
|
||||
player->mo->z-mo->z) > P_AproxDistance(P_AproxDistance(player->mo->x-closestmo->x,
|
||||
player->mo->y-closestmo->y), player->mo->z-closestmo->z))
|
||||
@@ -3167,7 +3177,7 @@ static ticcmd_t *P_CameraCmd(camera_t *cam, UINT8 num)
|
||||
lang = cam->localangle;
|
||||
laim = cam->localaiming;
|
||||
|
||||
cmd->angleturn = (INT16)(lang >> 16);
|
||||
cmd->angleturn = (INT16)(lang >> TICCMD_REDUCE);
|
||||
cmd->aiming = G_ClipAimingPitch(&laim);
|
||||
|
||||
const boolean analogjoystickmove = cv_usejoystick[num].value && !Joystick[num].bGamepadStyle;
|
||||
@@ -3263,7 +3273,7 @@ static ticcmd_t *P_CameraCmd(camera_t *cam, UINT8 num)
|
||||
|
||||
axis = JoyAxis(AXISLOOK, forplayer);
|
||||
|
||||
laim += (mlooky<<19)*player_invert;
|
||||
laim += (mousey<<19)*player_invert;
|
||||
|
||||
if (InputDown(gc_lookup, forplayer) || (usejoystick && axis < 0))
|
||||
{
|
||||
@@ -3302,7 +3312,7 @@ static ticcmd_t *P_CameraCmd(camera_t *cam, UINT8 num)
|
||||
cmd->aiming = G_ClipAimingPitch(&laim);
|
||||
}
|
||||
|
||||
mousex = mousey = mlooky = 0;
|
||||
mousex = mousey = 0;
|
||||
|
||||
if (forward > MAXPLMOVE)
|
||||
forward = MAXPLMOVE;
|
||||
@@ -3320,7 +3330,7 @@ static ticcmd_t *P_CameraCmd(camera_t *cam, UINT8 num)
|
||||
cmd->sidemove = (SINT8)(cmd->sidemove + side);
|
||||
}
|
||||
|
||||
lang += (cmd->angleturn << 16);
|
||||
lang += (cmd->angleturn << TICCMD_REDUCE);
|
||||
|
||||
cam->localangle = lang;
|
||||
if (!cam->reset_aiming)
|
||||
@@ -3350,7 +3360,7 @@ static void P_DemoCameraMovement(camera_t *cam, UINT8 num)
|
||||
cam->aiming = cmd->aiming << FRACBITS;
|
||||
}
|
||||
|
||||
cam->angle = cmd->angleturn << 16;
|
||||
cam->angle = cmd->angleturn << TICCMD_REDUCE;
|
||||
|
||||
// camera movement:
|
||||
if (!cam->button_a_held)
|
||||
@@ -3830,7 +3840,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
||||
// Sometimes stale ticcmds send a weird angle at the start of the race.
|
||||
// P_UpdatePlayerAngle knows to ignore cmd angle when you literally can't turn, so we do the same here.
|
||||
if (cv_demoangturn.value && leveltime > starttime)
|
||||
focusangle = player->cmd.angleturn << 16;
|
||||
focusangle = player->cmd.angleturn << TICCMD_REDUCE;
|
||||
else
|
||||
focusangle = mo->angle; // Just use something known sane.
|
||||
focusaiming = 0;
|
||||
|
||||
+5
-3
@@ -515,13 +515,15 @@ const INT32 checkcoord[12][4] =
|
||||
static boolean R_CheckBBox(const fixed_t *bspcoord)
|
||||
{
|
||||
angle_t angle1, angle2;
|
||||
INT32 sx1, sx2, boxpos;
|
||||
INT32 sx1, sx2;
|
||||
const INT32* check;
|
||||
|
||||
// Find the corners of the box
|
||||
// that define the edges from current viewpoint.
|
||||
boxpos = (viewx <= bspcoord[BOXLEFT] ? 0 : viewx < bspcoord[BOXRIGHT ] ? 1 : 2) +
|
||||
(viewy >= bspcoord[BOXTOP ] ? 0 : viewy > bspcoord[BOXBOTTOM] ? 4 : 8);
|
||||
const INT32 boxpos = (viewx <= bspcoord[BOXLEFT] ? 0 :
|
||||
viewx < bspcoord[BOXRIGHT] ? 1 : 2) +
|
||||
(viewy >= bspcoord[BOXTOP] ? 0 :
|
||||
viewy > bspcoord[BOXBOTTOM] ? 4 : 8);
|
||||
|
||||
if (boxpos == 5)
|
||||
return true;
|
||||
|
||||
+4
-15
@@ -722,6 +722,10 @@ void R_AddMobjInterpolator(mobj_t *mobj)
|
||||
|
||||
interpolated_mobjs.push_back(mobj);
|
||||
|
||||
// Maybe not the best place for it, but for first tic this old_z is 0,
|
||||
// so when R_ResetMobjInterpolationState is called old_z2 will be set to 0
|
||||
mobj->old_z = mobj->z;
|
||||
|
||||
R_ResetMobjInterpolationState(mobj);
|
||||
mobj->resetinterp = true;
|
||||
}
|
||||
@@ -763,22 +767,7 @@ void R_ResetMobjInterpolationState(mobj_t *mobj)
|
||||
if (rendermode == render_none)
|
||||
return;
|
||||
|
||||
mobj->old_x2 = mobj->old_x;
|
||||
mobj->old_y2 = mobj->old_y;
|
||||
mobj->old_z2 = mobj->old_z;
|
||||
mobj->old_angle2 = mobj->old_angle;
|
||||
mobj->old_scale2 = mobj->old_scale;
|
||||
|
||||
// rotation humor
|
||||
mobj->old_pitch2 = mobj->old_pitch;
|
||||
mobj->old_roll2 = mobj->old_roll;
|
||||
mobj->old_slopepitch2 = mobj->old_slopepitch;
|
||||
mobj->old_sloperoll2 = mobj->old_sloperoll;
|
||||
|
||||
mobj->old_spritexscale2 = mobj->old_spritexscale;
|
||||
mobj->old_spriteyscale2 = mobj->old_spriteyscale;
|
||||
mobj->old_spritexoffset2 = mobj->old_spritexoffset;
|
||||
mobj->old_spriteyoffset2 = mobj->old_spriteyoffset;
|
||||
|
||||
mobj->old_x = mobj->x;
|
||||
mobj->old_y = mobj->y;
|
||||
|
||||
+9
-5
@@ -567,6 +567,7 @@ static void R_InitTextureMapping(void)
|
||||
else if (t > viewwidth+1)
|
||||
t = viewwidth+1;
|
||||
}
|
||||
|
||||
viewangletox[i] = t;
|
||||
}
|
||||
|
||||
@@ -1109,7 +1110,8 @@ static void R_SetupCommonFrame(player_t * player)
|
||||
|
||||
static void R_SetupAimingFrame(player_t *player, camera_t *thiscam)
|
||||
{
|
||||
if (player->awayviewtics && player->awayviewmobj)
|
||||
if (player->awayviewtics && player->awayviewmobj
|
||||
&& !(thiscam && thiscam->freecam)) // dont force this if we wanna freecam!
|
||||
{
|
||||
newview->aim = player->awayviewaiming;
|
||||
newview->angle = player->awayviewmobj->angle;
|
||||
@@ -1276,9 +1278,10 @@ void R_SetupFrame(UINT8 pnum, boolean skybox)
|
||||
|
||||
R_SetupAimingFrame(player, thiscam);
|
||||
|
||||
if (player->awayviewtics && player->awayviewmobj) // cut-away view stuff
|
||||
if (player->awayviewtics && player->awayviewmobj // cut-away view stuff
|
||||
&& !(thiscam && thiscam->freecam)) // dont force this when we wanna freecam!
|
||||
{
|
||||
viewmobj = player->awayviewmobj; // should be a MT_ALTVIEWMAN
|
||||
viewmobj = player->awayviewmobj; // should be a MT_ALTVIEWMAN whos altview man?
|
||||
I_Assert(viewmobj != NULL);
|
||||
|
||||
newview->x = viewmobj->x;
|
||||
@@ -1337,7 +1340,7 @@ static void R_PortalFrame(portal_t *portal)
|
||||
}
|
||||
}
|
||||
|
||||
static void Mask_Pre (maskcount_t* m)
|
||||
static void Mask_Pre(maskcount_t* m)
|
||||
{
|
||||
m->drawsegs[0] = ds_p - drawsegs;
|
||||
m->vissprites[0] = visspritecount;
|
||||
@@ -1347,7 +1350,7 @@ static void Mask_Pre (maskcount_t* m)
|
||||
m->viewsector = viewsector;
|
||||
}
|
||||
|
||||
static void Mask_Post (maskcount_t* m)
|
||||
static void Mask_Post(maskcount_t* m)
|
||||
{
|
||||
m->drawsegs[1] = ds_p - drawsegs;
|
||||
m->vissprites[1] = visspritecount;
|
||||
@@ -1429,6 +1432,7 @@ void R_RenderPlayerView(player_t *player)
|
||||
|
||||
// Clear buffers.
|
||||
R_ClearPlanes();
|
||||
|
||||
if (viewmorph.use)
|
||||
{
|
||||
portalclipstart = viewmorph.x1;
|
||||
|
||||
+17
-19
@@ -58,7 +58,7 @@ static void AmigaType_OnChange(void);
|
||||
#endif
|
||||
|
||||
static CV_PossibleValue_t audbuffersize_cons_t[] = {{128, "128"}, {256, "256"}, {512, "512"}, {1024, "1024"}, {2048, "2048"}, {4096, "4096"}, {0, NULL}};
|
||||
consvar_t cv_audbuffersize = {"audiobuffersize", "2048", CV_SAVE|CV_CALL|CV_NOINIT, audbuffersize_cons_t, BufferSize_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_audbuffersize = {"audiobuffersize", "2048", CV_SAVE|CV_CALL, audbuffersize_cons_t, BufferSize_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
// stereo reverse
|
||||
consvar_t stereoreverse = {"stereoreverse", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
@@ -94,6 +94,14 @@ consvar_t cv_playsoundifunfocused = {"playsoundsifunfocused", "No", CV_SAVE, CV_
|
||||
consvar_t cv_pausemusic = {"playmusicifpaused", "No", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
//bird music stuff
|
||||
static CV_PossibleValue_t music_resync_threshold_cons_t[] = {
|
||||
{0, "MIN"},
|
||||
{1000, "MAX"},
|
||||
{0}
|
||||
};
|
||||
consvar_t cv_music_resync_threshold = {"music_resync_threshold", "0", CV_SAVE|CV_CALL, music_resync_threshold_cons_t, I_UpdateSongLagThreshold, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_music_resync_powerups_only = {"music_resync_powerups_only", "No", CV_SAVE|CV_CALL, CV_YesNo, I_UpdateSongLagThreshold, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_invincmusicfade = {"invincmusicfade", "300", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_growmusicfade = {"growmusicfade", "500", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_respawnfademusicout = {"respawnfademusicout", "1000", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
@@ -273,12 +281,6 @@ void S_RegisterSoundStuff(void)
|
||||
CV_RegisterVar(&cv_gamesounds);
|
||||
CV_RegisterVar(&cv_gamedigimusic);
|
||||
|
||||
#ifdef HAVE_FLUIDSYNTH
|
||||
CV_RegisterVar(&cv_midisoundfontpath);
|
||||
CV_RegisterVar(&cv_midichorus);
|
||||
CV_RegisterVar(&cv_midireverb);
|
||||
#endif
|
||||
|
||||
CV_RegisterVar(&cv_samesoundlimit);
|
||||
|
||||
// bird music stuff
|
||||
@@ -286,6 +288,9 @@ void S_RegisterSoundStuff(void)
|
||||
CV_RegisterVar(&cv_playsoundifunfocused);
|
||||
CV_RegisterVar(&cv_pausemusic);
|
||||
|
||||
CV_RegisterVar(&cv_music_resync_threshold);
|
||||
CV_RegisterVar(&cv_music_resync_powerups_only);
|
||||
|
||||
CV_RegisterVar(&cv_invincmusicfade);
|
||||
CV_RegisterVar(&cv_growmusicfade);
|
||||
|
||||
@@ -357,7 +362,6 @@ boolean S_SoundDisabled(void)
|
||||
|
||||
int S_CacheSound(void)
|
||||
{
|
||||
#if SOUND == SOUND_MIXER
|
||||
if (sound_disabled)
|
||||
return SOUNDCACHE_OFF;
|
||||
|
||||
@@ -365,9 +369,6 @@ int S_CacheSound(void)
|
||||
return SOUNDCACHE_PRECACHE;
|
||||
|
||||
return cv_cachesound.value;
|
||||
#else
|
||||
return SOUNDCACHE_OFF;
|
||||
#endif
|
||||
}
|
||||
|
||||
// Stop all sounds, load level info, THEN start sounds.
|
||||
@@ -771,14 +772,9 @@ void S_UpdateSounds(void)
|
||||
volume = c->volume; // 8 bits internal volume precision
|
||||
sep = NORM_SEP;
|
||||
|
||||
if (P_MobjWasRemoved(c->origin))
|
||||
{
|
||||
// origin was removed, stop the music
|
||||
S_StopChannel(cnum);
|
||||
}
|
||||
// check non-local sounds for distance clipping
|
||||
// or modify their params
|
||||
else
|
||||
if (c->origin)
|
||||
{
|
||||
boolean itsUs = false;
|
||||
|
||||
@@ -1646,7 +1642,7 @@ UINT32 S_GetMusicPosition(void)
|
||||
static lumpnum_t S_GetMusicLumpNum(const char *mname)
|
||||
{
|
||||
if (S_MusicExists(mname, false, true)) // check non midis first
|
||||
return W_GetNumForName(va("O_%s", mname));
|
||||
return W_GetNumForName(va("o_%s", mname));
|
||||
|
||||
if (S_MusicExists(mname, true, false))
|
||||
{
|
||||
@@ -1654,7 +1650,7 @@ static lumpnum_t S_GetMusicLumpNum(const char *mname)
|
||||
CONS_Alert(CONS_ERROR, "A MIDI music lump %.6s was found,\nbut SRB2Kart does not support MIDI output.\nWe apologise for the inconvenience.\n", mname);
|
||||
return LUMPERROR;
|
||||
#else
|
||||
return W_GetNumForName(va("D_%s", mname));
|
||||
return W_GetNumForName(va("d_%s", mname));
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1713,6 +1709,8 @@ static boolean S_PlayMusic(boolean looping, UINT32 fadeinms)
|
||||
if (S_MusicDisabled())
|
||||
return false;
|
||||
|
||||
I_UpdateSongLagThreshold();
|
||||
|
||||
if ((!fadeinms && !I_PlaySong(looping)) ||
|
||||
(fadeinms && !I_FadeInPlaySong(fadeinms, looping)))
|
||||
{
|
||||
|
||||
+3
-6
@@ -54,13 +54,10 @@ extern consvar_t cv_amigatype;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_FLUIDSYNTH
|
||||
extern consvar_t cv_midisoundfontpath;
|
||||
extern consvar_t cv_midichorus;
|
||||
extern consvar_t cv_midireverb;
|
||||
#endif
|
||||
|
||||
//bird music stuff
|
||||
extern consvar_t cv_music_resync_threshold;
|
||||
extern consvar_t cv_music_resync_powerups_only;
|
||||
|
||||
extern consvar_t cv_invincmusicfade;
|
||||
extern consvar_t cv_growmusicfade;
|
||||
|
||||
|
||||
+2
-2
@@ -42,8 +42,8 @@ INT32 setmodeneeded = 0; // video mode change needed if > 0 (the mode number to
|
||||
static CV_PossibleValue_t shittyscreen_cons_t[] = {{0, "Okay"}, {1, "Shitty"}, {2, "Extra Shitty"}, {0, NULL}};
|
||||
|
||||
//added : 03-02-98: default screen mode, as loaded/saved in config
|
||||
consvar_t cv_scr_width = {"scr_width", "1280", CV_SAVE|CV_CALL, CV_Unsigned, VID_RefreshModeList, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_scr_height = {"scr_height", "800", CV_SAVE|CV_CALL, CV_Unsigned, VID_RefreshModeList, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_scr_width = {"scr_width", "1280", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_scr_height = {"scr_height", "800", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_renderview = {"renderview", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_frameskip = {"frameskip", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
+24
-25
@@ -46,8 +46,8 @@
|
||||
#include "SDL_image.h"
|
||||
#else
|
||||
// SDLCALL terms removed from original SDL_image declarations
|
||||
int IMG_isXPM(SDL_IOStream *src);
|
||||
SDL_Surface *IMG_LoadXPM_RW(SDL_IOStream *src);
|
||||
int IMG_isXPM(SDL_RWops *src);
|
||||
SDL_Surface *IMG_LoadXPM_RW(SDL_RWops *src);
|
||||
SDL_Surface *IMG_ReadXPMFromArray(const char **xpm);
|
||||
#define IMG_SetError SDL_SetError
|
||||
#define IMG_GetError SDL_GetError
|
||||
@@ -56,7 +56,7 @@ SDL_Surface *IMG_ReadXPMFromArray(const char **xpm);
|
||||
#ifdef LOAD_XPM
|
||||
|
||||
/* See if an image is contained in a data source */
|
||||
int IMG_isXPM(SDL_IOStream *src)
|
||||
int IMG_isXPM(SDL_RWops *src)
|
||||
{
|
||||
Sint64 start;
|
||||
int is_XPM;
|
||||
@@ -64,14 +64,14 @@ int IMG_isXPM(SDL_IOStream *src)
|
||||
|
||||
if ( !src )
|
||||
return 0;
|
||||
start = SDL_TellIO(src);
|
||||
start = SDL_RWtell(src);
|
||||
is_XPM = 0;
|
||||
if ( SDL_ReadIO(src, magic, sizeof(magic)) ) {
|
||||
if ( SDL_RWread(src, magic, sizeof(magic), 1) ) {
|
||||
if ( SDL_memcmp(magic, "/* XPM */", sizeof(magic)) == 0 ) {
|
||||
is_XPM = 1;
|
||||
}
|
||||
}
|
||||
SDL_SeekIO(src, start, SDL_IO_SEEK_SET);
|
||||
SDL_RWseek(src, start, RW_SEEK_SET);
|
||||
return(is_XPM);
|
||||
}
|
||||
|
||||
@@ -933,7 +933,7 @@ static const char *error;
|
||||
* If len > 0, it's assumed to be at least len chars (for efficiency).
|
||||
* Return NULL and set error upon EOF or parse error.
|
||||
*/
|
||||
static const char *get_next_line(const char ***lines, SDL_IOStream *src, int len)
|
||||
static const char *get_next_line(const char ***lines, SDL_RWops *src, int len)
|
||||
{
|
||||
char *linebufnew;
|
||||
|
||||
@@ -943,7 +943,7 @@ static const char *get_next_line(const char ***lines, SDL_IOStream *src, int len
|
||||
char c;
|
||||
int n;
|
||||
do {
|
||||
if (SDL_ReadIO(src, &c, 1) <= 0) {
|
||||
if (SDL_RWread(src, &c, 1, 1) <= 0) {
|
||||
error = "Premature end of data";
|
||||
return NULL;
|
||||
}
|
||||
@@ -960,7 +960,7 @@ static const char *get_next_line(const char ***lines, SDL_IOStream *src, int len
|
||||
}
|
||||
linebuf = linebufnew;
|
||||
}
|
||||
if (SDL_ReadIO(src, linebuf, len - 1) <= 0) {
|
||||
if (SDL_RWread(src, linebuf, len - 1, 1) <= 0) {
|
||||
error = "Premature end of data";
|
||||
return NULL;
|
||||
}
|
||||
@@ -980,7 +980,7 @@ static const char *get_next_line(const char ***lines, SDL_IOStream *src, int len
|
||||
}
|
||||
linebuf = linebufnew;
|
||||
}
|
||||
if (SDL_ReadIO(src, linebuf + n, 1) <= 0) {
|
||||
if (SDL_RWread(src, linebuf + n, 1, 1) <= 0) {
|
||||
error = "Premature end of data";
|
||||
return NULL;
|
||||
}
|
||||
@@ -1005,7 +1005,7 @@ do { \
|
||||
} while (0)
|
||||
|
||||
/* read XPM from either array or RWops */
|
||||
static SDL_Surface *load_xpm(const char **xpm, SDL_IOStream *src)
|
||||
static SDL_Surface *load_xpm(const char **xpm, SDL_RWops *src)
|
||||
{
|
||||
Sint64 start = 0;
|
||||
SDL_Surface *image = NULL;
|
||||
@@ -1027,7 +1027,7 @@ static SDL_Surface *load_xpm(const char **xpm, SDL_IOStream *src)
|
||||
buflen = 0;
|
||||
|
||||
if (src)
|
||||
start = SDL_TellIO(src);
|
||||
start = SDL_RWtell(src);
|
||||
|
||||
if (xpm)
|
||||
xpmlines = &xpm;
|
||||
@@ -1065,15 +1065,14 @@ static SDL_Surface *load_xpm(const char **xpm, SDL_IOStream *src)
|
||||
/* Create the new surface */
|
||||
if (ncolors <= 256) {
|
||||
indexed = 1;
|
||||
image = SDL_CreateSurface(w, h,
|
||||
SDL_PIXELFORMAT_INDEX8);
|
||||
SDL_Palette *palette = SDL_CreateSurfacePalette(image);
|
||||
im_colors = palette->colors;
|
||||
palette->ncolors = ncolors;
|
||||
image = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, 8,
|
||||
0, 0, 0, 0);
|
||||
im_colors = image->format->palette->colors;
|
||||
image->format->palette->ncolors = ncolors;
|
||||
} else {
|
||||
indexed = 0;
|
||||
image = SDL_CreateSurface(w, h,
|
||||
SDL_GetPixelFormatForMasks(32, 0xff0000, 0x00ff00, 0x0000ff, 0));
|
||||
image = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, 32,
|
||||
0xff0000, 0x00ff00, 0x0000ff, 0);
|
||||
}
|
||||
if (!image) {
|
||||
/* Hmm, some SDL error (out of memory?) */
|
||||
@@ -1129,7 +1128,7 @@ static SDL_Surface *load_xpm(const char **xpm, SDL_IOStream *src)
|
||||
add_colorhash(colors, nextkey, cpp, pixel);
|
||||
nextkey += cpp;
|
||||
if (rgb == 0xffffffff)
|
||||
SDL_SetSurfaceColorKey(image, true, pixel);
|
||||
SDL_SetColorKey(image, SDL_TRUE, pixel);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1165,9 +1164,9 @@ static SDL_Surface *load_xpm(const char **xpm, SDL_IOStream *src)
|
||||
done:
|
||||
if (error) {
|
||||
if ( src )
|
||||
SDL_SeekIO(src, start, SDL_IO_SEEK_SET);
|
||||
SDL_RWseek(src, start, RW_SEEK_SET);
|
||||
if ( image ) {
|
||||
SDL_DestroySurface(image);
|
||||
SDL_FreeSurface(image);
|
||||
image = NULL;
|
||||
}
|
||||
IMG_SetError("%s", error);
|
||||
@@ -1181,7 +1180,7 @@ done:
|
||||
}
|
||||
|
||||
/* Load a XPM type image from an RWops datasource */
|
||||
SDL_Surface *IMG_LoadXPM_RW(SDL_IOStream *src)
|
||||
SDL_Surface *IMG_LoadXPM_RW(SDL_RWops *src)
|
||||
{
|
||||
if ( !src ) {
|
||||
/* The error message has been set in SDL_RWFromFile */
|
||||
@@ -1204,14 +1203,14 @@ SDL_Surface *IMG_ReadXPMFromArray(const char **xpm)
|
||||
#else /* not LOAD_XPM */
|
||||
|
||||
/* See if an image is contained in a data source */
|
||||
int IMG_isXPM(SDL_IOStream *src)
|
||||
int IMG_isXPM(SDL_RWops *src)
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
/* Load a XPM type image from an SDL datasource */
|
||||
SDL_Surface *IMG_LoadXPM_RW(SDL_IOStream *src)
|
||||
SDL_Surface *IMG_LoadXPM_RW(SDL_RWops *src)
|
||||
{
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
+2
-2
@@ -27,10 +27,10 @@
|
||||
|
||||
#ifdef HAVE_SDL
|
||||
|
||||
#include <SDL3/SDL.h>
|
||||
#include "SDL.h"
|
||||
|
||||
#ifndef NOLOADSO
|
||||
#include <SDL3/SDL_loadso.h>
|
||||
#include "SDL_loadso.h"
|
||||
#endif
|
||||
|
||||
#define _CREATE_DLL_ // necessary for Unix AND Windows
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@
|
||||
#ifdef HAVE_SDL
|
||||
|
||||
#ifdef HAVE_TTF
|
||||
#include <SDL3/SDL.h>
|
||||
#include "SDL.h"
|
||||
#include "i_ttf.h"
|
||||
#endif
|
||||
|
||||
|
||||
+52
-59
@@ -67,15 +67,13 @@ typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T);
|
||||
|
||||
#ifdef HAVE_SDL
|
||||
#define _MATH_DEFINES_DEFINED
|
||||
#include <SDL3/SDL.h>
|
||||
#include <SDL3/SDL_joystick.h>
|
||||
#include <SDL3/SDL_gamepad.h>
|
||||
#include "SDL.h"
|
||||
|
||||
#ifdef HAVE_TTF
|
||||
#include "i_ttf.h"
|
||||
#endif
|
||||
|
||||
#include <SDL3/SDL_cpuinfo.h>
|
||||
#include "SDL_cpuinfo.h"
|
||||
#define HAVE_SDLCPUINFO
|
||||
|
||||
#if defined (__unix__) || defined(__APPLE__) || (defined (UNIXCOMMON) && !defined (__HAIKU__))
|
||||
@@ -215,13 +213,13 @@ static char returnWadPath[256];
|
||||
#include "../byteptr.h"
|
||||
#endif
|
||||
|
||||
bool consolevent = false;
|
||||
bool framebuffer = false;
|
||||
SDL_bool consolevent = SDL_FALSE;
|
||||
SDL_bool framebuffer = SDL_FALSE;
|
||||
UINT8 keyboard_started = false;
|
||||
|
||||
#ifdef HAVE_TERMIOS
|
||||
// TERMIOS console code from Quake3: thank you!
|
||||
bool stdin_active = true;
|
||||
SDL_bool stdin_active = SDL_TRUE;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@@ -284,7 +282,7 @@ static void I_ShutdownConsole(void)
|
||||
if (consolevent)
|
||||
{
|
||||
I_OutputMsg("Shutdown tty console\n");
|
||||
consolevent = false;
|
||||
consolevent = SDL_FALSE;
|
||||
tcsetattr(STDIN_FILENO, TCSADRAIN, &tty_tc);
|
||||
}
|
||||
}
|
||||
@@ -299,11 +297,11 @@ static void I_StartupConsole(void)
|
||||
signal(SIGTTIN, SIG_IGN);
|
||||
signal(SIGTTOU, SIG_IGN);
|
||||
|
||||
consolevent = static_cast<bool>(!M_CheckParm("-noconsole"));
|
||||
framebuffer = static_cast<bool>( M_CheckParm("-framebuffer"));
|
||||
consolevent = static_cast<SDL_bool>(!M_CheckParm("-noconsole"));
|
||||
framebuffer = static_cast<SDL_bool>( M_CheckParm("-framebuffer"));
|
||||
|
||||
if (framebuffer)
|
||||
consolevent = false;
|
||||
consolevent = SDL_FALSE;
|
||||
|
||||
if (!consolevent)
|
||||
return;
|
||||
@@ -311,7 +309,7 @@ static void I_StartupConsole(void)
|
||||
if (isatty(STDIN_FILENO)!=1)
|
||||
{
|
||||
I_OutputMsg("stdin is not a tty, tty console mode failed\n");
|
||||
consolevent = false;
|
||||
consolevent = SDL_FALSE;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -513,7 +511,7 @@ static void I_StartupConsole(void)
|
||||
if (gotConsole)
|
||||
{
|
||||
SetConsoleTitleA("SRB2Kart Console");
|
||||
consolevent = true;
|
||||
consolevent = SDL_TRUE;
|
||||
}
|
||||
|
||||
//Let get the real console HANDLE, because Mingw's Bash is bad!
|
||||
@@ -546,7 +544,7 @@ static inline void I_StartupConsole(void)
|
||||
framebuffer = M_CheckParm("-framebuffer");
|
||||
|
||||
if (framebuffer)
|
||||
consolevent = false;
|
||||
consolevent = SDL_FALSE;
|
||||
}
|
||||
static inline void I_ShutdownConsole(void){}
|
||||
#endif
|
||||
@@ -695,7 +693,7 @@ void I_OutputMsg(const char *fmt, ...)
|
||||
//
|
||||
// I_GetKey
|
||||
//
|
||||
INT32 I_GetKey(void)
|
||||
INT32 I_GetKey (void)
|
||||
{
|
||||
// Warning: I_GetKey empties the event queue till next keypress
|
||||
event_t *ev;
|
||||
@@ -725,7 +723,7 @@ static void JoyReset(SDLJoyInfo_t *JoySet)
|
||||
{
|
||||
if (JoySet->dev)
|
||||
{
|
||||
SDL_CloseGamepad(JoySet->dev);
|
||||
SDL_GameControllerClose(JoySet->dev);
|
||||
}
|
||||
|
||||
JoySet->dev = NULL;
|
||||
@@ -767,15 +765,15 @@ void I_JoyScale4(void)
|
||||
}
|
||||
|
||||
// Cheat to get the device index for a joystick handle
|
||||
INT32 I_GetJoystickDeviceIndex(SDL_Gamepad *dev)
|
||||
INT32 I_GetJoystickDeviceIndex(SDL_GameController *dev)
|
||||
{
|
||||
SDL_Joystick *joystick = NULL;
|
||||
|
||||
joystick = SDL_GetGamepadJoystick(dev);
|
||||
joystick = SDL_GameControllerGetJoystick(dev);
|
||||
|
||||
if (joystick)
|
||||
{
|
||||
return SDL_GetJoystickID(joystick);
|
||||
return SDL_JoystickInstanceID(joystick);
|
||||
}
|
||||
|
||||
return -1;
|
||||
@@ -885,7 +883,7 @@ void I_ShutdownJoystick(UINT8 index)
|
||||
*/
|
||||
static int joy_open(int playerIndex, int joyIndex)
|
||||
{
|
||||
SDL_Gamepad *newdev = NULL;
|
||||
SDL_GameController *newdev = NULL;
|
||||
int num_joy = 0;
|
||||
|
||||
if (SDL_WasInit(SDL_INIT_JOYSTICK) == 0)
|
||||
@@ -894,7 +892,7 @@ static int joy_open(int playerIndex, int joyIndex)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (SDL_WasInit(SDL_INIT_GAMEPAD) == 0)
|
||||
if (SDL_WasInit(SDL_INIT_GAMECONTROLLER) == 0)
|
||||
{
|
||||
CONS_Printf(M_GetText("Game Controller subsystem not started\n"));
|
||||
return -1;
|
||||
@@ -903,7 +901,7 @@ static int joy_open(int playerIndex, int joyIndex)
|
||||
if (joyIndex <= 0)
|
||||
return -1;
|
||||
|
||||
SDL_GetJoysticks(&num_joy);
|
||||
num_joy = SDL_NumJoysticks();
|
||||
|
||||
if (num_joy == 0)
|
||||
{
|
||||
@@ -911,7 +909,7 @@ static int joy_open(int playerIndex, int joyIndex)
|
||||
return -1;
|
||||
}
|
||||
|
||||
newdev = SDL_OpenGamepad(joyIndex-1);
|
||||
newdev = SDL_GameControllerOpen(joyIndex-1);
|
||||
|
||||
// Handle the edge case where the device <-> joystick index assignment can change due to hotplugging
|
||||
// This indexing is SDL's responsibility and there's not much we can do about it.
|
||||
@@ -926,8 +924,8 @@ static int joy_open(int playerIndex, int joyIndex)
|
||||
if (JoyInfo[playerIndex].dev)
|
||||
{
|
||||
if (JoyInfo[playerIndex].dev == newdev // same device, nothing to do
|
||||
|| (newdev == NULL && SDL_GamepadConnected(JoyInfo[playerIndex].dev))) // we failed, but already have a working device
|
||||
return SDL_GAMEPAD_AXIS_COUNT;
|
||||
|| (newdev == NULL && SDL_GameControllerGetAttached(JoyInfo[playerIndex].dev))) // we failed, but already have a working device
|
||||
return SDL_CONTROLLER_AXIS_MAX;
|
||||
|
||||
// Else, we're changing devices, so send neutral joy events
|
||||
CONS_Debug(DBG_GAMELOGIC, "Joystick1 device is changing; resetting events...\n");
|
||||
@@ -944,13 +942,13 @@ static int joy_open(int playerIndex, int joyIndex)
|
||||
}
|
||||
else
|
||||
{
|
||||
CONS_Debug(DBG_GAMELOGIC, M_GetText("Joystick1: %s\n"), SDL_GetGamepadName(JoyInfo[playerIndex].dev));
|
||||
JoyInfo[playerIndex].axises = SDL_GAMEPAD_AXIS_COUNT;
|
||||
CONS_Debug(DBG_GAMELOGIC, M_GetText("Joystick1: %s\n"), SDL_GameControllerName(JoyInfo[playerIndex].dev));
|
||||
JoyInfo[playerIndex].axises = SDL_CONTROLLER_AXIS_MAX;
|
||||
|
||||
if (JoyInfo[playerIndex].axises > JOYAXISSET*2)
|
||||
JoyInfo[playerIndex].axises = JOYAXISSET*2;
|
||||
|
||||
JoyInfo[playerIndex].buttons = SDL_GAMEPAD_BUTTON_COUNT; // dpad is 4 buttons
|
||||
JoyInfo[playerIndex].buttons = SDL_CONTROLLER_BUTTON_MAX ; // dpad is 4 buttons
|
||||
if (JoyInfo[playerIndex].buttons > JOYBUTTONS)
|
||||
JoyInfo[playerIndex].buttons = JOYBUTTONS;
|
||||
|
||||
@@ -970,7 +968,7 @@ static int joy_open(int playerIndex, int joyIndex)
|
||||
void I_InitJoystick(UINT8 index)
|
||||
{
|
||||
UINT8 i;
|
||||
SDL_Gamepad *newcontroller = NULL;
|
||||
SDL_GameController *newcontroller = NULL;
|
||||
|
||||
// not sure if this is the best place to put this
|
||||
SDL_SetHint(SDL_HINT_AUTO_UPDATE_SENSORS, "0");
|
||||
@@ -988,16 +986,15 @@ void I_InitJoystick(UINT8 index)
|
||||
{
|
||||
CONS_Printf("I_InitJoystick()...\n");
|
||||
|
||||
if (!SDL_InitSubSystem(SDL_INIT_JOYSTICK))
|
||||
if (SDL_InitSubSystem(SDL_INIT_JOYSTICK) == -1)
|
||||
{
|
||||
CONS_Printf(M_GetText("Couldn't initialize joystick: %s\n"), SDL_GetError());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (SDL_WasInit(SDL_INIT_GAMEPAD) == 0)
|
||||
if (SDL_WasInit(SDL_INIT_GAMECONTROLLER) == 0)
|
||||
{
|
||||
if (!SDL_InitSubSystem(SDL_INIT_GAMEPAD))
|
||||
if (SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER) == -1)
|
||||
{
|
||||
CONS_Printf(M_GetText("Couldn't initialize gamepads: %s\n"), SDL_GetError());
|
||||
return;
|
||||
@@ -1010,7 +1007,7 @@ void I_InitJoystick(UINT8 index)
|
||||
JoyInfo[index].axises = JoyInfo[index].buttons = JoyInfo[index].hats = JoyInfo[index].balls = 0;
|
||||
|
||||
if (cv_usejoystick[index].value)
|
||||
newcontroller = SDL_OpenGamepad(cv_usejoystick[index].value-1);
|
||||
newcontroller = SDL_GameControllerOpen(cv_usejoystick[index].value-1);
|
||||
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
@@ -1050,7 +1047,7 @@ void I_InitJoystick(UINT8 index)
|
||||
if (i == MAXSPLITSCREENPLAYERS)
|
||||
{
|
||||
// Joystick didn't end up being used
|
||||
SDL_CloseGamepad(newcontroller);
|
||||
SDL_GameControllerClose(newcontroller);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1085,10 +1082,10 @@ static void I_ShutdownInput(void)
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
I_ShutdownJoystick(i);
|
||||
|
||||
if (SDL_WasInit(SDL_INIT_GAMEPAD) == SDL_INIT_GAMEPAD)
|
||||
if (SDL_WasInit(SDL_INIT_GAMECONTROLLER) == SDL_INIT_GAMECONTROLLER)
|
||||
{
|
||||
CONS_Printf("Shutting down gamecontroller system\n");
|
||||
SDL_QuitSubSystem(SDL_INIT_GAMEPAD);
|
||||
SDL_QuitSubSystem(SDL_INIT_GAMECONTROLLER);
|
||||
I_OutputMsg("I_Joystick: SDL's Game Controller system has been shutdown\n");
|
||||
}
|
||||
|
||||
@@ -1105,9 +1102,7 @@ INT32 I_NumJoys(void)
|
||||
INT32 numjoy = 0;
|
||||
|
||||
if (SDL_WasInit(SDL_INIT_JOYSTICK) == SDL_INIT_JOYSTICK)
|
||||
{
|
||||
SDL_GetJoysticks(&numjoy);
|
||||
}
|
||||
numjoy = SDL_NumJoysticks();
|
||||
|
||||
return numjoy;
|
||||
}
|
||||
@@ -1122,7 +1117,7 @@ const char *I_GetJoyName(INT32 joyindex)
|
||||
|
||||
if (SDL_WasInit(SDL_INIT_JOYSTICK) == SDL_INIT_JOYSTICK)
|
||||
{
|
||||
tempname = SDL_GetJoystickNameForID(joyindex);
|
||||
tempname = SDL_JoystickNameForIndex(joyindex);
|
||||
|
||||
if (tempname)
|
||||
{
|
||||
@@ -1142,14 +1137,14 @@ void I_GamepadRumble(INT32 playernum, UINT16 low_strength, UINT16 high_strength,
|
||||
(void)high_strength;
|
||||
(void)duration;
|
||||
#else
|
||||
SDL_Gamepad *controller = JoyInfo[playernum].dev;
|
||||
SDL_GameController *controller = JoyInfo[playernum].dev;
|
||||
|
||||
if (controller == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
SDL_RumbleGamepad(controller, low_strength, high_strength, duration);
|
||||
SDL_GameControllerRumble(controller, low_strength, high_strength, duration);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1161,14 +1156,14 @@ void I_SetGamepadIndicatorColor(INT32 playernum, UINT8 red, UINT8 green, UINT8 b
|
||||
(void)green;
|
||||
(void)blue;
|
||||
#else
|
||||
SDL_Gamepad *controller = JoyInfo[playernum].dev;
|
||||
SDL_GameController *controller = JoyInfo[playernum].dev;
|
||||
|
||||
if (controller == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
SDL_SetGamepadLED(controller, red, green, blue);
|
||||
SDL_GameControllerSetLED(controller, red, green, blue);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1821,7 +1816,10 @@ static void I_Fork(void)
|
||||
|
||||
INT32 I_StartupSystem(void)
|
||||
{
|
||||
int SDLlinked = SDL_GetVersion();
|
||||
SDL_version SDLcompiled;
|
||||
SDL_version SDLlinked;
|
||||
SDL_VERSION(&SDLcompiled)
|
||||
SDL_GetVersion(&SDLlinked);
|
||||
I_StartupConsole();
|
||||
#ifdef NEWSIGNALHANDLER
|
||||
// This is useful when debugging. It lets GDB attach to
|
||||
@@ -1837,15 +1835,15 @@ INT32 I_StartupSystem(void)
|
||||
#endif
|
||||
I_RegisterSignals();
|
||||
I_OutputMsg("Compiled for SDL version: %d.%d.%d\n",
|
||||
SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_MICRO_VERSION);
|
||||
SDLcompiled.major, SDLcompiled.minor, SDLcompiled.patch);
|
||||
I_OutputMsg("Linked with SDL version: %d.%d.%d\n",
|
||||
SDL_VERSIONNUM_MAJOR(SDLlinked), SDL_VERSIONNUM_MINOR(SDLlinked), SDL_VERSIONNUM_MICRO(SDLlinked));
|
||||
SDLlinked.major, SDLlinked.minor, SDLlinked.patch);
|
||||
|
||||
#if (SDL_VERSION_ATLEAST(2, 0, 18))
|
||||
SDL_SetHint(SDL_HINT_APP_NAME, "SRB2Kart Saturn");
|
||||
#endif
|
||||
|
||||
if (!SDL_Init(0))
|
||||
if (SDL_Init(0) < 0)
|
||||
I_Error("SRB2: SDL System Error: %s", SDL_GetError()); //Alam: Oh no....
|
||||
#ifndef NOMUMBLE
|
||||
I_SetupMumble();
|
||||
@@ -1858,12 +1856,12 @@ INT32 I_StartupSystem(void)
|
||||
//
|
||||
FUNCNORETURN void ATTRNORETURN I_Quit(void)
|
||||
{
|
||||
static bool quiting = false;
|
||||
static SDL_bool quiting = SDL_FALSE;
|
||||
|
||||
/* prevent recursive I_Quit() */
|
||||
if (quiting) goto death;
|
||||
SDL_ShowCursor();
|
||||
quiting = false;
|
||||
SDL_ShowCursor(SDL_TRUE);
|
||||
quiting = SDL_FALSE;
|
||||
I_ShutdownConsole();
|
||||
M_SaveConfig(NULL); //save game config, cvars..
|
||||
D_SaveBan(); // save the ban list
|
||||
@@ -2316,17 +2314,12 @@ static void pathonly(char *s)
|
||||
size_t j;
|
||||
|
||||
for (j = strlen(s); j != (size_t)-1; j--)
|
||||
{
|
||||
if ((s[j] == '\\') || (s[j] == ':') || (s[j] == '/'))
|
||||
{
|
||||
if (s[j] == ':')
|
||||
s[j+1] = 0;
|
||||
else
|
||||
s[j] = 0;
|
||||
|
||||
if (s[j] == ':') s[j+1] = 0;
|
||||
else s[j] = 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** \brief search for srb2.srb in the given path
|
||||
|
||||
+30
-25
@@ -12,7 +12,7 @@
|
||||
#include "../doomdef.h"
|
||||
#include "../i_threads.h"
|
||||
|
||||
#include <SDL3/SDL.h>
|
||||
#include <SDL.h>
|
||||
|
||||
typedef void * (*Create_fn)(void);
|
||||
|
||||
@@ -45,7 +45,7 @@ static I_mutex i_thread_pool_mutex;
|
||||
static I_mutex i_mutex_pool_mutex;
|
||||
static I_mutex i_cond_pool_mutex;
|
||||
|
||||
static SDL_AtomicInt i_threads_running = {1};
|
||||
static SDL_atomic_t i_threads_running = {1};
|
||||
|
||||
static Link
|
||||
Insert_link (
|
||||
@@ -103,13 +103,13 @@ Identity (
|
||||
){
|
||||
void * id;
|
||||
|
||||
id = SDL_GetAtomicPointer(anchor);
|
||||
id = SDL_AtomicGetPtr(anchor);
|
||||
|
||||
if (! id)
|
||||
{
|
||||
I_lock_mutex(&pool_mutex);
|
||||
{
|
||||
id = SDL_GetAtomicPointer(anchor);
|
||||
id = SDL_AtomicGetPtr(anchor);
|
||||
|
||||
if (! id)
|
||||
{
|
||||
@@ -120,7 +120,7 @@ Identity (
|
||||
|
||||
Insert_link(pool_anchor, New_link(id));
|
||||
|
||||
SDL_SetAtomicPointer(anchor, id);
|
||||
SDL_AtomicSetPtr(anchor, id);
|
||||
}
|
||||
}
|
||||
I_unlock_mutex(pool_mutex);
|
||||
@@ -139,11 +139,11 @@ Worker (
|
||||
|
||||
(*th->entry)(th->userdata);
|
||||
|
||||
if (SDL_GetAtomicInt(&i_threads_running))
|
||||
if (SDL_AtomicGet(&i_threads_running))
|
||||
{
|
||||
I_lock_mutex(&i_thread_pool_mutex);
|
||||
{
|
||||
if (SDL_GetAtomicInt(&i_threads_running))
|
||||
if (SDL_AtomicGet(&i_threads_running))
|
||||
{
|
||||
SDL_DetachThread(th->thread);
|
||||
Free_link(&i_thread_pool, link);
|
||||
@@ -176,7 +176,7 @@ I_spawn_thread (
|
||||
{
|
||||
link = Insert_link(&i_thread_pool, New_link(th));
|
||||
|
||||
if (SDL_GetAtomicInt(&i_threads_running))
|
||||
if (SDL_AtomicGet(&i_threads_running))
|
||||
{
|
||||
th->thread = SDL_CreateThread(
|
||||
(SDL_ThreadFunction)Worker,
|
||||
@@ -194,7 +194,7 @@ I_spawn_thread (
|
||||
int
|
||||
I_thread_is_stopped (void)
|
||||
{
|
||||
return ( ! SDL_GetAtomicInt(&i_threads_running) );
|
||||
return ( ! SDL_AtomicGet(&i_threads_running) );
|
||||
}
|
||||
|
||||
void
|
||||
@@ -220,13 +220,13 @@ I_stop_threads (void)
|
||||
Link next;
|
||||
|
||||
Thread th;
|
||||
SDL_Mutex * mutex;
|
||||
SDL_Condition * cond;
|
||||
SDL_mutex * mutex;
|
||||
SDL_cond * cond;
|
||||
|
||||
if (i_threads_running.value)
|
||||
{
|
||||
/* rely on the good will of thread-san */
|
||||
SDL_SetAtomicInt(&i_threads_running, 0);
|
||||
SDL_AtomicSet(&i_threads_running, 0);
|
||||
|
||||
I_lock_mutex(&i_thread_pool_mutex);
|
||||
{
|
||||
@@ -267,7 +267,7 @@ I_stop_threads (void)
|
||||
next = link->next;
|
||||
cond = link->data;
|
||||
|
||||
SDL_DestroyCondition(cond);
|
||||
SDL_DestroyCond(cond);
|
||||
|
||||
free(link);
|
||||
}
|
||||
@@ -282,7 +282,7 @@ void
|
||||
I_lock_mutex (
|
||||
I_mutex * anchor
|
||||
){
|
||||
SDL_Mutex * mutex;
|
||||
SDL_mutex * mutex;
|
||||
|
||||
mutex = Identity(
|
||||
&i_mutex_pool,
|
||||
@@ -291,14 +291,16 @@ I_lock_mutex (
|
||||
(Create_fn)SDL_CreateMutex
|
||||
);
|
||||
|
||||
SDL_LockMutex(mutex);
|
||||
if (SDL_LockMutex(mutex) == -1)
|
||||
abort();
|
||||
}
|
||||
|
||||
void
|
||||
I_unlock_mutex (
|
||||
I_mutex id
|
||||
){
|
||||
SDL_UnlockMutex(id);
|
||||
if (SDL_UnlockMutex(id) == -1)
|
||||
abort();
|
||||
}
|
||||
|
||||
void
|
||||
@@ -306,46 +308,49 @@ I_hold_cond (
|
||||
I_cond * cond_anchor,
|
||||
I_mutex mutex_id
|
||||
){
|
||||
SDL_Condition * cond;
|
||||
SDL_cond * cond;
|
||||
|
||||
cond = Identity(
|
||||
&i_cond_pool,
|
||||
i_cond_pool_mutex,
|
||||
cond_anchor,
|
||||
(Create_fn)SDL_CreateCondition
|
||||
(Create_fn)SDL_CreateCond
|
||||
);
|
||||
|
||||
SDL_WaitCondition(cond, mutex_id);
|
||||
if (SDL_CondWait(cond, mutex_id) == -1)
|
||||
abort();
|
||||
}
|
||||
|
||||
void
|
||||
I_wake_one_cond (
|
||||
I_cond * anchor
|
||||
){
|
||||
SDL_Condition * cond;
|
||||
SDL_cond * cond;
|
||||
|
||||
cond = Identity(
|
||||
&i_cond_pool,
|
||||
i_cond_pool_mutex,
|
||||
anchor,
|
||||
(Create_fn)SDL_CreateCondition
|
||||
(Create_fn)SDL_CreateCond
|
||||
);
|
||||
|
||||
SDL_SignalCondition(cond);
|
||||
if (SDL_CondSignal(cond) == -1)
|
||||
abort();
|
||||
}
|
||||
|
||||
void
|
||||
I_wake_all_cond (
|
||||
I_cond * anchor
|
||||
){
|
||||
SDL_Condition * cond;
|
||||
SDL_cond * cond;
|
||||
|
||||
cond = Identity(
|
||||
&i_cond_pool,
|
||||
i_cond_pool_mutex,
|
||||
anchor,
|
||||
(Create_fn)SDL_CreateCondition
|
||||
(Create_fn)SDL_CreateCond
|
||||
);
|
||||
|
||||
SDL_BroadcastCondition(cond);
|
||||
if (SDL_CondBroadcast(cond) == -1)
|
||||
abort();
|
||||
}
|
||||
+3
-3
@@ -16,7 +16,7 @@
|
||||
/// \file
|
||||
/// \brief SDL_ttf interface code. Necessary for platforms with no framebuffer console systems.
|
||||
|
||||
#if defined (HAVE_SDL) && defined (HAVE_TTF)
|
||||
#if defined(HAVE_SDL) && defined(HAVE_TTF)
|
||||
#include "SDL.h"
|
||||
#include "SDL_ttf.h"
|
||||
#include "../doomdef.h"
|
||||
@@ -236,14 +236,14 @@ void I_StartupTTF(UINT32 fontpointsize, Uint32 initflags, Uint32 vidmodeflags)
|
||||
|
||||
// what's the point of trying to display an error?
|
||||
// SDL_ttf is not started, can't display anything to screen (presumably)...
|
||||
if (!SDL_InitSubSystem(initflags))
|
||||
if (SDL_InitSubSystem(initflags) < 0)
|
||||
I_Error("Couldn't initialize SDL: %s\n", SDL_GetError());
|
||||
|
||||
TTFSurface = SDL_SetVideoMode(res.width, res.height, bitsperpixel, vidmodeflags);
|
||||
if (!TTFSurface)
|
||||
I_Error("Couldn't set SDL Video resolution: %s\n", SDL_GetError());
|
||||
|
||||
if (!TTF_Init())
|
||||
if (TTF_Init() < 0)
|
||||
I_Error("Couldn't start SDL_ttf: %s\n", TTF_GetError());
|
||||
|
||||
// look for default font in many directories
|
||||
|
||||
+298
-479
File diff suppressed because it is too large.
Load diff
+2
-2
@@ -20,7 +20,7 @@
|
||||
#ifdef HAVE_SDL
|
||||
#define _MATH_DEFINES_DEFINED
|
||||
|
||||
#include <SDL3/SDL.h>
|
||||
#include "SDL.h"
|
||||
|
||||
#include "sdlmain.h"
|
||||
|
||||
@@ -96,7 +96,7 @@ boolean VID_LoadOGLAPI(void)
|
||||
if (M_CheckParm("-OGLlib") && M_IsNextParm())
|
||||
OGLLibname = M_GetNextParm();
|
||||
|
||||
if (!SDL_GL_LoadLibrary(OGLLibname))
|
||||
if (SDL_GL_LoadLibrary(OGLLibname) != 0)
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, "Could not load OpenGL Library: %s\n", SDL_GetError());
|
||||
if (!M_CheckParm("-OGLlib"))
|
||||
|
||||
-1962
File diff suppressed because it is too large.
Load diff
+5
-7
@@ -23,16 +23,14 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern bool consolevent;
|
||||
extern bool framebuffer;
|
||||
extern SDL_bool consolevent;
|
||||
extern SDL_bool framebuffer;
|
||||
|
||||
#include "../m_fixed.h"
|
||||
|
||||
// SDL2 stub macro
|
||||
#define SDL2STUB() CONS_Printf("SDL2: stubbed: %s:%d\n", __func__, __LINE__)
|
||||
|
||||
#include <SDL3/SDL_gamepad.h>
|
||||
|
||||
// So m_menu knows whether to store cv_usejoystick value or string
|
||||
#define JOYSTICK_HOTPLUG
|
||||
|
||||
@@ -43,9 +41,9 @@ extern bool framebuffer;
|
||||
typedef struct SDLJoyInfo_s
|
||||
{
|
||||
/// Controller handle
|
||||
SDL_Gamepad *dev;
|
||||
SDL_GameController *dev;
|
||||
/// Controller index
|
||||
SDL_JoystickID id;
|
||||
INT32 id;
|
||||
/// number of old joystick
|
||||
int oldjoy;
|
||||
/// number of axies
|
||||
@@ -73,7 +71,7 @@ extern SDLJoyInfo_t JoyInfo[4]; //MAXSPLITSCREENPLAYERS
|
||||
void I_ShutdownJoystick(UINT8 index);
|
||||
|
||||
// Cheat to get the device index for a game controller handle
|
||||
INT32 I_GetJoystickDeviceIndex(SDL_Gamepad *dev);
|
||||
INT32 I_GetJoystickDeviceIndex(SDL_GameController *dev);
|
||||
|
||||
// Quick thing to make SDL_JOYDEVICEADDED events less of an abomination
|
||||
void I_UpdateJoystickDeviceIndex(UINT8 player);
|
||||
|
||||
+3
-9
@@ -2992,9 +2992,7 @@ INT32 V_CreditStringWidth(const char *string)
|
||||
if (!string)
|
||||
return 0;
|
||||
|
||||
const size_t strlength = strlen(string);
|
||||
|
||||
for (i = 0; i < strlength; i++)
|
||||
for (i = 0; i < strlen(string); i++)
|
||||
{
|
||||
c = toupper(string[i]) - CRED_FONTSTART;
|
||||
if (c < 0 || c >= CRED_FONTSIZE)
|
||||
@@ -3072,9 +3070,7 @@ INT32 V_LevelNameWidth(const char *string)
|
||||
INT32 c, w = 0;
|
||||
size_t i;
|
||||
|
||||
const size_t strlength = strlen(string);
|
||||
|
||||
for (i = 0; i < strlength; i++)
|
||||
for (i = 0; i < strlen(string); i++)
|
||||
{
|
||||
c = toupper(string[i]) - LT_FONTSTART;
|
||||
if (c < 0 || c >= LT_FONTSIZE || !lt_font[c])
|
||||
@@ -3093,9 +3089,7 @@ INT32 V_LevelNameHeight(const char *string)
|
||||
INT32 c, w = 0;
|
||||
size_t i;
|
||||
|
||||
const size_t strlength = strlen(string);
|
||||
|
||||
for (i = 0; i < strlength; i++)
|
||||
for (i = 0; i < strlen(string); i++)
|
||||
{
|
||||
c = toupper(string[i]) - LT_FONTSTART;
|
||||
if (c < 0 || c >= LT_FONTSIZE || !lt_font[c])
|
||||
|
||||
+19
-16
@@ -352,7 +352,7 @@ static void Y_PlayerStandingsDrawer(y_data_t *standings, INT32 x, INT32 hilicol)
|
||||
if (pnum == whiteplayer)
|
||||
{
|
||||
UINT8 cursorframe = (intertic / 4) % 8;
|
||||
V_DrawScaledPatch(x+16, y-4, 0, W_CachePatchName(va("K_CHILI%d", cursorframe+1), PU_PATCH));
|
||||
V_DrawScaledPatch(x+16, y-4, 0, (patch_t *)W_CachePatchName(va("K_CHILI%d", cursorframe+1), PU_PATCH));
|
||||
}
|
||||
|
||||
STRBUFCPY(strtime, standings->name[i]);
|
||||
@@ -831,6 +831,9 @@ void Y_VoteScreenCheck(void)
|
||||
VoteScreen.foundLuaVoteFrames = VoteScreen.foundLuaVoteWideFrames = 0;
|
||||
VoteScreen.currentAnimFrame = 0;
|
||||
|
||||
if (VoteScreen.timePerAnimFrame == 0)
|
||||
VoteScreen.timePerAnimFrame = 2;
|
||||
|
||||
INT32 i = 1;
|
||||
|
||||
// check for lua vote background replacements
|
||||
@@ -856,8 +859,8 @@ void Y_VoteScreenCheck(void)
|
||||
|
||||
// non lua vote background handling
|
||||
boolean prefbattletype = ((votelevels[0][1] & ~0x80) == GT_MATCH);
|
||||
VoteScreen.widebgpatch = W_CachePatchName((prefbattletype ? "BATTLSCW" : "INTERSCW"), PU_PATCH_LOWPRIORITY);
|
||||
VoteScreen.bgpatch = W_CachePatchName((prefbattletype ? "BATTLSCR" : "INTERSCR"), PU_PATCH_LOWPRIORITY);
|
||||
VoteScreen.widebgpatch = (patch_t *)W_CachePatchName((prefbattletype ? "BATTLSCW" : "INTERSCW"), PU_PATCH_LOWPRIORITY);
|
||||
VoteScreen.bgpatch = (patch_t *)W_CachePatchName((prefbattletype ? "BATTLSCR" : "INTERSCR"), PU_PATCH_LOWPRIORITY);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -905,7 +908,7 @@ static void Y_DrawLuaVoteScreenPatch(boolean widePatch)
|
||||
// Draw non animated patch
|
||||
if (!tempfoundAnimLuaVoteFrames)
|
||||
{
|
||||
votebg = W_CachePatchName(va("%s1", tempPrefix), PU_PATCH_LOWPRIORITY);
|
||||
votebg = (patch_t *)W_CachePatchName(va("%s1", tempPrefix), PU_PATCH_LOWPRIORITY);
|
||||
Y_VoteBackgroundDrawer(votebg);
|
||||
return;
|
||||
}
|
||||
@@ -918,11 +921,11 @@ static void Y_DrawLuaVoteScreenPatch(boolean widePatch)
|
||||
|
||||
nextframe = (VoteScreen.currentAnimFrame + 1);
|
||||
|
||||
votebg = W_CachePatchName(va("%s%d", tempPrefix, nextframe), PU_PATCH_LOWPRIORITY);
|
||||
votebg = (patch_t *)W_CachePatchName(va("%s%d", tempPrefix, nextframe), PU_PATCH_LOWPRIORITY);
|
||||
|
||||
Y_VoteBackgroundDrawer(votebg);
|
||||
|
||||
if (renderisnewtic && (votetic % 2 == 0) && !paused)
|
||||
if (renderisnewtic && (votetic % VoteScreen.timePerAnimFrame == 0) && !paused)
|
||||
VoteScreen.currentAnimFrame = (nextframe > tempfoundAnimLuaVoteFrames) ? 0 : nextframe;
|
||||
}
|
||||
|
||||
@@ -1186,7 +1189,7 @@ void Y_VoteDrawer(void)
|
||||
if (!splitscreen && i == consoleplayer)
|
||||
{
|
||||
UINT8 cursorframe = (votetic / 4) % 8;
|
||||
V_DrawScaledPatch(x+24, y+9, V_SNAPTOLEFT, W_CachePatchName(va("K_CHILI%d", cursorframe+1), PU_PATCH));
|
||||
V_DrawScaledPatch(x+24, y+9, V_SNAPTOLEFT, (patch_t *)W_CachePatchName(va("K_CHILI%d", cursorframe+1), PU_PATCH));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1446,14 +1449,14 @@ static void Y_InitVoteDrawing(void)
|
||||
// setup the background patches
|
||||
Y_VoteScreenCheck();
|
||||
|
||||
VoteScreen.cursor[0] = W_CachePatchName("M_CURSOR", PU_PATCH_LOWPRIORITY);
|
||||
VoteScreen.cursor[1] = W_CachePatchName("P1CURSOR", PU_PATCH_LOWPRIORITY);
|
||||
VoteScreen.cursor[2] = W_CachePatchName("P2CURSOR", PU_PATCH_LOWPRIORITY);
|
||||
VoteScreen.cursor[3] = W_CachePatchName("P3CURSOR", PU_PATCH_LOWPRIORITY);
|
||||
VoteScreen.cursor[4] = W_CachePatchName("P4CURSOR", PU_PATCH_LOWPRIORITY);
|
||||
VoteScreen.cursor[0] = (patch_t*)W_CachePatchName("M_CURSOR", PU_PATCH);
|
||||
VoteScreen.cursor[1] = (patch_t*)W_CachePatchName("P1CURSOR", PU_PATCH_LOWPRIORITY);
|
||||
VoteScreen.cursor[2] = (patch_t*)W_CachePatchName("P2CURSOR", PU_PATCH_LOWPRIORITY);
|
||||
VoteScreen.cursor[3] = (patch_t*)W_CachePatchName("P3CURSOR", PU_PATCH_LOWPRIORITY);
|
||||
VoteScreen.cursor[4] = (patch_t*)W_CachePatchName("P4CURSOR", PU_PATCH_LOWPRIORITY);
|
||||
|
||||
VoteScreen.randomlvl = W_CachePatchName("RANDOMLV", PU_PATCH_LOWPRIORITY);
|
||||
VoteScreen.rubyicon = W_CachePatchName("RUBYICON", PU_PATCH_LOWPRIORITY);
|
||||
VoteScreen.randomlvl = (patch_t*)W_CachePatchName("RANDOMLV", PU_PATCH);
|
||||
VoteScreen.rubyicon = (patch_t*)W_CachePatchName("RUBYICON", PU_PATCH);
|
||||
}
|
||||
|
||||
void Y_StartVote(void)
|
||||
@@ -1538,9 +1541,9 @@ void Y_StartVote(void)
|
||||
{
|
||||
lumpnum = W_CheckNumForName(va("%sP", G_BuildMapName(votelevels[i][0]+1)));
|
||||
if (lumpnum != LUMPERROR)
|
||||
levelinfo[i].pic = W_CachePatchName(va("%sP", G_BuildMapName(votelevels[i][0]+1)), PU_PATCH_LOWPRIORITY);
|
||||
levelinfo[i].pic = (patch_t *)W_CachePatchName(va("%sP", G_BuildMapName(votelevels[i][0]+1)), PU_PATCH);
|
||||
else
|
||||
levelinfo[i].pic = W_CachePatchName("BLANKLVL", PU_PATCH_LOWPRIORITY);
|
||||
levelinfo[i].pic = (patch_t *)W_CachePatchName("BLANKLVL", PU_PATCH);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -79,6 +79,7 @@ typedef struct
|
||||
char luaPrefix[5]; // prefix for lua votescreens
|
||||
|
||||
INT32 currentAnimFrame; // current animated background frame
|
||||
INT32 timePerAnimFrame; // time for 1 frame in ticks, 2 by default
|
||||
|
||||
INT32 foundLuaVoteFrames; // normal lua patch frames
|
||||
INT32 foundLuaVoteWideFrames; // widescreen lua patch frames
|
||||
|
||||
Reference in new issue
Block a user