Merge branch 'next' of https://git.do.srb2.org/STJr/SRB2.git into prerelease

This commit is contained in:
LJ Sonic 2021-02-13 20:33:41 +01:00
commit 6f38fba82e
58 changed files with 602 additions and 372 deletions

2
dep/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
#All folders
*.d

2
dep/FreeBSD/SDL/Debug/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
# DON'T REMOVE
# This keeps the folder from disappearing

2
dep/FreeBSD/SDL/Release/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
# DON'T REMOVE
# This keeps the folder from disappearing

2
dep/Linux/SDL/Debug/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
# DON'T REMOVE
# This keeps the folder from disappearing

2
dep/Linux/SDL/Release/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
# DON'T REMOVE
# This keeps the folder from disappearing

2
dep/Linux64/SDL/Debug/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
# DON'T REMOVE
# This keeps the folder from disappearing

2
dep/Linux64/SDL/Release/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
# DON'T REMOVE
# This keeps the folder from disappearing

2
dep/MasterClient/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
# DON'T REMOVE
# This keeps the folder from disappearing

2
dep/MasterServer/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
# DON'T REMOVE
# This keeps the folder from disappearing

2
dep/Mingw/Debug/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
# DON'T REMOVE
# This keeps the folder from disappearing

2
dep/Mingw/Release/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
# DON'T REMOVE
# This keeps the folder from disappearing

2
dep/Mingw/SDL/Debug/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
# DON'T REMOVE
# This keeps the folder from disappearing

2
dep/Mingw/SDL/Release/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
# DON'T REMOVE
# This keeps the folder from disappearing

2
dep/Mingw64/Debug/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
# DON'T REMOVE
# This keeps the folder from disappearing

2
dep/Mingw64/Release/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
# DON'T REMOVE
# This keeps the folder from disappearing

2
dep/Mingw64/SDL/Debug/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
# DON'T REMOVE
# This keeps the folder from disappearing

2
dep/Mingw64/SDL/Release/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
# DON'T REMOVE
# This keeps the folder from disappearing

2
dep/SDL/Release/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
# DON'T REMOVE
# This keeps the folder from disappearing

2
dep/VC/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
# DON'T REMOVE
# This keeps the folder from disappearing

2
dep/VC9/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
# DON'T REMOVE
# This keeps the folder from disappearing

2
dep/cygwin/Debug/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
# DON'T REMOVE
# This keeps the folder from disappearing

2
dep/cygwin/Release/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
# DON'T REMOVE
# This keeps the folder from disappearing

2
dep/dummy/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1247,6 +1247,7 @@ patterns
sprite = "SPHRA0";
width = 96;
height = 192;
}
609
{
title = "Circle of Rings and Spheres (Big)";

View file

@ -2,7 +2,7 @@
# GNU Make makefile for SRB2
#############################################################################
# Copyright (C) 1998-2000 by DooM Legacy Team.
# Copyright (C) 2003-2020 by Sonic Team Junior.
# Copyright (C) 2003-2021 by Sonic Team Junior.
#
# This program is free software distributed under the
# terms of the GNU General Public License, version 2.
@ -24,7 +24,9 @@
# clean
# Remove all object files
# cleandep
# Remove depend.dep
# Remove dependency files
# distclean
# Remove autogenerated files
# dll
# compile primary HW render DLL/SO
# all_dll
@ -79,6 +81,17 @@
#
#############################################################################
,=,
ifeq (,$(filter-out cleandep clean distclean,$(or $(MAKECMDGOALS),all)))
CLEANONLY=1
else ifndef SILENT
echo=@echo "$(1)"
ifndef MAKE_RESTARTS
print=$(info $(1))
endif
endif
ALL_SYSTEMS=\
PANDORA\
LINUX64\
@ -98,7 +111,7 @@ ALL_SYSTEMS=\
ifeq (,$(filter $(ALL_SYSTEMS),$(.VARIABLES)))
ifeq ($(OS),Windows_NT) # all windows are Windows_NT...
$(info Detected a Windows system, compiling for 32-bit MinGW SDL2...)
$(call print,Detected a Windows system$(,) compiling for 32-bit MinGW SDL2...)
# go for a 32-bit sdl mingw exe by default
MINGW=1
@ -123,7 +136,7 @@ else # if you on the *nix
new_system:=$(new_system)64
endif
$(info Detected $(system) ($(new_system))...)
$(call print,Detected $(system) ($(new_system))...)
$(new_system)=1
endif
@ -237,6 +250,12 @@ endif
MSGFMT?=msgfmt
ifdef WINDOWSHELL
COMPTIME=-..\comptime.bat
else
COMPTIME=-../comptime.sh
endif
ifndef ECHO
NASM:=@$(NASM)
REMOVE:=@$(REMOVE)
@ -251,6 +270,7 @@ ifndef ECHO
MSGFMT:=@$(MSGFMT)
UPX:=@$(UPX)
UPX_OPTS+=-q
COMPTIME:=@$(COMPTIME)
endif
ifdef NONET
@ -415,7 +435,7 @@ ifdef GCC48
else
CFLAGS+=-O0
endif
CFLAGS+= -Wall -DPARANOIA -DRANGECHECK -DPACKETDROP -DMOBJCONSISTANCY
CFLAGS+= -Wall -DPARANOIA -DRANGECHECK -DPACKETDROP
else
@ -455,7 +475,6 @@ DBGNAME?=$(EXENAME).debug
# not too sophisticated dependency
OBJS:=$(i_main_o) \
$(OBJDIR)/comptime.o \
$(OBJDIR)/string.o \
$(OBJDIR)/d_main.o \
$(OBJDIR)/d_clisrv.o \
@ -542,7 +561,10 @@ OBJS:=$(i_main_o) \
$(i_sound_o) \
$(OBJS)
DEPS:=$(patsubst $(OBJDIR)/%.o,$(DEPDIR)/%.d,$(filter %.o,$(OBJS)))
OBJS+=$(OBJDIR)/comptime.o
ifndef SILENT
ifndef ECHO
ifndef NOECHOFILENAMES
define echoName =
@ -550,6 +572,7 @@ define echoName =
endef
endif
endif
endif
# List of languages to compile.
# For reference, this is the command I use to build a srb2.pot file from the source code.
@ -562,12 +585,12 @@ OPTS+=-DGETTEXT
endif
ifdef PANDORA
all: pre-build $(BIN)/$(PNDNAME)
all: $(BIN)/$(PNDNAME)
endif
ifdef SDL
all: pre-build $(BIN)/$(EXENAME)
all: $(BIN)/$(EXENAME)
endif
ifdef DUMMY
@ -575,20 +598,15 @@ all: $(BIN)/$(EXENAME)
endif
cleandep:
$(REMOVE) $(OBJDIR)/depend.dep
$(REMOVE) $(DEPS)
$(REMOVE) comptime.h
pre-build:
ifdef WINDOWSHELL
-..\comptime.bat .
else
-@../comptime.sh .
endif
clean:
$(REMOVE) *~ *.flc
$(REMOVE) $(OBJDIR)/*.o
distclean: clean cleandep
ifdef MINGW
$(REMOVE) $(OBJDIR)/*.res
endif
@ -608,11 +626,11 @@ asm:
$(BIN)/$(EXENAME): $(POS) $(OBJS)
-$(MKDIR) $(BIN)
@echo Linking $(EXENAME)...
$(call echo,Linking $(EXENAME)...)
$(LD) $(LDFLAGS) $(OBJS) -o $(BIN)/$(EXENAME) $(LIBS)
ifndef VALGRIND
ifndef NOOBJDUMP
@echo Dumping debugging info
$(call echo,Dumping debugging info)
$(OBJDUMP) $(OBJDUMP_OPTS) $(BIN)/$(EXENAME) > $(BIN)/$(DBGNAME).txt
ifdef WINDOWSHELL
-$(GZIP) $(GZIP_OPTS) $(BIN)/$(DBGNAME).txt
@ -631,10 +649,10 @@ ifndef NOUPX
-$(UPX) $(UPX_OPTS) $(BIN)/$(EXENAME)
endif
endif
@echo Build is done, please look for $(EXENAME) in $(BIN), \(checking for post steps\)
$(call echo,Build is done$(,) please look for $(EXENAME) in $(BIN)$(,) (checking for post steps))
reobjdump:
@echo Redumping debugging info
$(call echo,Redumping debugging info)
$(OBJDUMP) $(OBJDUMP_OPTS) $(BIN)/$(DBGNAME) > $(BIN)/$(DBGNAME).txt
ifdef WINDOWSHELL
-$(GZIP) $(GZIP_OPTS) $(BIN)/$(DBGNAME).txt
@ -670,24 +688,40 @@ endif
endif
#dependecy made by gcc itself !
$(OBJS):
ifndef DUMMY
-include $(OBJDIR)/depend.dep
ifndef CLEANONLY
$(call print,Checking dependency files...)
-include $(DEPS)
endif
endif
$(OBJDIR)/depend.dep:
@echo "Creating dependency file, depend.dep"
@echo > comptime.h
-$(MKDIR) $(OBJDIR)
$(CC) $(CFLAGS) -MM *.c > $(OBJDIR)/depend.ped
$(CC) $(CFLAGS) -MM $(INTERFACE)/*.c >> $(OBJDIR)/depend.ped
ifndef NOHW
$(CC) $(CFLAGS) -MM hardware/*.c >> $(OBJDIR)/depend.ped
undefine deps_rule
# windows makes it too hard !
ifndef WINDOWSHELL
ifdef echoName
define deps_rule =
@printf "%-20.20s\r" $<
endef
endif
$(CC) $(CFLAGS) -MM blua/*.c >> $(OBJDIR)/depend.ped
@sed -e 's,\(.*\)\.o: ,$(subst /,\/,$(OBJDIR))\/&,g' < $(OBJDIR)/depend.ped > $(OBJDIR)/depend.dep
$(REMOVE) $(OBJDIR)/depend.ped
@echo "Created dependency file, depend.dep"
endif
define deps_rule +=
$(CC) $(CFLAGS) -M -MF $@ -MT $(OBJDIR)/$< $<
endef
$(DEPDIR)/%.d: %.c
$(deps_rule)
$(DEPDIR)/%.d: $(INTERFACE)/%.c
$(deps_rule)
$(DEPDIR)/%.d: hardware/%.c
$(deps_rule)
$(DEPDIR)/%.d: blua/%.c
$(deps_rule)
ifdef VALGRIND
$(OBJDIR)/z_zone.o: z_zone.c
@ -695,9 +729,12 @@ $(OBJDIR)/z_zone.o: z_zone.c
$(CC) $(CFLAGS) $(WFLAGS) -DHAVE_VALGRIND $(VALGRIND_CFLAGS) -c $< -o $@
endif
$(OBJDIR)/comptime.o: comptime.c pre-build
$(echoName)
$(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@
$(OBJDIR)/comptime.o::
ifdef echoName
@echo -- comptime.c ...
endif
$(COMPTIME) .
$(CC) $(CFLAGS) $(WFLAGS) -c comptime.c -o $@
$(BIN)/%.mo: locale/%.po
-$(MKDIR) $(BIN)

View file

@ -47,7 +47,8 @@ ifdef MACOSX
endif
# Automatically set version flag, but not if one was manually set
ifeq (,$(filter GCC%,$(.VARIABLES)))
# And don't bother if this is a clean only run
ifeq (,$(filter GCC% CLEANONLY,$(.VARIABLES)))
version:=$(shell $(CC) --version)
# check if this is in fact GCC
ifneq (,$(or $(findstring gcc,$(version)),$(findstring GCC,$(version))))
@ -60,12 +61,14 @@ ifeq (,$(filter GCC%,$(.VARIABLES)))
# If this version is not in the list, default to the latest supported
ifeq (,$(filter $(v),$(SUPPORTED_GCC_VERSIONS)))
$(info\
Your compiler version, GCC $(version), is not supported by the Makefile.\
The Makefile will assume GCC $(LATEST_GCC_VERSION).)
define line =
Your compiler version, GCC $(version), is not supported by the Makefile.
The Makefile will assume GCC $(LATEST_GCC_VERSION).))
endef
$(call print,$(line))
GCC$(subst .,,$(LATEST_GCC_VERSION))=1
else
$(info Detected GCC $(version) (GCC$(v)))
$(call print,Detected GCC $(version) (GCC$(v)))
GCC$(v)=1
endif
endif
@ -361,6 +364,7 @@ i_main_o=$(OBJDIR)/i_main.o
#set OBJDIR and BIN's starting place
OBJDIR=../objs
BIN=../bin
DEPDIR=../dep
#Nasm ASM and rm
ifdef YASM
NASM?=yasm
@ -383,6 +387,7 @@ ifdef DUMMY
INTERFACE=dummy
OBJDIR:=$(OBJDIR)/dummy
BIN:=$(BIN)/dummy
DEPDIR:=$(DEPDIR)/dummy
else
ifdef LINUX
NASMFORMAT=elf -DLINUX
@ -390,9 +395,11 @@ ifdef LINUX
ifdef LINUX64
OBJDIR:=$(OBJDIR)/Linux64
BIN:=$(BIN)/Linux64
DEPDIR:=$(DEPDIR)/Linux64
else
OBJDIR:=$(OBJDIR)/Linux
BIN:=$(BIN)/Linux
DEPDIR:=$(DEPDIR)/Linux
endif
else
ifdef FREEBSD
@ -402,6 +409,7 @@ ifdef FREEBSD
OBJDIR:=$(OBJDIR)/FreeBSD
BIN:=$(BIN)/FreeBSD
DEPDIR:=$(DEPDIR)/Linux
else
ifdef SOLARIS
INTERFACE=sdl
@ -410,6 +418,7 @@ ifdef SOLARIS
OBJDIR:=$(OBJDIR)/Solaris
BIN:=$(BIN)/Solaris
DEPDIR:=$(DEPDIR)/Solaris
else
ifdef CYGWIN32
INTERFACE=sdl
@ -418,18 +427,21 @@ ifdef CYGWIN32
OBJDIR:=$(OBJDIR)/cygwin
BIN:=$(BIN)/Cygwin
DEPDIR:=$(DEPDIR)/Cygwin
else
ifdef MINGW64
#NASMFORMAT=win64
SDL=1
OBJDIR:=$(OBJDIR)/Mingw64
BIN:=$(BIN)/Mingw64
DEPDIR:=$(DEPDIR)/Mingw64
else
ifdef MINGW
NASMFORMAT=win32
SDL=1
OBJDIR:=$(OBJDIR)/Mingw
BIN:=$(BIN)/Mingw
DEPDIR:=$(DEPDIR)/Mingw
endif
endif
endif
@ -441,6 +453,7 @@ endif
ifdef ARCHNAME
OBJDIR:=$(OBJDIR)/$(ARCHNAME)
BIN:=$(BIN)/$(ARCHNAME)
DEPDIR:=$(DEPDIR)/$(ARCHNAME)
endif
OBJDUMP_OPTS?=--wide --source --line-numbers
@ -449,14 +462,17 @@ LD=$(CC)
ifdef SDL
INTERFACE=sdl
OBJDIR:=$(OBJDIR)/SDL
DEPDIR:=$(DEPDIR)/SDL
endif
ifndef DUMMY
ifdef DEBUGMODE
OBJDIR:=$(OBJDIR)/Debug
BIN:=$(BIN)/Debug
DEPDIR:=$(DEPDIR)/Debug
else
OBJDIR:=$(OBJDIR)/Release
BIN:=$(BIN)/Release
DEPDIR:=$(DEPDIR)/Release
endif
endif

View file

@ -3112,7 +3112,7 @@ consvar_t cv_maxplayers = CVAR_INIT ("maxplayers", "8", CV_SAVE|CV_NETVAR, maxpl
static CV_PossibleValue_t joindelay_cons_t[] = {{1, "MIN"}, {3600, "MAX"}, {0, "Off"}, {0, NULL}};
consvar_t cv_joindelay = CVAR_INIT ("joindelay", "10", CV_SAVE|CV_NETVAR, joindelay_cons_t, NULL);
static CV_PossibleValue_t rejointimeout_cons_t[] = {{1, "MIN"}, {60 * FRACUNIT, "MAX"}, {0, "Off"}, {0, NULL}};
consvar_t cv_rejointimeout = CVAR_INIT ("rejointimeout", "Off", CV_SAVE|CV_NETVAR|CV_FLOAT, rejointimeout_cons_t, NULL);
consvar_t cv_rejointimeout = CVAR_INIT ("rejointimeout", "2", CV_SAVE|CV_NETVAR|CV_FLOAT, rejointimeout_cons_t, NULL);
static CV_PossibleValue_t resynchattempts_cons_t[] = {{1, "MIN"}, {20, "MAX"}, {0, "No"}, {0, NULL}};
consvar_t cv_resynchattempts = CVAR_INIT ("resynchattempts", "10", CV_SAVE|CV_NETVAR, resynchattempts_cons_t, NULL);
@ -4480,70 +4480,73 @@ static INT16 Consistancy(void)
ret += P_GetRandSeed();
#ifdef MOBJCONSISTANCY
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
if (gamestate == GS_LEVEL)
{
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
mo = (mobj_t *)th;
if (mo->flags & (MF_SPECIAL | MF_SOLID | MF_PUSHABLE | MF_BOSS | MF_MISSILE | MF_SPRING | MF_MONITOR | MF_FIRE | MF_ENEMY | MF_PAIN | MF_STICKY))
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
{
ret -= mo->type;
ret += mo->x;
ret -= mo->y;
ret += mo->z;
ret -= mo->momx;
ret += mo->momy;
ret -= mo->momz;
ret += mo->angle;
ret -= mo->flags;
ret += mo->flags2;
ret -= mo->eflags;
if (mo->target)
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
mo = (mobj_t *)th;
if (mo->flags & (MF_SPECIAL | MF_SOLID | MF_PUSHABLE | MF_BOSS | MF_MISSILE | MF_SPRING | MF_MONITOR | MF_FIRE | MF_ENEMY | MF_PAIN | MF_STICKY))
{
ret += mo->target->type;
ret -= mo->target->x;
ret += mo->target->y;
ret -= mo->target->z;
ret += mo->target->momx;
ret -= mo->target->momy;
ret += mo->target->momz;
ret -= mo->target->angle;
ret += mo->target->flags;
ret -= mo->target->flags2;
ret += mo->target->eflags;
ret -= mo->target->state - states;
ret += mo->target->tics;
ret -= mo->target->sprite;
ret += mo->target->frame;
ret -= mo->type;
ret += mo->x;
ret -= mo->y;
ret += mo->z;
ret -= mo->momx;
ret += mo->momy;
ret -= mo->momz;
ret += mo->angle;
ret -= mo->flags;
ret += mo->flags2;
ret -= mo->eflags;
if (mo->target)
{
ret += mo->target->type;
ret -= mo->target->x;
ret += mo->target->y;
ret -= mo->target->z;
ret += mo->target->momx;
ret -= mo->target->momy;
ret += mo->target->momz;
ret -= mo->target->angle;
ret += mo->target->flags;
ret -= mo->target->flags2;
ret += mo->target->eflags;
ret -= mo->target->state - states;
ret += mo->target->tics;
ret -= mo->target->sprite;
ret += mo->target->frame;
}
else
ret ^= 0x3333;
if (mo->tracer && mo->tracer->type != MT_OVERLAY)
{
ret += mo->tracer->type;
ret -= mo->tracer->x;
ret += mo->tracer->y;
ret -= mo->tracer->z;
ret += mo->tracer->momx;
ret -= mo->tracer->momy;
ret += mo->tracer->momz;
ret -= mo->tracer->angle;
ret += mo->tracer->flags;
ret -= mo->tracer->flags2;
ret += mo->tracer->eflags;
ret -= mo->tracer->state - states;
ret += mo->tracer->tics;
ret -= mo->tracer->sprite;
ret += mo->tracer->frame;
}
else
ret ^= 0xAAAA;
ret -= mo->state - states;
ret += mo->tics;
ret -= mo->sprite;
ret += mo->frame;
}
else
ret ^= 0x3333;
if (mo->tracer && mo->tracer->type != MT_OVERLAY)
{
ret += mo->tracer->type;
ret -= mo->tracer->x;
ret += mo->tracer->y;
ret -= mo->tracer->z;
ret += mo->tracer->momx;
ret -= mo->tracer->momy;
ret += mo->tracer->momz;
ret -= mo->tracer->angle;
ret += mo->tracer->flags;
ret -= mo->tracer->flags2;
ret += mo->tracer->eflags;
ret -= mo->tracer->state - states;
ret += mo->tracer->tics;
ret -= mo->tracer->sprite;
ret += mo->tracer->frame;
}
else
ret ^= 0xAAAA;
ret -= mo->state - states;
ret += mo->tics;
ret -= mo->sprite;
ret += mo->frame;
}
}
#endif

View file

@ -61,7 +61,7 @@
#include "p_local.h" // chasecam
#include "mserv.h" // ms_RoomId
#include "m_misc.h" // screenshot functionality
#include "dehacked.h" // Dehacked list test
#include "deh_tables.h" // Dehacked list test
#include "m_cond.h" // condition initialization
#include "fastcmp.h"
#include "keys.h"
@ -1072,7 +1072,7 @@ void D_SRB2Main(void)
G_LoadGameSettings();
// Test Dehacked lists
DEH_Check();
DEH_TableCheck();
// Netgame URL special case: change working dir to EXE folder.
ChangeDirForUrlHandler();

View file

@ -2130,7 +2130,7 @@ static void Command_Pause(void)
if (cv_pause.value || server || (IsPlayerAdmin(consoleplayer)))
{
if (modeattacking || !(gamestate == GS_LEVEL || gamestate == GS_INTERMISSION))
if (modeattacking || !(gamestate == GS_LEVEL || gamestate == GS_INTERMISSION) || (marathonmode && gamestate == GS_INTERMISSION))
{
CONS_Printf(M_GetText("You can't pause here.\n"));
return;

View file

@ -5457,3 +5457,27 @@ struct int_const_s const INT_CONST[] = {
{NULL,0}
};
// For this to work compile-time without being in this file,
// this function would need to check sizes at runtime, without sizeof
void DEH_TableCheck(void)
{
#if defined(_DEBUG) || defined(PARANOIA)
const size_t dehstates = sizeof(STATE_LIST)/sizeof(const char*);
const size_t dehmobjs = sizeof(MOBJTYPE_LIST)/sizeof(const char*);
const size_t dehpowers = sizeof(POWERS_LIST)/sizeof(const char*);
const size_t dehcolors = sizeof(COLOR_ENUMS)/sizeof(const char*);
if (dehstates != S_FIRSTFREESLOT)
I_Error("You forgot to update the Dehacked states list, you dolt!\n(%d states defined, versus %s in the Dehacked list)\n", S_FIRSTFREESLOT, sizeu1(dehstates));
if (dehmobjs != MT_FIRSTFREESLOT)
I_Error("You forgot to update the Dehacked mobjtype list, you dolt!\n(%d mobj types defined, versus %s in the Dehacked list)\n", MT_FIRSTFREESLOT, sizeu1(dehmobjs));
if (dehpowers != NUMPOWERS)
I_Error("You forgot to update the Dehacked powers list, you dolt!\n(%d powers defined, versus %s in the Dehacked list)\n", NUMPOWERS, sizeu1(dehpowers));
if (dehcolors != SKINCOLOR_FIRSTFREESLOT)
I_Error("You forgot to update the Dehacked colors list, you dolt!\n(%d colors defined, versus %s in the Dehacked list)\n", SKINCOLOR_FIRSTFREESLOT, sizeu1(dehcolors));
#endif
}

View file

@ -72,4 +72,7 @@ extern const char *const MENUTYPES_LIST[];
extern struct int_const_s const INT_CONST[];
// Moved to this file because it can't work compile-time otherwise
void DEH_TableCheck(void);
#endif

View file

@ -645,25 +645,3 @@ void DEH_LoadDehackedLump(lumpnum_t lumpnum)
{
DEH_LoadDehackedLumpPwad(WADFILENUM(lumpnum),LUMPNUM(lumpnum), false);
}
void DEH_Check(void)
{
#if defined(_DEBUG) || defined(PARANOIA)
const size_t dehstates = sizeof(STATE_LIST)/sizeof(const char*);
const size_t dehmobjs = sizeof(MOBJTYPE_LIST)/sizeof(const char*);
const size_t dehpowers = sizeof(POWERS_LIST)/sizeof(const char*);
const size_t dehcolors = sizeof(COLOR_ENUMS)/sizeof(const char*);
if (dehstates != S_FIRSTFREESLOT)
I_Error("You forgot to update the Dehacked states list, you dolt!\n(%d states defined, versus %s in the Dehacked list)\n", S_FIRSTFREESLOT, sizeu1(dehstates));
if (dehmobjs != MT_FIRSTFREESLOT)
I_Error("You forgot to update the Dehacked mobjtype list, you dolt!\n(%d mobj types defined, versus %s in the Dehacked list)\n", MT_FIRSTFREESLOT, sizeu1(dehmobjs));
if (dehpowers != NUMPOWERS)
I_Error("You forgot to update the Dehacked powers list, you dolt!\n(%d powers defined, versus %s in the Dehacked list)\n", NUMPOWERS, sizeu1(dehpowers));
if (dehcolors != SKINCOLOR_FIRSTFREESLOT)
I_Error("You forgot to update the Dehacked colors list, you dolt!\n(%d colors defined, versus %s in the Dehacked list)\n", SKINCOLOR_FIRSTFREESLOT, sizeu1(dehcolors));
#endif
}

View file

@ -30,8 +30,6 @@ typedef enum
void DEH_LoadDehackedLump(lumpnum_t lumpnum);
void DEH_LoadDehackedLumpPwad(UINT16 wad, UINT16 lump, boolean mainfile);
void DEH_Check(void);
fixed_t get_number(const char *word);
FUNCPRINTF void deh_warning(const char *first, ...);
void deh_strlcpy(char *dst, const char *src, size_t size, const char *warntext);

View file

@ -437,18 +437,9 @@ void HWR_DrawCroppedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale,
if (!(option & V_SCALEPATCHMASK))
{
// if it's meant to cover the whole screen, black out the rest (ONLY IF TOP LEFT ISN'T TRANSPARENT)
// cx and cy are possibly *slightly* off from float maths
// This is done before here compared to software because we directly alter cx and cy to centre
if (cx >= -0.1f && cx <= 0.1f && gpatch->width == BASEVIDWIDTH && cy >= -0.1f && cy <= 0.1f && gpatch->height == BASEVIDHEIGHT)
{
const column_t *column = (const column_t *)((const UINT8 *)(gpatch->columns) + (gpatch->columnofs[0]));
if (!column->topdelta)
{
const UINT8 *source = (const UINT8 *)(column) + 3;
HWR_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, (column->topdelta == 0xff ? 31 : source[0]));
}
}
// if it's meant to cover the whole screen, black out the rest
// no the patch is cropped do not do this ever
// centre screen
if (fabsf((float)vid.width - (float)BASEVIDWIDTH * dupx) > 1.0E-36f)
{
@ -470,11 +461,11 @@ void HWR_DrawCroppedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale,
fwidth = w;
fheight = h;
if (fwidth > gpatch->width)
fwidth = gpatch->width;
if (sx + w > gpatch->width)
fwidth = gpatch->width - sx;
if (fheight > gpatch->height)
fheight = gpatch->height;
if (sy + h > gpatch->height)
fheight = gpatch->height - sy;
if (pscale != FRACUNIT)
{
@ -506,13 +497,13 @@ void HWR_DrawCroppedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale,
v[0].s = v[3].s = ((sx)/(float)(gpatch->width))*hwrPatch->max_s;
if (sx + w > gpatch->width)
v[2].s = v[1].s = hwrPatch->max_s - ((sx+w)/(float)(gpatch->width))*hwrPatch->max_s;
v[2].s = v[1].s = hwrPatch->max_s;
else
v[2].s = v[1].s = ((sx+w)/(float)(gpatch->width))*hwrPatch->max_s;
v[0].t = v[1].t = ((sy)/(float)(gpatch->height))*hwrPatch->max_t;
if (sy + h > gpatch->height)
v[2].t = v[3].t = hwrPatch->max_t - ((sy+h)/(float)(gpatch->height))*hwrPatch->max_t;
v[2].t = v[3].t = hwrPatch->max_t;
else
v[2].t = v[3].t = ((sy+h)/(float)(gpatch->height))*hwrPatch->max_t;

View file

@ -3665,7 +3665,7 @@ static void HWR_DrawDropShadow(mobj_t *thing, fixed_t scale)
static void HWR_RotateSpritePolyToAim(gl_vissprite_t *spr, FOutVector *wallVerts, const boolean precip)
{
if (cv_glspritebillboarding.value
&& spr && spr->mobj && !(spr->mobj->frame & FF_PAPERSPRITE)
&& spr && spr->mobj && !R_ThingIsPaperSprite(spr->mobj)
&& wallVerts)
{
float basey = FIXED_TO_FLOAT(spr->mobj->z);
@ -3707,7 +3707,6 @@ static void HWR_SplitSprite(gl_vissprite_t *spr)
FBITFIELD blend = 0;
FBITFIELD occlusion;
boolean use_linkdraw_hack = false;
boolean splat = R_ThingIsFloorSprite(spr->mobj);
UINT8 alpha;
INT32 i;
@ -3766,22 +3765,19 @@ static void HWR_SplitSprite(gl_vissprite_t *spr)
baseWallVerts[0].t = baseWallVerts[1].t = ((GLPatch_t *)gpatch->hardware)->max_t;
}
if (!splat)
{
// if it has a dispoffset, push it a little towards the camera
if (spr->dispoffset) {
float co = -gl_viewcos*(0.05f*spr->dispoffset);
float si = -gl_viewsin*(0.05f*spr->dispoffset);
baseWallVerts[0].z = baseWallVerts[3].z = baseWallVerts[0].z+si;
baseWallVerts[1].z = baseWallVerts[2].z = baseWallVerts[1].z+si;
baseWallVerts[0].x = baseWallVerts[3].x = baseWallVerts[0].x+co;
baseWallVerts[1].x = baseWallVerts[2].x = baseWallVerts[1].x+co;
}
// Let dispoffset work first since this adjust each vertex
HWR_RotateSpritePolyToAim(spr, baseWallVerts, false);
// if it has a dispoffset, push it a little towards the camera
if (spr->dispoffset) {
float co = -gl_viewcos*(0.05f*spr->dispoffset);
float si = -gl_viewsin*(0.05f*spr->dispoffset);
baseWallVerts[0].z = baseWallVerts[3].z = baseWallVerts[0].z+si;
baseWallVerts[1].z = baseWallVerts[2].z = baseWallVerts[1].z+si;
baseWallVerts[0].x = baseWallVerts[3].x = baseWallVerts[0].x+co;
baseWallVerts[1].x = baseWallVerts[2].x = baseWallVerts[1].x+co;
}
// Let dispoffset work first since this adjust each vertex
HWR_RotateSpritePolyToAim(spr, baseWallVerts, false);
realtop = top = baseWallVerts[3].y;
realbot = bot = baseWallVerts[0].y;
ttop = baseWallVerts[3].t;
@ -3914,7 +3910,7 @@ static void HWR_SplitSprite(gl_vissprite_t *spr)
// The x and y only need to be adjusted in the case that it's not a papersprite
if (cv_glspritebillboarding.value
&& spr->mobj && !(spr->mobj->frame & FF_PAPERSPRITE))
&& spr->mobj && !R_ThingIsPaperSprite(spr->mobj))
{
// Get the x and z of the vertices so billboarding draws correctly
realheight = realbot - realtop;
@ -3983,7 +3979,7 @@ static void HWR_SplitSprite(gl_vissprite_t *spr)
static void HWR_DrawSprite(gl_vissprite_t *spr)
{
FOutVector wallVerts[4];
patch_t *gpatch; // sprite patch converted to hardware
patch_t *gpatch;
FSurfaceInfo Surf;
const boolean splat = R_ThingIsFloorSprite(spr->mobj);
@ -4284,7 +4280,7 @@ static inline void HWR_DrawPrecipitationSprite(gl_vissprite_t *spr)
{
FBITFIELD blend = 0;
FOutVector wallVerts[4];
patch_t *gpatch; // sprite patch converted to hardware
patch_t *gpatch;
FSurfaceInfo Surf;
if (!spr->mobj)
@ -4337,7 +4333,7 @@ static inline void HWR_DrawPrecipitationSprite(gl_vissprite_t *spr)
// Always use the light at the top instead of whatever I was doing before
INT32 light = R_GetPlaneLight(sector, spr->mobj->z + spr->mobj->height, false);
if (!(spr->mobj->frame & FF_FULLBRIGHT))
if (!R_ThingIsFullBright(spr->mobj))
lightlevel = *sector->lightlist[light].lightlevel > 255 ? 255 : *sector->lightlist[light].lightlevel;
if (*sector->lightlist[light].extra_colormap)
@ -4345,7 +4341,7 @@ static inline void HWR_DrawPrecipitationSprite(gl_vissprite_t *spr)
}
else
{
if (!(spr->mobj->frame & FF_FULLBRIGHT))
if (!R_ThingIsFullBright(spr->mobj))
lightlevel = sector->lightlevel > 255 ? 255 : sector->lightlevel;
if (sector->extra_colormap)
@ -4921,8 +4917,8 @@ static void HWR_ProjectSprite(mobj_t *thing)
angle_t ang;
INT32 heightsec, phs;
const boolean papersprite = R_ThingIsPaperSprite(thing);
const boolean splat = R_ThingIsFloorSprite(thing);
const boolean papersprite = (R_ThingIsPaperSprite(thing) && !splat);
angle_t mobjangle = (thing->player ? thing->player->drawangle : thing->angle);
float z1, z2;

View file

@ -158,7 +158,7 @@ static GLTextureFormat_t PNG_Load(const char *filename, int *w, int *h, GLPatch_
jmp_buf jmpbuf;
#endif
#endif
png_FILE_p png_FILE;
volatile png_FILE_p png_FILE;
//Filename checking fixed ~Monster Iestyn and Golden
char *pngfilename = va("%s"PATHSEP"models"PATHSEP"%s", srb2home, filename);
@ -1314,7 +1314,7 @@ boolean HWR_DrawModel(gl_vissprite_t *spr)
light = R_GetPlaneLight(sector, spr->mobj->z + spr->mobj->height, false); // Always use the light at the top instead of whatever I was doing before
if (!(spr->mobj->frame & FF_FULLBRIGHT))
if (!R_ThingIsFullBright(spr->mobj))
lightlevel = *sector->lightlist[light].lightlevel > 255 ? 255 : *sector->lightlist[light].lightlevel;
if (*sector->lightlist[light].extra_colormap)
@ -1322,7 +1322,7 @@ boolean HWR_DrawModel(gl_vissprite_t *spr)
}
else
{
if (!(spr->mobj->frame & FF_FULLBRIGHT))
if (!R_ThingIsFullBright(spr->mobj))
lightlevel = sector->lightlevel > 255 ? 255 : sector->lightlevel;
if (sector->extra_colormap)
@ -1340,10 +1340,9 @@ boolean HWR_DrawModel(gl_vissprite_t *spr)
GLPatch_t *hwrPatch = NULL, *hwrBlendPatch = NULL;
INT32 durs = spr->mobj->state->tics;
INT32 tics = spr->mobj->tics;
//mdlframe_t *next = NULL;
const boolean papersprite = (spr->mobj->frame & FF_PAPERSPRITE);
const UINT8 flip = (UINT8)(!(spr->mobj->eflags & MFE_VERTICALFLIP) != !(spr->mobj->frame & FF_VERTICALFLIP));
const UINT8 hflip = (UINT8)(!(spr->mobj->mirrored) != !(spr->mobj->frame & FF_HORIZONTALFLIP));
const boolean papersprite = (R_ThingIsPaperSprite(spr->mobj) && !R_ThingIsFloorSprite(spr->mobj));
const UINT8 flip = (UINT8)(!(spr->mobj->eflags & MFE_VERTICALFLIP) != !R_ThingVerticallyFlipped(spr->mobj));
const UINT8 hflip = (UINT8)(!(spr->mobj->mirrored) != !R_ThingHorizontallyFlipped(spr->mobj));
spritedef_t *sprdef;
spriteframe_t *sprframe;
spriteinfo_t *sprinfo;
@ -1405,6 +1404,11 @@ boolean HWR_DrawModel(gl_vissprite_t *spr)
|| ((!hwrBlendPatch->mipmap->format || !hwrBlendPatch->mipmap->downloaded) && !md2->noblendfile)))
md2_loadBlendTexture(md2);
// Load it again, because it isn't being loaded into blendgpatch after md2_loadblendtexture...
blendgpatch = md2->blendgrpatch;
if (blendgpatch)
hwrBlendPatch = ((GLPatch_t *)blendgpatch->hardware);
if (md2->error)
return false; // we already failed loading this before :(
if (!md2->model)

View file

@ -962,8 +962,6 @@ EXPORT boolean HWRAPI(CompileShaders) (void)
}
}
SetShader(SHADER_DEFAULT);
return true;
#else
return false;

View file

@ -98,6 +98,7 @@ patch_t *emeraldpics[3][8]; // 0 = normal, 1 = tiny, 2 = coinbox
static patch_t *emblemicon;
patch_t *tokenicon;
static patch_t *exiticon;
static patch_t *nopingicon;
//-------------------------------------------
// misc vars
@ -286,6 +287,7 @@ void HU_LoadGraphics(void)
emblemicon = W_CachePatchName("EMBLICON", PU_HUDGFX);
tokenicon = W_CachePatchName("TOKNICON", PU_HUDGFX);
exiticon = W_CachePatchName("EXITICON", PU_HUDGFX);
nopingicon = W_CachePatchName("NOPINGICON", PU_HUDGFX);
emeraldpics[0][0] = W_CachePatchName("CHAOS1", PU_HUDGFX);
emeraldpics[0][1] = W_CachePatchName("CHAOS2", PU_HUDGFX);
@ -2246,8 +2248,8 @@ void HU_Erase(void)
//
void HU_drawPing(INT32 x, INT32 y, UINT32 ping, boolean notext, INT32 flags)
{
UINT8 numbars = 1; // how many ping bars do we draw?
UINT8 barcolor = 35; // color we use for the bars (green, yellow or red)
UINT8 numbars = 0; // how many ping bars do we draw?
UINT8 barcolor = 31; // color we use for the bars (green, yellow, red or black)
SINT8 i = 0;
SINT8 yoffset = 6;
INT32 dx = x+1 - (V_SmallStringWidth(va("%dms", ping),
@ -2260,11 +2262,16 @@ void HU_drawPing(INT32 x, INT32 y, UINT32 ping, boolean notext, INT32 flags)
}
else if (ping < 256)
{
numbars = 2; // Apparently ternaries w/ multiple statements don't look good in C so I decided against it.
numbars = 2;
barcolor = 73;
}
else if (ping < UINT32_MAX)
{
numbars = 1;
barcolor = 35;
}
if (!notext || vid.width >= 640) // how sad, we're using a shit resolution.
if (ping < UINT32_MAX && (!notext || vid.width >= 640)) // how sad, we're using a shit resolution.
V_DrawSmallString(dx, y+4, V_ALLOWLOWERCASE|flags, va("%dms", ping));
for (i=0; (i<3); i++) // Draw the ping bar
@ -2275,6 +2282,9 @@ void HU_drawPing(INT32 x, INT32 y, UINT32 ping, boolean notext, INT32 flags)
yoffset -= 2;
}
if (ping == UINT32_MAX)
V_DrawSmallScaledPatch(x + 4 - nopingicon->width/2, y + 9 - nopingicon->height/2, 0, nopingicon);
}
//
@ -2301,16 +2311,17 @@ void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, I
if (!splitscreen) // don't draw it on splitscreen,
{
if (!(tab[i].num == serverplayer || players[tab[i].num].quittime))
HU_drawPing(x+ 253, y, playerpingtable[tab[i].num], false, 0);
if (tab[i].num != serverplayer)
HU_drawPing(x + 253, y, players[tab[i].num].quittime ? UINT32_MAX : playerpingtable[tab[i].num], false, 0);
//else
// V_DrawSmallString(x+ 246, y+4, V_YELLOWMAP, "SERVER");
}
V_DrawString(x + 20, y,
((tab[i].num == whiteplayer) ? V_YELLOWMAP : 0)
| (greycheck ? V_60TRANS : 0)
| V_ALLOWLOWERCASE, tab[i].name);
if (!players[tab[i].num].quittime || (leveltime / (TICRATE/2) & 1))
V_DrawString(x + 20, y,
((tab[i].num == whiteplayer) ? V_YELLOWMAP : 0)
| (greycheck ? V_60TRANS : 0)
| V_ALLOWLOWERCASE, tab[i].name);
// Draw emeralds
if (players[tab[i].num].powers[pw_invulnerability] && (players[tab[i].num].powers[pw_invulnerability] == players[tab[i].num].powers[pw_sneakers]) && ((leveltime/7) & 1))
@ -2458,10 +2469,11 @@ static void HU_Draw32TeamTabRankings(playersort_t *tab, INT32 whiteplayer)
supercheck = supercheckdef;
strlcpy(name, tab[i].name, 8);
V_DrawString(x + 10, y,
((tab[i].num == whiteplayer) ? V_YELLOWMAP : 0)
| (greycheck ? 0 : V_TRANSLUCENT)
| V_ALLOWLOWERCASE, name);
if (!players[tab[i].num].quittime || (leveltime / (TICRATE/2) & 1))
V_DrawString(x + 10, y,
((tab[i].num == whiteplayer) ? V_YELLOWMAP : 0)
| (greycheck ? 0 : V_TRANSLUCENT)
| V_ALLOWLOWERCASE, name);
if (gametyperules & GTR_TEAMFLAGS)
{
@ -2500,10 +2512,10 @@ static void HU_Draw32TeamTabRankings(playersort_t *tab, INT32 whiteplayer)
V_DrawRightAlignedThinString(x+128, y, ((players[tab[i].num].spectator || players[tab[i].num].playerstate == PST_DEAD) ? 0 : V_TRANSLUCENT), va("%u", tab[i].count));
if (!splitscreen)
{
if (!(tab[i].num == serverplayer || players[tab[i].num].quittime))
HU_drawPing(x+ 135, y+1, playerpingtable[tab[i].num], true, 0);
//else
//V_DrawSmallString(x+ 129, y+4, V_YELLOWMAP, "HOST");
if (tab[i].num != serverplayer)
HU_drawPing(x + 135, y+1, players[tab[i].num].quittime ? UINT32_MAX : playerpingtable[tab[i].num], true, 0);
//else
//V_DrawSmallString(x+ 129, y+4, V_YELLOWMAP, "HOST");
}
}
}
@ -2586,10 +2598,11 @@ void HU_DrawTeamTabRankings(playersort_t *tab, INT32 whiteplayer)
supercheck = supercheckdef;
strlcpy(name, tab[i].name, 7);
V_DrawString(x + 20, y,
((tab[i].num == whiteplayer) ? V_YELLOWMAP : 0)
| (greycheck ? V_TRANSLUCENT : 0)
| V_ALLOWLOWERCASE, name);
if (!players[tab[i].num].quittime || (leveltime / (TICRATE/2) & 1))
V_DrawString(x + 20, y,
((tab[i].num == whiteplayer) ? V_YELLOWMAP : 0)
| (greycheck ? V_TRANSLUCENT : 0)
| V_ALLOWLOWERCASE, name);
if (gametyperules & GTR_TEAMFLAGS)
{
@ -2624,10 +2637,10 @@ void HU_DrawTeamTabRankings(playersort_t *tab, INT32 whiteplayer)
V_DrawRightAlignedThinString(x+100, y, (greycheck ? V_TRANSLUCENT : 0), va("%u", tab[i].count));
if (!splitscreen)
{
if (!(tab[i].num == serverplayer || players[tab[i].num].quittime))
HU_drawPing(x+ 113, y, playerpingtable[tab[i].num], false, 0);
//else
// V_DrawSmallString(x+ 94, y+4, V_YELLOWMAP, "SERVER");
if (tab[i].num != serverplayer)
HU_drawPing(x+ 113, y, players[tab[i].num].quittime ? UINT32_MAX : playerpingtable[tab[i].num], false, 0);
//else
// V_DrawSmallString(x+ 94, y+4, V_YELLOWMAP, "SERVER");
}
}
}
@ -2655,15 +2668,16 @@ void HU_DrawDualTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scoreline
supercheck = supercheckdef;
strlcpy(name, tab[i].name, 7);
if (!(tab[i].num == serverplayer || players[tab[i].num].quittime))
HU_drawPing(x+ 113, y, playerpingtable[tab[i].num], false, 0);
if (tab[i].num != serverplayer)
HU_drawPing(x+ 113, y, players[tab[i].num].quittime ? UINT32_MAX : playerpingtable[tab[i].num], false, 0);
//else
// V_DrawSmallString(x+ 94, y+4, V_YELLOWMAP, "SERVER");
V_DrawString(x + 20, y,
((tab[i].num == whiteplayer) ? V_YELLOWMAP : 0)
| (greycheck ? V_TRANSLUCENT : 0)
| V_ALLOWLOWERCASE, name);
if (!players[tab[i].num].quittime || (leveltime / (TICRATE/2) & 1))
V_DrawString(x + 20, y,
((tab[i].num == whiteplayer) ? V_YELLOWMAP : 0)
| (greycheck ? V_TRANSLUCENT : 0)
| V_ALLOWLOWERCASE, name);
if (G_GametypeUsesLives() && !(G_GametypeUsesCoopLives() && (cv_cooplives.value == 0 || cv_cooplives.value == 3)) && (players[tab[i].num].lives != INFLIVES)) //show lives
V_DrawRightAlignedString(x, y+4, V_ALLOWLOWERCASE, va("%dx", players[tab[i].num].lives));
@ -2763,16 +2777,17 @@ static void HU_Draw32TabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scor
strlcpy(name, tab[i].name, 7);
if (!splitscreen) // don't draw it on splitscreen,
{
if (!(tab[i].num == serverplayer || players[tab[i].num].quittime))
HU_drawPing(x+ 135, y+1, playerpingtable[tab[i].num], true, 0);
//else
// V_DrawSmallString(x+ 129, y+4, V_YELLOWMAP, "HOST");
if (tab[i].num != serverplayer)
HU_drawPing(x+ 135, y+1, players[tab[i].num].quittime ? UINT32_MAX : playerpingtable[tab[i].num], true, 0);
//else
// V_DrawSmallString(x+ 129, y+4, V_YELLOWMAP, "HOST");
}
V_DrawString(x + 10, y,
((tab[i].num == whiteplayer) ? V_YELLOWMAP : 0)
| (greycheck ? 0 : V_TRANSLUCENT)
| V_ALLOWLOWERCASE, name);
if (!players[tab[i].num].quittime || (leveltime / (TICRATE/2) & 1))
V_DrawString(x + 10, y,
((tab[i].num == whiteplayer) ? V_YELLOWMAP : 0)
| (greycheck ? 0 : V_TRANSLUCENT)
| V_ALLOWLOWERCASE, name);
if (G_GametypeUsesLives()) //show lives
V_DrawRightAlignedThinString(x-1, y, V_ALLOWLOWERCASE, va("%d", players[tab[i].num].lives));

View file

@ -432,7 +432,6 @@ static int lib_pAproxDistance(lua_State *L)
fixed_t dx = luaL_checkfixed(L, 1);
fixed_t dy = luaL_checkfixed(L, 2);
//HUDSAFE
LUA_Deprecated(L, "P_AproxDistance", "FixedHypot");
lua_pushfixed(L, R_PointToDist2(0, 0, dx, dy));
return 1;
}

View file

@ -583,7 +583,7 @@ static int sector_get(lua_State *L)
lua_pushinteger(L, sector->special);
return 1;
case sector_tag:
lua_pushinteger(L, Tag_FGet(&sector->tags));
lua_pushinteger(L, (UINT16)Tag_FGet(&sector->tags));
return 1;
case sector_taglist:
LUA_PushUserdata(L, &sector->tags, META_SECTORTAGLIST);
@ -828,6 +828,17 @@ static int line_get(lua_State *L)
lua_pushinteger(L, line->special);
return 1;
case line_tag:
// HELLO
// THIS IS LJ SONIC
// HOW IS YOUR DAY?
// BY THE WAY WHEN 2.3 OR 3.0 OR 4.0 OR SRB3 OR SRB4 OR WHATEVER IS OUT
// YOU SHOULD REMEMBER TO CHANGE THIS SO IT ALWAYS RETURNS A UNSIGNED VALUE
// HAVE A NICE DAY
//
//
//
//
// you are ugly
lua_pushinteger(L, Tag_FGet(&line->tags));
return 1;
case line_taglist:

View file

@ -417,7 +417,7 @@ static int lib_getPolyObject(lua_State *L)
{
i = luaL_checkinteger(L, 2);
if (i < 0 || i >= numPolyObjects)
return luaL_error(L, "PolyObjects[] index %d out of range (0 - %d)", i, numPolyObjects-1);
return luaL_error(L, "polyobjects[] index %d out of range (0 - %d)", i, numPolyObjects-1);
LUA_PushUserdata(L, &PolyObjects[i], META_POLYOBJ);
return 1;
}
@ -481,6 +481,6 @@ int LUA_PolyObjLib(lua_State *L)
lua_pushcfunction(L, lib_numPolyObjects);
lua_setfield(L, -2, "__len");
lua_setmetatable(L, -2);
lua_setglobal(L, "PolyObjects");
lua_setglobal(L, "polyobjects");
return 0;
}

View file

@ -1612,53 +1612,54 @@ static menuitem_t OP_ServerOptionsMenu[] =
{IT_STRING | IT_CVAR, NULL, "Max Players", &cv_maxplayers, 21},
{IT_STRING | IT_CVAR, NULL, "Allow Add-on Downloading", &cv_downloading, 26},
{IT_STRING | IT_CVAR, NULL, "Allow players to join", &cv_allownewplayer, 31},
{IT_STRING | IT_CVAR, NULL, "Minutes for reconnecting", &cv_rejointimeout, 36},
#endif
{IT_STRING | IT_CVAR, NULL, "Map progression", &cv_advancemap, 36},
{IT_STRING | IT_CVAR, NULL, "Intermission Timer", &cv_inttime, 41},
{IT_STRING | IT_CVAR, NULL, "Map progression", &cv_advancemap, 41},
{IT_STRING | IT_CVAR, NULL, "Intermission Timer", &cv_inttime, 46},
{IT_HEADER, NULL, "Characters", NULL, 50},
{IT_STRING | IT_CVAR, NULL, "Force a character", &cv_forceskin, 56},
{IT_STRING | IT_CVAR, NULL, "Restrict character changes", &cv_restrictskinchange, 61},
{IT_HEADER, NULL, "Characters", NULL, 55},
{IT_STRING | IT_CVAR, NULL, "Force a character", &cv_forceskin, 61},
{IT_STRING | IT_CVAR, NULL, "Restrict character changes", &cv_restrictskinchange, 66},
{IT_HEADER, NULL, "Items", NULL, 70},
{IT_STRING | IT_CVAR, NULL, "Item respawn delay", &cv_itemrespawntime, 76},
{IT_STRING | IT_SUBMENU, NULL, "Mystery Item Monitor Toggles...", &OP_MonitorToggleDef, 81},
{IT_HEADER, NULL, "Items", NULL, 75},
{IT_STRING | IT_CVAR, NULL, "Item respawn delay", &cv_itemrespawntime, 81},
{IT_STRING | IT_SUBMENU, NULL, "Mystery Item Monitor Toggles...", &OP_MonitorToggleDef, 86},
{IT_HEADER, NULL, "Cooperative", NULL, 90},
{IT_STRING | IT_CVAR, NULL, "Players required for exit", &cv_playersforexit, 96},
{IT_STRING | IT_CVAR, NULL, "Starposts", &cv_coopstarposts, 101},
{IT_STRING | IT_CVAR, NULL, "Life sharing", &cv_cooplives, 106},
{IT_STRING | IT_CVAR, NULL, "Post-goal free roaming", &cv_exitmove, 111},
{IT_HEADER, NULL, "Cooperative", NULL, 95},
{IT_STRING | IT_CVAR, NULL, "Players required for exit", &cv_playersforexit, 101},
{IT_STRING | IT_CVAR, NULL, "Starposts", &cv_coopstarposts, 106},
{IT_STRING | IT_CVAR, NULL, "Life sharing", &cv_cooplives, 111},
{IT_STRING | IT_CVAR, NULL, "Post-goal free roaming", &cv_exitmove, 116},
{IT_HEADER, NULL, "Race, Competition", NULL, 120},
{IT_STRING | IT_CVAR, NULL, "Level completion countdown", &cv_countdowntime, 126},
{IT_STRING | IT_CVAR, NULL, "Item Monitors", &cv_competitionboxes, 131},
{IT_HEADER, NULL, "Race, Competition", NULL, 125},
{IT_STRING | IT_CVAR, NULL, "Level completion countdown", &cv_countdowntime, 131},
{IT_STRING | IT_CVAR, NULL, "Item Monitors", &cv_competitionboxes, 136},
{IT_HEADER, NULL, "Ringslinger (Match, CTF, Tag, H&S)", NULL, 140},
{IT_STRING | IT_CVAR, NULL, "Time Limit", &cv_timelimit, 146},
{IT_STRING | IT_CVAR, NULL, "Score Limit", &cv_pointlimit, 151},
{IT_STRING | IT_CVAR, NULL, "Overtime on Tie", &cv_overtime, 156},
{IT_STRING | IT_CVAR, NULL, "Player respawn delay", &cv_respawntime, 161},
{IT_HEADER, NULL, "Ringslinger (Match, CTF, Tag, H&S)", NULL, 145},
{IT_STRING | IT_CVAR, NULL, "Time Limit", &cv_timelimit, 151},
{IT_STRING | IT_CVAR, NULL, "Score Limit", &cv_pointlimit, 156},
{IT_STRING | IT_CVAR, NULL, "Overtime on Tie", &cv_overtime, 161},
{IT_STRING | IT_CVAR, NULL, "Player respawn delay", &cv_respawntime, 166},
{IT_STRING | IT_CVAR, NULL, "Item Monitors", &cv_matchboxes, 171},
{IT_STRING | IT_CVAR, NULL, "Weapon Rings", &cv_specialrings, 176},
{IT_STRING | IT_CVAR, NULL, "Power Stones", &cv_powerstones, 181},
{IT_STRING | IT_CVAR, NULL, "Item Monitors", &cv_matchboxes, 176},
{IT_STRING | IT_CVAR, NULL, "Weapon Rings", &cv_specialrings, 181},
{IT_STRING | IT_CVAR, NULL, "Power Stones", &cv_powerstones, 186},
{IT_STRING | IT_CVAR, NULL, "Flag respawn delay", &cv_flagtime, 191},
{IT_STRING | IT_CVAR, NULL, "Hiding time", &cv_hidetime, 196},
{IT_STRING | IT_CVAR, NULL, "Flag respawn delay", &cv_flagtime, 196},
{IT_STRING | IT_CVAR, NULL, "Hiding time", &cv_hidetime, 201},
{IT_HEADER, NULL, "Teams", NULL, 205},
{IT_STRING | IT_CVAR, NULL, "Autobalance sizes", &cv_autobalance, 211},
{IT_STRING | IT_CVAR, NULL, "Scramble on Map Change", &cv_scrambleonchange, 216},
{IT_HEADER, NULL, "Teams", NULL, 210},
{IT_STRING | IT_CVAR, NULL, "Autobalance sizes", &cv_autobalance, 216},
{IT_STRING | IT_CVAR, NULL, "Scramble on Map Change", &cv_scrambleonchange, 221},
#ifndef NONET
{IT_HEADER, NULL, "Advanced", NULL, 225},
{IT_STRING | IT_CVAR | IT_CV_STRING, NULL, "Master server", &cv_masterserver, 231},
{IT_HEADER, NULL, "Advanced", NULL, 230},
{IT_STRING | IT_CVAR | IT_CV_STRING, NULL, "Master server", &cv_masterserver, 236},
{IT_STRING | IT_CVAR, NULL, "Join delay", &cv_joindelay, 246},
{IT_STRING | IT_CVAR, NULL, "Attempts to resynchronise", &cv_resynchattempts, 251},
{IT_STRING | IT_CVAR, NULL, "Join delay", &cv_joindelay, 251},
{IT_STRING | IT_CVAR, NULL, "Attempts to resynchronise", &cv_resynchattempts, 256},
{IT_STRING | IT_CVAR, NULL, "Show IP Address of Joiners", &cv_showjoinaddress, 256},
{IT_STRING | IT_CVAR, NULL, "Show IP Address of Joiners", &cv_showjoinaddress, 261},
#endif
};

View file

@ -165,7 +165,9 @@ consvar_t cv_zlib_window_bitsa = CVAR_INIT ("apng_window_size", "32k", CV_SAVE,
consvar_t cv_apng_delay = CVAR_INIT ("apng_speed", "1x", CV_SAVE, apng_delay_t, NULL);
consvar_t cv_apng_downscale = CVAR_INIT ("apng_downscale", "On", CV_SAVE, CV_OnOff, NULL);
#ifdef USE_APNG
static boolean apng_downscale = false; // So nobody can do something dumb like changing cvars mid output
#endif
boolean takescreenshot = false; // Take a screenshot this tic

View file

@ -1834,7 +1834,7 @@ void A_SnailerThink(mobj_t *actor)
fixed_t dist;
fixed_t dx, dy;
dist = R_PointToDist2(0, 0, actor->x - actor->target->x, actor->y - actor->target->y);
dist = P_AproxDistance(actor->x - actor->target->x, actor->y - actor->target->y);
if (an > ANGLE_45 && an <= ANGLE_90) // fire at 45 degrees to the left
{
@ -9879,22 +9879,23 @@ void A_Custom3DRotate(mobj_t *actor)
if (LUA_CallAction(A_CUSTOM3DROTATE, actor))
return;
if (!actor->target) // Ensure we actually have a target first.
{
CONS_Printf("Error: A_Custom3DRotate: Object has no target.\n");
P_RemoveMobj(actor);
return;
}
if (actor->target->health == 0)
{
P_RemoveMobj(actor);
return;
}
if (!actor->target) // This should NEVER happen.
{
if (cv_debug)
CONS_Printf("Error: Object has no target\n");
P_RemoveMobj(actor);
return;
}
if (hspeed==0 && vspeed==0)
{
CONS_Printf("Error: A_Custom3DRotate: Object has no speed.\n");
if (cv_debug)
CONS_Printf("Error: A_Custom3DRotate: Object has no speed.\n");
return;
}

View file

@ -190,7 +190,7 @@ fixed_t P_ReturnThrustY(mobj_t *mo, angle_t angle, fixed_t move)
boolean P_AutoPause(void)
{
// Don't pause even on menu-up or focus-lost in netgames or record attack
if (netgame || modeattacking || gamestate == GS_TITLESCREEN)
if (netgame || modeattacking || gamestate == GS_TITLESCREEN || (marathonmode && gamestate == GS_INTERMISSION))
return false;
return (menuactive || ( window_notinfocus && cv_pauseifunfocused.value ));
@ -4880,22 +4880,28 @@ void P_DoBubbleBounce(player_t *player)
//
void P_DoAbilityBounce(player_t *player, boolean changemomz)
{
fixed_t prevmomz;
if (player->mo->state-states == S_PLAY_BOUNCE_LANDING)
return;
if (changemomz)
{
fixed_t minmomz;
prevmomz = player->mo->momz;
fixed_t prevmomz = player->mo->momz, minmomz;
if (P_MobjFlip(player->mo)*prevmomz < 0)
prevmomz = 0;
else if (player->mo->eflags & MFE_UNDERWATER)
prevmomz /= 2;
P_DoJump(player, false);
player->pflags &= ~(PF_STARTJUMP|PF_JUMPED);
minmomz = FixedMul(player->mo->momz, 3*FRACUNIT/2);
player->mo->momz = max(minmomz, (minmomz + prevmomz)/2);
if (player->mo->eflags & MFE_VERTICALFLIP) // Use "min" or "max" depending on if the player is flipped
player->mo->momz = min(minmomz, (minmomz + prevmomz)/2);
else
player->mo->momz = max(minmomz, (minmomz + prevmomz)/2);
}
S_StartSound(player->mo, sfx_boingf);
P_SetPlayerMobjState(player->mo, S_PLAY_BOUNCE_LANDING);
player->pflags |= PF_BOUNCING|PF_THOKKED;
@ -5924,7 +5930,7 @@ static void P_3dMovement(player_t *player)
player->rmomy = player->mo->momy - player->cmomy;
// Calculates player's speed based on distance-of-a-line formula
player->speed = R_PointToDist2(0, 0, player->rmomx, player->rmomy);
player->speed = P_AproxDistance(player->rmomx, player->rmomy);
// Monster Iestyn - 04-11-13
// Quadrants are stupid, excessive and broken, let's do this a much simpler way!

View file

@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2020 by Sonic Team Junior.
// Copyright (C) 1999-2021 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@ -30,10 +30,6 @@
#include "byteptr.h"
#include "dehacked.h"
#ifdef _WIN32
#include <malloc.h> // alloca(sizeof)
#endif
//
// Graphics.
// SRB2 graphics for walls and sprites

View file

@ -134,9 +134,43 @@ UINT32 nflatxshift, nflatyshift, nflatshiftup, nflatmask;
#define DEFAULT_STARTTRANSCOLOR 96
#define NUM_PALETTE_ENTRIES 256
static UINT8** translationtablecache[MAXSKINS + 7] = {NULL};
static UINT8 **translationtablecache[MAXSKINS + 7] = {NULL};
UINT8 skincolor_modified[MAXSKINCOLORS];
static INT32 SkinToCacheIndex(INT32 skinnum)
{
switch (skinnum)
{
case TC_DEFAULT: return DEFAULT_TT_CACHE_INDEX;
case TC_BOSS: return BOSS_TT_CACHE_INDEX;
case TC_METALSONIC: return METALSONIC_TT_CACHE_INDEX;
case TC_ALLWHITE: return ALLWHITE_TT_CACHE_INDEX;
case TC_RAINBOW: return RAINBOW_TT_CACHE_INDEX;
case TC_BLINK: return BLINK_TT_CACHE_INDEX;
case TC_DASHMODE: return DASHMODE_TT_CACHE_INDEX;
default: break;
}
return skinnum;
}
static INT32 CacheIndexToSkin(INT32 ttc)
{
switch (ttc)
{
case DEFAULT_TT_CACHE_INDEX: return TC_DEFAULT;
case BOSS_TT_CACHE_INDEX: return TC_BOSS;
case METALSONIC_TT_CACHE_INDEX: return TC_METALSONIC;
case ALLWHITE_TT_CACHE_INDEX: return TC_ALLWHITE;
case RAINBOW_TT_CACHE_INDEX: return TC_RAINBOW;
case BLINK_TT_CACHE_INDEX: return TC_BLINK;
case DASHMODE_TT_CACHE_INDEX: return TC_DASHMODE;
default: break;
}
return ttc;
}
CV_PossibleValue_t Color_cons_t[MAXSKINCOLORS+1];
#define TRANSTAB_AMTMUL10 (256.0f / 10.0f)
@ -308,7 +342,7 @@ static void R_RainbowColormap(UINT8 *dest_colormap, UINT16 skincolor)
/** \brief Generates a translation colormap.
\param dest_colormap colormap to populate
\param skinnum number of skin, TC_DEFAULT or TC_BOSS
\param skinnum skin number, or a translation mode
\param color translation color
\return void
@ -412,6 +446,9 @@ static void R_GenerateTranslationColormap(UINT8 *dest_colormap, INT32 skinnum, U
if (color >= numskincolors)
I_Error("Invalid skin color #%hu.", (UINT16)color);
if (skinnum < 0 && skinnum > TC_DEFAULT)
I_Error("Invalid translation colormap index %d.", skinnum);
starttranscolor = (skinnum != TC_DEFAULT) ? skins[skinnum].starttranscolor : DEFAULT_STARTTRANSCOLOR;
if (starttranscolor >= NUM_PALETTE_ENTRIES)
@ -448,25 +485,11 @@ static void R_GenerateTranslationColormap(UINT8 *dest_colormap, INT32 skinnum, U
UINT8* R_GetTranslationColormap(INT32 skinnum, skincolornum_t color, UINT8 flags)
{
UINT8* ret;
INT32 skintableindex;
INT32 skintableindex = SkinToCacheIndex(skinnum); // Adjust if we want the default colormap
INT32 i;
// Adjust if we want the default colormap
switch (skinnum)
{
case TC_DEFAULT: skintableindex = DEFAULT_TT_CACHE_INDEX; break;
case TC_BOSS: skintableindex = BOSS_TT_CACHE_INDEX; break;
case TC_METALSONIC: skintableindex = METALSONIC_TT_CACHE_INDEX; break;
case TC_ALLWHITE: skintableindex = ALLWHITE_TT_CACHE_INDEX; break;
case TC_RAINBOW: skintableindex = RAINBOW_TT_CACHE_INDEX; break;
case TC_BLINK: skintableindex = BLINK_TT_CACHE_INDEX; break;
case TC_DASHMODE: skintableindex = DASHMODE_TT_CACHE_INDEX; break;
default: skintableindex = skinnum; break;
}
if (flags & GTC_CACHE)
{
// Allocate table for skin if necessary
if (!translationtablecache[skintableindex])
translationtablecache[skintableindex] = Z_Calloc(MAXSKINCOLORS * sizeof(UINT8**), PU_STATIC, NULL);
@ -479,7 +502,8 @@ UINT8* R_GetTranslationColormap(INT32 skinnum, skincolornum_t color, UINT8 flags
{
for (i = 0; i < (INT32)(sizeof(translationtablecache) / sizeof(translationtablecache[0])); i++)
if (translationtablecache[i] && translationtablecache[i][color])
R_GenerateTranslationColormap(translationtablecache[i][color], i>=MAXSKINS ? MAXSKINS-i-1 : i, color);
R_GenerateTranslationColormap(translationtablecache[i][color], CacheIndexToSkin(i), color);
skincolor_modified[color] = false;
}
}

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2020 by Sonic Team Junior.
// Copyright (C) 1999-2021 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@ -1447,10 +1447,7 @@ void R_DrawFloorSprite_8 (void)
// SoM: Why didn't I see this earlier? the spot variable is a waste now because we don't
// have the uber complicated math to calculate it now, so that was a memory write we didn't
// need!
//
// <Callum> 4194303 = (2048x2048)-1 (2048x2048 is maximum flat size)
val = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift);
val &= 4194303;
val = source[val];
if (val & 0xFF00)
dest[0] = colormap[translation[val & 0xFF]];
@ -1458,7 +1455,6 @@ void R_DrawFloorSprite_8 (void)
yposition += ystep;
val = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift);
val &= 4194303;
val = source[val];
if (val & 0xFF00)
dest[1] = colormap[translation[val & 0xFF]];
@ -1466,7 +1462,6 @@ void R_DrawFloorSprite_8 (void)
yposition += ystep;
val = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift);
val &= 4194303;
val = source[val];
if (val & 0xFF00)
dest[2] = colormap[translation[val & 0xFF]];
@ -1474,7 +1469,6 @@ void R_DrawFloorSprite_8 (void)
yposition += ystep;
val = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift);
val &= 4194303;
val = source[val];
if (val & 0xFF00)
dest[3] = colormap[translation[val & 0xFF]];
@ -1482,7 +1476,6 @@ void R_DrawFloorSprite_8 (void)
yposition += ystep;
val = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift);
val &= 4194303;
val = source[val];
if (val & 0xFF00)
dest[4] = colormap[translation[val & 0xFF]];
@ -1490,7 +1483,6 @@ void R_DrawFloorSprite_8 (void)
yposition += ystep;
val = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift);
val &= 4194303;
val = source[val];
if (val & 0xFF00)
dest[5] = colormap[translation[val & 0xFF]];
@ -1498,7 +1490,6 @@ void R_DrawFloorSprite_8 (void)
yposition += ystep;
val = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift);
val &= 4194303;
val = source[val];
if (val & 0xFF00)
dest[6] = colormap[translation[val & 0xFF]];
@ -1506,7 +1497,6 @@ void R_DrawFloorSprite_8 (void)
yposition += ystep;
val = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift);
val &= 4194303;
val = source[val];
if (val & 0xFF00)
dest[7] = colormap[translation[val & 0xFF]];

View file

@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2020 by Sonic Team Junior.
// Copyright (C) 1999-2021 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@ -154,14 +154,10 @@ static void R_UpdatePlaneRipple(void)
// R_MapPlane
//
// Uses global vars:
// planeheight
// basexscale
// baseyscale
// centerx
// viewx
// viewy
// viewsin
// viewcos
// viewheight
void R_MapPlane(INT32 y, INT32 x1, INT32 x2)
{
@ -580,7 +576,7 @@ void R_ExpandPlane(visplane_t *pl, INT32 start, INT32 stop)
//
void R_MakeSpans(INT32 x, INT32 t1, INT32 b1, INT32 t2, INT32 b2)
{
// Alam: from r_splats's R_RenderFloorSplat
// Alam: from r_splats's R_RasterizeFloorSplat
if (t1 >= vid.height) t1 = vid.height-1;
if (b1 >= vid.height) b1 = vid.height-1;
if (t2 >= vid.height) t2 = vid.height-1;
@ -607,7 +603,6 @@ void R_MakeSpans(INT32 x, INT32 t1, INT32 b1, INT32 t2, INT32 b2)
void R_DrawPlanes(void)
{
visplane_t *pl;
angle_t va = viewangle;
INT32 i;
R_UpdatePlaneRipple();
@ -622,8 +617,6 @@ void R_DrawPlanes(void)
R_DrawSinglePlane(pl);
}
}
viewangle = va;
}
// R_DrawSkyPlane

View file

@ -1649,23 +1649,26 @@ void R_StoreWallRange(INT32 start, INT32 stop)
// left
temp = xtoviewangle[start]+viewangle;
#define FIXED_TO_DOUBLE(x) (((double)(x)) / ((double)FRACUNIT))
#define DOUBLE_TO_FIXED(x) (fixed_t)((x) * ((double)FRACUNIT))
{
// Both lines can be written in slope-intercept form, so figure out line intersection
float a1, b1, c1, a2, b2, c2, det; // 1 is the seg, 2 is the view angle vector...
///TODO: convert to FPU
double a1, b1, c1, a2, b2, c2, det; // 1 is the seg, 2 is the view angle vector...
///TODO: convert to fixed point
a1 = FIXED_TO_FLOAT(curline->v2->y-curline->v1->y);
b1 = FIXED_TO_FLOAT(curline->v1->x-curline->v2->x);
c1 = a1*FIXED_TO_FLOAT(curline->v1->x) + b1*FIXED_TO_FLOAT(curline->v1->y);
a1 = FIXED_TO_DOUBLE(curline->v2->y-curline->v1->y);
b1 = FIXED_TO_DOUBLE(curline->v1->x-curline->v2->x);
c1 = a1*FIXED_TO_DOUBLE(curline->v1->x) + b1*FIXED_TO_DOUBLE(curline->v1->y);
a2 = -FIXED_TO_FLOAT(FINESINE(temp>>ANGLETOFINESHIFT));
b2 = FIXED_TO_FLOAT(FINECOSINE(temp>>ANGLETOFINESHIFT));
c2 = a2*FIXED_TO_FLOAT(viewx) + b2*FIXED_TO_FLOAT(viewy);
a2 = -FIXED_TO_DOUBLE(FINESINE(temp>>ANGLETOFINESHIFT));
b2 = FIXED_TO_DOUBLE(FINECOSINE(temp>>ANGLETOFINESHIFT));
c2 = a2*FIXED_TO_DOUBLE(viewx) + b2*FIXED_TO_DOUBLE(viewy);
det = a1*b2 - a2*b1;
ds_p->leftpos.x = segleft.x = FLOAT_TO_FIXED((b2*c1 - b1*c2)/det);
ds_p->leftpos.y = segleft.y = FLOAT_TO_FIXED((a1*c2 - a2*c1)/det);
ds_p->leftpos.x = segleft.x = DOUBLE_TO_FIXED((b2*c1 - b1*c2)/det);
ds_p->leftpos.y = segleft.y = DOUBLE_TO_FIXED((a1*c2 - a2*c1)/det);
}
// right
@ -1673,22 +1676,26 @@ void R_StoreWallRange(INT32 start, INT32 stop)
{
// Both lines can be written in slope-intercept form, so figure out line intersection
float a1, b1, c1, a2, b2, c2, det; // 1 is the seg, 2 is the view angle vector...
///TODO: convert to FPU
double a1, b1, c1, a2, b2, c2, det; // 1 is the seg, 2 is the view angle vector...
///TODO: convert to fixed point
a1 = FIXED_TO_FLOAT(curline->v2->y-curline->v1->y);
b1 = FIXED_TO_FLOAT(curline->v1->x-curline->v2->x);
c1 = a1*FIXED_TO_FLOAT(curline->v1->x) + b1*FIXED_TO_FLOAT(curline->v1->y);
a1 = FIXED_TO_DOUBLE(curline->v2->y-curline->v1->y);
b1 = FIXED_TO_DOUBLE(curline->v1->x-curline->v2->x);
c1 = a1*FIXED_TO_DOUBLE(curline->v1->x) + b1*FIXED_TO_DOUBLE(curline->v1->y);
a2 = -FIXED_TO_FLOAT(FINESINE(temp>>ANGLETOFINESHIFT));
b2 = FIXED_TO_FLOAT(FINECOSINE(temp>>ANGLETOFINESHIFT));
c2 = a2*FIXED_TO_FLOAT(viewx) + b2*FIXED_TO_FLOAT(viewy);
a2 = -FIXED_TO_DOUBLE(FINESINE(temp>>ANGLETOFINESHIFT));
b2 = FIXED_TO_DOUBLE(FINECOSINE(temp>>ANGLETOFINESHIFT));
c2 = a2*FIXED_TO_DOUBLE(viewx) + b2*FIXED_TO_DOUBLE(viewy);
det = a1*b2 - a2*b1;
ds_p->rightpos.x = segright.x = FLOAT_TO_FIXED((b2*c1 - b1*c2)/det);
ds_p->rightpos.y = segright.y = FLOAT_TO_FIXED((a1*c2 - a2*c1)/det);
ds_p->rightpos.x = segright.x = DOUBLE_TO_FIXED((b2*c1 - b1*c2)/det);
ds_p->rightpos.y = segright.y = DOUBLE_TO_FIXED((a1*c2 - a2*c1)/det);
}
#undef FIXED_TO_DOUBLE
#undef DOUBLE_TO_FIXED
}

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2020 by Sonic Team Junior.
// Copyright (C) 1999-2021 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@ -28,11 +28,12 @@ static void prepare_rastertab(void);
// FLOOR SPLATS
// ==========================================================================
static void R_RasterizeFloorSplat(floorsplat_t *pSplat, vector2_t *verts, vissprite_t *vis);
#ifdef USEASM
void ASMCALL rasterize_segment_tex_asm(INT32 x1, INT32 y1, INT32 x2, INT32 y2, INT32 tv1, INT32 tv2, INT32 tc, INT32 dir);
#endif
// Lactozilla
static void rasterize_segment_tex(INT32 x1, INT32 y1, INT32 x2, INT32 y2, INT32 tv1, INT32 tv2, INT32 tc, INT32 dir)
{
#ifdef USEASM
@ -137,7 +138,7 @@ static void rasterize_segment_tex(INT32 x1, INT32 y1, INT32 x2, INT32 y2, INT32
}
}
void R_DrawFloorSprite(vissprite_t *spr)
void R_DrawFloorSplat(vissprite_t *spr)
{
floorsplat_t splat;
mobj_t *mobj = spr->mobj;
@ -187,7 +188,7 @@ void R_DrawFloorSprite(vissprite_t *spr)
if (spr->rotateflags & SRF_3D || renderflags & RF_NOSPLATBILLBOARD)
splatangle = mobj->angle;
else
splatangle = viewangle;
splatangle = spr->viewangle;
if (!(spr->cut & SC_ISROTATED))
splatangle += mobj->rollangle;
@ -265,7 +266,6 @@ void R_DrawFloorSprite(vissprite_t *spr)
if (splat.tilted)
{
// Lactozilla: Just copy the entire slope LMFAOOOO
pslope_t *s = &splat.slope;
s->o.x = slope->o.x;
@ -330,7 +330,7 @@ void R_DrawFloorSprite(vissprite_t *spr)
v2d[i].y = (centeryfrac + FixedMul(rot_z, yscale))>>FRACBITS;
}
R_RenderFloorSplat(&splat, v2d, spr);
R_RasterizeFloorSplat(&splat, v2d, spr);
}
// --------------------------------------------------------------------------
@ -338,7 +338,7 @@ void R_DrawFloorSprite(vissprite_t *spr)
// fill the polygon with linear interpolation, call span drawer for each
// scan line
// --------------------------------------------------------------------------
void R_RenderFloorSplat(floorsplat_t *pSplat, vector2_t *verts, vissprite_t *vis)
static void R_RasterizeFloorSplat(floorsplat_t *pSplat, vector2_t *verts, vissprite_t *vis)
{
// rasterizing
INT32 miny = viewheight + 1, maxy = 0;
@ -416,11 +416,10 @@ void R_RenderFloorSplat(floorsplat_t *pSplat, vector2_t *verts, vissprite_t *vis
if (R_CheckPowersOfTwo())
R_CheckFlatLength(ds_flatwidth * ds_flatheight);
// Lactozilla: I don't know what I'm doing
if (pSplat->tilted)
{
R_SetTiltedSpan(0);
R_CalculateSlopeVectors(&pSplat->slope, viewx, viewy, viewz, pSplat->xscale, pSplat->yscale, -pSplat->verts[0].x, pSplat->verts[0].y, viewangle, pSplat->angle, 1.0f);
R_CalculateSlopeVectors(&pSplat->slope, viewx, viewy, viewz, pSplat->xscale, pSplat->yscale, -pSplat->verts[0].x, pSplat->verts[0].y, vis->viewangle, pSplat->angle, 1.0f);
spanfunctype = SPANDRAWFUNC_TILTEDSPRITE;
}
else
@ -533,7 +532,7 @@ void R_RenderFloorSplat(floorsplat_t *pSplat, vector2_t *verts, vissprite_t *vis
fixed_t xstep, ystep;
fixed_t distance, span;
angle_t angle = (viewangle + pSplat->angle)>>ANGLETOFINESHIFT;
angle_t angle = (vis->viewangle + pSplat->angle)>>ANGLETOFINESHIFT;
angle_t planecos = FINECOSINE(angle);
angle_t planesin = FINESINE(angle);
@ -543,17 +542,13 @@ void R_RenderFloorSplat(floorsplat_t *pSplat, vector2_t *verts, vissprite_t *vis
distance = cacheddistance[y] = FixedMul(planeheight, yslope[y]);
span = abs(centery - y);
if (span) // don't divide by zero
if (span) // Don't divide by zero
{
xstep = FixedMul(planesin, planeheight) / span;
ystep = FixedMul(planecos, planeheight) / span;
}
else
{
// ah
xstep = FRACUNIT;
ystep = FRACUNIT;
}
xstep = ystep = FRACUNIT;
cachedxstep[y] = xstep;
cachedystep[y] = ystep;

View file

@ -42,7 +42,6 @@ typedef struct floorsplat_s
mobj_t *mobj; // Mobj it is tied to
} floorsplat_t;
void R_DrawFloorSprite(vissprite_t *spr);
void R_RenderFloorSplat(floorsplat_t *pSplat, vector2_t *verts, vissprite_t *vis);
void R_DrawFloorSplat(vissprite_t *spr);
#endif /*__R_SPLATS_H__*/

View file

@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2020 by Sonic Team Junior.
// Copyright (C) 1999-2021 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@ -28,11 +28,6 @@
#include "byteptr.h"
#include "dehacked.h"
// I don't know what this is even for, but r_data.c had it.
#ifdef _WIN32
#include <malloc.h> // alloca(sizeof)
#endif
#ifdef HWRENDER
#include "hardware/hw_glob.h" // HWR_LoadMapTextures
#endif
@ -626,7 +621,7 @@ void *R_GetLevelFlat(levelflat_t *levelflat)
//
// R_CheckPowersOfTwo
//
// Self-explanatory?
// Sets ds_powersoftwo true if the flat's dimensions are powers of two, and returns that.
//
boolean R_CheckPowersOfTwo(void)
{

View file

@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2020 by Sonic Team Junior.
// Copyright (C) 1999-2021 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@ -796,7 +796,7 @@ static void R_DrawVisSprite(vissprite_t *vis)
INT32 pwidth;
fixed_t frac;
patch_t *patch = vis->patch;
fixed_t this_scale = vis->mobj->scale;
fixed_t this_scale = vis->thingscale;
INT32 x1, x2;
INT64 overflow_test;
@ -1332,6 +1332,7 @@ static void R_ProjectDropShadow(mobj_t *thing, vissprite_t *vis, fixed_t scale,
shadow->xscale = FixedMul(xscale, shadowxscale); //SoM: 4/17/2000
shadow->scale = FixedMul(yscale, shadowyscale);
shadow->thingscale = thing->scale;
shadow->sector = vis->sector;
shadow->szt = (INT16)((centeryfrac - FixedMul(shadow->gzt - viewz, yscale))>>FRACBITS);
shadow->sz = (INT16)((centeryfrac - FixedMul(shadow->gz - viewz, yscale))>>FRACBITS);
@ -1423,7 +1424,7 @@ static void R_ProjectSprite(mobj_t *thing)
fixed_t sheartan = 0;
fixed_t shadowscale = FRACUNIT;
fixed_t basetx; // drop shadows
fixed_t basetx, basetz; // drop shadows
boolean shadowdraw, shadoweffects, shadowskew;
boolean splat = R_ThingIsFloorSprite(thing);
@ -1453,7 +1454,7 @@ static void R_ProjectSprite(mobj_t *thing)
tr_x = thing->x - viewx;
tr_y = thing->y - viewy;
tz = FixedMul(tr_x, viewcos) + FixedMul(tr_y, viewsin); // near/far distance
basetz = tz = FixedMul(tr_x, viewcos) + FixedMul(tr_y, viewsin); // near/far distance
// thing is behind view plane?
if (!papersprite && (tz < FixedMul(MINZ, this_scale))) // papersprite clipping is handled later
@ -1955,6 +1956,7 @@ static void R_ProjectSprite(mobj_t *thing)
vis->paperoffset = paperoffset;
vis->paperdistance = paperdistance;
vis->centerangle = centerangle;
vis->viewangle = viewangle;
vis->shear.tan = sheartan;
vis->shear.offset = 0;
@ -1975,6 +1977,7 @@ static void R_ProjectSprite(mobj_t *thing)
vis->xscale = FixedMul(spritexscale, xscale); //SoM: 4/17/2000
vis->scale = FixedMul(spriteyscale, yscale); //<<detailshift;
vis->thingscale = oldthing->scale;
vis->spritexscale = spritexscale;
vis->spriteyscale = spriteyscale;
@ -2052,7 +2055,7 @@ static void R_ProjectSprite(mobj_t *thing)
R_SplitSprite(vis);
if (oldthing->shadowscale && cv_shadow.value)
R_ProjectDropShadow(oldthing, vis, oldthing->shadowscale, basetx, tz);
R_ProjectDropShadow(oldthing, vis, oldthing->shadowscale, basetx, basetz);
// Debug
++objectsdrawn;
@ -2781,7 +2784,7 @@ static void R_DrawSprite(vissprite_t *spr)
mceilingclip = spr->cliptop;
if (spr->cut & SC_SPLAT)
R_DrawFloorSprite(spr);
R_DrawFloorSplat(spr);
else
R_DrawVisSprite(spr);
}

View file

@ -155,7 +155,8 @@ typedef struct vissprite_s
fixed_t pz, pzt; // physical bottom/top for sorting with 3D floors
fixed_t startfrac; // horizontal position of x1
fixed_t scale;
fixed_t xscale, scale; // projected horizontal and vertical scales
fixed_t thingscale; // the object's scale
fixed_t sortscale; // sortscale only differs from scale for paper sprites, floor sprites, and MF2_LINKDRAW
fixed_t sortsplat; // the sortscale from behind the floor sprite
fixed_t scalestep; // only for paper sprites, 0 otherwise
@ -163,6 +164,7 @@ typedef struct vissprite_s
fixed_t xiscale; // negative if flipped
angle_t centerangle; // for paper sprites
angle_t viewangle; // for floor sprites, the viewpoint's current angle
struct {
fixed_t tan; // The amount to shear the sprite vertically per row
@ -183,8 +185,6 @@ typedef struct vissprite_s
extracolormap_t *extra_colormap; // global colormaps
fixed_t xscale;
// Precalculated top and bottom screen coords for the sprite.
fixed_t thingheight; // The actual height of the thing (for 3D floors)
sector_t *sector; // The sector containing the thing.

View file

@ -137,6 +137,12 @@ typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T);
#include <errno.h>
#endif
#if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)
#include <execinfo.h>
#include <time.h>
#define UNIXBACKTRACE
#endif
// Locations for searching the srb2.pk3
#if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)
#define DEFAULTWADLOCATION1 "/usr/local/share/games/SRB2"
@ -238,6 +244,71 @@ SDL_bool framebuffer = SDL_FALSE;
UINT8 keyboard_started = false;
#ifdef UNIXBACKTRACE
#define STDERR_WRITE(string) if (fd != -1) I_OutputMsg("%s", string)
#define CRASHLOG_WRITE(string) if (fd != -1) write(fd, string, strlen(string))
#define CRASHLOG_STDERR_WRITE(string) \
if (fd != -1)\
write(fd, string, strlen(string));\
I_OutputMsg("%s", string)
static void write_backtrace(INT32 signal)
{
int fd = -1;
size_t size;
time_t rawtime;
struct tm timeinfo;
enum { BT_SIZE = 1024, STR_SIZE = 32 };
void *array[BT_SIZE];
char timestr[STR_SIZE];
const char *error = "An error occurred within SRB2! Send this stack trace to someone who can help!\n";
const char *error2 = "(Or find crash-log.txt in your SRB2 directory.)\n"; // Shown only to stderr.
fd = open(va("%s" PATHSEP "%s", srb2home, "crash-log.txt"), O_CREAT|O_APPEND|O_RDWR, S_IRUSR|S_IWUSR);
if (fd == -1)
I_OutputMsg("\nWARNING: Couldn't open crash log for writing! Make sure your permissions are correct. Please save the below report!\n");
// Get the current time as a string.
time(&rawtime);
localtime_r(&rawtime, &timeinfo);
strftime(timestr, STR_SIZE, "%a, %d %b %Y %T %z", &timeinfo);
CRASHLOG_WRITE("------------------------\n"); // Nice looking seperator
CRASHLOG_STDERR_WRITE("\n"); // Newline to look nice for both outputs.
CRASHLOG_STDERR_WRITE(error); // "Oops, SRB2 crashed" message
STDERR_WRITE(error2); // Tell the user where the crash log is.
// Tell the log when we crashed.
CRASHLOG_WRITE("Time of crash: ");
CRASHLOG_WRITE(timestr);
CRASHLOG_WRITE("\n");
// Give the crash log the cause and a nice 'Backtrace:' thing
// The signal is given to the user when the parent process sees we crashed.
CRASHLOG_WRITE("Cause: ");
CRASHLOG_WRITE(strsignal(signal));
CRASHLOG_WRITE("\n"); // Newline for the signal name
CRASHLOG_STDERR_WRITE("\nBacktrace:\n");
// Flood the output and log with the backtrace
size = backtrace(array, BT_SIZE);
backtrace_symbols_fd(array, size, fd);
backtrace_symbols_fd(array, size, STDERR_FILENO);
CRASHLOG_WRITE("\n"); // Write another newline to the log so it looks nice :)
close(fd);
}
#undef STDERR_WRITE
#undef CRASHLOG_WRITE
#undef CRASHLOG_STDERR_WRITE
#endif // UNIXBACKTRACE
static void I_ReportSignal(int num, int coredumped)
{
//static char msg[] = "oh no! back to reality!\r\n";
@ -297,6 +368,9 @@ FUNCNORETURN static ATTRNORETURN void signal_handler(INT32 num)
{
D_QuitNetGame(); // Fix server freezes
CL_AbortDownloadResume();
#ifdef UNIXBACKTRACE
write_backtrace(num);
#endif
I_ReportSignal(num, 0);
I_ShutdownSystem();
signal(num, SIG_DFL); //default signal action
@ -687,6 +761,28 @@ static void I_RegisterSignals (void)
#endif
}
#ifdef NEWSIGNALHANDLER
static void signal_handler_child(INT32 num)
{
#ifdef UNIXBACKTRACE
write_backtrace(num);
#endif
signal(num, SIG_DFL); //default signal action
raise(num);
}
static void I_RegisterChildSignals(void)
{
// If these defines don't exist,
// then compilation would have failed above us...
signal(SIGILL , signal_handler_child);
signal(SIGSEGV , signal_handler_child);
signal(SIGABRT , signal_handler_child);
signal(SIGFPE , signal_handler_child);
}
#endif
//
//I_OutputMsg
//
@ -2123,6 +2219,7 @@ static void I_Fork(void)
newsignalhandler_Warn("fork()");
break;
case 0:
I_RegisterChildSignals();
break;
default:
if (logstream)

View file

@ -1298,7 +1298,7 @@ boolean I_PlaySong(boolean looping)
if (gme)
{
gme_equalizer_t eq = {GME_TREBLE, GME_BASS, 0,0,0,0,0,0,0,0};
#if GME_VERSION >= 0x000603
#if defined (GME_VERSION) && GME_VERSION >= 0x000603
if (looping)
gme_set_autoload_playback_limit(gme, 0);
#endif

View file

@ -821,7 +821,8 @@ UINT16 W_InitFile(const char *filename, boolean mainfile, boolean startup)
}
if (important && !mainfile)
G_SetGameModified(true);
//G_SetGameModified(true);
modifiedgame = true; // avoid savemoddata being set to false
//
// link wad file to search files