mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-02-22 11:51:41 +00:00
Merge branch 'next' into monster-cleaning-up-again
This commit is contained in:
commit
571d6c5438
170 changed files with 20887 additions and 16649 deletions
2
dep/.gitignore
vendored
Normal file
2
dep/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
#All folders
|
||||
*.d
|
2
dep/FreeBSD/SDL/Debug/.gitignore
vendored
Normal file
2
dep/FreeBSD/SDL/Debug/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
# DON'T REMOVE
|
||||
# This keeps the folder from disappearing
|
2
dep/FreeBSD/SDL/Release/.gitignore
vendored
Normal file
2
dep/FreeBSD/SDL/Release/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
# DON'T REMOVE
|
||||
# This keeps the folder from disappearing
|
2
dep/Linux/SDL/Debug/.gitignore
vendored
Normal file
2
dep/Linux/SDL/Debug/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
# DON'T REMOVE
|
||||
# This keeps the folder from disappearing
|
2
dep/Linux/SDL/Release/.gitignore
vendored
Normal file
2
dep/Linux/SDL/Release/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
# DON'T REMOVE
|
||||
# This keeps the folder from disappearing
|
2
dep/Linux64/SDL/Debug/.gitignore
vendored
Normal file
2
dep/Linux64/SDL/Debug/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
# DON'T REMOVE
|
||||
# This keeps the folder from disappearing
|
2
dep/Linux64/SDL/Release/.gitignore
vendored
Normal file
2
dep/Linux64/SDL/Release/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
# DON'T REMOVE
|
||||
# This keeps the folder from disappearing
|
2
dep/MasterClient/.gitignore
vendored
Normal file
2
dep/MasterClient/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
# DON'T REMOVE
|
||||
# This keeps the folder from disappearing
|
2
dep/MasterServer/.gitignore
vendored
Normal file
2
dep/MasterServer/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
# DON'T REMOVE
|
||||
# This keeps the folder from disappearing
|
2
dep/Mingw/Debug/.gitignore
vendored
Normal file
2
dep/Mingw/Debug/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
# DON'T REMOVE
|
||||
# This keeps the folder from disappearing
|
2
dep/Mingw/Release/.gitignore
vendored
Normal file
2
dep/Mingw/Release/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
# DON'T REMOVE
|
||||
# This keeps the folder from disappearing
|
2
dep/Mingw/SDL/Debug/.gitignore
vendored
Normal file
2
dep/Mingw/SDL/Debug/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
# DON'T REMOVE
|
||||
# This keeps the folder from disappearing
|
2
dep/Mingw/SDL/Release/.gitignore
vendored
Normal file
2
dep/Mingw/SDL/Release/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
# DON'T REMOVE
|
||||
# This keeps the folder from disappearing
|
2
dep/Mingw64/Debug/.gitignore
vendored
Normal file
2
dep/Mingw64/Debug/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
# DON'T REMOVE
|
||||
# This keeps the folder from disappearing
|
2
dep/Mingw64/Release/.gitignore
vendored
Normal file
2
dep/Mingw64/Release/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
# DON'T REMOVE
|
||||
# This keeps the folder from disappearing
|
2
dep/Mingw64/SDL/Debug/.gitignore
vendored
Normal file
2
dep/Mingw64/SDL/Debug/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
# DON'T REMOVE
|
||||
# This keeps the folder from disappearing
|
2
dep/Mingw64/SDL/Release/.gitignore
vendored
Normal file
2
dep/Mingw64/SDL/Release/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
# DON'T REMOVE
|
||||
# This keeps the folder from disappearing
|
2
dep/SDL/Release/.gitignore
vendored
Normal file
2
dep/SDL/Release/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
# DON'T REMOVE
|
||||
# This keeps the folder from disappearing
|
2
dep/VC/.gitignore
vendored
Normal file
2
dep/VC/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
# DON'T REMOVE
|
||||
# This keeps the folder from disappearing
|
2
dep/VC9/.gitignore
vendored
Normal file
2
dep/VC9/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
# DON'T REMOVE
|
||||
# This keeps the folder from disappearing
|
2
dep/cygwin/Debug/.gitignore
vendored
Normal file
2
dep/cygwin/Debug/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
# DON'T REMOVE
|
||||
# This keeps the folder from disappearing
|
2
dep/cygwin/Release/.gitignore
vendored
Normal file
2
dep/cygwin/Release/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
# DON'T REMOVE
|
||||
# This keeps the folder from disappearing
|
2
dep/dummy/.gitignore
vendored
Normal file
2
dep/dummy/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
# DON'T REMOVE
|
||||
# This keeps the folder from disappearing
|
|
@ -1247,6 +1247,7 @@ patterns
|
|||
sprite = "SPHRA0";
|
||||
width = 96;
|
||||
height = 192;
|
||||
}
|
||||
609
|
||||
{
|
||||
title = "Circle of Rings and Spheres (Big)";
|
||||
|
|
|
@ -13,6 +13,9 @@ set(SRB2_CORE_SOURCES
|
|||
d_netcmd.c
|
||||
d_netfil.c
|
||||
dehacked.c
|
||||
deh_soc.c
|
||||
deh_lua.c
|
||||
deh_tables.c
|
||||
f_finale.c
|
||||
f_wipe.c
|
||||
filesrch.c
|
||||
|
@ -66,6 +69,9 @@ set(SRB2_CORE_HEADERS
|
|||
d_think.h
|
||||
d_ticcmd.h
|
||||
dehacked.h
|
||||
deh_soc.h
|
||||
deh_lua.h
|
||||
deh_tables.h
|
||||
doomdata.h
|
||||
doomdef.h
|
||||
doomstat.h
|
||||
|
@ -130,6 +136,8 @@ set(SRB2_CORE_RENDER_SOURCES
|
|||
r_splats.c
|
||||
r_things.c
|
||||
r_textures.c
|
||||
r_patch.c
|
||||
r_patchrotation.c
|
||||
r_picformats.c
|
||||
r_portal.c
|
||||
|
||||
|
@ -147,6 +155,8 @@ set(SRB2_CORE_RENDER_SOURCES
|
|||
r_state.h
|
||||
r_things.h
|
||||
r_textures.h
|
||||
r_patch.h
|
||||
r_patchrotation.h
|
||||
r_picformats.h
|
||||
r_portal.h
|
||||
)
|
||||
|
@ -169,6 +179,7 @@ set(SRB2_CORE_GAME_SOURCES
|
|||
p_telept.c
|
||||
p_tick.c
|
||||
p_user.c
|
||||
taglist.c
|
||||
|
||||
p_local.h
|
||||
p_maputl.h
|
||||
|
@ -180,6 +191,7 @@ set(SRB2_CORE_GAME_SOURCES
|
|||
p_slopes.h
|
||||
p_spec.h
|
||||
p_tick.h
|
||||
taglist.h
|
||||
)
|
||||
|
||||
if(NOT (CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
|
||||
|
@ -264,6 +276,7 @@ set(SRB2_LUA_SOURCES
|
|||
lua_hudlib.c
|
||||
lua_infolib.c
|
||||
lua_maplib.c
|
||||
lua_taglib.c
|
||||
lua_mathlib.c
|
||||
lua_mobjlib.c
|
||||
lua_playerlib.c
|
||||
|
|
232
src/Makefile
232
src/Makefile
|
@ -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.
|
||||
|
@ -13,8 +13,7 @@
|
|||
# -DHAVE_SDL -> use for the SDL interface
|
||||
#
|
||||
# Sets:
|
||||
# Compile the DirectX/Mingw version with 'make MINGW=1'
|
||||
# Compile the SDL/Mingw version with 'make MINGW=1 SDL=1'
|
||||
# Compile the SDL/Mingw version with 'make MINGW=1'
|
||||
# Compile the SDL/Linux version with 'make LINUX=1'
|
||||
# Compile the SDL/Solaris version with 'make SOLARIS=1'
|
||||
# Compile the SDL/FreeBSD version with 'gmake FREEBSD=1'
|
||||
|
@ -25,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
|
||||
|
@ -80,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\
|
||||
|
@ -99,11 +111,10 @@ 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
|
||||
SDL=1
|
||||
WINDOWSHELL=1
|
||||
|
||||
else # if you on the *nix
|
||||
|
@ -125,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
|
||||
|
@ -239,6 +250,12 @@ endif
|
|||
|
||||
MSGFMT?=msgfmt
|
||||
|
||||
ifdef WINDOWSHELL
|
||||
COMPTIME=-..\comptime.bat
|
||||
else
|
||||
COMPTIME=-../comptime.sh
|
||||
endif
|
||||
|
||||
ifndef ECHO
|
||||
NASM:=@$(NASM)
|
||||
REMOVE:=@$(REMOVE)
|
||||
|
@ -253,6 +270,7 @@ ifndef ECHO
|
|||
MSGFMT:=@$(MSGFMT)
|
||||
UPX:=@$(UPX)
|
||||
UPX_OPTS+=-q
|
||||
COMPTIME:=@$(COMPTIME)
|
||||
endif
|
||||
|
||||
ifdef NONET
|
||||
|
@ -417,7 +435,7 @@ ifdef GCC48
|
|||
else
|
||||
CFLAGS+=-O0
|
||||
endif
|
||||
CFLAGS+= -Wall -DPARANOIA -DRANGECHECK -DPACKETDROP -DMOBJCONSISTANCY
|
||||
CFLAGS+= -Wall -DPARANOIA -DRANGECHECK -DPACKETDROP
|
||||
else
|
||||
|
||||
|
||||
|
@ -457,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 \
|
||||
|
@ -465,6 +482,9 @@ OBJS:=$(i_main_o) \
|
|||
$(OBJDIR)/d_netfil.o \
|
||||
$(OBJDIR)/d_netcmd.o \
|
||||
$(OBJDIR)/dehacked.o \
|
||||
$(OBJDIR)/deh_soc.o \
|
||||
$(OBJDIR)/deh_lua.o \
|
||||
$(OBJDIR)/deh_tables.o \
|
||||
$(OBJDIR)/z_zone.o \
|
||||
$(OBJDIR)/f_finale.o \
|
||||
$(OBJDIR)/f_wipe.o \
|
||||
|
@ -519,9 +539,12 @@ OBJS:=$(i_main_o) \
|
|||
$(OBJDIR)/r_splats.o \
|
||||
$(OBJDIR)/r_things.o \
|
||||
$(OBJDIR)/r_textures.o \
|
||||
$(OBJDIR)/r_patch.o \
|
||||
$(OBJDIR)/r_patchrotation.o \
|
||||
$(OBJDIR)/r_picformats.o \
|
||||
$(OBJDIR)/r_portal.o \
|
||||
$(OBJDIR)/screen.o \
|
||||
$(OBJDIR)/taglist.o \
|
||||
$(OBJDIR)/v_video.o \
|
||||
$(OBJDIR)/s_sound.o \
|
||||
$(OBJDIR)/sounds.o \
|
||||
|
@ -538,6 +561,19 @@ 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 =
|
||||
@echo -- $< ...
|
||||
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.
|
||||
# (The listed source files are the ones containing translated strings).
|
||||
|
@ -549,18 +585,12 @@ OPTS+=-DGETTEXT
|
|||
endif
|
||||
|
||||
ifdef PANDORA
|
||||
all: pre-build $(BIN)/$(PNDNAME)
|
||||
all: $(BIN)/$(PNDNAME)
|
||||
endif
|
||||
|
||||
|
||||
ifdef MINGW
|
||||
ifndef SDL
|
||||
all: pre-build $(BIN)/$(EXENAME) dll
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef SDL
|
||||
all: pre-build $(BIN)/$(EXENAME)
|
||||
all: $(BIN)/$(EXENAME)
|
||||
endif
|
||||
|
||||
ifdef DUMMY
|
||||
|
@ -568,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
|
||||
|
@ -601,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
|
||||
|
@ -624,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
|
||||
|
@ -638,57 +663,6 @@ endif
|
|||
$(OBJDIR):
|
||||
-$(MKDIR) $(OBJDIR)
|
||||
|
||||
ifndef SDL
|
||||
ifdef NOHW
|
||||
dll :
|
||||
else
|
||||
dll : opengl_dll
|
||||
endif
|
||||
ifdef MINGW
|
||||
all_dll: opengl_dll ds3d_dll fmod_dll openal_dll
|
||||
|
||||
opengl_dll: $(BIN)/r_opengl.dll
|
||||
$(BIN)/r_opengl.dll: $(OBJDIR)/ogl_win.o $(OBJDIR)/r_opengl.o
|
||||
-$(MKDIR) $(BIN)
|
||||
@echo Linking R_OpenGL.dll...
|
||||
$(CC) --shared $^ -o $@ -g -Wl,--add-stdcall-alias -lgdi32 -static-libgcc
|
||||
ifndef NOUPX
|
||||
-$(UPX) $(UPX_OPTS) $@
|
||||
endif
|
||||
|
||||
ds3d_dll: $(BIN)/s_ds3d.dll
|
||||
$(BIN)/s_ds3d.dll: $(OBJDIR)/s_ds3d.o
|
||||
@echo Linking S_DS3d.dll...
|
||||
$(CC) --shared $^ -o $@ -g -Wl,--add-stdcall-alias -ldsound -luuid
|
||||
|
||||
fmod_dll: $(BIN)/s_fmod.dll
|
||||
$(BIN)/s_fmod.dll: $(OBJDIR)/s_fmod.o
|
||||
-$(MKDIR) $(BIN)
|
||||
@echo Linking S_FMOD.dll...
|
||||
$(CC) --shared $^ -o $@ -g -Wl,--add-stdcall-alias -lfmod
|
||||
|
||||
openal_dll: $(BIN)/s_openal.dll
|
||||
$(BIN)/s_openal.dll: $(OBJDIR)/s_openal.o
|
||||
-$(MKDIR) $(BIN)
|
||||
@echo Linking S_OpenAL.dll...
|
||||
$(CC) --shared $^ -o $@ -g -Wl,--add-stdcall-alias -lopenal32
|
||||
else
|
||||
all_dll: fmod_so openal_so
|
||||
|
||||
fmod_so: $(BIN)/s_fmod.so
|
||||
$(BIN)/s_fmod.so: $(OBJDIR)/s_fmod.o
|
||||
-$(MKDIR) $(BIN)
|
||||
@echo Linking S_FMOD.so...
|
||||
$(CC) --shared $^ -o $@ -g --nostartfiles -lm -lfmod
|
||||
|
||||
openal_so: $(BIN)/s_openal.so
|
||||
$(BIN)/s_openal.so: $(OBJDIR)/s_openal.o
|
||||
-$(MKDIR) $(BIN)
|
||||
@echo Linking S_OpenAL.so...
|
||||
$(CC) --shared $^ -o $@ -g --nostartfiles -lm -lopenal
|
||||
endif
|
||||
|
||||
else
|
||||
ifdef SDL
|
||||
ifdef MINGW
|
||||
$(OBJDIR)/r_opengl.o: hardware/r_opengl/r_opengl.c hardware/r_opengl/r_opengl.h \
|
||||
|
@ -698,6 +672,7 @@ $(OBJDIR)/r_opengl.o: hardware/r_opengl/r_opengl.c hardware/r_opengl/r_opengl.h
|
|||
hardware/hw_md2load.h hardware/hw_md3load.h hardware/hw_model.h hardware/u_list.h \
|
||||
am_map.h d_event.h d_player.h p_pspr.h m_fixed.h tables.h info.h d_think.h \
|
||||
p_mobj.h doomdata.h d_ticcmd.h r_defs.h hardware/hw_dll.h
|
||||
$(echoName)
|
||||
$(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@
|
||||
else
|
||||
$(OBJDIR)/r_opengl.o: hardware/r_opengl/r_opengl.c hardware/r_opengl/r_opengl.h \
|
||||
|
@ -707,128 +682,139 @@ $(OBJDIR)/r_opengl.o: hardware/r_opengl/r_opengl.c hardware/r_opengl/r_opengl.h
|
|||
hardware/hw_md2load.h hardware/hw_md3load.h hardware/hw_model.h hardware/u_list.h \
|
||||
am_map.h d_event.h d_player.h p_pspr.h m_fixed.h tables.h info.h d_think.h \
|
||||
p_mobj.h doomdata.h d_ticcmd.h r_defs.h hardware/hw_dll.h
|
||||
$(echoName)
|
||||
$(CC) $(CFLAGS) $(WFLAGS) -I/usr/X11R6/include -c $< -o $@
|
||||
endif
|
||||
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
|
||||
$(echoName)
|
||||
$(CC) $(CFLAGS) $(WFLAGS) -DHAVE_VALGRIND $(VALGRIND_CFLAGS) -c $< -o $@
|
||||
endif
|
||||
|
||||
$(OBJDIR)/comptime.o: comptime.c pre-build
|
||||
$(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)
|
||||
$(echoName)
|
||||
$(MSGFMT) -f -o $@ $<
|
||||
|
||||
$(OBJDIR)/%.o: %.c
|
||||
$(echoName)
|
||||
$(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@
|
||||
|
||||
$(OBJDIR)/%.o: $(INTERFACE)/%.c
|
||||
$(echoName)
|
||||
$(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@
|
||||
|
||||
ifdef MACOSX
|
||||
$(OBJDIR)/%.o: sdl/macosx/%.c
|
||||
$(echoName)
|
||||
$(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@
|
||||
endif
|
||||
|
||||
$(OBJDIR)/%.o: hardware/%.c
|
||||
$(echoName)
|
||||
$(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@
|
||||
|
||||
$(OBJDIR)/%.o: blua/%.c
|
||||
$(echoName)
|
||||
$(CC) $(CFLAGS) $(LUA_CFLAGS) $(WFLAGS) -c $< -o $@
|
||||
|
||||
$(OBJDIR)/%.o: %.nas
|
||||
$(echoName)
|
||||
$(NASM) $(NASMOPTS) -o $@ -f $(NASMFORMAT) $<
|
||||
|
||||
$(OBJDIR)/vid_copy.o: vid_copy.s asm_defs.inc
|
||||
$(echoName)
|
||||
$(CC) $(OPTS) $(ASFLAGS) -x assembler-with-cpp -c $< -o $@
|
||||
|
||||
$(OBJDIR)/%.o: %.s
|
||||
$(echoName)
|
||||
$(CC) $(OPTS) -x assembler-with-cpp -c $< -o $@
|
||||
|
||||
$(OBJDIR)/SRB2.res: win32/Srb2win.rc win32/afxres.h win32/resource.h
|
||||
$(echoName)
|
||||
$(WINDRES) -i $< -O rc $(WINDRESFLAGS) --include-dir=win32 -o $@ -O coff
|
||||
|
||||
|
||||
ifdef MINGW
|
||||
ifndef SDL
|
||||
ifndef NOHW
|
||||
$(OBJDIR)/r_opengl.o: hardware/r_opengl/r_opengl.c hardware/r_opengl/r_opengl.h \
|
||||
doomdef.h doomtype.h g_state.h m_swap.h hardware/hw_drv.h screen.h \
|
||||
command.h hardware/hw_data.h hardware/hw_defs.h \
|
||||
hardware/hw_md2.h hardware/hw_glob.h hardware/hw_main.h hardware/hw_clip.h \
|
||||
hardware/hw_md2load.h hardware/hw_md3load.h hardware/hw_model.h hardware/u_list.h \
|
||||
am_map.h d_event.h d_player.h p_pspr.h m_fixed.h tables.h info.h d_think.h \
|
||||
p_mobj.h doomdata.h d_ticcmd.h r_defs.h hardware/hw_dll.h
|
||||
$(CC) $(CFLAGS) $(WFLAGS) -D_WINDOWS -mwindows -c $< -o $@
|
||||
|
||||
$(OBJDIR)/ogl_win.o: hardware/r_opengl/ogl_win.c hardware/r_opengl/r_opengl.h \
|
||||
doomdef.h doomtype.h g_state.h m_swap.h hardware/hw_drv.h screen.h \
|
||||
command.h hardware/hw_data.h hardware/hw_defs.h \
|
||||
hardware/hw_md2.h hardware/hw_glob.h hardware/hw_main.h hardware/hw_clip.h \
|
||||
hardware/hw_md2load.h hardware/hw_md3load.h hardware/hw_model.h hardware/u_list.h \
|
||||
am_map.h d_event.h d_player.h p_pspr.h m_fixed.h tables.h info.h d_think.h \
|
||||
p_mobj.h doomdata.h d_ticcmd.h r_defs.h hardware/hw_dll.h
|
||||
$(CC) $(CFLAGS) $(WFLAGS) -D_WINDOWS -mwindows -c $< -o $@
|
||||
endif
|
||||
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef SDL
|
||||
|
||||
ifdef MINGW
|
||||
$(OBJDIR)/win_dbg.o: win32/win_dbg.c
|
||||
$(echoName)
|
||||
$(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@
|
||||
endif
|
||||
|
||||
ifdef STATICHS
|
||||
$(OBJDIR)/s_openal.o: hardware/s_openal/s_openal.c hardware/hw3dsdrv.h \
|
||||
hardware/hw_dll.h
|
||||
$(echoName)
|
||||
$(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@
|
||||
|
||||
$(OBJDIR)/s_fmod.o: hardware/s_fmod/s_fmod.c hardware/hw3dsdrv.h \
|
||||
hardware/hw_dll.h
|
||||
$(echoName)
|
||||
$(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@
|
||||
|
||||
ifdef MINGW
|
||||
$(OBJDIR)/s_ds3d.o: hardware/s_ds3d/s_ds3d.c hardware/hw3dsdrv.h \
|
||||
hardware/hw_dll.h
|
||||
$(echoName)
|
||||
$(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@
|
||||
endif
|
||||
else
|
||||
|
||||
$(OBJDIR)/s_fmod.o: hardware/s_fmod/s_fmod.c hardware/hw3dsdrv.h \
|
||||
hardware/hw_dll.h
|
||||
$(echoName)
|
||||
$(CC) $(ARCHOPTS) -Os -o $(OBJDIR)/s_fmod.o -DHW3SOUND -DUNIXCOMMON -shared -nostartfiles -c hardware/s_fmod/s_fmod.c
|
||||
|
||||
$(OBJDIR)/s_openal.o: hardware/s_openal/s_openal.c hardware/hw3dsdrv.h \
|
||||
hardware/hw_dll.h
|
||||
$(echoName)
|
||||
$(CC) $(ARCHOPTS) -Os -o $(OBJDIR)/s_openal.o -DHW3SOUND -DUNIXCOMMON -shared -nostartfiles -c hardware/s_openal/s_openal.c
|
||||
endif
|
||||
endif
|
||||
|
|
|
@ -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
|
||||
INTERFACE=win32
|
||||
#NASMFORMAT=win64
|
||||
SDL=1
|
||||
OBJDIR:=$(OBJDIR)/Mingw64
|
||||
BIN:=$(BIN)/Mingw64
|
||||
DEPDIR:=$(DEPDIR)/Mingw64
|
||||
else
|
||||
ifdef MINGW
|
||||
INTERFACE=win32
|
||||
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
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "utils/Log.h"
|
||||
|
||||
rendermode_t rendermode = render_soft;
|
||||
rendermode_t chosenrendermode = render_none;
|
||||
|
||||
boolean highcolor = false;
|
||||
|
||||
|
@ -52,8 +53,15 @@ INT32 VID_SetMode(INT32 modenum)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void VID_CheckRenderer(void) {}
|
||||
void VID_CheckGLLoaded(rendermode_t oldrender) {}
|
||||
boolean VID_CheckRenderer(void)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void VID_CheckGLLoaded(rendermode_t oldrender)
|
||||
{
|
||||
(void)oldrender;
|
||||
}
|
||||
|
||||
const char *VID_GetModeName(INT32 modenum)
|
||||
{
|
||||
|
|
|
@ -47,6 +47,7 @@ OBJS:=$(OBJS) \
|
|||
$(OBJDIR)/lua_skinlib.o \
|
||||
$(OBJDIR)/lua_thinkerlib.o \
|
||||
$(OBJDIR)/lua_maplib.o \
|
||||
$(OBJDIR)/lua_taglib.o \
|
||||
$(OBJDIR)/lua_polyobjlib.o \
|
||||
$(OBJDIR)/lua_blockmaplib.o \
|
||||
$(OBJDIR)/lua_hudlib.o
|
||||
|
|
|
@ -686,6 +686,15 @@ static void codearith (FuncState *fs, OpCode op, expdesc *e1, expdesc *e2) {
|
|||
}
|
||||
|
||||
|
||||
static void codeunaryarith (FuncState *fs, OpCode op, expdesc *e) {
|
||||
expdesc e2;
|
||||
e2.t = e2.f = NO_JUMP; e2.k = VKNUM; e2.u.nval = 0;
|
||||
if (op == OP_LEN || !isnumeral(e))
|
||||
luaK_exp2anyreg(fs, e); /* cannot operate on non-numeric constants */
|
||||
codearith(fs, op, e, &e2);
|
||||
}
|
||||
|
||||
|
||||
static void codecomp (FuncState *fs, OpCode op, int cond, expdesc *e1,
|
||||
expdesc *e2) {
|
||||
int o1 = luaK_exp2RK(fs, e1);
|
||||
|
@ -703,27 +712,11 @@ static void codecomp (FuncState *fs, OpCode op, int cond, expdesc *e1,
|
|||
|
||||
|
||||
void luaK_prefix (FuncState *fs, UnOpr op, expdesc *e) {
|
||||
expdesc e2;
|
||||
e2.t = e2.f = NO_JUMP; e2.k = VKNUM; e2.u.nval = 0;
|
||||
switch (op) {
|
||||
case OPR_MINUS: {
|
||||
if (!isnumeral(e))
|
||||
luaK_exp2anyreg(fs, e); /* cannot operate on non-numeric constants */
|
||||
codearith(fs, OP_UNM, e, &e2);
|
||||
break;
|
||||
}
|
||||
case OPR_BNOT: {
|
||||
if (e->k == VK)
|
||||
luaK_exp2anyreg(fs, e); /* cannot operate on non-numeric constants */
|
||||
codearith(fs, OP_BNOT, e, &e2);
|
||||
break;
|
||||
}
|
||||
case OPR_MINUS: codeunaryarith(fs, OP_UNM, e); break;
|
||||
case OPR_BNOT: codeunaryarith(fs, OP_BNOT, e); break;
|
||||
case OPR_NOT: codenot(fs, e); break;
|
||||
case OPR_LEN: {
|
||||
luaK_exp2anyreg(fs, e); /* cannot operate on constants */
|
||||
codearith(fs, OP_LEN, e, &e2);
|
||||
break;
|
||||
}
|
||||
case OPR_LEN: codeunaryarith(fs, OP_LEN, e); break;
|
||||
default: lua_assert(0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -277,6 +277,9 @@ void Got_LuaFile(UINT8 **cp, INT32 playernum)
|
|||
if (!luafiletransfers)
|
||||
I_Error("No Lua file transfer\n");
|
||||
|
||||
lua_settop(gL, 0); // Just in case...
|
||||
lua_pushcfunction(gL, LUA_GetErrorMessage);
|
||||
|
||||
// Retrieve the callback and push it on the stack
|
||||
lua_pushfstring(gL, FMT_FILECALLBACKID, luafiletransfers->id);
|
||||
lua_gettable(gL, LUA_REGISTRYINDEX);
|
||||
|
@ -304,7 +307,8 @@ void Got_LuaFile(UINT8 **cp, INT32 playernum)
|
|||
lua_pushstring(gL, luafiletransfers->filename);
|
||||
|
||||
// Call the callback
|
||||
LUA_Call(gL, 2);
|
||||
LUA_Call(gL, 2, 0, 1);
|
||||
lua_settop(gL, 0);
|
||||
|
||||
if (success)
|
||||
{
|
||||
|
|
|
@ -158,7 +158,7 @@ typedef struct consvar_s //NULL, NULL, 0, NULL, NULL |, 0, NULL, NULL, 0, 0, NUL
|
|||
|
||||
/* name, defaultvalue, flags, PossibleValue, func */
|
||||
#define CVAR_INIT( ... ) \
|
||||
{ __VA_ARGS__, 0, NULL, NULL, {0}, 0U, (char)0, NULL }
|
||||
{ __VA_ARGS__, 0, NULL, NULL, {0, {NULL}}, 0U, (char)0, NULL }
|
||||
|
||||
#ifdef OLD22DEMOCOMPAT
|
||||
typedef struct old_demo_var old_demo_var_t;
|
||||
|
|
110
src/console.c
110
src/console.c
|
@ -56,7 +56,8 @@ I_mutex con_mutex;
|
|||
#endif/*HAVE_THREADS*/
|
||||
|
||||
static boolean con_started = false; // console has been initialised
|
||||
boolean con_startup = false; // true at game startup, screen need refreshing
|
||||
boolean con_startup = false; // true at game startup
|
||||
boolean con_refresh = false; // screen needs refreshing
|
||||
static boolean con_forcepic = true; // at startup toggle console translucency when first off
|
||||
boolean con_recalc; // set true when screen size has changed
|
||||
|
||||
|
@ -359,30 +360,48 @@ static void CON_SetupColormaps(void)
|
|||
for (i = 0; i < (256*15); i++, ++memorysrc)
|
||||
*memorysrc = (UINT8)(i & 0xFF); // remap each color to itself...
|
||||
|
||||
#define colset(map, a, b, c) \
|
||||
map[1] = (UINT8)a;\
|
||||
map[3] = (UINT8)b;\
|
||||
map[9] = (UINT8)c
|
||||
#define colset(map, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) \
|
||||
map[0x0] = (UINT8)a;\
|
||||
map[0x1] = (UINT8)b;\
|
||||
map[0x2] = (UINT8)c;\
|
||||
map[0x3] = (UINT8)d;\
|
||||
map[0x4] = (UINT8)e;\
|
||||
map[0x5] = (UINT8)f;\
|
||||
map[0x6] = (UINT8)g;\
|
||||
map[0x7] = (UINT8)h;\
|
||||
map[0x8] = (UINT8)i;\
|
||||
map[0x9] = (UINT8)j;\
|
||||
map[0xA] = (UINT8)k;\
|
||||
map[0xB] = (UINT8)l;\
|
||||
map[0xC] = (UINT8)m;\
|
||||
map[0xD] = (UINT8)n;\
|
||||
map[0xE] = (UINT8)o;\
|
||||
map[0xF] = (UINT8)p;
|
||||
|
||||
colset(magentamap, 177, 178, 184);
|
||||
colset(yellowmap, 82, 73, 66);
|
||||
colset(lgreenmap, 97, 98, 106);
|
||||
colset(bluemap, 146, 147, 155);
|
||||
colset(redmap, 210, 32, 39);
|
||||
colset(graymap, 6, 8, 14);
|
||||
colset(orangemap, 51, 52, 57);
|
||||
colset(skymap, 129, 130, 133);
|
||||
colset(purplemap, 160, 161, 163);
|
||||
colset(aquamap, 120, 121, 123);
|
||||
colset(peridotmap, 88, 188, 190);
|
||||
colset(azuremap, 144, 145, 170);
|
||||
colset(brownmap, 219, 221, 224);
|
||||
colset(rosymap, 200, 201, 203);
|
||||
colset(invertmap, 27, 26, 22);
|
||||
invertmap[26] = (UINT8)3;
|
||||
// Tried to keep the colors vanilla while adding some shades in between them ~SonicX8000
|
||||
|
||||
// 0x1 0x3 0x9 0xF
|
||||
colset(magentamap, 177, 177, 178, 178, 178, 180, 180, 180, 182, 182, 182, 182, 184, 184, 184, 185);
|
||||
colset(yellowmap, 82, 82, 73, 73, 73, 64, 64, 64, 66, 66, 66, 66, 67, 67, 67, 68);
|
||||
colset(lgreenmap, 96, 96, 98, 98, 98, 101, 101, 101, 104, 104, 104, 104, 106, 106, 106, 107);
|
||||
colset(bluemap, 146, 146, 147, 147, 147, 149, 149, 149, 152, 152, 152, 152, 155, 155, 155, 157);
|
||||
colset(redmap, 32, 32, 33, 33, 33, 35, 35, 35, 39, 39, 39, 39, 42, 42, 42, 44);
|
||||
colset(graymap, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23);
|
||||
colset(orangemap, 50, 50, 52, 52, 52, 54, 54, 54, 56, 56, 56, 56, 59, 59, 59, 60);
|
||||
colset(skymap, 129, 129, 130, 130, 130, 131, 131, 131, 133, 133, 133, 133, 135, 135, 135, 136);
|
||||
colset(purplemap, 160, 160, 161, 161, 161, 162, 162, 162, 163, 163, 163, 163, 164, 164, 164, 165);
|
||||
colset(aquamap, 120, 120, 121, 121, 121, 122, 122, 122, 123, 123, 123, 123, 124, 124, 124, 125);
|
||||
colset(peridotmap, 72, 72, 188, 188, 189, 189, 189, 189, 190, 190, 190, 190, 191, 191, 191, 94);
|
||||
colset(azuremap, 144, 144, 145, 145, 145, 146, 146, 146, 170, 170, 170, 170, 171, 171, 171, 172);
|
||||
colset(brownmap, 219, 219, 221, 221, 221, 222, 222, 222, 224, 224, 224, 224, 227, 227, 227, 229);
|
||||
colset(rosymap, 200, 200, 201, 201, 201, 202, 202, 202, 203, 203, 203, 203, 204, 204, 204, 205);
|
||||
|
||||
#undef colset
|
||||
|
||||
// Yeah just straight up invert it like a normal person
|
||||
for (i = 0x00; i <= 0x1F; i++)
|
||||
invertmap[0x1F - i] = i;
|
||||
|
||||
// Init back colormap
|
||||
CON_SetupBackColormap();
|
||||
}
|
||||
|
@ -439,7 +458,8 @@ void CON_Init(void)
|
|||
Lock_state();
|
||||
|
||||
con_started = true;
|
||||
con_startup = true; // need explicit screen refresh until we are in Doom loop
|
||||
con_startup = true;
|
||||
con_refresh = true; // needs explicit screen refresh until we are in the main game loop
|
||||
consoletoggle = false;
|
||||
|
||||
Unlock_state();
|
||||
|
@ -457,7 +477,8 @@ void CON_Init(void)
|
|||
Lock_state();
|
||||
|
||||
con_started = true;
|
||||
con_startup = false; // need explicit screen refresh until we are in Doom loop
|
||||
con_startup = false;
|
||||
con_refresh = false; // disable explicit screen refresh
|
||||
consoletoggle = true;
|
||||
|
||||
Unlock_state();
|
||||
|
@ -805,6 +826,12 @@ static void CON_InputDelSelection(void)
|
|||
|
||||
Lock_state();
|
||||
|
||||
if (!input_cur)
|
||||
{
|
||||
Unlock_state();
|
||||
return;
|
||||
}
|
||||
|
||||
if (input_cur > input_sel)
|
||||
{
|
||||
start = input_sel;
|
||||
|
@ -1438,7 +1465,7 @@ void CONS_Printf(const char *fmt, ...)
|
|||
{
|
||||
va_list argptr;
|
||||
static char *txt = NULL;
|
||||
boolean startup;
|
||||
boolean refresh;
|
||||
|
||||
if (txt == NULL)
|
||||
txt = malloc(8192);
|
||||
|
@ -1454,32 +1481,21 @@ void CONS_Printf(const char *fmt, ...)
|
|||
if (con_started)
|
||||
CON_Print(txt);
|
||||
|
||||
CON_LogMessage(txt);
|
||||
CON_LogMessage(txt);
|
||||
|
||||
Lock_state();
|
||||
|
||||
// make sure new text is visible
|
||||
con_scrollup = 0;
|
||||
startup = con_startup;
|
||||
refresh = con_refresh;
|
||||
|
||||
Unlock_state();
|
||||
|
||||
// if not in display loop, force screen update
|
||||
if (startup && (!setrenderneeded))
|
||||
if (refresh)
|
||||
{
|
||||
#ifdef _WINDOWS
|
||||
patch_t *con_backpic = W_CachePatchName("CONSBACK", PU_PATCH);
|
||||
|
||||
// Jimita: CON_DrawBackpic just called V_DrawScaledPatch
|
||||
V_DrawScaledPatch(0, 0, 0, con_backpic);
|
||||
|
||||
W_UnlockCachedPatch(con_backpic);
|
||||
I_LoadingScreen(txt); // Win32/OS2 only
|
||||
#else
|
||||
// here we display the console text
|
||||
CON_Drawer();
|
||||
CON_Drawer(); // here we display the console text
|
||||
I_FinishUpdate(); // page flip or blit buffer
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1541,7 +1557,7 @@ void CONS_Debug(INT32 debugflags, const char *fmt, ...)
|
|||
//
|
||||
void CONS_Error(const char *msg)
|
||||
{
|
||||
#ifdef RPC_NO_WINDOWS_H
|
||||
#if defined(RPC_NO_WINDOWS_H) && defined(_WINDOWS)
|
||||
if (!graphics_started)
|
||||
{
|
||||
MessageBoxA(vid.WndParent, msg, "SRB2 Warning", MB_OK);
|
||||
|
@ -1690,7 +1706,7 @@ static void CON_DrawHudlines(void)
|
|||
;//charwidth = 4 * con_scalefactor;
|
||||
else
|
||||
{
|
||||
//charwidth = SHORT(hu_font['A'-HU_FONTSTART]->width) * con_scalefactor;
|
||||
//charwidth = (hu_font['A'-HU_FONTSTART]->width) * con_scalefactor;
|
||||
V_DrawCharacter(x, y, (INT32)(*p) | charflags | cv_constextsize.value | V_NOSCALESTART, true);
|
||||
}
|
||||
}
|
||||
|
@ -1719,8 +1735,8 @@ static void CON_DrawBackpic(void)
|
|||
if (piclump == LUMPERROR)
|
||||
piclump = W_GetNumForName("MISSING");
|
||||
|
||||
// Cache the Software patch.
|
||||
con_backpic = W_CacheSoftwarePatchNum(piclump, PU_PATCH);
|
||||
// Cache the patch.
|
||||
con_backpic = W_CachePatchNum(piclump, PU_PATCH);
|
||||
|
||||
// Center the backpic, and draw a vertically cropped patch.
|
||||
w = (con_backpic->width * vid.dupx);
|
||||
|
@ -1731,7 +1747,7 @@ static void CON_DrawBackpic(void)
|
|||
// then fill the sides with a solid color.
|
||||
if (x > 0)
|
||||
{
|
||||
column_t *column = (column_t *)((UINT8 *)(con_backpic) + LONG(con_backpic->columnofs[0]));
|
||||
column_t *column = (column_t *)((UINT8 *)(con_backpic->columns) + (con_backpic->columnofs[0]));
|
||||
if (!column->topdelta)
|
||||
{
|
||||
UINT8 *source = (UINT8 *)(column) + 3;
|
||||
|
@ -1743,8 +1759,7 @@ static void CON_DrawBackpic(void)
|
|||
}
|
||||
}
|
||||
|
||||
// Cache the patch normally.
|
||||
con_backpic = W_CachePatchNum(piclump, PU_PATCH);
|
||||
// Draw the patch.
|
||||
V_DrawCroppedPatch(x << FRACBITS, 0, FRACUNIT, V_NOSCALESTART, con_backpic,
|
||||
0, ( BASEVIDHEIGHT - h ), BASEVIDWIDTH, h);
|
||||
|
||||
|
@ -1829,9 +1844,6 @@ void CON_Drawer(void)
|
|||
return;
|
||||
}
|
||||
|
||||
if (needpatchrecache)
|
||||
HU_LoadGraphics();
|
||||
|
||||
if (con_recalc)
|
||||
{
|
||||
CON_RecalcSize();
|
||||
|
|
|
@ -25,8 +25,12 @@ extern I_mutex con_mutex;
|
|||
// set true when screen size has changed, to adapt console
|
||||
extern boolean con_recalc;
|
||||
|
||||
// console being displayed at game startup
|
||||
extern boolean con_startup;
|
||||
|
||||
// needs explicit screen refresh until we are in the main game loop
|
||||
extern boolean con_refresh;
|
||||
|
||||
// top clip value for view render: do not draw part of view hidden by console
|
||||
extern INT32 con_clipviewtop;
|
||||
|
||||
|
|
174
src/d_clisrv.c
174
src/d_clisrv.c
|
@ -1595,9 +1595,7 @@ static void CL_ReloadReceivedSavegame(void)
|
|||
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
#ifdef HAVE_BLUA
|
||||
LUA_InvalidatePlayer(&players[i]);
|
||||
#endif
|
||||
sprintf(player_names[i], "Player %d", i + 1);
|
||||
}
|
||||
|
||||
|
@ -2260,11 +2258,15 @@ void D_SaveBan(void)
|
|||
size_t i;
|
||||
banreason_t *reasonlist = reasonhead;
|
||||
const char *address, *mask;
|
||||
const char *path = va("%s"PATHSEP"%s", srb2home, "ban.txt");
|
||||
|
||||
if (!reasonhead)
|
||||
{
|
||||
remove(path);
|
||||
return;
|
||||
}
|
||||
|
||||
f = fopen(va("%s"PATHSEP"%s", srb2home, "ban.txt"), "w");
|
||||
f = fopen(path, "w");
|
||||
|
||||
if (!f)
|
||||
{
|
||||
|
@ -2308,16 +2310,14 @@ static void Ban_Add(const char *reason)
|
|||
reasontail = reasonlist;
|
||||
}
|
||||
|
||||
static void Command_ClearBans(void)
|
||||
static void Ban_Clear(void)
|
||||
{
|
||||
banreason_t *temp;
|
||||
|
||||
if (!I_ClearBans)
|
||||
return;
|
||||
|
||||
I_ClearBans();
|
||||
D_SaveBan();
|
||||
|
||||
reasontail = NULL;
|
||||
|
||||
while (reasonhead)
|
||||
{
|
||||
temp = reasonhead->next;
|
||||
|
@ -2327,6 +2327,15 @@ static void Command_ClearBans(void)
|
|||
}
|
||||
}
|
||||
|
||||
static void Command_ClearBans(void)
|
||||
{
|
||||
if (!I_ClearBans)
|
||||
return;
|
||||
|
||||
Ban_Clear();
|
||||
D_SaveBan();
|
||||
}
|
||||
|
||||
static void Ban_Load_File(boolean warning)
|
||||
{
|
||||
FILE *f;
|
||||
|
@ -2334,6 +2343,9 @@ static void Ban_Load_File(boolean warning)
|
|||
const char *address, *mask;
|
||||
char buffer[MAX_WADPATH];
|
||||
|
||||
if (!I_ClearBans)
|
||||
return;
|
||||
|
||||
f = fopen(va("%s"PATHSEP"%s", srb2home, "ban.txt"), "r");
|
||||
|
||||
if (!f)
|
||||
|
@ -2343,13 +2355,7 @@ static void Ban_Load_File(boolean warning)
|
|||
return;
|
||||
}
|
||||
|
||||
if (I_ClearBans)
|
||||
Command_ClearBans();
|
||||
else
|
||||
{
|
||||
fclose(f);
|
||||
return;
|
||||
}
|
||||
Ban_Clear();
|
||||
|
||||
for (i=0; fgets(buffer, (int)sizeof(buffer), f); i++)
|
||||
{
|
||||
|
@ -3026,8 +3032,7 @@ static void Got_KickCmd(UINT8 **p, INT32 playernum)
|
|||
|
||||
if (pnum == consoleplayer)
|
||||
{
|
||||
if (Playing())
|
||||
LUAh_GameQuit();
|
||||
LUAh_GameQuit(false);
|
||||
#ifdef DUMPCONSISTENCY
|
||||
if (msg == KICK_MSG_CON_FAIL) SV_SavedGame();
|
||||
#endif
|
||||
|
@ -3107,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);
|
||||
|
@ -3727,8 +3732,7 @@ static void HandleConnect(SINT8 node)
|
|||
static void HandleShutdown(SINT8 node)
|
||||
{
|
||||
(void)node;
|
||||
if (Playing())
|
||||
LUAh_GameQuit();
|
||||
LUAh_GameQuit(false);
|
||||
D_QuitNetGame();
|
||||
CL_Reset();
|
||||
D_StartTitle();
|
||||
|
@ -3743,8 +3747,7 @@ static void HandleShutdown(SINT8 node)
|
|||
static void HandleTimeout(SINT8 node)
|
||||
{
|
||||
(void)node;
|
||||
if (Playing())
|
||||
LUAh_GameQuit();
|
||||
LUAh_GameQuit(false);
|
||||
D_QuitNetGame();
|
||||
CL_Reset();
|
||||
D_StartTitle();
|
||||
|
@ -4477,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
|
||||
|
@ -4847,14 +4853,14 @@ void TryRunTics(tic_t realtics)
|
|||
{
|
||||
DEBFILE(va("============ Running tic %d (local %d)\n", gametic, localgametic));
|
||||
|
||||
ps_tictime = I_GetTimeMicros();
|
||||
ps_tictime = I_GetPreciseTime();
|
||||
|
||||
G_Ticker((gametic % NEWTICRATERATIO) == 0);
|
||||
ExtraDataTicker();
|
||||
gametic++;
|
||||
consistancy[gametic%BACKUPTICS] = Consistancy();
|
||||
|
||||
ps_tictime = I_GetTimeMicros() - ps_tictime;
|
||||
ps_tictime = I_GetPreciseTime() - ps_tictime;
|
||||
|
||||
// Leave a certain amount of tics present in the net buffer as long as we've ran at least one tic this frame.
|
||||
if (client && gamestate == GS_LEVEL && leveltime > 3 && neededtic <= gametic + cv_netticbuffer.value)
|
||||
|
|
106
src/d_main.c
106
src/d_main.c
|
@ -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"
|
||||
|
@ -107,8 +107,6 @@ boolean devparm = false; // started game with -devparm
|
|||
boolean singletics = false; // timedemo
|
||||
boolean lastdraw = false;
|
||||
|
||||
static void D_CheckRendererState(void);
|
||||
|
||||
postimg_t postimgtype = postimg_none;
|
||||
INT32 postimgparam;
|
||||
postimg_t postimgtype2 = postimg_none;
|
||||
|
@ -237,7 +235,6 @@ INT16 wipetypepost = -1;
|
|||
|
||||
static void D_Display(void)
|
||||
{
|
||||
INT32 setrenderstillneeded = 0;
|
||||
boolean forcerefresh = false;
|
||||
static boolean wipe = false;
|
||||
INT32 wipedefindex = 0;
|
||||
|
@ -260,48 +257,28 @@ static void D_Display(void)
|
|||
// create plane polygons, if necessary.
|
||||
// 3. Functions related to switching video
|
||||
// modes (resolution) are called.
|
||||
// 4. Patch data is freed from memory,
|
||||
// and recached if necessary.
|
||||
// 5. The frame is ready to be drawn!
|
||||
// 4. The frame is ready to be drawn!
|
||||
|
||||
// stop movie if needs to change renderer
|
||||
if (setrenderneeded && (moviemode == MM_APNG))
|
||||
M_StopMovie();
|
||||
|
||||
// check for change of renderer or screen size (video mode)
|
||||
// Check for change of renderer or screen size (video mode)
|
||||
if ((setrenderneeded || setmodeneeded) && !wipe)
|
||||
{
|
||||
if (setrenderneeded)
|
||||
{
|
||||
CONS_Debug(DBG_RENDER, "setrenderneeded set (%d)\n", setrenderneeded);
|
||||
setrenderstillneeded = setrenderneeded;
|
||||
}
|
||||
SCR_SetMode(); // change video mode
|
||||
}
|
||||
|
||||
if (vid.recalc || setrenderstillneeded)
|
||||
{
|
||||
// Recalc the screen
|
||||
if (vid.recalc)
|
||||
SCR_Recalc(); // NOTE! setsizeneeded is set by SCR_Recalc()
|
||||
#ifdef HWRENDER
|
||||
// Shoot! The screen texture was flushed!
|
||||
if ((rendermode == render_opengl) && (gamestate == GS_INTERMISSION))
|
||||
usebuffer = false;
|
||||
#endif
|
||||
}
|
||||
|
||||
// View morph
|
||||
if (rendermode == render_soft && !splitscreen)
|
||||
R_CheckViewMorph();
|
||||
|
||||
// change the view size if needed
|
||||
if (setsizeneeded || setrenderstillneeded)
|
||||
// Change the view size if needed
|
||||
// Set by changing video mode or renderer
|
||||
if (setsizeneeded)
|
||||
{
|
||||
R_ExecuteSetViewSize();
|
||||
forcerefresh = true; // force background redraw
|
||||
}
|
||||
|
||||
// Lactozilla: Renderer switching
|
||||
D_CheckRendererState();
|
||||
|
||||
// draw buffered stuff to screen
|
||||
// Used only by linux GGI version
|
||||
I_UpdateNoBlit();
|
||||
|
@ -436,7 +413,7 @@ static void D_Display(void)
|
|||
|
||||
if (!automapactive && !dedicated && cv_renderview.value)
|
||||
{
|
||||
ps_rendercalltime = I_GetTimeMicros();
|
||||
ps_rendercalltime = I_GetPreciseTime();
|
||||
if (players[displayplayer].mo || players[displayplayer].playerstate == PST_DEAD)
|
||||
{
|
||||
topleft = screens[0] + viewwindowy*vid.width + viewwindowx;
|
||||
|
@ -483,7 +460,7 @@ static void D_Display(void)
|
|||
if (postimgtype2)
|
||||
V_DoPostProcessor(1, postimgtype2, postimgparam2);
|
||||
}
|
||||
ps_rendercalltime = I_GetTimeMicros() - ps_rendercalltime;
|
||||
ps_rendercalltime = I_GetPreciseTime() - ps_rendercalltime;
|
||||
}
|
||||
|
||||
if (lastdraw)
|
||||
|
@ -497,7 +474,7 @@ static void D_Display(void)
|
|||
lastdraw = false;
|
||||
}
|
||||
|
||||
ps_uitime = I_GetTimeMicros();
|
||||
ps_uitime = I_GetPreciseTime();
|
||||
|
||||
if (gamestate == GS_LEVEL)
|
||||
{
|
||||
|
@ -510,7 +487,7 @@ static void D_Display(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
ps_uitime = I_GetTimeMicros();
|
||||
ps_uitime = I_GetPreciseTime();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -530,7 +507,7 @@ static void D_Display(void)
|
|||
else
|
||||
py = viewwindowy + 4;
|
||||
patch = W_CachePatchName("M_PAUSE", PU_PATCH);
|
||||
V_DrawScaledPatch(viewwindowx + (BASEVIDWIDTH - SHORT(patch->width))/2, py, 0, patch);
|
||||
V_DrawScaledPatch(viewwindowx + (BASEVIDWIDTH - patch->width)/2, py, 0, patch);
|
||||
#else
|
||||
INT32 y = ((automapactive) ? (32) : (BASEVIDHEIGHT/2));
|
||||
M_DrawTextBox((BASEVIDWIDTH/2) - (60), y - (16), 13, 2);
|
||||
|
@ -552,7 +529,7 @@ static void D_Display(void)
|
|||
|
||||
CON_Drawer();
|
||||
|
||||
ps_uitime = I_GetTimeMicros() - ps_uitime;
|
||||
ps_uitime = I_GetPreciseTime() - ps_uitime;
|
||||
|
||||
//
|
||||
// wipe update
|
||||
|
@ -638,30 +615,10 @@ static void D_Display(void)
|
|||
M_DrawPerfStats();
|
||||
}
|
||||
|
||||
ps_swaptime = I_GetTimeMicros();
|
||||
ps_swaptime = I_GetPreciseTime();
|
||||
I_FinishUpdate(); // page flip or blit buffer
|
||||
ps_swaptime = I_GetTimeMicros() - ps_swaptime;
|
||||
ps_swaptime = I_GetPreciseTime() - ps_swaptime;
|
||||
}
|
||||
|
||||
needpatchflush = false;
|
||||
needpatchrecache = false;
|
||||
}
|
||||
|
||||
// Check the renderer's state
|
||||
// after a possible renderer switch.
|
||||
void D_CheckRendererState(void)
|
||||
{
|
||||
// flush all patches from memory
|
||||
if (needpatchflush)
|
||||
{
|
||||
Z_FlushCachedPatches();
|
||||
needpatchflush = false;
|
||||
}
|
||||
|
||||
// some patches have been freed,
|
||||
// so cache them again
|
||||
if (needpatchrecache)
|
||||
R_ReloadHUDGraphics();
|
||||
}
|
||||
|
||||
// =========================================================================
|
||||
|
@ -688,12 +645,15 @@ void D_SRB2Loop(void)
|
|||
oldentertics = I_GetTime();
|
||||
|
||||
// end of loading screen: CONS_Printf() will no more call FinishUpdate()
|
||||
con_refresh = false;
|
||||
con_startup = false;
|
||||
|
||||
// make sure to do a d_display to init mode _before_ load a level
|
||||
SCR_SetMode(); // change video mode
|
||||
SCR_Recalc();
|
||||
|
||||
chosenrendermode = render_none;
|
||||
|
||||
// Check and print which version is executed.
|
||||
// Use this as the border between setup and the main game loop being entered.
|
||||
CONS_Printf(
|
||||
|
@ -1038,7 +998,7 @@ static void IdentifyVersion(void)
|
|||
#define MUSICTEST(str) \
|
||||
{\
|
||||
const char *musicpath = va(pandf,srb2waddir,str);\
|
||||
int ms = W_VerifyNMUSlumps(musicpath); \
|
||||
int ms = W_VerifyNMUSlumps(musicpath, false); \
|
||||
if (ms == 1) \
|
||||
D_AddFile(startupwadfiles, musicpath); \
|
||||
else if (ms == 0) \
|
||||
|
@ -1112,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();
|
||||
|
@ -1227,11 +1187,7 @@ void D_SRB2Main(void)
|
|||
const char *s = M_GetNextParm();
|
||||
|
||||
if (s) // Check for NULL?
|
||||
{
|
||||
if (!W_VerifyNMUSlumps(s))
|
||||
G_SetGameModified(true);
|
||||
D_AddFile(startuppwads, s);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1338,24 +1294,6 @@ void D_SRB2Main(void)
|
|||
// set user default mode or mode set at cmdline
|
||||
SCR_CheckDefaultMode();
|
||||
|
||||
// Lactozilla: Does the render mode need to change?
|
||||
if ((setrenderneeded != 0) && (setrenderneeded != rendermode))
|
||||
{
|
||||
CONS_Printf(M_GetText("Switching the renderer...\n"));
|
||||
Z_PreparePatchFlush();
|
||||
|
||||
// set needpatchflush / needpatchrecache true for D_CheckRendererState
|
||||
needpatchflush = true;
|
||||
needpatchrecache = true;
|
||||
|
||||
// Set cv_renderer to the new render mode
|
||||
VID_CheckRenderer();
|
||||
SCR_ChangeRendererCVars(rendermode);
|
||||
|
||||
// check the renderer's state
|
||||
D_CheckRendererState();
|
||||
}
|
||||
|
||||
wipegamestate = gamestate;
|
||||
|
||||
savedata.lives = 0; // flag this as not-used
|
||||
|
|
|
@ -214,11 +214,9 @@ consvar_t cv_respawntime = CVAR_INIT ("respawndelay", "3", CV_SAVE|CV_NETVAR|CV_
|
|||
|
||||
consvar_t cv_competitionboxes = CVAR_INIT ("competitionboxes", "Mystery", CV_SAVE|CV_NETVAR|CV_CHEAT, competitionboxes_cons_t, NULL);
|
||||
|
||||
#ifdef SEENAMES
|
||||
static CV_PossibleValue_t seenames_cons_t[] = {{0, "Off"}, {1, "Colorless"}, {2, "Team"}, {3, "Ally/Foe"}, {0, NULL}};
|
||||
consvar_t cv_seenames = CVAR_INIT ("seenames", "Ally/Foe", CV_SAVE, seenames_cons_t, 0);
|
||||
consvar_t cv_allowseenames = CVAR_INIT ("allowseenames", "Yes", CV_SAVE|CV_NETVAR, CV_YesNo, NULL);
|
||||
#endif
|
||||
|
||||
// names
|
||||
consvar_t cv_playername = CVAR_INIT ("name", "Sonic", CV_SAVE|CV_CALL|CV_NOINIT, NULL, Name_OnChange);
|
||||
|
@ -374,6 +372,7 @@ consvar_t cv_sleep = CVAR_INIT ("cpusleep", "1", CV_SAVE, sleeping_cons_t, NULL)
|
|||
static CV_PossibleValue_t perfstats_cons_t[] = {
|
||||
{0, "Off"}, {1, "Rendering"}, {2, "Logic"}, {3, "ThinkFrame"}, {0, NULL}};
|
||||
consvar_t cv_perfstats = CVAR_INIT ("perfstats", "Off", 0, perfstats_cons_t, NULL);
|
||||
consvar_t cv_freedemocamera = CVAR_INIT("freedemocamera", "Off", CV_SAVE, CV_OnOff, NULL);
|
||||
|
||||
char timedemo_name[256];
|
||||
boolean timedemo_csv;
|
||||
|
@ -596,9 +595,7 @@ void D_RegisterServerCommands(void)
|
|||
CV_RegisterVar(&cv_pingtimeout);
|
||||
CV_RegisterVar(&cv_showping);
|
||||
|
||||
#ifdef SEENAMES
|
||||
CV_RegisterVar(&cv_allowseenames);
|
||||
#endif
|
||||
CV_RegisterVar(&cv_allowseenames);
|
||||
|
||||
CV_RegisterVar(&cv_dummyconsvar);
|
||||
}
|
||||
|
@ -669,16 +666,13 @@ void D_RegisterClientCommands(void)
|
|||
CV_RegisterVar(&cv_zlib_strategya);
|
||||
CV_RegisterVar(&cv_zlib_window_bitsa);
|
||||
CV_RegisterVar(&cv_apng_delay);
|
||||
CV_RegisterVar(&cv_apng_downscale);
|
||||
// GIF variables
|
||||
CV_RegisterVar(&cv_gif_optimize);
|
||||
CV_RegisterVar(&cv_gif_downscale);
|
||||
CV_RegisterVar(&cv_gif_dynamicdelay);
|
||||
CV_RegisterVar(&cv_gif_localcolortable);
|
||||
|
||||
#ifdef WALLSPLATS
|
||||
CV_RegisterVar(&cv_splats);
|
||||
#endif
|
||||
|
||||
// register these so it is saved to config
|
||||
CV_RegisterVar(&cv_playername);
|
||||
CV_RegisterVar(&cv_playercolor);
|
||||
|
@ -693,9 +687,7 @@ void D_RegisterClientCommands(void)
|
|||
CV_RegisterVar(&cv_defaultplayercolor2);
|
||||
CV_RegisterVar(&cv_defaultskin2);
|
||||
|
||||
#ifdef SEENAMES
|
||||
CV_RegisterVar(&cv_seenames);
|
||||
#endif
|
||||
CV_RegisterVar(&cv_rollingdemos);
|
||||
CV_RegisterVar(&cv_netstat);
|
||||
CV_RegisterVar(&cv_netticbuffer);
|
||||
|
@ -880,6 +872,8 @@ void D_RegisterClientCommands(void)
|
|||
// CV_RegisterVar(&cv_grid);
|
||||
// CV_RegisterVar(&cv_snapto);
|
||||
|
||||
CV_RegisterVar(&cv_freedemocamera);
|
||||
|
||||
// add cheat commands
|
||||
COM_AddCommand("noclip", Command_CheatNoClip_f);
|
||||
COM_AddCommand("god", Command_CheatGod_f);
|
||||
|
@ -2136,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;
|
||||
|
@ -3295,7 +3289,13 @@ static void Command_Addfile(void)
|
|||
if (!isprint(fn[i]) || fn[i] == ';')
|
||||
return;
|
||||
|
||||
musiconly = W_VerifyNMUSlumps(fn);
|
||||
musiconly = W_VerifyNMUSlumps(fn, false);
|
||||
|
||||
if (musiconly == -1)
|
||||
{
|
||||
addedfiles[numfilesadded++] = fn;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!musiconly)
|
||||
{
|
||||
|
@ -3607,8 +3607,7 @@ static void Command_Playintro_f(void)
|
|||
*/
|
||||
FUNCNORETURN static ATTRNORETURN void Command_Quit_f(void)
|
||||
{
|
||||
if (Playing())
|
||||
LUAh_GameQuit();
|
||||
LUAh_GameQuit(true);
|
||||
I_Quit();
|
||||
}
|
||||
|
||||
|
@ -4270,8 +4269,7 @@ void Command_ExitGame_f(void)
|
|||
{
|
||||
INT32 i;
|
||||
|
||||
if (Playing())
|
||||
LUAh_GameQuit();
|
||||
LUAh_GameQuit(false);
|
||||
|
||||
D_QuitNetGame();
|
||||
CL_Reset();
|
||||
|
|
|
@ -31,9 +31,7 @@ extern consvar_t cv_defaultskin;
|
|||
extern consvar_t cv_defaultplayercolor2;
|
||||
extern consvar_t cv_defaultskin2;
|
||||
|
||||
#ifdef SEENAMES
|
||||
extern consvar_t cv_seenames, cv_allowseenames;
|
||||
#endif
|
||||
extern consvar_t cv_usemouse;
|
||||
extern consvar_t cv_usejoystick;
|
||||
extern consvar_t cv_usejoystick2;
|
||||
|
@ -75,9 +73,6 @@ extern consvar_t cv_teamscramble;
|
|||
extern consvar_t cv_scrambleonchange;
|
||||
|
||||
extern consvar_t cv_netstat;
|
||||
#ifdef WALLSPLATS
|
||||
extern consvar_t cv_splats;
|
||||
#endif
|
||||
|
||||
extern consvar_t cv_countdowntime;
|
||||
extern consvar_t cv_runscripts;
|
||||
|
@ -121,6 +116,8 @@ extern boolean timedemo_csv;
|
|||
extern char timedemo_csv_id[256];
|
||||
extern boolean timedemo_quit;
|
||||
|
||||
extern consvar_t cv_freedemocamera;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
XD_NAMEANDCOLOR = 1,
|
||||
|
|
|
@ -51,7 +51,9 @@ typedef enum
|
|||
SF_NONIGHTSSUPER = 1<<15, // Disable super colors for NiGHTS (if you have SF_SUPER)
|
||||
SF_NOSUPERSPRITES = 1<<16, // Don't use super sprites while super
|
||||
SF_NOSUPERJUMPBOOST = 1<<17, // Disable the jump boost given while super (i.e. Knuckles)
|
||||
SF_CANBUSTWALLS = 1<<18, // Can naturally bust walls on contact? (i.e. Knuckles)
|
||||
SF_CANBUSTWALLS = 1<<18, // Can naturally bust walls on contact? (i.e. Knuckles)
|
||||
SF_NOSHIELDABILITY = 1<<19, // Disable shield abilities
|
||||
|
||||
// free up to and including 1<<31
|
||||
} skinflags_t;
|
||||
|
||||
|
|
697
src/deh_lua.c
Normal file
697
src/deh_lua.c
Normal file
|
@ -0,0 +1,697 @@
|
|||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2020 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
// See the 'LICENSE' file for more details.
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file deh_lua.c
|
||||
/// \brief Lua SOC library
|
||||
|
||||
#include "g_game.h"
|
||||
#include "s_sound.h"
|
||||
#include "z_zone.h"
|
||||
#include "m_menu.h"
|
||||
#include "m_misc.h"
|
||||
#include "p_local.h"
|
||||
#include "st_stuff.h"
|
||||
#include "fastcmp.h"
|
||||
#include "lua_script.h"
|
||||
#include "lua_libs.h"
|
||||
|
||||
#include "dehacked.h"
|
||||
#include "deh_lua.h"
|
||||
#include "deh_tables.h"
|
||||
|
||||
#ifdef MUSICSLOT_COMPATIBILITY
|
||||
#include "deh_soc.h" // for get_mus
|
||||
#endif
|
||||
|
||||
// freeslot takes a name (string only!)
|
||||
// and allocates it to the appropriate free slot.
|
||||
// Returns the slot number allocated for it or nil if failed.
|
||||
// ex. freeslot("MT_MYTHING","S_MYSTATE1","S_MYSTATE2")
|
||||
// TODO: Error checking! @.@; There's currently no way to know which ones failed and why!
|
||||
//
|
||||
static inline int lib_freeslot(lua_State *L)
|
||||
{
|
||||
int n = lua_gettop(L);
|
||||
int r = 0; // args returned
|
||||
char *s, *type,*word;
|
||||
|
||||
if (!lua_lumploading)
|
||||
return luaL_error(L, "This function cannot be called from within a hook or coroutine!");
|
||||
|
||||
while (n-- > 0)
|
||||
{
|
||||
s = Z_StrDup(luaL_checkstring(L,1));
|
||||
type = strtok(s, "_");
|
||||
if (type)
|
||||
strupr(type);
|
||||
else {
|
||||
Z_Free(s);
|
||||
return luaL_error(L, "Unknown enum type in '%s'\n", luaL_checkstring(L, 1));
|
||||
}
|
||||
|
||||
word = strtok(NULL, "\n");
|
||||
if (word)
|
||||
strupr(word);
|
||||
else {
|
||||
Z_Free(s);
|
||||
return luaL_error(L, "Missing enum name in '%s'\n", luaL_checkstring(L, 1));
|
||||
}
|
||||
if (fastcmp(type, "SFX")) {
|
||||
sfxenum_t sfx;
|
||||
strlwr(word);
|
||||
CONS_Printf("Sound sfx_%s allocated.\n",word);
|
||||
sfx = S_AddSoundFx(word, false, 0, false);
|
||||
if (sfx != sfx_None) {
|
||||
lua_pushinteger(L, sfx);
|
||||
r++;
|
||||
} else
|
||||
CONS_Alert(CONS_WARNING, "Ran out of free SFX slots!\n");
|
||||
}
|
||||
else if (fastcmp(type, "SPR"))
|
||||
{
|
||||
char wad;
|
||||
spritenum_t j;
|
||||
lua_getfield(L, LUA_REGISTRYINDEX, "WAD");
|
||||
wad = (char)lua_tointeger(L, -1);
|
||||
lua_pop(L, 1);
|
||||
for (j = SPR_FIRSTFREESLOT; j <= SPR_LASTFREESLOT; j++)
|
||||
{
|
||||
if (used_spr[(j-SPR_FIRSTFREESLOT)/8] & (1<<(j%8)))
|
||||
{
|
||||
if (!sprnames[j][4] && memcmp(sprnames[j],word,4)==0)
|
||||
sprnames[j][4] = wad;
|
||||
continue; // Already allocated, next.
|
||||
}
|
||||
// Found a free slot!
|
||||
CONS_Printf("Sprite SPR_%s allocated.\n",word);
|
||||
strncpy(sprnames[j],word,4);
|
||||
//sprnames[j][4] = 0;
|
||||
used_spr[(j-SPR_FIRSTFREESLOT)/8] |= 1<<(j%8); // Okay, this sprite slot has been named now.
|
||||
lua_pushinteger(L, j);
|
||||
r++;
|
||||
break;
|
||||
}
|
||||
if (j > SPR_LASTFREESLOT)
|
||||
CONS_Alert(CONS_WARNING, "Ran out of free sprite slots!\n");
|
||||
}
|
||||
else if (fastcmp(type, "S"))
|
||||
{
|
||||
statenum_t i;
|
||||
for (i = 0; i < NUMSTATEFREESLOTS; i++)
|
||||
if (!FREE_STATES[i]) {
|
||||
CONS_Printf("State S_%s allocated.\n",word);
|
||||
FREE_STATES[i] = Z_Malloc(strlen(word)+1, PU_STATIC, NULL);
|
||||
strcpy(FREE_STATES[i],word);
|
||||
lua_pushinteger(L, S_FIRSTFREESLOT + i);
|
||||
r++;
|
||||
break;
|
||||
}
|
||||
if (i == NUMSTATEFREESLOTS)
|
||||
CONS_Alert(CONS_WARNING, "Ran out of free State slots!\n");
|
||||
}
|
||||
else if (fastcmp(type, "MT"))
|
||||
{
|
||||
mobjtype_t i;
|
||||
for (i = 0; i < NUMMOBJFREESLOTS; i++)
|
||||
if (!FREE_MOBJS[i]) {
|
||||
CONS_Printf("MobjType MT_%s allocated.\n",word);
|
||||
FREE_MOBJS[i] = Z_Malloc(strlen(word)+1, PU_STATIC, NULL);
|
||||
strcpy(FREE_MOBJS[i],word);
|
||||
lua_pushinteger(L, MT_FIRSTFREESLOT + i);
|
||||
r++;
|
||||
break;
|
||||
}
|
||||
if (i == NUMMOBJFREESLOTS)
|
||||
CONS_Alert(CONS_WARNING, "Ran out of free MobjType slots!\n");
|
||||
}
|
||||
else if (fastcmp(type, "SKINCOLOR"))
|
||||
{
|
||||
skincolornum_t i;
|
||||
for (i = 0; i < NUMCOLORFREESLOTS; i++)
|
||||
if (!FREE_SKINCOLORS[i]) {
|
||||
CONS_Printf("Skincolor SKINCOLOR_%s allocated.\n",word);
|
||||
FREE_SKINCOLORS[i] = Z_Malloc(strlen(word)+1, PU_STATIC, NULL);
|
||||
strcpy(FREE_SKINCOLORS[i],word);
|
||||
M_AddMenuColor(numskincolors++);
|
||||
lua_pushinteger(L, SKINCOLOR_FIRSTFREESLOT + i);
|
||||
r++;
|
||||
break;
|
||||
}
|
||||
if (i == NUMCOLORFREESLOTS)
|
||||
CONS_Alert(CONS_WARNING, "Ran out of free skincolor slots!\n");
|
||||
}
|
||||
else if (fastcmp(type, "SPR2"))
|
||||
{
|
||||
// Search if we already have an SPR2 by that name...
|
||||
playersprite_t i;
|
||||
for (i = SPR2_FIRSTFREESLOT; i < free_spr2; i++)
|
||||
if (memcmp(spr2names[i],word,4) == 0)
|
||||
break;
|
||||
// We don't, so allocate a new one.
|
||||
if (i >= free_spr2) {
|
||||
if (free_spr2 < NUMPLAYERSPRITES)
|
||||
{
|
||||
CONS_Printf("Sprite SPR2_%s allocated.\n",word);
|
||||
strncpy(spr2names[free_spr2],word,4);
|
||||
spr2defaults[free_spr2] = 0;
|
||||
lua_pushinteger(L, free_spr2);
|
||||
r++;
|
||||
spr2names[free_spr2++][4] = 0;
|
||||
} else
|
||||
CONS_Alert(CONS_WARNING, "Ran out of free SPR2 slots!\n");
|
||||
}
|
||||
}
|
||||
else if (fastcmp(type, "TOL"))
|
||||
{
|
||||
// Search if we already have a typeoflevel by that name...
|
||||
int i;
|
||||
for (i = 0; TYPEOFLEVEL[i].name; i++)
|
||||
if (fastcmp(word, TYPEOFLEVEL[i].name))
|
||||
break;
|
||||
|
||||
// We don't, so allocate a new one.
|
||||
if (TYPEOFLEVEL[i].name == NULL) {
|
||||
if (lastcustomtol == (UINT32)MAXTOL) // Unless you have way too many, since they're flags.
|
||||
CONS_Alert(CONS_WARNING, "Ran out of free typeoflevel slots!\n");
|
||||
else {
|
||||
CONS_Printf("TypeOfLevel TOL_%s allocated.\n",word);
|
||||
G_AddTOL(lastcustomtol, word);
|
||||
lua_pushinteger(L, lastcustomtol);
|
||||
lastcustomtol <<= 1;
|
||||
r++;
|
||||
}
|
||||
}
|
||||
}
|
||||
Z_Free(s);
|
||||
lua_remove(L, 1);
|
||||
continue;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
// Wrapper for ALL A_Action functions.
|
||||
// Arguments: mobj_t actor, int var1, int var2
|
||||
static int action_call(lua_State *L)
|
||||
{
|
||||
//actionf_t *action = lua_touserdata(L,lua_upvalueindex(1));
|
||||
actionf_t *action = *((actionf_t **)luaL_checkudata(L, 1, META_ACTION));
|
||||
mobj_t *actor = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ));
|
||||
var1 = (INT32)luaL_optinteger(L, 3, 0);
|
||||
var2 = (INT32)luaL_optinteger(L, 4, 0);
|
||||
if (!actor)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
action->acp1(actor);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Hardcoded A_Action name to call for super() or NULL if super() would be invalid.
|
||||
// Set in lua_infolib.
|
||||
const char *superactions[MAXRECURSION];
|
||||
UINT8 superstack = 0;
|
||||
|
||||
static int lib_dummysuper(lua_State *L)
|
||||
{
|
||||
return luaL_error(L, "Can't call super() outside of hardcode-replacing A_Action functions being called by state changes!"); // convoluted, I know. @_@;;
|
||||
}
|
||||
|
||||
static inline int lib_getenum(lua_State *L)
|
||||
{
|
||||
const char *word, *p;
|
||||
fixed_t i;
|
||||
boolean mathlib = lua_toboolean(L, lua_upvalueindex(1));
|
||||
if (lua_type(L,2) != LUA_TSTRING)
|
||||
return 0;
|
||||
word = lua_tostring(L,2);
|
||||
if (strlen(word) == 1) { // Assume sprite frame if length 1.
|
||||
if (*word >= 'A' && *word <= '~')
|
||||
{
|
||||
lua_pushinteger(L, *word-'A');
|
||||
return 1;
|
||||
}
|
||||
if (mathlib) return luaL_error(L, "constant '%s' could not be parsed.\n", word);
|
||||
return 0;
|
||||
}
|
||||
else if (fastncmp("MF_", word, 3)) {
|
||||
p = word+3;
|
||||
for (i = 0; MOBJFLAG_LIST[i]; i++)
|
||||
if (fastcmp(p, MOBJFLAG_LIST[i])) {
|
||||
lua_pushinteger(L, ((lua_Integer)1<<i));
|
||||
return 1;
|
||||
}
|
||||
if (mathlib) return luaL_error(L, "mobjflag '%s' could not be found.\n", word);
|
||||
return 0;
|
||||
}
|
||||
else if (fastncmp("MF2_", word, 4)) {
|
||||
p = word+4;
|
||||
for (i = 0; MOBJFLAG2_LIST[i]; i++)
|
||||
if (fastcmp(p, MOBJFLAG2_LIST[i])) {
|
||||
lua_pushinteger(L, ((lua_Integer)1<<i));
|
||||
return 1;
|
||||
}
|
||||
if (mathlib) return luaL_error(L, "mobjflag2 '%s' could not be found.\n", word);
|
||||
return 0;
|
||||
}
|
||||
else if (fastncmp("MFE_", word, 4)) {
|
||||
p = word+4;
|
||||
for (i = 0; MOBJEFLAG_LIST[i]; i++)
|
||||
if (fastcmp(p, MOBJEFLAG_LIST[i])) {
|
||||
lua_pushinteger(L, ((lua_Integer)1<<i));
|
||||
return 1;
|
||||
}
|
||||
if (mathlib) return luaL_error(L, "mobjeflag '%s' could not be found.\n", word);
|
||||
return 0;
|
||||
}
|
||||
else if (fastncmp("MTF_", word, 4)) {
|
||||
p = word+4;
|
||||
for (i = 0; i < 4; i++)
|
||||
if (MAPTHINGFLAG_LIST[i] && fastcmp(p, MAPTHINGFLAG_LIST[i])) {
|
||||
lua_pushinteger(L, ((lua_Integer)1<<i));
|
||||
return 1;
|
||||
}
|
||||
if (mathlib) return luaL_error(L, "mapthingflag '%s' could not be found.\n", word);
|
||||
return 0;
|
||||
}
|
||||
else if (fastncmp("PF_", word, 3)) {
|
||||
p = word+3;
|
||||
for (i = 0; PLAYERFLAG_LIST[i]; i++)
|
||||
if (fastcmp(p, PLAYERFLAG_LIST[i])) {
|
||||
lua_pushinteger(L, ((lua_Integer)1<<i));
|
||||
return 1;
|
||||
}
|
||||
if (fastcmp(p, "FULLSTASIS"))
|
||||
{
|
||||
lua_pushinteger(L, (lua_Integer)PF_FULLSTASIS);
|
||||
return 1;
|
||||
}
|
||||
else if (fastcmp(p, "USEDOWN")) // Remove case when 2.3 nears release...
|
||||
{
|
||||
lua_pushinteger(L, (lua_Integer)PF_SPINDOWN);
|
||||
return 1;
|
||||
}
|
||||
if (mathlib) return luaL_error(L, "playerflag '%s' could not be found.\n", word);
|
||||
return 0;
|
||||
}
|
||||
else if (fastncmp("GT_", word, 3)) {
|
||||
p = word;
|
||||
for (i = 0; Gametype_ConstantNames[i]; i++)
|
||||
if (fastcmp(p, Gametype_ConstantNames[i])) {
|
||||
lua_pushinteger(L, i);
|
||||
return 1;
|
||||
}
|
||||
if (mathlib) return luaL_error(L, "gametype '%s' could not be found.\n", word);
|
||||
return 0;
|
||||
}
|
||||
else if (fastncmp("GTR_", word, 4)) {
|
||||
p = word+4;
|
||||
for (i = 0; GAMETYPERULE_LIST[i]; i++)
|
||||
if (fastcmp(p, GAMETYPERULE_LIST[i])) {
|
||||
lua_pushinteger(L, ((lua_Integer)1<<i));
|
||||
return 1;
|
||||
}
|
||||
if (mathlib) return luaL_error(L, "game type rule '%s' could not be found.\n", word);
|
||||
return 0;
|
||||
}
|
||||
else if (fastncmp("TOL_", word, 4)) {
|
||||
p = word+4;
|
||||
for (i = 0; TYPEOFLEVEL[i].name; i++)
|
||||
if (fastcmp(p, TYPEOFLEVEL[i].name)) {
|
||||
lua_pushinteger(L, TYPEOFLEVEL[i].flag);
|
||||
return 1;
|
||||
}
|
||||
if (mathlib) return luaL_error(L, "typeoflevel '%s' could not be found.\n", word);
|
||||
return 0;
|
||||
}
|
||||
else if (fastncmp("ML_", word, 3)) {
|
||||
p = word+3;
|
||||
for (i = 0; i < 16; i++)
|
||||
if (ML_LIST[i] && fastcmp(p, ML_LIST[i])) {
|
||||
lua_pushinteger(L, ((lua_Integer)1<<i));
|
||||
return 1;
|
||||
}
|
||||
if (mathlib) return luaL_error(L, "linedef flag '%s' could not be found.\n", word);
|
||||
return 0;
|
||||
}
|
||||
else if (fastncmp("S_",word,2)) {
|
||||
p = word+2;
|
||||
for (i = 0; i < NUMSTATEFREESLOTS; i++) {
|
||||
if (!FREE_STATES[i])
|
||||
break;
|
||||
if (fastcmp(p, FREE_STATES[i])) {
|
||||
lua_pushinteger(L, S_FIRSTFREESLOT+i);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < S_FIRSTFREESLOT; i++)
|
||||
if (fastcmp(p, STATE_LIST[i]+2)) {
|
||||
lua_pushinteger(L, i);
|
||||
return 1;
|
||||
}
|
||||
return luaL_error(L, "state '%s' does not exist.\n", word);
|
||||
}
|
||||
else if (fastncmp("MT_",word,3)) {
|
||||
p = word+3;
|
||||
for (i = 0; i < NUMMOBJFREESLOTS; i++) {
|
||||
if (!FREE_MOBJS[i])
|
||||
break;
|
||||
if (fastcmp(p, FREE_MOBJS[i])) {
|
||||
lua_pushinteger(L, MT_FIRSTFREESLOT+i);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < MT_FIRSTFREESLOT; i++)
|
||||
if (fastcmp(p, MOBJTYPE_LIST[i]+3)) {
|
||||
lua_pushinteger(L, i);
|
||||
return 1;
|
||||
}
|
||||
return luaL_error(L, "mobjtype '%s' does not exist.\n", word);
|
||||
}
|
||||
else if (fastncmp("SPR_",word,4)) {
|
||||
p = word+4;
|
||||
for (i = 0; i < NUMSPRITES; i++)
|
||||
if (!sprnames[i][4] && fastncmp(p,sprnames[i],4)) {
|
||||
lua_pushinteger(L, i);
|
||||
return 1;
|
||||
}
|
||||
if (mathlib) return luaL_error(L, "sprite '%s' could not be found.\n", word);
|
||||
return 0;
|
||||
}
|
||||
else if (fastncmp("SPR2_",word,5)) {
|
||||
p = word+5;
|
||||
for (i = 0; i < (fixed_t)free_spr2; i++)
|
||||
if (!spr2names[i][4])
|
||||
{
|
||||
// special 3-char cases, e.g. SPR2_RUN
|
||||
// the spr2names entry will have "_" on the end, as in "RUN_"
|
||||
if (spr2names[i][3] == '_' && !p[3]) {
|
||||
if (fastncmp(p,spr2names[i],3)) {
|
||||
lua_pushinteger(L, i);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else if (fastncmp(p,spr2names[i],4)) {
|
||||
lua_pushinteger(L, i);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
if (mathlib) return luaL_error(L, "player sprite '%s' could not be found.\n", word);
|
||||
return 0;
|
||||
}
|
||||
else if (!mathlib && fastncmp("sfx_",word,4)) {
|
||||
p = word+4;
|
||||
for (i = 0; i < NUMSFX; i++)
|
||||
if (S_sfx[i].name && fastcmp(p, S_sfx[i].name)) {
|
||||
lua_pushinteger(L, i);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
else if (mathlib && fastncmp("SFX_",word,4)) { // SOCs are ALL CAPS!
|
||||
p = word+4;
|
||||
for (i = 0; i < NUMSFX; i++)
|
||||
if (S_sfx[i].name && fasticmp(p, S_sfx[i].name)) {
|
||||
lua_pushinteger(L, i);
|
||||
return 1;
|
||||
}
|
||||
return luaL_error(L, "sfx '%s' could not be found.\n", word);
|
||||
}
|
||||
else if (mathlib && fastncmp("DS",word,2)) {
|
||||
p = word+2;
|
||||
for (i = 0; i < NUMSFX; i++)
|
||||
if (S_sfx[i].name && fasticmp(p, S_sfx[i].name)) {
|
||||
lua_pushinteger(L, i);
|
||||
return 1;
|
||||
}
|
||||
if (mathlib) return luaL_error(L, "sfx '%s' could not be found.\n", word);
|
||||
return 0;
|
||||
}
|
||||
#ifdef MUSICSLOT_COMPATIBILITY
|
||||
else if (!mathlib && fastncmp("mus_",word,4)) {
|
||||
p = word+4;
|
||||
if ((i = get_mus(p, false)) == 0)
|
||||
return 0;
|
||||
lua_pushinteger(L, i);
|
||||
return 1;
|
||||
}
|
||||
else if (mathlib && fastncmp("MUS_",word,4)) { // SOCs are ALL CAPS!
|
||||
p = word+4;
|
||||
if ((i = get_mus(p, false)) == 0)
|
||||
return luaL_error(L, "music '%s' could not be found.\n", word);
|
||||
lua_pushinteger(L, i);
|
||||
return 1;
|
||||
}
|
||||
else if (mathlib && (fastncmp("O_",word,2) || fastncmp("D_",word,2))) {
|
||||
p = word+2;
|
||||
if ((i = get_mus(p, false)) == 0)
|
||||
return luaL_error(L, "music '%s' could not be found.\n", word);
|
||||
lua_pushinteger(L, i);
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
else if (!mathlib && fastncmp("pw_",word,3)) {
|
||||
p = word+3;
|
||||
for (i = 0; i < NUMPOWERS; i++)
|
||||
if (fasticmp(p, POWERS_LIST[i])) {
|
||||
lua_pushinteger(L, i);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
else if (mathlib && fastncmp("PW_",word,3)) { // SOCs are ALL CAPS!
|
||||
p = word+3;
|
||||
for (i = 0; i < NUMPOWERS; i++)
|
||||
if (fastcmp(p, POWERS_LIST[i])) {
|
||||
lua_pushinteger(L, i);
|
||||
return 1;
|
||||
}
|
||||
return luaL_error(L, "power '%s' could not be found.\n", word);
|
||||
}
|
||||
else if (fastncmp("HUD_",word,4)) {
|
||||
p = word+4;
|
||||
for (i = 0; i < NUMHUDITEMS; i++)
|
||||
if (fastcmp(p, HUDITEMS_LIST[i])) {
|
||||
lua_pushinteger(L, i);
|
||||
return 1;
|
||||
}
|
||||
if (mathlib) return luaL_error(L, "huditem '%s' could not be found.\n", word);
|
||||
return 0;
|
||||
}
|
||||
else if (fastncmp("SKINCOLOR_",word,10)) {
|
||||
p = word+10;
|
||||
for (i = 0; i < NUMCOLORFREESLOTS; i++) {
|
||||
if (!FREE_SKINCOLORS[i])
|
||||
break;
|
||||
if (fastcmp(p, FREE_SKINCOLORS[i])) {
|
||||
lua_pushinteger(L, SKINCOLOR_FIRSTFREESLOT+i);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < SKINCOLOR_FIRSTFREESLOT; i++)
|
||||
if (fastcmp(p, COLOR_ENUMS[i])) {
|
||||
lua_pushinteger(L, i);
|
||||
return 1;
|
||||
}
|
||||
return luaL_error(L, "skincolor '%s' could not be found.\n", word);
|
||||
}
|
||||
else if (fastncmp("GRADE_",word,6))
|
||||
{
|
||||
p = word+6;
|
||||
for (i = 0; NIGHTSGRADE_LIST[i]; i++)
|
||||
if (*p == NIGHTSGRADE_LIST[i])
|
||||
{
|
||||
lua_pushinteger(L, i);
|
||||
return 1;
|
||||
}
|
||||
if (mathlib) return luaL_error(L, "NiGHTS grade '%s' could not be found.\n", word);
|
||||
return 0;
|
||||
}
|
||||
else if (fastncmp("MN_",word,3)) {
|
||||
p = word+3;
|
||||
for (i = 0; i < NUMMENUTYPES; i++)
|
||||
if (fastcmp(p, MENUTYPES_LIST[i])) {
|
||||
lua_pushinteger(L, i);
|
||||
return 1;
|
||||
}
|
||||
if (mathlib) return luaL_error(L, "menutype '%s' could not be found.\n", word);
|
||||
return 0;
|
||||
}
|
||||
else if (!mathlib && fastncmp("A_",word,2)) {
|
||||
char *caps;
|
||||
// Try to get a Lua action first.
|
||||
/// \todo Push a closure that sets superactions[] and superstack.
|
||||
lua_getfield(L, LUA_REGISTRYINDEX, LREG_ACTIONS);
|
||||
// actions are stored in all uppercase.
|
||||
caps = Z_StrDup(word);
|
||||
strupr(caps);
|
||||
lua_getfield(L, -1, caps);
|
||||
Z_Free(caps);
|
||||
if (!lua_isnil(L, -1))
|
||||
return 1; // Success! :D That was easy.
|
||||
// Welp, that failed.
|
||||
lua_pop(L, 2); // pop nil and LREG_ACTIONS
|
||||
|
||||
// Hardcoded actions as callable Lua functions!
|
||||
// Retrieving them from this metatable allows them to be case-insensitive!
|
||||
for (i = 0; actionpointers[i].name; i++)
|
||||
if (fasticmp(word, actionpointers[i].name)) {
|
||||
// We push the actionf_t* itself as userdata!
|
||||
LUA_PushUserdata(L, &actionpointers[i].action, META_ACTION);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
else if (!mathlib && fastcmp("super",word))
|
||||
{
|
||||
if (!superstack)
|
||||
{
|
||||
lua_pushcfunction(L, lib_dummysuper);
|
||||
return 1;
|
||||
}
|
||||
for (i = 0; actionpointers[i].name; i++)
|
||||
if (fasticmp(superactions[superstack-1], actionpointers[i].name)) {
|
||||
LUA_PushUserdata(L, &actionpointers[i].action, META_ACTION);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (fastcmp(word, "BT_USE")) // Remove case when 2.3 nears release...
|
||||
{
|
||||
lua_pushinteger(L, (lua_Integer)BT_SPIN);
|
||||
return 1;
|
||||
}
|
||||
|
||||
for (i = 0; INT_CONST[i].n; i++)
|
||||
if (fastcmp(word,INT_CONST[i].n)) {
|
||||
lua_pushinteger(L, INT_CONST[i].v);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (mathlib) return luaL_error(L, "constant '%s' could not be parsed.\n", word);
|
||||
|
||||
// DYNAMIC variables too!!
|
||||
// Try not to add anything that would break netgames or timeattack replays here.
|
||||
// You know, like consoleplayer, displayplayer, secondarydisplayplayer, or gametime.
|
||||
return LUA_PushGlobals(L, word);
|
||||
}
|
||||
|
||||
int LUA_EnumLib(lua_State *L)
|
||||
{
|
||||
if (lua_gettop(L) == 0)
|
||||
lua_pushboolean(L, 0);
|
||||
|
||||
// Set the global metatable
|
||||
lua_createtable(L, 0, 1);
|
||||
lua_pushvalue(L, 1); // boolean passed to LUA_EnumLib as first argument.
|
||||
lua_pushcclosure(L, lib_getenum, 1);
|
||||
lua_setfield(L, -2, "__index");
|
||||
lua_setmetatable(L, LUA_GLOBALSINDEX);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// getActionName(action) -> return action's string name
|
||||
static int lib_getActionName(lua_State *L)
|
||||
{
|
||||
if (lua_isuserdata(L, 1)) // arg 1 is built-in action, expect action userdata
|
||||
{
|
||||
actionf_t *action = *((actionf_t **)luaL_checkudata(L, 1, META_ACTION));
|
||||
const char *name = NULL;
|
||||
if (!action)
|
||||
return luaL_error(L, "not a valid action?");
|
||||
name = LUA_GetActionName(action);
|
||||
if (!name) // that can't be right?
|
||||
return luaL_error(L, "no name string could be found for this action");
|
||||
lua_pushstring(L, name);
|
||||
return 1;
|
||||
}
|
||||
else if (lua_isfunction(L, 1)) // arg 1 is a function (either C or Lua)
|
||||
{
|
||||
lua_settop(L, 1); // set top of stack to 1 (removing any extra args, which there shouldn't be)
|
||||
// get the name for this action, if possible.
|
||||
lua_getfield(L, LUA_REGISTRYINDEX, LREG_ACTIONS);
|
||||
lua_pushnil(L);
|
||||
// Lua stack at this point:
|
||||
// 1 ... -2 -1
|
||||
// arg ... LREG_ACTIONS nil
|
||||
while (lua_next(L, -2))
|
||||
{
|
||||
// Lua stack at this point:
|
||||
// 1 ... -3 -2 -1
|
||||
// arg ... LREG_ACTIONS "A_ACTION" function
|
||||
if (lua_rawequal(L, -1, 1)) // is this the same as the arg?
|
||||
{
|
||||
// make sure the key (i.e. "A_ACTION") is a string first
|
||||
// (note: we don't use lua_isstring because it also returns true for numbers)
|
||||
if (lua_type(L, -2) == LUA_TSTRING)
|
||||
{
|
||||
lua_pushvalue(L, -2); // push "A_ACTION" string to top of stack
|
||||
return 1;
|
||||
}
|
||||
lua_pop(L, 2); // pop the name and function
|
||||
break; // probably should have succeeded but we didn't, so end the loop
|
||||
}
|
||||
lua_pop(L, 1);
|
||||
}
|
||||
lua_pop(L, 1); // pop LREG_ACTIONS
|
||||
return 0; // return nothing (don't error)
|
||||
}
|
||||
|
||||
return luaL_typerror(L, 1, "action userdata or Lua function");
|
||||
}
|
||||
|
||||
|
||||
|
||||
int LUA_SOCLib(lua_State *L)
|
||||
{
|
||||
lua_register(L,"freeslot",lib_freeslot);
|
||||
lua_register(L,"getActionName",lib_getActionName);
|
||||
|
||||
luaL_newmetatable(L, META_ACTION);
|
||||
lua_pushcfunction(L, action_call);
|
||||
lua_setfield(L, -2, "__call");
|
||||
lua_pop(L, 1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char *LUA_GetActionName(void *action)
|
||||
{
|
||||
actionf_t *act = (actionf_t *)action;
|
||||
size_t z;
|
||||
for (z = 0; actionpointers[z].name; z++)
|
||||
{
|
||||
if (actionpointers[z].action.acv == act->acv)
|
||||
return actionpointers[z].name;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void LUA_SetActionByName(void *state, const char *actiontocompare)
|
||||
{
|
||||
state_t *st = (state_t *)state;
|
||||
size_t z;
|
||||
for (z = 0; actionpointers[z].name; z++)
|
||||
{
|
||||
if (fasticmp(actiontocompare, actionpointers[z].name))
|
||||
{
|
||||
st->action = actionpointers[z].action;
|
||||
st->action.acv = actionpointers[z].action.acv; // assign
|
||||
st->action.acp1 = actionpointers[z].action.acp1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
enum actionnum LUA_GetActionNumByName(const char *actiontocompare)
|
||||
{
|
||||
size_t z;
|
||||
for (z = 0; actionpointers[z].name; z++)
|
||||
if (fasticmp(actiontocompare, actionpointers[z].name))
|
||||
return z;
|
||||
return z;
|
||||
}
|
21
src/deh_lua.h
Normal file
21
src/deh_lua.h
Normal file
|
@ -0,0 +1,21 @@
|
|||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2020 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
// See the 'LICENSE' file for more details.
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file deh_lua.h
|
||||
/// \brief Lua SOC library
|
||||
|
||||
#ifndef __DEH_LUA_H__
|
||||
#define __DEH_LUA_H__
|
||||
|
||||
boolean LUA_SetLuaAction(void *state, const char *actiontocompare);
|
||||
const char *LUA_GetActionName(void *action);
|
||||
void LUA_SetActionByName(void *state, const char *actiontocompare);
|
||||
enum actionnum LUA_GetActionNumByName(const char *actiontocompare);
|
||||
|
||||
#endif
|
4527
src/deh_soc.c
Normal file
4527
src/deh_soc.c
Normal file
File diff suppressed because it is too large
Load diff
89
src/deh_soc.h
Normal file
89
src/deh_soc.h
Normal file
|
@ -0,0 +1,89 @@
|
|||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2020 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
// See the 'LICENSE' file for more details.
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file deh_soc.h
|
||||
/// \brief Load SOC file and change tables and text
|
||||
|
||||
#ifndef __DEH_SOC_H__
|
||||
#define __DEH_SOC_H__
|
||||
|
||||
#include "doomdef.h"
|
||||
#include "g_game.h"
|
||||
#include "sounds.h"
|
||||
#include "info.h"
|
||||
#include "d_think.h"
|
||||
#include "m_argv.h"
|
||||
#include "z_zone.h"
|
||||
#include "w_wad.h"
|
||||
#include "m_menu.h"
|
||||
#include "m_misc.h"
|
||||
#include "f_finale.h"
|
||||
#include "st_stuff.h"
|
||||
#include "i_system.h"
|
||||
#include "p_setup.h"
|
||||
#include "r_data.h"
|
||||
#include "r_textures.h"
|
||||
#include "r_draw.h"
|
||||
#include "r_picformats.h"
|
||||
#include "r_things.h" // R_Char2Frame
|
||||
#include "r_sky.h"
|
||||
#include "fastcmp.h"
|
||||
#include "lua_script.h" // Reluctantly included for LUA_EvalMath
|
||||
#include "d_clisrv.h"
|
||||
|
||||
#ifdef HWRENDER
|
||||
#include "hardware/hw_light.h"
|
||||
#endif
|
||||
|
||||
#include "info.h"
|
||||
#include "dehacked.h"
|
||||
#include "doomdef.h" // MUSICSLOT_COMPATIBILITY, HWRENDER
|
||||
|
||||
// Crazy word-reading stuff
|
||||
/// \todo Put these in a seperate file or something.
|
||||
mobjtype_t get_mobjtype(const char *word);
|
||||
statenum_t get_state(const char *word);
|
||||
spritenum_t get_sprite(const char *word);
|
||||
playersprite_t get_sprite2(const char *word);
|
||||
sfxenum_t get_sfx(const char *word);
|
||||
#ifdef MUSICSLOT_COMPATIBILITY
|
||||
UINT16 get_mus(const char *word, UINT8 dehacked_mode);
|
||||
#endif
|
||||
hudnum_t get_huditem(const char *word);
|
||||
menutype_t get_menutype(const char *word);
|
||||
//INT16 get_gametype(const char *word);
|
||||
//powertype_t get_power(const char *word);
|
||||
skincolornum_t get_skincolor(const char *word);
|
||||
|
||||
void readwipes(MYFILE *f);
|
||||
void readmaincfg(MYFILE *f);
|
||||
void readconditionset(MYFILE *f, UINT8 setnum);
|
||||
void readunlockable(MYFILE *f, INT32 num);
|
||||
void readextraemblemdata(MYFILE *f, INT32 num);
|
||||
void reademblemdata(MYFILE *f, INT32 num);
|
||||
void readsound(MYFILE *f, INT32 num);
|
||||
void readframe(MYFILE *f, INT32 num);
|
||||
void readhuditem(MYFILE *f, INT32 num);
|
||||
void readmenu(MYFILE *f, INT32 num);
|
||||
void readtextprompt(MYFILE *f, INT32 num);
|
||||
void readcutscene(MYFILE *f, INT32 num);
|
||||
void readlevelheader(MYFILE *f, INT32 num);
|
||||
void readgametype(MYFILE *f, char *gtname);
|
||||
void readsprite2(MYFILE *f, INT32 num);
|
||||
void readspriteinfo(MYFILE *f, INT32 num, boolean sprite2);
|
||||
#ifdef HWRENDER
|
||||
void readlight(MYFILE *f, INT32 num);
|
||||
#endif
|
||||
void readskincolor(MYFILE *f, INT32 num);
|
||||
void readthing(MYFILE *f, INT32 num);
|
||||
void readfreeslots(MYFILE *f);
|
||||
void readPlayer(MYFILE *f, INT32 num);
|
||||
void clear_levels(void);
|
||||
void clear_conditionsets(void);
|
||||
#endif
|
5483
src/deh_tables.c
Normal file
5483
src/deh_tables.c
Normal file
File diff suppressed because it is too large
Load diff
78
src/deh_tables.h
Normal file
78
src/deh_tables.h
Normal file
|
@ -0,0 +1,78 @@
|
|||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2020 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
// See the 'LICENSE' file for more details.
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file deh_tables.h
|
||||
/// \brief Define DeHackEd tables.
|
||||
|
||||
#ifndef __DEH_TABLES_H__
|
||||
#define __DEH_TABLES_H__
|
||||
|
||||
#include "doomdef.h" // Constants
|
||||
#include "d_think.h" // actionf_t
|
||||
#include "info.h" // Mobj, state, sprite, etc constants
|
||||
#include "lua_script.h"
|
||||
|
||||
// Free slot names
|
||||
// The crazy word-reading stuff uses these.
|
||||
extern char *FREE_STATES[NUMSTATEFREESLOTS];
|
||||
extern char *FREE_MOBJS[NUMMOBJFREESLOTS];
|
||||
extern char *FREE_SKINCOLORS[NUMCOLORFREESLOTS];
|
||||
extern UINT8 used_spr[(NUMSPRITEFREESLOTS / 8) + 1]; // Bitwise flag for sprite freeslot in use! I would use ceil() here if I could, but it only saves 1 byte of memory anyway.
|
||||
|
||||
#define initfreeslots() {\
|
||||
memset(FREE_STATES,0,sizeof(char *) * NUMSTATEFREESLOTS);\
|
||||
memset(FREE_MOBJS,0,sizeof(char *) * NUMMOBJFREESLOTS);\
|
||||
memset(FREE_SKINCOLORS,0,sizeof(char *) * NUMCOLORFREESLOTS);\
|
||||
memset(used_spr,0,sizeof(UINT8) * ((NUMSPRITEFREESLOTS / 8) + 1));\
|
||||
}
|
||||
|
||||
struct flickytypes_s {
|
||||
const char *name;
|
||||
const mobjtype_t type;
|
||||
};
|
||||
|
||||
#define MAXFLICKIES 64
|
||||
|
||||
/** Action pointer for reading actions from Dehacked lumps.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
actionf_t action; ///< Function pointer corresponding to the actual action.
|
||||
const char *name; ///< Name of the action in ALL CAPS.
|
||||
} actionpointer_t;
|
||||
|
||||
struct int_const_s {
|
||||
const char *n;
|
||||
// has to be able to hold both fixed_t and angle_t, so drastic measure!!
|
||||
lua_Integer v;
|
||||
};
|
||||
|
||||
extern const char NIGHTSGRADE_LIST[];
|
||||
extern struct flickytypes_s FLICKYTYPES[];
|
||||
extern actionpointer_t actionpointers[]; // Array mapping action names to action functions.
|
||||
extern const char *const STATE_LIST[];
|
||||
extern const char *const MOBJTYPE_LIST[];
|
||||
extern const char *const MOBJFLAG_LIST[];
|
||||
extern const char *const MOBJFLAG2_LIST[]; // \tMF2_(\S+).*// (.+) --> \t"\1", // \2
|
||||
extern const char *const MOBJEFLAG_LIST[];
|
||||
extern const char *const MAPTHINGFLAG_LIST[4];
|
||||
extern const char *const PLAYERFLAG_LIST[];
|
||||
extern const char *const GAMETYPERULE_LIST[];
|
||||
extern const char *const ML_LIST[16]; // Linedef flags
|
||||
extern const char *COLOR_ENUMS[];
|
||||
extern const char *const POWERS_LIST[];
|
||||
extern const char *const HUDITEMS_LIST[];
|
||||
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
|
10718
src/dehacked.c
10718
src/dehacked.c
File diff suppressed because it is too large
Load diff
|
@ -30,16 +30,16 @@ 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);
|
||||
|
||||
boolean LUA_SetLuaAction(void *state, const char *actiontocompare);
|
||||
const char *LUA_GetActionName(void *action);
|
||||
void LUA_SetActionByName(void *state, const char *actiontocompare);
|
||||
FUNCPRINTF void deh_warning(const char *first, ...);
|
||||
void deh_strlcpy(char *dst, const char *src, size_t size, const char *warntext);
|
||||
|
||||
extern boolean deh_loaded;
|
||||
|
||||
extern boolean gamedataadded;
|
||||
extern boolean titlechanged;
|
||||
extern boolean introchanged;
|
||||
|
||||
#define MAXRECURSION 30
|
||||
extern const char *superactions[MAXRECURSION];
|
||||
extern UINT8 superstack;
|
||||
|
@ -60,4 +60,5 @@ typedef struct
|
|||
} MYFILE;
|
||||
#define myfeof(a) (a->data + a->size <= a->curpos)
|
||||
char *myfgets(char *buf, size_t bufsize, MYFILE *f);
|
||||
char *myhashfgets(char *buf, size_t bufsize, MYFILE *f);
|
||||
#endif
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
// Some global defines, that configure the game.
|
||||
#include "doomdef.h"
|
||||
|
||||
#include "taglist.h"
|
||||
#include "m_fixed.h" // See the mapthing_t scale.
|
||||
|
||||
//
|
||||
|
@ -208,11 +209,10 @@ typedef struct
|
|||
UINT16 options;
|
||||
INT16 z;
|
||||
UINT8 extrainfo;
|
||||
taglist_t tags;
|
||||
fixed_t scale;
|
||||
INT16 tag;
|
||||
INT32 args[NUMMAPTHINGARGS];
|
||||
char *stringargs[NUMMAPTHINGSTRINGARGS];
|
||||
|
||||
struct mobj_s *mobj;
|
||||
} mapthing_t;
|
||||
|
||||
|
|
|
@ -582,9 +582,6 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
|
|||
/// Dumps the contents of a network save game upon consistency failure for debugging.
|
||||
//#define DUMPCONSISTENCY
|
||||
|
||||
/// See name of player in your crosshair
|
||||
#define SEENAMES
|
||||
|
||||
/// Who put weights on my recycler? ... Inuyasha did.
|
||||
/// \note XMOD port.
|
||||
//#define WEIGHTEDRECYCLER
|
||||
|
@ -628,9 +625,6 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
|
|||
/// \note Required for proper collision with moving sloped surfaces that have sector specials on them.
|
||||
#define SECTORSPECIALSAFTERTHINK
|
||||
|
||||
/// Cache patches in Lua in a way that renderer switching will work flawlessly.
|
||||
//#define LUA_PATCH_SAFETY
|
||||
|
||||
/// Sprite rotation
|
||||
#define ROTSPRITE
|
||||
#define ROTANGLES 72 // Needs to be a divisor of 360 (45, 60, 90, 120...)
|
||||
|
|
|
@ -410,7 +410,7 @@ enum GameType
|
|||
GT_LASTFREESLOT = GT_FIRSTFREESLOT + NUMGAMETYPEFREESLOTS - 1,
|
||||
NUMGAMETYPES
|
||||
};
|
||||
// If you alter this list, update dehacked.c, MISC_ChangeGameTypeMenu in m_menu.c, and Gametype_Names in g_game.c
|
||||
// If you alter this list, update deh_tables.c, MISC_ChangeGameTypeMenu in m_menu.c, and Gametype_Names in g_game.c
|
||||
|
||||
// Gametype rules
|
||||
enum GameTypeRules
|
||||
|
|
|
@ -379,4 +379,30 @@ Needed for some lua shenanigans.
|
|||
#define FIELDFROM( type, field, have, want ) \
|
||||
(void *)((intptr_t)(field) - offsetof (type, have) + offsetof (type, want))
|
||||
|
||||
typedef UINT8 bitarray_t;
|
||||
|
||||
#define BIT_ARRAY_SIZE(n) (((n) + 7) >> 3)
|
||||
|
||||
static inline int
|
||||
in_bit_array (const bitarray_t * const array, const int value)
|
||||
{
|
||||
return (array[value >> 3] & (1<<(value & 7)));
|
||||
}
|
||||
|
||||
static inline void
|
||||
set_bit_array (bitarray_t * const array, const int value)
|
||||
{
|
||||
array[value >> 3] |= (1<<(value & 7));
|
||||
}
|
||||
|
||||
static inline void
|
||||
unset_bit_array (bitarray_t * const array, const int value)
|
||||
{
|
||||
array[value >> 3] &= ~(1<<(value & 7));
|
||||
}
|
||||
|
||||
#ifdef HAVE_SDL
|
||||
typedef UINT64 precise_t;
|
||||
#endif
|
||||
|
||||
#endif //__DOOMTYPE__
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "../i_video.h"
|
||||
|
||||
rendermode_t rendermode = render_none;
|
||||
rendermode_t chosenrendermode = render_none;
|
||||
|
||||
boolean highcolor = false;
|
||||
|
||||
|
@ -40,8 +41,15 @@ INT32 VID_SetMode(INT32 modenum)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void VID_CheckRenderer(void) {}
|
||||
void VID_CheckGLLoaded(rendermode_t oldrender) {}
|
||||
boolean VID_CheckRenderer(void)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void VID_CheckGLLoaded(rendermode_t oldrender)
|
||||
{
|
||||
(void)oldrender;
|
||||
}
|
||||
|
||||
const char *VID_GetModeName(INT32 modenum)
|
||||
{
|
||||
|
|
344
src/f_finale.c
344
src/f_finale.c
|
@ -533,78 +533,78 @@ static void F_IntroDrawScene(void)
|
|||
bgxoffs = 28;
|
||||
break;
|
||||
case 1:
|
||||
background = W_CachePatchName("INTRO1", PU_PATCH);
|
||||
background = W_CachePatchName("INTRO1", PU_PATCH_LOWPRIORITY);
|
||||
break;
|
||||
case 2:
|
||||
background = W_CachePatchName("INTRO2", PU_PATCH);
|
||||
background = W_CachePatchName("INTRO2", PU_PATCH_LOWPRIORITY);
|
||||
break;
|
||||
case 3:
|
||||
background = W_CachePatchName("INTRO3", PU_PATCH);
|
||||
background = W_CachePatchName("INTRO3", PU_PATCH_LOWPRIORITY);
|
||||
break;
|
||||
case 4:
|
||||
background = W_CachePatchName("INTRO4", PU_PATCH);
|
||||
background = W_CachePatchName("INTRO4", PU_PATCH_LOWPRIORITY);
|
||||
break;
|
||||
case 5:
|
||||
if (intro_curtime >= 5*TICRATE)
|
||||
background = W_CachePatchName("RADAR", PU_PATCH);
|
||||
background = W_CachePatchName("RADAR", PU_PATCH_LOWPRIORITY);
|
||||
else
|
||||
background = W_CachePatchName("DRAT", PU_PATCH);
|
||||
background = W_CachePatchName("DRAT", PU_PATCH_LOWPRIORITY);
|
||||
break;
|
||||
case 6:
|
||||
background = W_CachePatchName("INTRO6", PU_PATCH);
|
||||
background = W_CachePatchName("INTRO6", PU_PATCH_LOWPRIORITY);
|
||||
cx = 180;
|
||||
cy = 8;
|
||||
break;
|
||||
case 7:
|
||||
{
|
||||
if (intro_curtime >= 7*TICRATE + ((TICRATE/7)*2))
|
||||
background = W_CachePatchName("SGRASS5", PU_PATCH);
|
||||
background = W_CachePatchName("SGRASS5", PU_PATCH_LOWPRIORITY);
|
||||
else if (intro_curtime >= 7*TICRATE + (TICRATE/7))
|
||||
background = W_CachePatchName("SGRASS4", PU_PATCH);
|
||||
background = W_CachePatchName("SGRASS4", PU_PATCH_LOWPRIORITY);
|
||||
else if (intro_curtime >= 7*TICRATE)
|
||||
background = W_CachePatchName("SGRASS3", PU_PATCH);
|
||||
background = W_CachePatchName("SGRASS3", PU_PATCH_LOWPRIORITY);
|
||||
else if (intro_curtime >= 6*TICRATE)
|
||||
background = W_CachePatchName("SGRASS2", PU_PATCH);
|
||||
background = W_CachePatchName("SGRASS2", PU_PATCH_LOWPRIORITY);
|
||||
else
|
||||
background = W_CachePatchName("SGRASS1", PU_PATCH);
|
||||
background = W_CachePatchName("SGRASS1", PU_PATCH_LOWPRIORITY);
|
||||
break;
|
||||
}
|
||||
case 8:
|
||||
background = W_CachePatchName("WATCHING", PU_PATCH);
|
||||
background = W_CachePatchName("WATCHING", PU_PATCH_LOWPRIORITY);
|
||||
break;
|
||||
case 9:
|
||||
background = W_CachePatchName("ZOOMING", PU_PATCH);
|
||||
background = W_CachePatchName("ZOOMING", PU_PATCH_LOWPRIORITY);
|
||||
break;
|
||||
case 10:
|
||||
break;
|
||||
case 11:
|
||||
background = W_CachePatchName("INTRO5", PU_PATCH);
|
||||
background = W_CachePatchName("INTRO5", PU_PATCH_LOWPRIORITY);
|
||||
break;
|
||||
case 12:
|
||||
background = W_CachePatchName("REVENGE", PU_PATCH);
|
||||
background = W_CachePatchName("REVENGE", PU_PATCH_LOWPRIORITY);
|
||||
cx = 208;
|
||||
cy = 8;
|
||||
break;
|
||||
case 13:
|
||||
background = W_CachePatchName("CONFRONT", PU_PATCH);
|
||||
background = W_CachePatchName("CONFRONT", PU_PATCH_LOWPRIORITY);
|
||||
cy += 48;
|
||||
break;
|
||||
case 14:
|
||||
background = W_CachePatchName("TAILSSAD", PU_PATCH);
|
||||
background = W_CachePatchName("TAILSSAD", PU_PATCH_LOWPRIORITY);
|
||||
bgxoffs = 144;
|
||||
cx = 8;
|
||||
cy = 8;
|
||||
break;
|
||||
case 15:
|
||||
if (intro_curtime >= 7*TICRATE)
|
||||
background = W_CachePatchName("SONICDO2", PU_PATCH);
|
||||
background = W_CachePatchName("SONICDO2", PU_PATCH_LOWPRIORITY);
|
||||
else
|
||||
background = W_CachePatchName("SONICDO1", PU_PATCH);
|
||||
background = W_CachePatchName("SONICDO1", PU_PATCH_LOWPRIORITY);
|
||||
cx = 224;
|
||||
cy = 8;
|
||||
break;
|
||||
case 16:
|
||||
background = W_CachePatchName("INTRO7", PU_PATCH);
|
||||
background = W_CachePatchName("INTRO7", PU_PATCH_LOWPRIORITY);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -635,7 +635,7 @@ static void F_IntroDrawScene(void)
|
|||
strncpy(stjrintro, "STJRI029", 9);
|
||||
S_ChangeMusicInternal("_stjr", false);
|
||||
|
||||
background = W_CachePatchName(stjrintro, PU_PATCH);
|
||||
background = W_CachePatchName(stjrintro, PU_PATCH_LOWPRIORITY);
|
||||
wipestyleflags = WSF_FADEIN;
|
||||
F_WipeStartScreen();
|
||||
F_TryColormapFade(31);
|
||||
|
@ -646,7 +646,7 @@ static void F_IntroDrawScene(void)
|
|||
|
||||
if (!WipeInAction) // Draw the patch if not in a wipe
|
||||
{
|
||||
background = W_CachePatchName(stjrintro, PU_PATCH);
|
||||
background = W_CachePatchName(stjrintro, PU_PATCH_LOWPRIORITY);
|
||||
V_DrawSmallScaledPatch(bgxoffs, 84, 0, background);
|
||||
}
|
||||
}
|
||||
|
@ -656,27 +656,27 @@ static void F_IntroDrawScene(void)
|
|||
if (timetonext > 5*TICRATE && timetonext < 6*TICRATE)
|
||||
{
|
||||
if (!(finalecount & 3))
|
||||
background = W_CachePatchName("BRITEGG1", PU_PATCH);
|
||||
background = W_CachePatchName("BRITEGG1", PU_PATCH_LOWPRIORITY);
|
||||
else
|
||||
background = W_CachePatchName("DARKEGG1", PU_PATCH);
|
||||
background = W_CachePatchName("DARKEGG1", PU_PATCH_LOWPRIORITY);
|
||||
|
||||
V_DrawSmallScaledPatch(0, 0, 0, background);
|
||||
}
|
||||
else if (timetonext > 3*TICRATE && timetonext < 4*TICRATE)
|
||||
{
|
||||
if (!(finalecount & 3))
|
||||
background = W_CachePatchName("BRITEGG2", PU_PATCH);
|
||||
background = W_CachePatchName("BRITEGG2", PU_PATCH_LOWPRIORITY);
|
||||
else
|
||||
background = W_CachePatchName("DARKEGG2", PU_PATCH);
|
||||
background = W_CachePatchName("DARKEGG2", PU_PATCH_LOWPRIORITY);
|
||||
|
||||
V_DrawSmallScaledPatch(0, 0, 0, background);
|
||||
}
|
||||
else if (timetonext > 1*TICRATE && timetonext < 2*TICRATE)
|
||||
{
|
||||
if (!(finalecount & 3))
|
||||
background = W_CachePatchName("BRITEGG3", PU_PATCH);
|
||||
background = W_CachePatchName("BRITEGG3", PU_PATCH_LOWPRIORITY);
|
||||
else
|
||||
background = W_CachePatchName("DARKEGG3", PU_PATCH);
|
||||
background = W_CachePatchName("DARKEGG3", PU_PATCH_LOWPRIORITY);
|
||||
|
||||
V_DrawSmallScaledPatch(0, 0, 0, background);
|
||||
}
|
||||
|
@ -708,79 +708,79 @@ static void F_IntroDrawScene(void)
|
|||
knucklesx += sonicx;
|
||||
sonicx += P_ReturnThrustX(NULL, finalecount * ANG10, 3);
|
||||
|
||||
V_DrawSmallScaledPatch(skyx, 0, 0, (patch = W_CachePatchName("INTROSKY", PU_PATCH)));
|
||||
V_DrawSmallScaledPatch(skyx, 0, 0, (patch = W_CachePatchName("INTROSKY", PU_PATCH_LOWPRIORITY)));
|
||||
V_DrawSmallScaledPatch(skyx - 320, 0, 0, patch);
|
||||
W_UnlockCachedPatch(patch);
|
||||
V_DrawSmallScaledPatch(grassx, 0, 0, (patch = W_CachePatchName("INTROGRS", PU_PATCH)));
|
||||
V_DrawSmallScaledPatch(grassx, 0, 0, (patch = W_CachePatchName("INTROGRS", PU_PATCH_LOWPRIORITY)));
|
||||
V_DrawSmallScaledPatch(grassx - 320, 0, 0, patch);
|
||||
W_UnlockCachedPatch(patch);
|
||||
|
||||
if (finalecount & 1)
|
||||
{
|
||||
// Sonic
|
||||
V_DrawSmallScaledPatch(sonicx, 54, 0, (patch = W_CachePatchName("RUN2", PU_PATCH)));
|
||||
V_DrawSmallScaledPatch(sonicx, 54, 0, (patch = W_CachePatchName("RUN2", PU_PATCH_LOWPRIORITY)));
|
||||
W_UnlockCachedPatch(patch);
|
||||
|
||||
// Appendages
|
||||
if (finalecount & 2)
|
||||
{
|
||||
// Sonic's feet
|
||||
V_DrawSmallScaledPatch(sonicx - 8, 92, 0, (patch = W_CachePatchName("PEELOUT4", PU_PATCH)));
|
||||
V_DrawSmallScaledPatch(sonicx - 8, 92, 0, (patch = W_CachePatchName("PEELOUT4", PU_PATCH_LOWPRIORITY)));
|
||||
W_UnlockCachedPatch(patch);
|
||||
// Tails' tails
|
||||
V_DrawSmallScaledPatch(tailsx, tailsy, 0, (patch = W_CachePatchName("HELICOP2", PU_PATCH)));
|
||||
V_DrawSmallScaledPatch(tailsx, tailsy, 0, (patch = W_CachePatchName("HELICOP2", PU_PATCH_LOWPRIORITY)));
|
||||
W_UnlockCachedPatch(patch);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Sonic's feet
|
||||
V_DrawSmallScaledPatch(sonicx - 8, 92, 0, (patch = W_CachePatchName("PEELOUT2", PU_PATCH)));
|
||||
V_DrawSmallScaledPatch(sonicx - 8, 92, 0, (patch = W_CachePatchName("PEELOUT2", PU_PATCH_LOWPRIORITY)));
|
||||
W_UnlockCachedPatch(patch);
|
||||
// Tails' tails
|
||||
V_DrawSmallScaledPatch(tailsx, tailsy, 0, (patch = W_CachePatchName("HELICOP1", PU_PATCH)));
|
||||
V_DrawSmallScaledPatch(tailsx, tailsy, 0, (patch = W_CachePatchName("HELICOP1", PU_PATCH_LOWPRIORITY)));
|
||||
W_UnlockCachedPatch(patch);
|
||||
}
|
||||
|
||||
// Tails
|
||||
V_DrawSmallScaledPatch(tailsx, tailsy, 0, (patch = W_CachePatchName("FLY2", PU_PATCH)));
|
||||
V_DrawSmallScaledPatch(tailsx, tailsy, 0, (patch = W_CachePatchName("FLY2", PU_PATCH_LOWPRIORITY)));
|
||||
W_UnlockCachedPatch(patch);
|
||||
|
||||
// Knuckles
|
||||
V_DrawSmallScaledPatch(knucklesx, knucklesy, 0, (patch = W_CachePatchName("GLIDE2", PU_PATCH)));
|
||||
V_DrawSmallScaledPatch(knucklesx, knucklesy, 0, (patch = W_CachePatchName("GLIDE2", PU_PATCH_LOWPRIORITY)));
|
||||
W_UnlockCachedPatch(patch);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Sonic
|
||||
V_DrawSmallScaledPatch(sonicx, 54, 0, (patch = W_CachePatchName("RUN1", PU_PATCH)));
|
||||
V_DrawSmallScaledPatch(sonicx, 54, 0, (patch = W_CachePatchName("RUN1", PU_PATCH_LOWPRIORITY)));
|
||||
W_UnlockCachedPatch(patch);
|
||||
|
||||
// Appendages
|
||||
if (finalecount & 2)
|
||||
{
|
||||
// Sonic's feet
|
||||
V_DrawSmallScaledPatch(sonicx - 8, 92, 0, (patch = W_CachePatchName("PEELOUT3", PU_PATCH)));
|
||||
V_DrawSmallScaledPatch(sonicx - 8, 92, 0, (patch = W_CachePatchName("PEELOUT3", PU_PATCH_LOWPRIORITY)));
|
||||
W_UnlockCachedPatch(patch);
|
||||
// Tails' tails
|
||||
V_DrawSmallScaledPatch(tailsx, tailsy, 0, (patch = W_CachePatchName("HELICOP2", PU_PATCH)));
|
||||
V_DrawSmallScaledPatch(tailsx, tailsy, 0, (patch = W_CachePatchName("HELICOP2", PU_PATCH_LOWPRIORITY)));
|
||||
W_UnlockCachedPatch(patch);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Sonic's feet
|
||||
V_DrawSmallScaledPatch(sonicx - 8, 92, 0, (patch = W_CachePatchName("PEELOUT1", PU_PATCH)));
|
||||
V_DrawSmallScaledPatch(sonicx - 8, 92, 0, (patch = W_CachePatchName("PEELOUT1", PU_PATCH_LOWPRIORITY)));
|
||||
W_UnlockCachedPatch(patch);
|
||||
// Tails' tails
|
||||
V_DrawSmallScaledPatch(tailsx, tailsy, 0, (patch = W_CachePatchName("HELICOP1", PU_PATCH)));
|
||||
V_DrawSmallScaledPatch(tailsx, tailsy, 0, (patch = W_CachePatchName("HELICOP1", PU_PATCH_LOWPRIORITY)));
|
||||
W_UnlockCachedPatch(patch);
|
||||
}
|
||||
|
||||
// Tails
|
||||
V_DrawSmallScaledPatch(tailsx, tailsy, 0, (patch = W_CachePatchName("FLY1", PU_PATCH)));
|
||||
V_DrawSmallScaledPatch(tailsx, tailsy, 0, (patch = W_CachePatchName("FLY1", PU_PATCH_LOWPRIORITY)));
|
||||
W_UnlockCachedPatch(patch);
|
||||
|
||||
// Knuckles
|
||||
V_DrawSmallScaledPatch(knucklesx, knucklesy, 0, (patch = W_CachePatchName("GLIDE1", PU_PATCH)));
|
||||
V_DrawSmallScaledPatch(knucklesx, knucklesy, 0, (patch = W_CachePatchName("GLIDE1", PU_PATCH_LOWPRIORITY)));
|
||||
W_UnlockCachedPatch(patch);
|
||||
}
|
||||
|
||||
|
@ -813,8 +813,8 @@ static void F_IntroDrawScene(void)
|
|||
y += (30*(FRACUNIT-scale));
|
||||
}
|
||||
|
||||
rockpat = W_CachePatchName(va("ROID00%.2d", 34 - (worktics % 35)), PU_PATCH);
|
||||
glow = W_CachePatchName(va("ENDGLOW%.1d", 2+(worktics & 1)), PU_PATCH);
|
||||
rockpat = W_CachePatchName(va("ROID00%.2d", 34 - (worktics % 35)), PU_PATCH_LOWPRIORITY);
|
||||
glow = W_CachePatchName(va("ENDGLOW%.1d", 2+(worktics & 1)), PU_PATCH_LOWPRIORITY);
|
||||
|
||||
if (worktics >= 5)
|
||||
trans = (worktics-5)>>1;
|
||||
|
@ -934,7 +934,7 @@ void F_IntroDrawer(void)
|
|||
{
|
||||
if (intro_scenenum == 5 && intro_curtime == 5*TICRATE)
|
||||
{
|
||||
patch_t *radar = W_CachePatchName("RADAR", PU_PATCH);
|
||||
patch_t *radar = W_CachePatchName("RADAR", PU_PATCH_LOWPRIORITY);
|
||||
|
||||
F_WipeStartScreen();
|
||||
F_WipeColorFill(31);
|
||||
|
@ -947,7 +947,7 @@ void F_IntroDrawer(void)
|
|||
}
|
||||
else if (intro_scenenum == 7 && intro_curtime == 6*TICRATE) // Force a wipe here
|
||||
{
|
||||
patch_t *grass = W_CachePatchName("SGRASS2", PU_PATCH);
|
||||
patch_t *grass = W_CachePatchName("SGRASS2", PU_PATCH_LOWPRIORITY);
|
||||
|
||||
F_WipeStartScreen();
|
||||
F_WipeColorFill(31);
|
||||
|
@ -960,7 +960,7 @@ void F_IntroDrawer(void)
|
|||
}
|
||||
/*else if (intro_scenenum == 11 && intro_curtime == 7*TICRATE)
|
||||
{
|
||||
patch_t *confront = W_CachePatchName("CONFRONT", PU_PATCH);
|
||||
patch_t *confront = W_CachePatchName("CONFRONT", PU_PATCH_LOWPRIORITY);
|
||||
|
||||
F_WipeStartScreen();
|
||||
F_WipeColorFill(31);
|
||||
|
@ -973,7 +973,7 @@ void F_IntroDrawer(void)
|
|||
}*/
|
||||
if (intro_scenenum == 15 && intro_curtime == 7*TICRATE)
|
||||
{
|
||||
patch_t *sdo = W_CachePatchName("SONICDO2", PU_PATCH);
|
||||
patch_t *sdo = W_CachePatchName("SONICDO2", PU_PATCH_LOWPRIORITY);
|
||||
|
||||
F_WipeStartScreen();
|
||||
F_WipeColorFill(31);
|
||||
|
@ -1074,6 +1074,7 @@ static const char *credits[] = {
|
|||
"\1Programming",
|
||||
"Alam \"GBC\" Arias",
|
||||
"Logan \"GBA\" Arias",
|
||||
"Zolton \"Zippy_Zolton\" Auburn",
|
||||
"Colette \"fickleheart\" Bordelon",
|
||||
"Andrew \"orospakr\" Clunis",
|
||||
"Sally \"TehRealSalt\" Cochenour",
|
||||
|
@ -1104,6 +1105,7 @@ static const char *credits[] = {
|
|||
"Sean \"Sryder13\" Ryder",
|
||||
"Ehab \"Wolfy\" Saeed",
|
||||
"Tasos \"tatokis\" Sahanidis", // Corrected C FixedMul, making 64-bit builds netplay compatible
|
||||
"Riku \"Ors\" Salminen", // Demo consistency improvements
|
||||
"Jonas \"MascaraSnake\" Sauer",
|
||||
"Wessel \"sphere\" Smit",
|
||||
"\"SSNTails\"",
|
||||
|
@ -1136,6 +1138,7 @@ static const char *credits[] = {
|
|||
"Iestyn \"Monster Iestyn\" Jealous",
|
||||
"William \"GuyWithThePie\" Kloppenberg",
|
||||
"Alice \"Alacroix\" de Lemos",
|
||||
"Logan \"Hyperchaotix\" McCloud",
|
||||
"Alexander \"DrTapeworm\" Moench-Ford",
|
||||
"Andrew \"Senku Niola\" Moran",
|
||||
"\"MotorRoach\"",
|
||||
|
@ -1303,14 +1306,14 @@ void F_CreditDrawer(void)
|
|||
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31);
|
||||
|
||||
// Zig Zagz
|
||||
V_DrawScaledPatch(-16, zagpos, V_SNAPTOLEFT, W_CachePatchName("LTZIGZAG", PU_PATCH));
|
||||
V_DrawScaledPatch(-16, zagpos - 320, V_SNAPTOLEFT, W_CachePatchName("LTZIGZAG", PU_PATCH));
|
||||
V_DrawScaledPatch(BASEVIDWIDTH + 16, zagpos, V_SNAPTORIGHT|V_FLIP, W_CachePatchName("LTZIGZAG", PU_PATCH));
|
||||
V_DrawScaledPatch(BASEVIDWIDTH + 16, zagpos - 320, V_SNAPTORIGHT|V_FLIP, W_CachePatchName("LTZIGZAG", PU_PATCH));
|
||||
V_DrawScaledPatch(-16, zagpos, V_SNAPTOLEFT, W_CachePatchName("LTZIGZAG", PU_PATCH_LOWPRIORITY));
|
||||
V_DrawScaledPatch(-16, zagpos - 320, V_SNAPTOLEFT, W_CachePatchName("LTZIGZAG", PU_PATCH_LOWPRIORITY));
|
||||
V_DrawScaledPatch(BASEVIDWIDTH + 16, zagpos, V_SNAPTORIGHT|V_FLIP, W_CachePatchName("LTZIGZAG", PU_PATCH_LOWPRIORITY));
|
||||
V_DrawScaledPatch(BASEVIDWIDTH + 16, zagpos - 320, V_SNAPTORIGHT|V_FLIP, W_CachePatchName("LTZIGZAG", PU_PATCH_LOWPRIORITY));
|
||||
|
||||
// Draw background pictures first
|
||||
for (i = 0; credits_pics[i].patch; i++)
|
||||
V_DrawSciencePatch(credits_pics[i].x<<FRACBITS, (280<<FRACBITS) + (((i*credits_height)<<FRACBITS)/(credits_numpics)) - 4*(animtimer<<FRACBITS)/5, 0, W_CachePatchName(credits_pics[i].patch, PU_PATCH), FRACUNIT>>1);
|
||||
V_DrawSciencePatch(credits_pics[i].x<<FRACBITS, (280<<FRACBITS) + (((i*credits_height)<<FRACBITS)/(credits_numpics)) - 4*(animtimer<<FRACBITS)/5, 0, W_CachePatchName(credits_pics[i].patch, PU_PATCH_LOWPRIORITY), FRACUNIT>>1);
|
||||
|
||||
// Dim the background
|
||||
V_DrawFadeScreen(0xFF00, 16);
|
||||
|
@ -1519,14 +1522,14 @@ void F_GameEvaluationDrawer(void)
|
|||
|
||||
if (goodending)
|
||||
{
|
||||
rockpat = W_CachePatchName(va("ROID00%.2d", 34 - (finalecount % 35)), PU_PATCH);
|
||||
glow = W_CachePatchName(va("ENDGLOW%.1d", 2+(finalecount & 1)), PU_PATCH);
|
||||
rockpat = W_CachePatchName(va("ROID00%.2d", 34 - (finalecount % 35)), PU_PATCH_LOWPRIORITY);
|
||||
glow = W_CachePatchName(va("ENDGLOW%.1d", 2+(finalecount & 1)), PU_PATCH_LOWPRIORITY);
|
||||
x -= FRACUNIT;
|
||||
}
|
||||
else
|
||||
{
|
||||
rockpat = W_CachePatchName("ROID0000", PU_LEVEL);
|
||||
glow = W_CachePatchName(va("ENDGLOW%.1d", (finalecount & 1)), PU_PATCH);
|
||||
rockpat = W_CachePatchName("ROID0000", PU_PATCH_LOWPRIORITY);
|
||||
glow = W_CachePatchName(va("ENDGLOW%.1d", (finalecount & 1)), PU_PATCH_LOWPRIORITY);
|
||||
}
|
||||
|
||||
if (finalecount >= 5)
|
||||
|
@ -1558,20 +1561,20 @@ void F_GameEvaluationDrawer(void)
|
|||
// if j == 0 - alternate between 0 and 1
|
||||
// 1 - 1 and 2
|
||||
// 2 - 2 and not rendered
|
||||
V_DrawFixedPatch(x+sparkloffs[j-1][0], y+sparkloffs[j-1][1], FRACUNIT, 0, W_CachePatchName(va("ENDSPKL%.1d", (j - ((sparklloop & 1) ? 0 : 1))), PU_PATCH), R_GetTranslationColormap(TC_DEFAULT, SKINCOLOR_AQUA, GTC_CACHE));
|
||||
V_DrawFixedPatch(x+sparkloffs[j-1][0], y+sparkloffs[j-1][1], FRACUNIT, 0, W_CachePatchName(va("ENDSPKL%.1d", (j - ((sparklloop & 1) ? 0 : 1))), PU_PATCH_LOWPRIORITY), R_GetTranslationColormap(TC_DEFAULT, SKINCOLOR_AQUA, GTC_CACHE));
|
||||
}
|
||||
j--;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
patch_t *eggrock = W_CachePatchName("ENDEGRK5", PU_PATCH);
|
||||
patch_t *eggrock = W_CachePatchName("ENDEGRK5", PU_PATCH_LOWPRIORITY);
|
||||
V_DrawFixedPatch(x, y, scale, 0, eggrock, colormap[0]);
|
||||
if (trans < 10)
|
||||
V_DrawFixedPatch(x, y, scale, trans<<V_ALPHASHIFT, eggrock, colormap[1]);
|
||||
else if (sparklloop)
|
||||
V_DrawFixedPatch(x, y, scale, (10-sparklloop)<<V_ALPHASHIFT,
|
||||
W_CachePatchName("ENDEGRK0", PU_PATCH), colormap[1]);
|
||||
W_CachePatchName("ENDEGRK0", PU_PATCH_LOWPRIORITY), colormap[1]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1585,7 +1588,7 @@ void F_GameEvaluationDrawer(void)
|
|||
eemeralds_cur += (360<<FRACBITS)/7;
|
||||
|
||||
patchname[4] = 'A'+(char)i;
|
||||
V_DrawFixedPatch(x, y, FRACUNIT, ((emeralds & (1<<i)) ? 0 : V_80TRANS), W_CachePatchName(patchname, PU_PATCH), NULL);
|
||||
V_DrawFixedPatch(x, y, FRACUNIT, ((emeralds & (1<<i)) ? 0 : V_80TRANS), W_CachePatchName(patchname, PU_PATCH_LOWPRIORITY), NULL);
|
||||
}
|
||||
|
||||
V_DrawCreditString((BASEVIDWIDTH - V_CreditStringWidth(endingtext))<<(FRACBITS-1), (BASEVIDHEIGHT-100)<<(FRACBITS-1), 0, endingtext);
|
||||
|
@ -1714,32 +1717,32 @@ void F_GameEvaluationTicker(void)
|
|||
|
||||
static void F_CacheEnding(void)
|
||||
{
|
||||
endbrdr[1] = W_CachePatchName("ENDBRDR1", PU_PATCH);
|
||||
endbrdr[1] = W_CachePatchName("ENDBRDR1", PU_PATCH_LOWPRIORITY);
|
||||
|
||||
endegrk[0] = W_CachePatchName("ENDEGRK0", PU_PATCH);
|
||||
endegrk[1] = W_CachePatchName("ENDEGRK1", PU_PATCH);
|
||||
endegrk[0] = W_CachePatchName("ENDEGRK0", PU_PATCH_LOWPRIORITY);
|
||||
endegrk[1] = W_CachePatchName("ENDEGRK1", PU_PATCH_LOWPRIORITY);
|
||||
|
||||
endglow[0] = W_CachePatchName("ENDGLOW0", PU_PATCH);
|
||||
endglow[1] = W_CachePatchName("ENDGLOW1", PU_PATCH);
|
||||
endglow[0] = W_CachePatchName("ENDGLOW0", PU_PATCH_LOWPRIORITY);
|
||||
endglow[1] = W_CachePatchName("ENDGLOW1", PU_PATCH_LOWPRIORITY);
|
||||
|
||||
endbgsp[0] = W_CachePatchName("ENDBGSP0", PU_PATCH);
|
||||
endbgsp[1] = W_CachePatchName("ENDBGSP1", PU_PATCH);
|
||||
endbgsp[2] = W_CachePatchName("ENDBGSP2", PU_PATCH);
|
||||
endbgsp[0] = W_CachePatchName("ENDBGSP0", PU_PATCH_LOWPRIORITY);
|
||||
endbgsp[1] = W_CachePatchName("ENDBGSP1", PU_PATCH_LOWPRIORITY);
|
||||
endbgsp[2] = W_CachePatchName("ENDBGSP2", PU_PATCH_LOWPRIORITY);
|
||||
|
||||
endspkl[0] = W_CachePatchName("ENDSPKL0", PU_PATCH);
|
||||
endspkl[1] = W_CachePatchName("ENDSPKL1", PU_PATCH);
|
||||
endspkl[2] = W_CachePatchName("ENDSPKL2", PU_PATCH);
|
||||
endspkl[0] = W_CachePatchName("ENDSPKL0", PU_PATCH_LOWPRIORITY);
|
||||
endspkl[1] = W_CachePatchName("ENDSPKL1", PU_PATCH_LOWPRIORITY);
|
||||
endspkl[2] = W_CachePatchName("ENDSPKL2", PU_PATCH_LOWPRIORITY);
|
||||
|
||||
endxpld[0] = W_CachePatchName("ENDXPLD0", PU_PATCH);
|
||||
endxpld[1] = W_CachePatchName("ENDXPLD1", PU_PATCH);
|
||||
endxpld[2] = W_CachePatchName("ENDXPLD2", PU_PATCH);
|
||||
endxpld[3] = W_CachePatchName("ENDXPLD3", PU_PATCH);
|
||||
endxpld[0] = W_CachePatchName("ENDXPLD0", PU_PATCH_LOWPRIORITY);
|
||||
endxpld[1] = W_CachePatchName("ENDXPLD1", PU_PATCH_LOWPRIORITY);
|
||||
endxpld[2] = W_CachePatchName("ENDXPLD2", PU_PATCH_LOWPRIORITY);
|
||||
endxpld[3] = W_CachePatchName("ENDXPLD3", PU_PATCH_LOWPRIORITY);
|
||||
|
||||
endescp[0] = W_CachePatchName("ENDESCP0", PU_PATCH);
|
||||
endescp[1] = W_CachePatchName("ENDESCP1", PU_PATCH);
|
||||
endescp[2] = W_CachePatchName("ENDESCP2", PU_PATCH);
|
||||
endescp[3] = W_CachePatchName("ENDESCP3", PU_PATCH);
|
||||
endescp[4] = W_CachePatchName("ENDESCP4", PU_PATCH);
|
||||
endescp[0] = W_CachePatchName("ENDESCP0", PU_PATCH_LOWPRIORITY);
|
||||
endescp[1] = W_CachePatchName("ENDESCP1", PU_PATCH_LOWPRIORITY);
|
||||
endescp[2] = W_CachePatchName("ENDESCP2", PU_PATCH_LOWPRIORITY);
|
||||
endescp[3] = W_CachePatchName("ENDESCP3", PU_PATCH_LOWPRIORITY);
|
||||
endescp[4] = W_CachePatchName("ENDESCP4", PU_PATCH_LOWPRIORITY);
|
||||
|
||||
// so we only need to check once
|
||||
if ((goodending = ALL7EMERALDS(emeralds)))
|
||||
|
@ -1752,41 +1755,41 @@ static void F_CacheEnding(void)
|
|||
sprdef = &skins[skinnum].sprites[SPR2_XTRA];
|
||||
// character head, skin specific
|
||||
sprframe = &sprdef->spriteframes[XTRA_ENDING];
|
||||
endfwrk[0] = W_CachePatchNum(sprframe->lumppat[0], PU_PATCH);
|
||||
endfwrk[0] = W_CachePatchNum(sprframe->lumppat[0], PU_PATCH_LOWPRIORITY);
|
||||
sprframe = &sprdef->spriteframes[XTRA_ENDING+1];
|
||||
endfwrk[1] = W_CachePatchNum(sprframe->lumppat[0], PU_PATCH);
|
||||
endfwrk[1] = W_CachePatchNum(sprframe->lumppat[0], PU_PATCH_LOWPRIORITY);
|
||||
sprframe = &sprdef->spriteframes[XTRA_ENDING+2];
|
||||
endfwrk[2] = W_CachePatchNum(sprframe->lumppat[0], PU_PATCH);
|
||||
endfwrk[2] = W_CachePatchNum(sprframe->lumppat[0], PU_PATCH_LOWPRIORITY);
|
||||
}
|
||||
else // Show a star if your character doesn't have an ending firework display. (Basically the MISSINGs for this)
|
||||
{
|
||||
endfwrk[0] = W_CachePatchName("ENDFWRK3", PU_PATCH);
|
||||
endfwrk[1] = W_CachePatchName("ENDFWRK4", PU_PATCH);
|
||||
endfwrk[2] = W_CachePatchName("ENDFWRK5", PU_PATCH);
|
||||
endfwrk[0] = W_CachePatchName("ENDFWRK3", PU_PATCH_LOWPRIORITY);
|
||||
endfwrk[1] = W_CachePatchName("ENDFWRK4", PU_PATCH_LOWPRIORITY);
|
||||
endfwrk[2] = W_CachePatchName("ENDFWRK5", PU_PATCH_LOWPRIORITY);
|
||||
}
|
||||
|
||||
endbrdr[0] = W_CachePatchName("ENDBRDR2", PU_PATCH);
|
||||
endbrdr[0] = W_CachePatchName("ENDBRDR2", PU_PATCH_LOWPRIORITY);
|
||||
}
|
||||
else
|
||||
{
|
||||
// eggman, skin nonspecific
|
||||
endfwrk[0] = W_CachePatchName("ENDFWRK0", PU_PATCH);
|
||||
endfwrk[1] = W_CachePatchName("ENDFWRK1", PU_PATCH);
|
||||
endfwrk[2] = W_CachePatchName("ENDFWRK2", PU_PATCH);
|
||||
endfwrk[0] = W_CachePatchName("ENDFWRK0", PU_PATCH_LOWPRIORITY);
|
||||
endfwrk[1] = W_CachePatchName("ENDFWRK1", PU_PATCH_LOWPRIORITY);
|
||||
endfwrk[2] = W_CachePatchName("ENDFWRK2", PU_PATCH_LOWPRIORITY);
|
||||
|
||||
endbrdr[0] = W_CachePatchName("ENDBRDR0", PU_LEVEL);
|
||||
endbrdr[0] = W_CachePatchName("ENDBRDR0", PU_PATCH_LOWPRIORITY);
|
||||
}
|
||||
}
|
||||
|
||||
static void F_CacheGoodEnding(void)
|
||||
{
|
||||
endegrk[0] = W_CachePatchName("ENDEGRK2", PU_PATCH);
|
||||
endegrk[1] = W_CachePatchName("ENDEGRK3", PU_PATCH);
|
||||
endegrk[0] = W_CachePatchName("ENDEGRK2", PU_PATCH_LOWPRIORITY);
|
||||
endegrk[1] = W_CachePatchName("ENDEGRK3", PU_PATCH_LOWPRIORITY);
|
||||
|
||||
endglow[0] = W_CachePatchName("ENDGLOW2", PU_PATCH);
|
||||
endglow[1] = W_CachePatchName("ENDGLOW3", PU_PATCH);
|
||||
endglow[0] = W_CachePatchName("ENDGLOW2", PU_PATCH_LOWPRIORITY);
|
||||
endglow[1] = W_CachePatchName("ENDGLOW3", PU_PATCH_LOWPRIORITY);
|
||||
|
||||
endxpld[0] = W_CachePatchName("ENDEGRK4", PU_PATCH);
|
||||
endxpld[0] = W_CachePatchName("ENDEGRK4", PU_PATCH_LOWPRIORITY);
|
||||
}
|
||||
|
||||
void F_StartEnding(void)
|
||||
|
@ -1843,17 +1846,10 @@ void F_EndingDrawer(void)
|
|||
INT32 x, y, i, j, parallaxticker;
|
||||
patch_t *rockpat;
|
||||
|
||||
if (needpatchrecache)
|
||||
{
|
||||
F_CacheEnding();
|
||||
if (goodending && finalecount >= INFLECTIONPOINT) // time to swap some assets
|
||||
F_CacheGoodEnding();
|
||||
}
|
||||
|
||||
if (!goodending || finalecount < INFLECTIONPOINT)
|
||||
rockpat = W_CachePatchName("ROID0000", PU_PATCH);
|
||||
rockpat = W_CachePatchName("ROID0000", PU_PATCH_LOWPRIORITY);
|
||||
else
|
||||
rockpat = W_CachePatchName(va("ROID00%.2d", 34 - ((finalecount - INFLECTIONPOINT) % 35)), PU_PATCH);
|
||||
rockpat = W_CachePatchName(va("ROID00%.2d", 34 - ((finalecount - INFLECTIONPOINT) % 35)), PU_PATCH_LOWPRIORITY);
|
||||
|
||||
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31);
|
||||
|
||||
|
@ -2190,7 +2186,7 @@ void F_EndingDrawer(void)
|
|||
eemeralds_cur[0] += (360<<FRACBITS)/7;
|
||||
|
||||
patchname[4] = 'A'+(char)i;
|
||||
V_DrawFixedPatch(x, y, FRACUNIT, 0, W_CachePatchName(patchname, PU_LEVEL), NULL);
|
||||
V_DrawFixedPatch(x, y, FRACUNIT, 0, W_CachePatchName(patchname, PU_PATCH_LOWPRIORITY), NULL);
|
||||
}
|
||||
} // if (goodending...
|
||||
} // (finalecount > 20)
|
||||
|
@ -2337,14 +2333,14 @@ void F_SkyScroll(INT32 scrollxspeed, INT32 scrollyspeed, const char *patchname)
|
|||
|
||||
if (!scrollxspeed && !scrollyspeed)
|
||||
{
|
||||
V_DrawPatchFill(W_CachePatchName(patchname, PU_PATCH));
|
||||
V_DrawPatchFill(W_CachePatchName(patchname, PU_PATCH_LOWPRIORITY));
|
||||
return;
|
||||
}
|
||||
|
||||
pat = W_CachePatchName(patchname, PU_PATCH);
|
||||
pat = W_CachePatchName(patchname, PU_PATCH_LOWPRIORITY);
|
||||
|
||||
patwidth = SHORT(pat->width);
|
||||
patheight = SHORT(pat->height);
|
||||
patwidth = pat->width;
|
||||
patheight = pat->height;
|
||||
pw = patwidth * dupz;
|
||||
ph = patheight * dupz;
|
||||
|
||||
|
@ -2380,7 +2376,7 @@ void F_SkyScroll(INT32 scrollxspeed, INT32 scrollyspeed, const char *patchname)
|
|||
lumpnum = W_CheckNumForName(name); \
|
||||
if (lumpnum != LUMPERROR) \
|
||||
{ \
|
||||
arr[0] = W_CachePatchName(name, PU_LEVEL); \
|
||||
arr[0] = W_CachePatchName(name, PU_PATCH_LOWPRIORITY); \
|
||||
arr[min(1, maxf-1)] = 0; \
|
||||
} \
|
||||
else if (strlen(name) <= 6) \
|
||||
|
@ -2393,7 +2389,7 @@ else if (strlen(name) <= 6) \
|
|||
lumpname[8] = 0; \
|
||||
lumpnum = W_CheckNumForName(lumpname); \
|
||||
if (lumpnum != LUMPERROR) \
|
||||
arr[i] = W_CachePatchName(lumpname, PU_LEVEL); \
|
||||
arr[i] = W_CachePatchName(lumpname, PU_PATCH_LOWPRIORITY); \
|
||||
else \
|
||||
break; \
|
||||
} \
|
||||
|
@ -2408,21 +2404,21 @@ static void F_CacheTitleScreen(void)
|
|||
{
|
||||
case TTMODE_OLD:
|
||||
case TTMODE_NONE:
|
||||
ttbanner = W_CachePatchName("TTBANNER", PU_LEVEL);
|
||||
ttwing = W_CachePatchName("TTWING", PU_LEVEL);
|
||||
ttsonic = W_CachePatchName("TTSONIC", PU_LEVEL);
|
||||
ttswave1 = W_CachePatchName("TTSWAVE1", PU_LEVEL);
|
||||
ttswave2 = W_CachePatchName("TTSWAVE2", PU_LEVEL);
|
||||
ttswip1 = W_CachePatchName("TTSWIP1", PU_LEVEL);
|
||||
ttsprep1 = W_CachePatchName("TTSPREP1", PU_LEVEL);
|
||||
ttsprep2 = W_CachePatchName("TTSPREP2", PU_LEVEL);
|
||||
ttspop1 = W_CachePatchName("TTSPOP1", PU_LEVEL);
|
||||
ttspop2 = W_CachePatchName("TTSPOP2", PU_LEVEL);
|
||||
ttspop3 = W_CachePatchName("TTSPOP3", PU_LEVEL);
|
||||
ttspop4 = W_CachePatchName("TTSPOP4", PU_LEVEL);
|
||||
ttspop5 = W_CachePatchName("TTSPOP5", PU_LEVEL);
|
||||
ttspop6 = W_CachePatchName("TTSPOP6", PU_LEVEL);
|
||||
ttspop7 = W_CachePatchName("TTSPOP7", PU_LEVEL);
|
||||
ttbanner = W_CachePatchName("TTBANNER", PU_PATCH_LOWPRIORITY);
|
||||
ttwing = W_CachePatchName("TTWING", PU_PATCH_LOWPRIORITY);
|
||||
ttsonic = W_CachePatchName("TTSONIC", PU_PATCH_LOWPRIORITY);
|
||||
ttswave1 = W_CachePatchName("TTSWAVE1", PU_PATCH_LOWPRIORITY);
|
||||
ttswave2 = W_CachePatchName("TTSWAVE2", PU_PATCH_LOWPRIORITY);
|
||||
ttswip1 = W_CachePatchName("TTSWIP1", PU_PATCH_LOWPRIORITY);
|
||||
ttsprep1 = W_CachePatchName("TTSPREP1", PU_PATCH_LOWPRIORITY);
|
||||
ttsprep2 = W_CachePatchName("TTSPREP2", PU_PATCH_LOWPRIORITY);
|
||||
ttspop1 = W_CachePatchName("TTSPOP1", PU_PATCH_LOWPRIORITY);
|
||||
ttspop2 = W_CachePatchName("TTSPOP2", PU_PATCH_LOWPRIORITY);
|
||||
ttspop3 = W_CachePatchName("TTSPOP3", PU_PATCH_LOWPRIORITY);
|
||||
ttspop4 = W_CachePatchName("TTSPOP4", PU_PATCH_LOWPRIORITY);
|
||||
ttspop5 = W_CachePatchName("TTSPOP5", PU_PATCH_LOWPRIORITY);
|
||||
ttspop6 = W_CachePatchName("TTSPOP6", PU_PATCH_LOWPRIORITY);
|
||||
ttspop7 = W_CachePatchName("TTSPOP7", PU_PATCH_LOWPRIORITY);
|
||||
break;
|
||||
|
||||
// don't load alacroix gfx yet; we do that upon first draw.
|
||||
|
@ -2542,7 +2538,7 @@ void F_StartTitleScreen(void)
|
|||
|
||||
static void F_UnloadAlacroixGraphics(SINT8 oldttscale)
|
||||
{
|
||||
// This all gets freed by PU_LEVEL when exiting the menus.
|
||||
// This all gets freed by PU_PATCH_LOWPRIORITY when exiting the menus.
|
||||
// When re-visiting the menus (e.g., from exiting in-game), the gfx are force-reloaded.
|
||||
// So leftover addresses here should not be a problem.
|
||||
|
||||
|
@ -2550,28 +2546,28 @@ static void F_UnloadAlacroixGraphics(SINT8 oldttscale)
|
|||
oldttscale--; // zero-based index
|
||||
for (i = 0; i < TTMAX_ALACROIX; i++)
|
||||
{
|
||||
if(ttembl[oldttscale][i]) { Z_Free(ttembl[oldttscale][i]); ttembl[oldttscale][i] = 0; }
|
||||
if(ttribb[oldttscale][i]) { Z_Free(ttribb[oldttscale][i]); ttribb[oldttscale][i] = 0; }
|
||||
if(ttsont[oldttscale][i]) { Z_Free(ttsont[oldttscale][i]); ttsont[oldttscale][i] = 0; }
|
||||
if(ttrobo[oldttscale][i]) { Z_Free(ttrobo[oldttscale][i]); ttrobo[oldttscale][i] = 0; }
|
||||
if(tttwot[oldttscale][i]) { Z_Free(tttwot[oldttscale][i]); tttwot[oldttscale][i] = 0; }
|
||||
if(ttrbtx[oldttscale][i]) { Z_Free(ttrbtx[oldttscale][i]); ttrbtx[oldttscale][i] = 0; }
|
||||
if(ttsoib[oldttscale][i]) { Z_Free(ttsoib[oldttscale][i]); ttsoib[oldttscale][i] = 0; }
|
||||
if(ttsoif[oldttscale][i]) { Z_Free(ttsoif[oldttscale][i]); ttsoif[oldttscale][i] = 0; }
|
||||
if(ttsoba[oldttscale][i]) { Z_Free(ttsoba[oldttscale][i]); ttsoba[oldttscale][i] = 0; }
|
||||
if(ttsobk[oldttscale][i]) { Z_Free(ttsobk[oldttscale][i]); ttsobk[oldttscale][i] = 0; }
|
||||
if(ttsodh[oldttscale][i]) { Z_Free(ttsodh[oldttscale][i]); ttsodh[oldttscale][i] = 0; }
|
||||
if(tttaib[oldttscale][i]) { Z_Free(tttaib[oldttscale][i]); tttaib[oldttscale][i] = 0; }
|
||||
if(tttaif[oldttscale][i]) { Z_Free(tttaif[oldttscale][i]); tttaif[oldttscale][i] = 0; }
|
||||
if(tttaba[oldttscale][i]) { Z_Free(tttaba[oldttscale][i]); tttaba[oldttscale][i] = 0; }
|
||||
if(tttabk[oldttscale][i]) { Z_Free(tttabk[oldttscale][i]); tttabk[oldttscale][i] = 0; }
|
||||
if(tttabt[oldttscale][i]) { Z_Free(tttabt[oldttscale][i]); tttabt[oldttscale][i] = 0; }
|
||||
if(tttaft[oldttscale][i]) { Z_Free(tttaft[oldttscale][i]); tttaft[oldttscale][i] = 0; }
|
||||
if(ttknib[oldttscale][i]) { Z_Free(ttknib[oldttscale][i]); ttknib[oldttscale][i] = 0; }
|
||||
if(ttknif[oldttscale][i]) { Z_Free(ttknif[oldttscale][i]); ttknif[oldttscale][i] = 0; }
|
||||
if(ttknba[oldttscale][i]) { Z_Free(ttknba[oldttscale][i]); ttknba[oldttscale][i] = 0; }
|
||||
if(ttknbk[oldttscale][i]) { Z_Free(ttknbk[oldttscale][i]); ttknbk[oldttscale][i] = 0; }
|
||||
if(ttkndh[oldttscale][i]) { Z_Free(ttkndh[oldttscale][i]); ttkndh[oldttscale][i] = 0; }
|
||||
if(ttembl[oldttscale][i]) { Patch_Free(ttembl[oldttscale][i]); ttembl[oldttscale][i] = 0; }
|
||||
if(ttribb[oldttscale][i]) { Patch_Free(ttribb[oldttscale][i]); ttribb[oldttscale][i] = 0; }
|
||||
if(ttsont[oldttscale][i]) { Patch_Free(ttsont[oldttscale][i]); ttsont[oldttscale][i] = 0; }
|
||||
if(ttrobo[oldttscale][i]) { Patch_Free(ttrobo[oldttscale][i]); ttrobo[oldttscale][i] = 0; }
|
||||
if(tttwot[oldttscale][i]) { Patch_Free(tttwot[oldttscale][i]); tttwot[oldttscale][i] = 0; }
|
||||
if(ttrbtx[oldttscale][i]) { Patch_Free(ttrbtx[oldttscale][i]); ttrbtx[oldttscale][i] = 0; }
|
||||
if(ttsoib[oldttscale][i]) { Patch_Free(ttsoib[oldttscale][i]); ttsoib[oldttscale][i] = 0; }
|
||||
if(ttsoif[oldttscale][i]) { Patch_Free(ttsoif[oldttscale][i]); ttsoif[oldttscale][i] = 0; }
|
||||
if(ttsoba[oldttscale][i]) { Patch_Free(ttsoba[oldttscale][i]); ttsoba[oldttscale][i] = 0; }
|
||||
if(ttsobk[oldttscale][i]) { Patch_Free(ttsobk[oldttscale][i]); ttsobk[oldttscale][i] = 0; }
|
||||
if(ttsodh[oldttscale][i]) { Patch_Free(ttsodh[oldttscale][i]); ttsodh[oldttscale][i] = 0; }
|
||||
if(tttaib[oldttscale][i]) { Patch_Free(tttaib[oldttscale][i]); tttaib[oldttscale][i] = 0; }
|
||||
if(tttaif[oldttscale][i]) { Patch_Free(tttaif[oldttscale][i]); tttaif[oldttscale][i] = 0; }
|
||||
if(tttaba[oldttscale][i]) { Patch_Free(tttaba[oldttscale][i]); tttaba[oldttscale][i] = 0; }
|
||||
if(tttabk[oldttscale][i]) { Patch_Free(tttabk[oldttscale][i]); tttabk[oldttscale][i] = 0; }
|
||||
if(tttabt[oldttscale][i]) { Patch_Free(tttabt[oldttscale][i]); tttabt[oldttscale][i] = 0; }
|
||||
if(tttaft[oldttscale][i]) { Patch_Free(tttaft[oldttscale][i]); tttaft[oldttscale][i] = 0; }
|
||||
if(ttknib[oldttscale][i]) { Patch_Free(ttknib[oldttscale][i]); ttknib[oldttscale][i] = 0; }
|
||||
if(ttknif[oldttscale][i]) { Patch_Free(ttknif[oldttscale][i]); ttknif[oldttscale][i] = 0; }
|
||||
if(ttknba[oldttscale][i]) { Patch_Free(ttknba[oldttscale][i]); ttknba[oldttscale][i] = 0; }
|
||||
if(ttknbk[oldttscale][i]) { Patch_Free(ttknbk[oldttscale][i]); ttknbk[oldttscale][i] = 0; }
|
||||
if(ttkndh[oldttscale][i]) { Patch_Free(ttkndh[oldttscale][i]); ttkndh[oldttscale][i] = 0; }
|
||||
}
|
||||
ttloaded[oldttscale] = false;
|
||||
}
|
||||
|
@ -2648,17 +2644,12 @@ static void F_FigureActiveTtScale(void)
|
|||
SINT8 newttscale = max(1, min(6, vid.dupx));
|
||||
SINT8 oldttscale = activettscale;
|
||||
|
||||
if (needpatchrecache)
|
||||
ttloaded[0] = ttloaded[1] = ttloaded[2] = ttloaded[3] = ttloaded[4] = ttloaded[5] = 0;
|
||||
else
|
||||
{
|
||||
if (newttscale == testttscale)
|
||||
return;
|
||||
if (newttscale == testttscale)
|
||||
return;
|
||||
|
||||
// We have a new ttscale, so load gfx
|
||||
if(oldttscale > 0)
|
||||
F_UnloadAlacroixGraphics(oldttscale);
|
||||
}
|
||||
// We have a new ttscale, so load gfx
|
||||
if(oldttscale > 0)
|
||||
F_UnloadAlacroixGraphics(oldttscale);
|
||||
|
||||
testttscale = newttscale;
|
||||
|
||||
|
@ -2692,9 +2683,6 @@ void F_TitleScreenDrawer(void)
|
|||
if (modeattacking)
|
||||
return; // We likely came here from retrying. Don't do a damn thing.
|
||||
|
||||
if (needpatchrecache && (curttmode != TTMODE_ALACROIX))
|
||||
F_CacheTitleScreen();
|
||||
|
||||
// Draw that sky!
|
||||
if (curbgcolor >= 0)
|
||||
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, curbgcolor);
|
||||
|
@ -3658,7 +3646,7 @@ void F_ContinueDrawer(void)
|
|||
V_DrawLevelTitle(x - (V_LevelNameWidth("Continue?")>>1), 16, 0, "Continue?");
|
||||
|
||||
// Two stars...
|
||||
patch = W_CachePatchName("CONTSTAR", PU_PATCH);
|
||||
patch = W_CachePatchName("CONTSTAR", PU_PATCH_LOWPRIORITY);
|
||||
V_DrawScaledPatch(x-32, 160, 0, patch);
|
||||
V_DrawScaledPatch(x+32, 160, 0, patch);
|
||||
|
||||
|
@ -3666,14 +3654,14 @@ void F_ContinueDrawer(void)
|
|||
if (timeleft > 9)
|
||||
{
|
||||
numbuf[7] = '1';
|
||||
V_DrawScaledPatch(x - 10, 160, 0, W_CachePatchName(numbuf, PU_PATCH));
|
||||
V_DrawScaledPatch(x - 10, 160, 0, W_CachePatchName(numbuf, PU_PATCH_LOWPRIORITY));
|
||||
numbuf[7] = '0';
|
||||
V_DrawScaledPatch(x + 10, 160, 0, W_CachePatchName(numbuf, PU_PATCH));
|
||||
V_DrawScaledPatch(x + 10, 160, 0, W_CachePatchName(numbuf, PU_PATCH_LOWPRIORITY));
|
||||
}
|
||||
else
|
||||
{
|
||||
numbuf[7] = '0'+timeleft;
|
||||
V_DrawScaledPatch(x, 160, 0, W_CachePatchName(numbuf, PU_PATCH));
|
||||
V_DrawScaledPatch(x, 160, 0, W_CachePatchName(numbuf, PU_PATCH_LOWPRIORITY));
|
||||
}
|
||||
|
||||
// Draw the continue markers! Show continues.
|
||||
|
@ -3702,7 +3690,7 @@ void F_ContinueDrawer(void)
|
|||
}
|
||||
|
||||
// Spotlight
|
||||
V_DrawScaledPatch(x, 140, 0, W_CachePatchName("CONTSPOT", PU_PATCH));
|
||||
V_DrawScaledPatch(x, 140, 0, W_CachePatchName("CONTSPOT", PU_PATCH_LOWPRIORITY));
|
||||
|
||||
// warping laser
|
||||
if (continuetime)
|
||||
|
@ -3739,7 +3727,7 @@ void F_ContinueDrawer(void)
|
|||
#define drawchar(dx, dy, n) {\
|
||||
sprdef = &contskins[n]->sprites[cont_spr2[n][0]];\
|
||||
sprframe = &sprdef->spriteframes[cont_spr2[n][1]];\
|
||||
patch = W_CachePatchNum(sprframe->lumppat[cont_spr2[n][2]], PU_PATCH);\
|
||||
patch = W_CachePatchNum(sprframe->lumppat[cont_spr2[n][2]], PU_PATCH_LOWPRIORITY);\
|
||||
V_DrawFixedPatch((dx), (dy), contskins[n]->highresscale, (sprframe->flip & (1<<cont_spr2[n][2])) ? V_FLIP : 0, patch, contcolormaps[n]);\
|
||||
}
|
||||
|
||||
|
@ -4004,10 +3992,10 @@ void F_CutsceneDrawer(void)
|
|||
{
|
||||
if (cutscenes[cutnum]->scene[scenenum].pichires[picnum])
|
||||
V_DrawSmallScaledPatch(picxpos, picypos, 0,
|
||||
W_CachePatchName(cutscenes[cutnum]->scene[scenenum].picname[picnum], PU_PATCH));
|
||||
W_CachePatchName(cutscenes[cutnum]->scene[scenenum].picname[picnum], PU_PATCH_LOWPRIORITY));
|
||||
else
|
||||
V_DrawScaledPatch(picxpos,picypos, 0,
|
||||
W_CachePatchName(cutscenes[cutnum]->scene[scenenum].picname[picnum], PU_PATCH));
|
||||
W_CachePatchName(cutscenes[cutnum]->scene[scenenum].picname[picnum], PU_PATCH_LOWPRIORITY));
|
||||
}
|
||||
|
||||
if (dofadenow && rendermode != render_none)
|
||||
|
@ -4493,10 +4481,10 @@ void F_TextPromptDrawer(void)
|
|||
{
|
||||
if (textprompts[cutnum]->page[scenenum].pichires[picnum])
|
||||
V_DrawSmallScaledPatch(picxpos, picypos, 0,
|
||||
W_CachePatchName(textprompts[cutnum]->page[scenenum].picname[picnum], PU_PATCH));
|
||||
W_CachePatchName(textprompts[cutnum]->page[scenenum].picname[picnum], PU_PATCH_LOWPRIORITY));
|
||||
else
|
||||
V_DrawScaledPatch(picxpos,picypos, 0,
|
||||
W_CachePatchName(textprompts[cutnum]->page[scenenum].picname[picnum], PU_PATCH));
|
||||
W_CachePatchName(textprompts[cutnum]->page[scenenum].picname[picnum], PU_PATCH_LOWPRIORITY));
|
||||
}
|
||||
|
||||
// Draw background
|
||||
|
@ -4506,7 +4494,7 @@ void F_TextPromptDrawer(void)
|
|||
if (iconlump != LUMPERROR)
|
||||
{
|
||||
INT32 iconx, icony, scale, scaledsize;
|
||||
patch = W_CachePatchName(textprompts[cutnum]->page[scenenum].iconname, PU_PATCH);
|
||||
patch = W_CachePatchName(textprompts[cutnum]->page[scenenum].iconname, PU_PATCH_LOWPRIORITY);
|
||||
|
||||
// scale and center
|
||||
if (patch->width > patch->height)
|
||||
|
|
|
@ -293,7 +293,7 @@ static void F_DoWipe(fademask_t *fademask)
|
|||
else
|
||||
{
|
||||
// pointer to transtable that this mask would use
|
||||
transtbl = transtables + ((9 - *mask)<<FF_TRANSSHIFT);
|
||||
transtbl = R_GetTranslucencyTable((9 - *mask) + 1);
|
||||
|
||||
// DRAWING LOOP
|
||||
while (draw_linestogo--)
|
||||
|
|
25
src/g_demo.c
25
src/g_demo.c
|
@ -453,8 +453,7 @@ void G_WriteGhostTic(mobj_t *ghost)
|
|||
WRITEUINT16(demo_p,oldghost.sprite);
|
||||
if (ghostext.flags & EZT_HEIGHT)
|
||||
{
|
||||
height >>= FRACBITS;
|
||||
WRITEINT16(demo_p, height);
|
||||
WRITEFIXED(demo_p, height);
|
||||
}
|
||||
ghostext.flags = 0;
|
||||
}
|
||||
|
@ -610,7 +609,7 @@ void G_ConsGhostTic(void)
|
|||
if (xziptic & EZT_SPRITE)
|
||||
demo_p += sizeof(UINT16);
|
||||
if (xziptic & EZT_HEIGHT)
|
||||
demo_p += sizeof(INT16);
|
||||
demo_p += (demoversion < 0x000e) ? sizeof(INT16) : sizeof(fixed_t);
|
||||
}
|
||||
|
||||
if (ziptic & GZT_FOLLOW)
|
||||
|
@ -842,7 +841,7 @@ void G_GhostTicker(void)
|
|||
g->mo->sprite = READUINT16(g->p);
|
||||
if (xziptic & EZT_HEIGHT)
|
||||
{
|
||||
fixed_t temp = READINT16(g->p)<<FRACBITS;
|
||||
fixed_t temp = (g->version < 0x000e) ? READINT16(g->p)<<FRACBITS : READFIXED(g->p);
|
||||
g->mo->height = FixedMul(temp, g->mo->scale);
|
||||
}
|
||||
}
|
||||
|
@ -1106,7 +1105,7 @@ void G_ReadMetalTic(mobj_t *metal)
|
|||
metal->sprite = READUINT16(metal_p);
|
||||
if (xziptic & EZT_HEIGHT)
|
||||
{
|
||||
fixed_t temp = READINT16(metal_p)<<FRACBITS;
|
||||
fixed_t temp = (metalversion < 0x000e) ? READINT16(metal_p)<<FRACBITS : READFIXED(metal_p);
|
||||
metal->height = FixedMul(temp, metal->scale);
|
||||
}
|
||||
}
|
||||
|
@ -1293,8 +1292,7 @@ void G_WriteMetalTic(mobj_t *metal)
|
|||
WRITEUINT16(demo_p,oldmetal.sprite);
|
||||
if (ghostext.flags & EZT_HEIGHT)
|
||||
{
|
||||
height >>= FRACBITS;
|
||||
WRITEINT16(demo_p, height);
|
||||
WRITEFIXED(demo_p, height);
|
||||
}
|
||||
ghostext.flags = 0;
|
||||
}
|
||||
|
@ -1474,8 +1472,8 @@ void G_BeginRecording(void)
|
|||
WRITEUINT8(demo_p,player->thrustfactor);
|
||||
WRITEUINT8(demo_p,player->accelstart);
|
||||
WRITEUINT8(demo_p,player->acceleration);
|
||||
WRITEUINT8(demo_p,player->height>>FRACBITS);
|
||||
WRITEUINT8(demo_p,player->spinheight>>FRACBITS);
|
||||
WRITEFIXED(demo_p,player->height);
|
||||
WRITEFIXED(demo_p,player->spinheight);
|
||||
WRITEUINT8(demo_p,player->camerascale>>FRACBITS);
|
||||
WRITEUINT8(demo_p,player->shieldscale>>FRACBITS);
|
||||
|
||||
|
@ -1901,8 +1899,8 @@ void G_DoPlayDemo(char *defdemoname)
|
|||
thrustfactor = READUINT8(demo_p);
|
||||
accelstart = READUINT8(demo_p);
|
||||
acceleration = READUINT8(demo_p);
|
||||
height = (fixed_t)READUINT8(demo_p)<<FRACBITS;
|
||||
spinheight = (fixed_t)READUINT8(demo_p)<<FRACBITS;
|
||||
height = (demoversion < 0x000e) ? (fixed_t)READUINT8(demo_p)<<FRACBITS : READFIXED(demo_p);
|
||||
spinheight = (demoversion < 0x000e) ? (fixed_t)READUINT8(demo_p)<<FRACBITS : READFIXED(demo_p);
|
||||
camerascale = (fixed_t)READUINT8(demo_p)<<FRACBITS;
|
||||
shieldscale = (fixed_t)READUINT8(demo_p)<<FRACBITS;
|
||||
jumpfactor = READFIXED(demo_p);
|
||||
|
@ -1958,9 +1956,7 @@ void G_DoPlayDemo(char *defdemoname)
|
|||
// Set skin
|
||||
SetPlayerSkin(0, skin);
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
LUAh_MapChange(gamemap);
|
||||
#endif
|
||||
displayplayer = consoleplayer = 0;
|
||||
memset(playeringame,0,sizeof(playeringame));
|
||||
playeringame[0] = true;
|
||||
|
@ -2150,8 +2146,7 @@ void G_AddGhost(char *defdemoname)
|
|||
p++; // thrustfactor
|
||||
p++; // accelstart
|
||||
p++; // acceleration
|
||||
p++; // height
|
||||
p++; // spinheight
|
||||
p += (ghostversion < 0x000e) ? 2 : 2 * sizeof(fixed_t); // height and spinheight
|
||||
p++; // camerascale
|
||||
p++; // shieldscale
|
||||
p += 4; // jumpfactor
|
||||
|
|
56
src/g_game.c
56
src/g_game.c
|
@ -444,9 +444,7 @@ consvar_t cv_firenaxis2 = CVAR_INIT ("joyaxis2_firenormal", "Z-Axis", CV_SAVE, j
|
|||
consvar_t cv_deadzone2 = CVAR_INIT ("joy_deadzone2", "0.125", CV_FLOAT|CV_SAVE, zerotoone_cons_t, NULL);
|
||||
consvar_t cv_digitaldeadzone2 = CVAR_INIT ("joy_digdeadzone2", "0.25", CV_FLOAT|CV_SAVE, zerotoone_cons_t, NULL);
|
||||
|
||||
#ifdef SEENAMES
|
||||
player_t *seenplayer; // player we're aiming at right now
|
||||
#endif
|
||||
|
||||
// now automatically allocated in D_RegisterClientCommands
|
||||
// so that it doesn't have to be updated depending on the value of MAXPLAYERS
|
||||
|
@ -1677,10 +1675,26 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
|||
}
|
||||
}
|
||||
|
||||
// Note: Lat originally made the PlayerCmd hook for SRB2 Kart so credit goes to him.
|
||||
if (gamestate == GS_LEVEL)
|
||||
// At this point, cmd doesn't contain the final angle yet,
|
||||
// So we need to temporarily transform it so Lua scripters
|
||||
// don't need to handle it differently than in other hooks.
|
||||
if (addedtogame && gamestate == GS_LEVEL)
|
||||
{
|
||||
INT16 extra = ticcmd_oldangleturn[forplayer] - player->oldrelangleturn;
|
||||
INT16 origangle = cmd->angleturn;
|
||||
INT16 orighookangle = (INT16)(origangle + player->angleturn + extra);
|
||||
INT16 origaiming = cmd->aiming;
|
||||
|
||||
cmd->angleturn = orighookangle;
|
||||
|
||||
LUAh_PlayerCmd(player, cmd);
|
||||
|
||||
extra = cmd->angleturn - orighookangle;
|
||||
cmd->angleturn = origangle + extra;
|
||||
*myangle += extra << 16;
|
||||
*myaiming += (cmd->aiming - origaiming) << 16;
|
||||
}
|
||||
|
||||
//Reset away view if a command is given.
|
||||
if (ssplayer == 1 && (cmd->forwardmove || cmd->sidemove || cmd->buttons)
|
||||
&& displayplayer != consoleplayer)
|
||||
|
@ -2216,8 +2230,35 @@ void G_Ticker(boolean run)
|
|||
// Costs a life to retry ... unless the player in question is dead already, or you haven't even touched the first starpost in marathon run.
|
||||
if (marathonmode && gamemap == spmarathon_start && !players[consoleplayer].starposttime)
|
||||
{
|
||||
player_t *p = &players[consoleplayer];
|
||||
marathonmode |= MA_INIT;
|
||||
marathontime = 0;
|
||||
|
||||
numgameovers = tokenlist = token = 0;
|
||||
countdown = countdown2 = exitfadestarted = 0;
|
||||
|
||||
p->playerstate = PST_REBORN;
|
||||
p->starpostx = p->starposty = p->starpostz = 0;
|
||||
|
||||
p->lives = startinglivesbalance[0];
|
||||
p->continues = 1;
|
||||
|
||||
p->score = 0;
|
||||
|
||||
// The latter two should clear by themselves, but just in case
|
||||
p->pflags &= ~(PF_TAGIT|PF_GAMETYPEOVER|PF_FULLSTASIS);
|
||||
|
||||
// Clear cheatcodes too, just in case.
|
||||
p->pflags &= ~(PF_GODMODE|PF_NOCLIP|PF_INVIS);
|
||||
|
||||
p->xtralife = 0;
|
||||
|
||||
// Reset unlockable triggers
|
||||
unlocktriggers = 0;
|
||||
|
||||
emeralds = 0;
|
||||
|
||||
memset(&luabanks, 0, sizeof(luabanks));
|
||||
}
|
||||
else if (G_GametypeUsesLives() && players[consoleplayer].playerstate == PST_LIVE && players[consoleplayer].lives != INFLIVES)
|
||||
players[consoleplayer].lives -= 1;
|
||||
|
@ -2250,14 +2291,21 @@ void G_Ticker(boolean run)
|
|||
{
|
||||
if (playeringame[i])
|
||||
{
|
||||
INT16 received;
|
||||
|
||||
G_CopyTiccmd(&players[i].cmd, &netcmds[buf][i], 1);
|
||||
|
||||
received = (players[i].cmd.angleturn & TICCMD_RECEIVED);
|
||||
|
||||
players[i].angleturn += players[i].cmd.angleturn - players[i].oldrelangleturn;
|
||||
players[i].oldrelangleturn = players[i].cmd.angleturn;
|
||||
if (P_ControlStyle(&players[i]) == CS_LMAOGALOG)
|
||||
P_ForceLocalAngle(&players[i], players[i].angleturn << 16);
|
||||
else
|
||||
players[i].cmd.angleturn = players[i].angleturn;
|
||||
|
||||
players[i].cmd.angleturn &= ~TICCMD_RECEIVED;
|
||||
players[i].cmd.angleturn |= received;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -25,9 +25,7 @@ extern char timeattackfolder[64];
|
|||
extern char customversionstring[32];
|
||||
#define GAMEDATASIZE (4*8192)
|
||||
|
||||
#ifdef SEENAMES
|
||||
extern player_t *seenplayer;
|
||||
#endif
|
||||
extern char player_names[MAXPLAYERS][MAXPLAYERNAME+1];
|
||||
extern INT32 player_name_changes[MAXPLAYERS];
|
||||
|
||||
|
|
|
@ -248,12 +248,12 @@ void HWR_RenderBatches(void)
|
|||
}
|
||||
|
||||
// sort polygons
|
||||
ps_hw_batchsorttime = I_GetTimeMicros();
|
||||
ps_hw_batchsorttime = I_GetPreciseTime();
|
||||
if (cv_glshaders.value && gl_shadersavailable)
|
||||
qsort(polygonIndexArray, polygonArraySize, sizeof(unsigned int), comparePolygons);
|
||||
else
|
||||
qsort(polygonIndexArray, polygonArraySize, sizeof(unsigned int), comparePolygonsNoShaders);
|
||||
ps_hw_batchsorttime = I_GetTimeMicros() - ps_hw_batchsorttime;
|
||||
ps_hw_batchsorttime = I_GetPreciseTime() - ps_hw_batchsorttime;
|
||||
// sort order
|
||||
// 1. shader
|
||||
// 2. texture
|
||||
|
@ -261,7 +261,7 @@ void HWR_RenderBatches(void)
|
|||
// 4. colors + light level
|
||||
// not sure about what order of the last 2 should be, or if it even matters
|
||||
|
||||
ps_hw_batchdrawtime = I_GetTimeMicros();
|
||||
ps_hw_batchdrawtime = I_GetPreciseTime();
|
||||
|
||||
currentShader = polygonArray[polygonIndexArray[0]].shader;
|
||||
currentTexture = polygonArray[polygonIndexArray[0]].texture;
|
||||
|
@ -446,7 +446,7 @@ void HWR_RenderBatches(void)
|
|||
polygonArraySize = 0;
|
||||
unsortedVertexArraySize = 0;
|
||||
|
||||
ps_hw_batchdrawtime = I_GetTimeMicros() - ps_hw_batchdrawtime;
|
||||
ps_hw_batchdrawtime = I_GetPreciseTime() - ps_hw_batchdrawtime;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#include "hw_data.h"
|
||||
#include "hw_drv.h"
|
||||
|
||||
typedef struct
|
||||
typedef struct
|
||||
{
|
||||
FSurfaceInfo surf;// surf also has its own polyflags for some reason, but it seems unused
|
||||
unsigned int vertsIndex;// location of verts in unsortedVertexArray
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "../z_zone.h"
|
||||
#include "../v_video.h"
|
||||
#include "../r_draw.h"
|
||||
#include "../r_patch.h"
|
||||
#include "../r_picformats.h"
|
||||
#include "../p_setup.h"
|
||||
|
||||
|
@ -107,7 +108,7 @@ static void HWR_DrawColumnInCache(const column_t *patchcol, UINT8 *block, GLMipm
|
|||
|
||||
//Hurdler: 25/04/2000: now support colormap in hardware mode
|
||||
if (mipmap->colormap)
|
||||
texel = mipmap->colormap[texel];
|
||||
texel = mipmap->colormap->data[texel];
|
||||
|
||||
// hope compiler will get this switch out of the loops (dreams...)
|
||||
// gcc do it ! but vcc not ! (why don't use cygwin gcc for win32 ?)
|
||||
|
@ -217,7 +218,7 @@ static void HWR_DrawFlippedColumnInCache(const column_t *patchcol, UINT8 *block,
|
|||
|
||||
//Hurdler: 25/04/2000: now support colormap in hardware mode
|
||||
if (mipmap->colormap)
|
||||
texel = mipmap->colormap[texel];
|
||||
texel = mipmap->colormap->data[texel];
|
||||
|
||||
// hope compiler will get this switch out of the loops (dreams...)
|
||||
// gcc do it ! but vcc not ! (why don't use cygwin gcc for win32 ?)
|
||||
|
@ -306,7 +307,7 @@ static void HWR_DrawPatchInCache(GLMipmap_t *mipmap,
|
|||
// Draw each column to the block cache
|
||||
for (; ncols--; block += bpp, xfrac += xfracstep)
|
||||
{
|
||||
patchcol = (const column_t *)((const UINT8 *)realpatch + LONG(realpatch->columnofs[xfrac>>FRACBITS]));
|
||||
patchcol = (const column_t *)((const UINT8 *)realpatch->columns + (realpatch->columnofs[xfrac>>FRACBITS]));
|
||||
|
||||
HWR_DrawColumnInCache(patchcol, block, mipmap,
|
||||
pblockheight, blockmodulo,
|
||||
|
@ -320,7 +321,7 @@ static void HWR_DrawPatchInCache(GLMipmap_t *mipmap,
|
|||
static void HWR_DrawTexturePatchInCache(GLMipmap_t *mipmap,
|
||||
INT32 pblockwidth, INT32 pblockheight,
|
||||
texture_t *texture, texpatch_t *patch,
|
||||
const patch_t *realpatch)
|
||||
const softwarepatch_t *realpatch)
|
||||
{
|
||||
INT32 x, x1, x2;
|
||||
INT32 col, ncols;
|
||||
|
@ -391,7 +392,7 @@ static void HWR_DrawTexturePatchInCache(GLMipmap_t *mipmap,
|
|||
bpp = format2bpp(mipmap->format);
|
||||
|
||||
if (bpp < 1 || bpp > 4)
|
||||
I_Error("HWR_DrawPatchInCache: no drawer defined for this bpp (%d)\n",bpp);
|
||||
I_Error("HWR_DrawTexturePatchInCache: no drawer defined for this bpp (%d)\n",bpp);
|
||||
|
||||
// NOTE: should this actually be pblockwidth*bpp?
|
||||
blockmodulo = pblockwidth*bpp;
|
||||
|
@ -446,7 +447,7 @@ static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *grtex)
|
|||
UINT8 *block;
|
||||
texture_t *texture;
|
||||
texpatch_t *patch;
|
||||
patch_t *realpatch;
|
||||
softwarepatch_t *realpatch;
|
||||
UINT8 *pdata;
|
||||
INT32 blockwidth, blockheight, blocksize;
|
||||
|
||||
|
@ -502,16 +503,16 @@ static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *grtex)
|
|||
boolean dealloc = true;
|
||||
size_t lumplength = W_LumpLengthPwad(patch->wad, patch->lump);
|
||||
pdata = W_CacheLumpNumPwad(patch->wad, patch->lump, PU_CACHE);
|
||||
realpatch = (patch_t *)pdata;
|
||||
realpatch = (softwarepatch_t *)pdata;
|
||||
|
||||
#ifndef NO_PNG_LUMPS
|
||||
if (Picture_IsLumpPNG((UINT8 *)realpatch, lumplength))
|
||||
realpatch = (patch_t *)Picture_PNGConvert(pdata, PICFMT_PATCH, NULL, NULL, NULL, NULL, lumplength, NULL, 0);
|
||||
realpatch = (softwarepatch_t *)Picture_PNGConvert(pdata, PICFMT_DOOMPATCH, NULL, NULL, NULL, NULL, lumplength, NULL, 0);
|
||||
else
|
||||
#endif
|
||||
#ifdef WALLFLATS
|
||||
if (texture->type == TEXTURETYPE_FLAT)
|
||||
realpatch = (patch_t *)Picture_Convert(PICFMT_FLAT, pdata, PICFMT_PATCH, 0, NULL, texture->width, texture->height, 0, 0, 0);
|
||||
realpatch = (softwarepatch_t *)Picture_Convert(PICFMT_FLAT, pdata, PICFMT_DOOMPATCH, 0, NULL, texture->width, texture->height, 0, 0, 0);
|
||||
else
|
||||
#endif
|
||||
{
|
||||
|
@ -544,36 +545,20 @@ static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *grtex)
|
|||
// patch may be NULL if grMipmap has been initialised already and makebitmap is false
|
||||
void HWR_MakePatch (const patch_t *patch, GLPatch_t *grPatch, GLMipmap_t *grMipmap, boolean makebitmap)
|
||||
{
|
||||
#ifndef NO_PNG_LUMPS
|
||||
// lump is a png so convert it
|
||||
size_t len = W_LumpLengthPwad(grPatch->wadnum, grPatch->lumpnum);
|
||||
if ((patch != NULL) && Picture_IsLumpPNG((const UINT8 *)patch, len))
|
||||
patch = (patch_t *)Picture_PNGConvert((const UINT8 *)patch, PICFMT_PATCH, NULL, NULL, NULL, NULL, len, NULL, 0);
|
||||
#endif
|
||||
|
||||
// don't do it twice (like a cache)
|
||||
if (grMipmap->width == 0)
|
||||
{
|
||||
// save the original patch header so that the GLPatch can be casted
|
||||
// into a standard patch_t struct and the existing code can get the
|
||||
// orginal patch dimensions and offsets.
|
||||
grPatch->width = SHORT(patch->width);
|
||||
grPatch->height = SHORT(patch->height);
|
||||
grPatch->leftoffset = SHORT(patch->leftoffset);
|
||||
grPatch->topoffset = SHORT(patch->topoffset);
|
||||
|
||||
grMipmap->width = grMipmap->height = 1;
|
||||
while (grMipmap->width < grPatch->width) grMipmap->width <<= 1;
|
||||
while (grMipmap->height < grPatch->height) grMipmap->height <<= 1;
|
||||
while (grMipmap->width < patch->width) grMipmap->width <<= 1;
|
||||
while (grMipmap->height < patch->height) grMipmap->height <<= 1;
|
||||
|
||||
// no wrap around, no chroma key
|
||||
grMipmap->flags = 0;
|
||||
|
||||
// setup the texture info
|
||||
grMipmap->format = patchformat;
|
||||
|
||||
//grPatch->max_s = grPatch->max_t = 1.0f;
|
||||
grPatch->max_s = (float)grPatch->width / (float)grMipmap->width;
|
||||
grPatch->max_t = (float)grPatch->height / (float)grMipmap->height;
|
||||
grPatch->max_s = (float)patch->width / (float)grMipmap->width;
|
||||
grPatch->max_t = (float)patch->height / (float)grMipmap->height;
|
||||
}
|
||||
|
||||
Z_Free(grMipmap->data);
|
||||
|
@ -585,7 +570,7 @@ void HWR_MakePatch (const patch_t *patch, GLPatch_t *grPatch, GLMipmap_t *grMipm
|
|||
|
||||
HWR_DrawPatchInCache(grMipmap,
|
||||
grMipmap->width, grMipmap->height,
|
||||
grPatch->width, grPatch->height,
|
||||
patch->width, patch->height,
|
||||
patch);
|
||||
}
|
||||
}
|
||||
|
@ -598,20 +583,56 @@ void HWR_MakePatch (const patch_t *patch, GLPatch_t *grPatch, GLMipmap_t *grMipm
|
|||
static size_t gl_numtextures = 0; // Texture count
|
||||
static GLMapTexture_t *gl_textures; // For all textures
|
||||
static GLMapTexture_t *gl_flats; // For all (texture) flats, as normal flats don't need to be cached
|
||||
boolean gl_maptexturesloaded = false;
|
||||
|
||||
void HWR_InitTextureCache(void)
|
||||
void HWR_FreeTextureData(patch_t *patch)
|
||||
{
|
||||
gl_textures = NULL;
|
||||
gl_flats = NULL;
|
||||
GLPatch_t *grPatch;
|
||||
|
||||
if (!patch || !patch->hardware)
|
||||
return;
|
||||
|
||||
grPatch = patch->hardware;
|
||||
|
||||
if (vid.glstate == VID_GL_LIBRARY_LOADED)
|
||||
HWD.pfnDeleteTexture(grPatch->mipmap);
|
||||
if (grPatch->mipmap->data)
|
||||
Z_Free(grPatch->mipmap->data);
|
||||
}
|
||||
|
||||
// Callback function for HWR_FreeTextureCache.
|
||||
static void FreeMipmapColormap(INT32 patchnum, void *patch)
|
||||
void HWR_FreeTexture(patch_t *patch)
|
||||
{
|
||||
GLPatch_t* const pat = patch;
|
||||
(void)patchnum; //unused
|
||||
if (!patch)
|
||||
return;
|
||||
|
||||
if (patch->hardware)
|
||||
{
|
||||
GLPatch_t *grPatch = patch->hardware;
|
||||
|
||||
HWR_FreeTextureColormaps(patch);
|
||||
|
||||
if (grPatch->mipmap)
|
||||
{
|
||||
HWR_FreeTextureData(patch);
|
||||
Z_Free(grPatch->mipmap);
|
||||
}
|
||||
|
||||
Z_Free(patch->hardware);
|
||||
}
|
||||
|
||||
patch->hardware = NULL;
|
||||
}
|
||||
|
||||
// Called by HWR_FreePatchCache.
|
||||
void HWR_FreeTextureColormaps(patch_t *patch)
|
||||
{
|
||||
GLPatch_t *pat;
|
||||
|
||||
// The patch must be valid, obviously
|
||||
if (!patch)
|
||||
return;
|
||||
|
||||
pat = patch->hardware;
|
||||
if (!pat)
|
||||
return;
|
||||
|
||||
|
@ -627,7 +648,7 @@ static void FreeMipmapColormap(INT32 patchnum, void *patch)
|
|||
if (!pat->mipmap)
|
||||
break;
|
||||
|
||||
// No colormap mipmap either.
|
||||
// No colormap mipmaps either.
|
||||
if (!pat->mipmap->nextcolormap)
|
||||
break;
|
||||
|
||||
|
@ -638,35 +659,78 @@ static void FreeMipmapColormap(INT32 patchnum, void *patch)
|
|||
// Free image data from memory.
|
||||
if (next->data)
|
||||
Z_Free(next->data);
|
||||
if (next->colormap)
|
||||
Z_Free(next->colormap);
|
||||
next->data = NULL;
|
||||
next->colormap = NULL;
|
||||
HWD.pfnDeleteTexture(next);
|
||||
|
||||
// Free the old colormap mipmap from memory.
|
||||
free(next);
|
||||
}
|
||||
}
|
||||
|
||||
void HWR_FreeMipmapCache(void)
|
||||
static boolean FreeTextureCallback(void *mem)
|
||||
{
|
||||
INT32 i;
|
||||
|
||||
// free references to the textures
|
||||
HWD.pfnClearMipMapCache();
|
||||
|
||||
// free all hardware-converted graphics cached in the heap
|
||||
// our gool is only the textures since user of the texture is the texture cache
|
||||
Z_FreeTag(PU_HWRCACHE);
|
||||
Z_FreeTag(PU_HWRCACHE_UNLOCKED);
|
||||
|
||||
// Alam: free the Z_Blocks before freeing it's users
|
||||
// free all patch colormaps after each level: must be done after ClearMipMapCache!
|
||||
for (i = 0; i < numwadfiles; i++)
|
||||
M_AATreeIterate(wadfiles[i]->hwrcache, FreeMipmapColormap);
|
||||
patch_t *patch = (patch_t *)mem;
|
||||
HWR_FreeTexture(patch);
|
||||
return false;
|
||||
}
|
||||
|
||||
void HWR_FreeTextureCache(void)
|
||||
static boolean FreeColormapsCallback(void *mem)
|
||||
{
|
||||
// free references to the textures
|
||||
HWR_FreeMipmapCache();
|
||||
patch_t *patch = (patch_t *)mem;
|
||||
HWR_FreeTextureColormaps(patch);
|
||||
return false;
|
||||
}
|
||||
|
||||
static void HWR_FreePatchCache(boolean freeall)
|
||||
{
|
||||
boolean (*callback)(void *mem) = FreeTextureCallback;
|
||||
|
||||
if (!freeall)
|
||||
callback = FreeColormapsCallback;
|
||||
|
||||
Z_IterateTags(PU_PATCH, PU_PATCH_ROTATED, callback);
|
||||
Z_IterateTags(PU_SPRITE, PU_HUDGFX, callback);
|
||||
}
|
||||
|
||||
// free all textures after each level
|
||||
void HWR_ClearAllTextures(void)
|
||||
{
|
||||
HWD.pfnClearMipMapCache(); // free references to the textures
|
||||
HWR_FreePatchCache(true);
|
||||
}
|
||||
|
||||
void HWR_FreeColormapCache(void)
|
||||
{
|
||||
HWR_FreePatchCache(false);
|
||||
}
|
||||
|
||||
void HWR_InitMapTextures(void)
|
||||
{
|
||||
gl_textures = NULL;
|
||||
gl_flats = NULL;
|
||||
gl_maptexturesloaded = false;
|
||||
}
|
||||
|
||||
static void FreeMapTexture(GLMapTexture_t *tex)
|
||||
{
|
||||
HWD.pfnDeleteTexture(&tex->mipmap);
|
||||
if (tex->mipmap.data)
|
||||
Z_Free(tex->mipmap.data);
|
||||
tex->mipmap.data = NULL;
|
||||
}
|
||||
|
||||
void HWR_FreeMapTextures(void)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < gl_numtextures; i++)
|
||||
{
|
||||
FreeMapTexture(&gl_textures[i]);
|
||||
FreeMapTexture(&gl_flats[i]);
|
||||
}
|
||||
|
||||
// now the heap don't have any 'user' pointing to our
|
||||
// texturecache info, we can free it
|
||||
|
@ -677,22 +741,22 @@ void HWR_FreeTextureCache(void)
|
|||
gl_textures = NULL;
|
||||
gl_flats = NULL;
|
||||
gl_numtextures = 0;
|
||||
gl_maptexturesloaded = false;
|
||||
}
|
||||
|
||||
void HWR_LoadTextures(size_t pnumtextures)
|
||||
void HWR_LoadMapTextures(size_t pnumtextures)
|
||||
{
|
||||
// we must free it since numtextures changed
|
||||
HWR_FreeTextureCache();
|
||||
// we must free it since numtextures may have changed
|
||||
HWR_FreeMapTextures();
|
||||
|
||||
// Why not Z_Malloc?
|
||||
gl_numtextures = pnumtextures;
|
||||
gl_textures = calloc(gl_numtextures, sizeof(*gl_textures));
|
||||
gl_flats = calloc(gl_numtextures, sizeof(*gl_flats));
|
||||
|
||||
// Doesn't tell you which it _is_, but hopefully
|
||||
// should never ever happen (right?!)
|
||||
if ((gl_textures == NULL) || (gl_flats == NULL))
|
||||
I_Error("HWR_LoadTextures: ran out of memory for OpenGL textures. Sad!");
|
||||
I_Error("HWR_LoadMapTextures: ran out of memory for OpenGL textures");
|
||||
|
||||
gl_maptexturesloaded = true;
|
||||
}
|
||||
|
||||
void HWR_SetPalette(RGBA_t *palette)
|
||||
|
@ -730,7 +794,6 @@ GLMapTexture_t *HWR_GetTexture(INT32 tex)
|
|||
// If hardware does not have the texture, then call pfnSetTexture to upload it
|
||||
if (!grtex->mipmap.downloaded)
|
||||
HWD.pfnSetTexture(&grtex->mipmap);
|
||||
|
||||
HWR_SetCurrentTexture(&grtex->mipmap);
|
||||
|
||||
// The system-memory data can be purged now.
|
||||
|
@ -803,20 +866,22 @@ static void HWR_CacheTextureAsFlat(GLMipmap_t *grMipmap, INT32 texturenum)
|
|||
}
|
||||
|
||||
// Download a Doom 'flat' to the hardware cache and make it ready for use
|
||||
void HWR_LiterallyGetFlat(lumpnum_t flatlumpnum)
|
||||
void HWR_GetRawFlat(lumpnum_t flatlumpnum)
|
||||
{
|
||||
GLMipmap_t *grmip;
|
||||
patch_t *patch;
|
||||
|
||||
if (flatlumpnum == LUMPERROR)
|
||||
return;
|
||||
|
||||
grmip = HWR_GetCachedGLPatch(flatlumpnum)->mipmap;
|
||||
patch = HWR_GetCachedGLPatch(flatlumpnum);
|
||||
grmip = ((GLPatch_t *)Patch_AllocateHardwarePatch(patch))->mipmap;
|
||||
if (!grmip->downloaded && !grmip->data)
|
||||
HWR_CacheFlat(grmip, flatlumpnum);
|
||||
|
||||
// If hardware does not have the texture, then call pfnSetTexture to upload it
|
||||
if (!grmip->downloaded)
|
||||
HWD.pfnSetTexture(grmip);
|
||||
|
||||
HWR_SetCurrentTexture(grmip);
|
||||
|
||||
// The system-memory data can be purged now.
|
||||
|
@ -830,7 +895,7 @@ void HWR_GetLevelFlat(levelflat_t *levelflat)
|
|||
return;
|
||||
|
||||
if (levelflat->type == LEVELFLAT_FLAT)
|
||||
HWR_LiterallyGetFlat(levelflat->u.flat.lumpnum);
|
||||
HWR_GetRawFlat(levelflat->u.flat.lumpnum);
|
||||
else if (levelflat->type == LEVELFLAT_TEXTURE)
|
||||
{
|
||||
GLMapTexture_t *grtex;
|
||||
|
@ -854,7 +919,6 @@ void HWR_GetLevelFlat(levelflat_t *levelflat)
|
|||
// If hardware does not have the texture, then call pfnSetTexture to upload it
|
||||
if (!grtex->mipmap.downloaded)
|
||||
HWD.pfnSetTexture(&grtex->mipmap);
|
||||
|
||||
HWR_SetCurrentTexture(&grtex->mipmap);
|
||||
|
||||
// The system-memory data can be purged now.
|
||||
|
@ -862,23 +926,25 @@ void HWR_GetLevelFlat(levelflat_t *levelflat)
|
|||
}
|
||||
else if (levelflat->type == LEVELFLAT_PATCH)
|
||||
{
|
||||
GLPatch_t *patch = W_CachePatchNum(levelflat->u.flat.lumpnum, PU_CACHE);
|
||||
levelflat->width = (UINT16)SHORT(patch->width);
|
||||
levelflat->height = (UINT16)SHORT(patch->height);
|
||||
patch_t *patch = W_CachePatchNum(levelflat->u.flat.lumpnum, PU_CACHE);
|
||||
levelflat->width = (UINT16)(patch->width);
|
||||
levelflat->height = (UINT16)(patch->height);
|
||||
HWR_GetPatch(patch);
|
||||
}
|
||||
#ifndef NO_PNG_LUMPS
|
||||
else if (levelflat->type == LEVELFLAT_PNG)
|
||||
{
|
||||
INT32 pngwidth = 0, pngheight = 0;
|
||||
GLMipmap_t *mipmap = levelflat->mipmap;
|
||||
UINT8 *flat;
|
||||
size_t size;
|
||||
|
||||
// Cache the picture.
|
||||
if (!levelflat->picture)
|
||||
if (!levelflat->mippic)
|
||||
{
|
||||
levelflat->picture = Picture_PNGConvert(W_CacheLumpNum(levelflat->u.flat.lumpnum, PU_CACHE), PICFMT_FLAT, &pngwidth, &pngheight, NULL, NULL, W_LumpLength(levelflat->u.flat.lumpnum), NULL, 0);
|
||||
INT32 pngwidth = 0, pngheight = 0;
|
||||
void *pic = Picture_PNGConvert(W_CacheLumpNum(levelflat->u.flat.lumpnum, PU_CACHE), PICFMT_FLAT, &pngwidth, &pngheight, NULL, NULL, W_LumpLength(levelflat->u.flat.lumpnum), NULL, 0);
|
||||
|
||||
Z_ChangeTag(pic, PU_LEVEL);
|
||||
Z_SetUser(pic, &levelflat->mippic);
|
||||
|
||||
levelflat->width = (UINT16)pngwidth;
|
||||
levelflat->height = (UINT16)pngheight;
|
||||
}
|
||||
|
@ -886,7 +952,7 @@ void HWR_GetLevelFlat(levelflat_t *levelflat)
|
|||
// Make the mipmap.
|
||||
if (mipmap == NULL)
|
||||
{
|
||||
mipmap = Z_Calloc(sizeof(GLMipmap_t), PU_LEVEL, NULL);
|
||||
mipmap = Z_Calloc(sizeof(GLMipmap_t), PU_STATIC, NULL);
|
||||
mipmap->format = GL_TEXFMT_P_8;
|
||||
mipmap->flags = TF_WRAPXY|TF_CHROMAKEYED;
|
||||
levelflat->mipmap = mipmap;
|
||||
|
@ -894,106 +960,109 @@ void HWR_GetLevelFlat(levelflat_t *levelflat)
|
|||
|
||||
if (!mipmap->data && !mipmap->downloaded)
|
||||
{
|
||||
UINT8 *flat;
|
||||
size_t size;
|
||||
|
||||
if (levelflat->mippic == NULL)
|
||||
I_Error("HWR_GetLevelFlat: levelflat->mippic == NULL");
|
||||
|
||||
mipmap->width = levelflat->width;
|
||||
mipmap->height = levelflat->height;
|
||||
|
||||
size = (mipmap->width * mipmap->height);
|
||||
flat = Z_Malloc(size, PU_LEVEL, &mipmap->data);
|
||||
if (levelflat->picture == NULL)
|
||||
I_Error("HWR_GetLevelFlat: levelflat->picture == NULL");
|
||||
M_Memcpy(flat, levelflat->picture, size);
|
||||
M_Memcpy(flat, levelflat->mippic, size);
|
||||
}
|
||||
|
||||
// Tell the hardware driver to bind the current texture to the flat's mipmap
|
||||
HWD.pfnSetTexture(mipmap);
|
||||
HWR_SetCurrentTexture(mipmap);
|
||||
}
|
||||
#endif
|
||||
else // set no texture
|
||||
HWR_SetCurrentTexture(NULL);
|
||||
}
|
||||
|
||||
//
|
||||
// HWR_LoadMappedPatch(): replace the skin color of the sprite in cache
|
||||
// : load it first in doom cache if not already
|
||||
//
|
||||
static void HWR_LoadMappedPatch(GLMipmap_t *grmip, GLPatch_t *gpatch)
|
||||
// --------------------+
|
||||
// HWR_LoadPatchMipmap : Generates a patch into a mipmap, usually the mipmap inside the patch itself
|
||||
// --------------------+
|
||||
static void HWR_LoadPatchMipmap(patch_t *patch, GLMipmap_t *grMipmap)
|
||||
{
|
||||
if (!grmip->downloaded && !grmip->data)
|
||||
{
|
||||
patch_t *patch = gpatch->rawpatch;
|
||||
if (!patch)
|
||||
patch = W_CacheLumpNumPwad(gpatch->wadnum, gpatch->lumpnum, PU_STATIC);
|
||||
HWR_MakePatch(patch, gpatch, grmip, true);
|
||||
|
||||
// You can't free rawpatch for some reason?
|
||||
// (Obviously I can't, sprite rotation needs that...)
|
||||
if (!gpatch->rawpatch)
|
||||
Z_Free(patch);
|
||||
}
|
||||
GLPatch_t *grPatch = patch->hardware;
|
||||
if (!grMipmap->downloaded && !grMipmap->data)
|
||||
HWR_MakePatch(patch, grPatch, grMipmap, true);
|
||||
|
||||
// If hardware does not have the texture, then call pfnSetTexture to upload it
|
||||
if (!grmip->downloaded)
|
||||
HWD.pfnSetTexture(grmip);
|
||||
|
||||
HWR_SetCurrentTexture(grmip);
|
||||
if (!grMipmap->downloaded)
|
||||
HWD.pfnSetTexture(grMipmap);
|
||||
HWR_SetCurrentTexture(grMipmap);
|
||||
|
||||
// The system-memory data can be purged now.
|
||||
Z_ChangeTag(grmip->data, PU_HWRCACHE_UNLOCKED);
|
||||
Z_ChangeTag(grMipmap->data, PU_HWRCACHE_UNLOCKED);
|
||||
}
|
||||
|
||||
// -----------------+
|
||||
// HWR_GetPatch : Download a patch to the hardware cache and make it ready for use
|
||||
// -----------------+
|
||||
void HWR_GetPatch(GLPatch_t *gpatch)
|
||||
// ----------------------+
|
||||
// HWR_UpdatePatchMipmap : Updates a mipmap.
|
||||
// ----------------------+
|
||||
static void HWR_UpdatePatchMipmap(patch_t *patch, GLMipmap_t *grMipmap)
|
||||
{
|
||||
// is it in hardware cache
|
||||
if (!gpatch->mipmap->downloaded && !gpatch->mipmap->data)
|
||||
{
|
||||
// load the software patch, PU_STATIC or the Z_Malloc for hardware patch will
|
||||
// flush the software patch before the conversion! oh yeah I suffered
|
||||
patch_t *ptr = gpatch->rawpatch;
|
||||
if (!ptr)
|
||||
ptr = W_CacheLumpNumPwad(gpatch->wadnum, gpatch->lumpnum, PU_STATIC);
|
||||
HWR_MakePatch(ptr, gpatch, gpatch->mipmap, true);
|
||||
|
||||
// this is inefficient.. but the hardware patch in heap is purgeable so it should
|
||||
// not fragment memory, and besides the REAL cache here is the hardware memory
|
||||
if (!gpatch->rawpatch)
|
||||
Z_Free(ptr);
|
||||
}
|
||||
GLPatch_t *grPatch = patch->hardware;
|
||||
HWR_MakePatch(patch, grPatch, grMipmap, true);
|
||||
|
||||
// If hardware does not have the texture, then call pfnSetTexture to upload it
|
||||
if (!gpatch->mipmap->downloaded)
|
||||
HWD.pfnSetTexture(gpatch->mipmap);
|
||||
// If it does have the texture, then call pfnUpdateTexture to update it
|
||||
if (!grMipmap->downloaded)
|
||||
HWD.pfnSetTexture(grMipmap);
|
||||
else
|
||||
HWD.pfnUpdateTexture(grMipmap);
|
||||
HWR_SetCurrentTexture(grMipmap);
|
||||
|
||||
HWR_SetCurrentTexture(gpatch->mipmap);
|
||||
|
||||
// The system-memory patch data can be purged now.
|
||||
Z_ChangeTag(gpatch->mipmap->data, PU_HWRCACHE_UNLOCKED);
|
||||
// The system-memory data can be purged now.
|
||||
Z_ChangeTag(grMipmap->data, PU_HWRCACHE_UNLOCKED);
|
||||
}
|
||||
|
||||
// -----------------+
|
||||
// HWR_GetPatch : Downloads a patch to the hardware cache and make it ready for use
|
||||
// -----------------+
|
||||
void HWR_GetPatch(patch_t *patch)
|
||||
{
|
||||
if (!patch->hardware)
|
||||
Patch_CreateGL(patch);
|
||||
HWR_LoadPatchMipmap(patch, ((GLPatch_t *)patch->hardware)->mipmap);
|
||||
}
|
||||
|
||||
// -------------------+
|
||||
// HWR_GetMappedPatch : Same as HWR_GetPatch for sprite color
|
||||
// -------------------+
|
||||
void HWR_GetMappedPatch(GLPatch_t *gpatch, const UINT8 *colormap)
|
||||
void HWR_GetMappedPatch(patch_t *patch, const UINT8 *colormap)
|
||||
{
|
||||
GLMipmap_t *grmip, *newmip;
|
||||
GLPatch_t *grPatch;
|
||||
GLMipmap_t *grMipmap, *newMipmap;
|
||||
|
||||
if (!patch->hardware)
|
||||
Patch_CreateGL(patch);
|
||||
grPatch = patch->hardware;
|
||||
|
||||
if (colormap == colormaps || colormap == NULL)
|
||||
{
|
||||
// Load the default (green) color in doom cache (temporary?) AND hardware cache
|
||||
HWR_GetPatch(gpatch);
|
||||
// Load the default (green) color in hardware cache
|
||||
HWR_GetPatch(patch);
|
||||
return;
|
||||
}
|
||||
|
||||
// search for the mimmap
|
||||
// search for the mipmap
|
||||
// skip the first (no colormap translated)
|
||||
for (grmip = gpatch->mipmap; grmip->nextcolormap; )
|
||||
for (grMipmap = grPatch->mipmap; grMipmap->nextcolormap; )
|
||||
{
|
||||
grmip = grmip->nextcolormap;
|
||||
if (grmip->colormap == colormap)
|
||||
grMipmap = grMipmap->nextcolormap;
|
||||
if (grMipmap->colormap && grMipmap->colormap->source == colormap)
|
||||
{
|
||||
HWR_LoadMappedPatch(grmip, gpatch);
|
||||
if (memcmp(grMipmap->colormap->data, colormap, 256 * sizeof(UINT8)))
|
||||
{
|
||||
M_Memcpy(grMipmap->colormap->data, colormap, 256 * sizeof(UINT8));
|
||||
HWR_UpdatePatchMipmap(patch, grMipmap);
|
||||
}
|
||||
else
|
||||
HWR_LoadPatchMipmap(patch, grMipmap);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -1002,15 +1071,18 @@ void HWR_GetMappedPatch(GLPatch_t *gpatch, const UINT8 *colormap)
|
|||
|
||||
//BP: WARNING: don't free it manually without clearing the cache of harware renderer
|
||||
// (it have a liste of mipmap)
|
||||
// this malloc is cleared in HWR_FreeTextureCache
|
||||
// this malloc is cleared in HWR_FreeColormapCache
|
||||
// (...) unfortunately z_malloc fragment alot the memory :(so malloc is better
|
||||
newmip = calloc(1, sizeof (*newmip));
|
||||
if (newmip == NULL)
|
||||
newMipmap = calloc(1, sizeof (*newMipmap));
|
||||
if (newMipmap == NULL)
|
||||
I_Error("%s: Out of memory", "HWR_GetMappedPatch");
|
||||
grmip->nextcolormap = newmip;
|
||||
grMipmap->nextcolormap = newMipmap;
|
||||
|
||||
newmip->colormap = colormap;
|
||||
HWR_LoadMappedPatch(newmip, gpatch);
|
||||
newMipmap->colormap = Z_Calloc(sizeof(*newMipmap->colormap), PU_HWRPATCHCOLMIPMAP, NULL);
|
||||
newMipmap->colormap->source = colormap;
|
||||
M_Memcpy(newMipmap->colormap->data, colormap, 256 * sizeof(UINT8));
|
||||
|
||||
HWR_LoadPatchMipmap(patch, newMipmap);
|
||||
}
|
||||
|
||||
void HWR_UnlockCachedPatch(GLPatch_t *gpatch)
|
||||
|
@ -1019,7 +1091,6 @@ void HWR_UnlockCachedPatch(GLPatch_t *gpatch)
|
|||
return;
|
||||
|
||||
Z_ChangeTag(gpatch->mipmap->data, PU_HWRCACHE_UNLOCKED);
|
||||
Z_ChangeTag(gpatch, PU_HWRPATCHINFO_UNLOCKED);
|
||||
}
|
||||
|
||||
static const INT32 picmode2GR[] =
|
||||
|
@ -1100,79 +1171,73 @@ static void HWR_DrawPicInCache(UINT8 *block, INT32 pblockwidth, INT32 pblockheig
|
|||
// HWR_GetPic : Download a Doom pic (raw row encoded with no 'holes')
|
||||
// Returns :
|
||||
// -----------------+
|
||||
GLPatch_t *HWR_GetPic(lumpnum_t lumpnum)
|
||||
patch_t *HWR_GetPic(lumpnum_t lumpnum)
|
||||
{
|
||||
GLPatch_t *grpatch = HWR_GetCachedGLPatch(lumpnum);
|
||||
if (!grpatch->mipmap->downloaded && !grpatch->mipmap->data)
|
||||
patch_t *patch = HWR_GetCachedGLPatch(lumpnum);
|
||||
GLPatch_t *grPatch = (GLPatch_t *)(patch->hardware);
|
||||
|
||||
if (!grPatch->mipmap->downloaded && !grPatch->mipmap->data)
|
||||
{
|
||||
pic_t *pic;
|
||||
UINT8 *block;
|
||||
size_t len;
|
||||
|
||||
pic = W_CacheLumpNum(lumpnum, PU_CACHE);
|
||||
grpatch->width = SHORT(pic->width);
|
||||
grpatch->height = SHORT(pic->height);
|
||||
patch->width = SHORT(pic->width);
|
||||
patch->height = SHORT(pic->height);
|
||||
len = W_LumpLength(lumpnum) - sizeof (pic_t);
|
||||
|
||||
grpatch->leftoffset = 0;
|
||||
grpatch->topoffset = 0;
|
||||
|
||||
grpatch->mipmap->width = (UINT16)grpatch->width;
|
||||
grpatch->mipmap->height = (UINT16)grpatch->height;
|
||||
grPatch->mipmap->width = (UINT16)patch->width;
|
||||
grPatch->mipmap->height = (UINT16)patch->height;
|
||||
|
||||
if (pic->mode == PALETTE)
|
||||
grpatch->mipmap->format = textureformat; // can be set by driver
|
||||
grPatch->mipmap->format = textureformat; // can be set by driver
|
||||
else
|
||||
grpatch->mipmap->format = picmode2GR[pic->mode];
|
||||
grPatch->mipmap->format = picmode2GR[pic->mode];
|
||||
|
||||
Z_Free(grpatch->mipmap->data);
|
||||
Z_Free(grPatch->mipmap->data);
|
||||
|
||||
// allocate block
|
||||
block = MakeBlock(grpatch->mipmap);
|
||||
block = MakeBlock(grPatch->mipmap);
|
||||
|
||||
if (grpatch->width == SHORT(pic->width) &&
|
||||
grpatch->height == SHORT(pic->height) &&
|
||||
format2bpp(grpatch->mipmap->format) == format2bpp(picmode2GR[pic->mode]))
|
||||
if (patch->width == SHORT(pic->width) &&
|
||||
patch->height == SHORT(pic->height) &&
|
||||
format2bpp(grPatch->mipmap->format) == format2bpp(picmode2GR[pic->mode]))
|
||||
{
|
||||
// no conversion needed
|
||||
M_Memcpy(grpatch->mipmap->data, pic->data,len);
|
||||
M_Memcpy(grPatch->mipmap->data, pic->data,len);
|
||||
}
|
||||
else
|
||||
HWR_DrawPicInCache(block, SHORT(pic->width), SHORT(pic->height),
|
||||
SHORT(pic->width)*format2bpp(grpatch->mipmap->format),
|
||||
SHORT(pic->width)*format2bpp(grPatch->mipmap->format),
|
||||
pic,
|
||||
format2bpp(grpatch->mipmap->format));
|
||||
format2bpp(grPatch->mipmap->format));
|
||||
|
||||
Z_Unlock(pic);
|
||||
Z_ChangeTag(block, PU_HWRCACHE_UNLOCKED);
|
||||
|
||||
grpatch->mipmap->flags = 0;
|
||||
grpatch->max_s = grpatch->max_t = 1.0f;
|
||||
grPatch->mipmap->flags = 0;
|
||||
grPatch->max_s = grPatch->max_t = 1.0f;
|
||||
}
|
||||
HWD.pfnSetTexture(grpatch->mipmap);
|
||||
//CONS_Debug(DBG_RENDER, "picloaded at %x as texture %d\n",grpatch->mipmap.data, grpatch->mipmap.downloaded);
|
||||
HWD.pfnSetTexture(grPatch->mipmap);
|
||||
//CONS_Debug(DBG_RENDER, "picloaded at %x as texture %d\n",grPatch->mipmap->data, grPatch->mipmap->downloaded);
|
||||
|
||||
return grpatch;
|
||||
return patch;
|
||||
}
|
||||
|
||||
GLPatch_t *HWR_GetCachedGLPatchPwad(UINT16 wadnum, UINT16 lumpnum)
|
||||
patch_t *HWR_GetCachedGLPatchPwad(UINT16 wadnum, UINT16 lumpnum)
|
||||
{
|
||||
aatree_t *hwrcache = wadfiles[wadnum]->hwrcache;
|
||||
GLPatch_t *grpatch;
|
||||
|
||||
if (!(grpatch = M_AATreeGet(hwrcache, lumpnum)))
|
||||
lumpcache_t *lumpcache = wadfiles[wadnum]->patchcache;
|
||||
if (!lumpcache[lumpnum])
|
||||
{
|
||||
grpatch = Z_Calloc(sizeof(GLPatch_t), PU_HWRPATCHINFO, NULL);
|
||||
grpatch->wadnum = wadnum;
|
||||
grpatch->lumpnum = lumpnum;
|
||||
grpatch->mipmap = Z_Calloc(sizeof(GLMipmap_t), PU_HWRPATCHINFO, NULL);
|
||||
M_AATreeSet(hwrcache, lumpnum, grpatch);
|
||||
void *ptr = Z_Calloc(sizeof(patch_t), PU_PATCH, &lumpcache[lumpnum]);
|
||||
Patch_Create(NULL, 0, ptr);
|
||||
Patch_AllocateHardwarePatch(ptr);
|
||||
}
|
||||
|
||||
return grpatch;
|
||||
return (patch_t *)(lumpcache[lumpnum]);
|
||||
}
|
||||
|
||||
GLPatch_t *HWR_GetCachedGLPatch(lumpnum_t lumpnum)
|
||||
patch_t *HWR_GetCachedGLPatch(lumpnum_t lumpnum)
|
||||
{
|
||||
return HWR_GetCachedGLPatchPwad(WADFILENUM(lumpnum),LUMPNUM(lumpnum));
|
||||
}
|
||||
|
@ -1192,8 +1257,8 @@ static void HWR_DrawFadeMaskInCache(GLMipmap_t *mipmap, INT32 pblockwidth, INT32
|
|||
W_ReadLump(fademasklumpnum, Z_Malloc(W_LumpLength(fademasklumpnum),
|
||||
PU_HWRCACHE, &flat));
|
||||
|
||||
stepy = ((INT32)SHORT(fmheight)<<FRACBITS)/pblockheight;
|
||||
stepx = ((INT32)SHORT(fmwidth)<<FRACBITS)/pblockwidth;
|
||||
stepy = ((INT32)fmheight<<FRACBITS)/pblockheight;
|
||||
stepx = ((INT32)fmwidth<<FRACBITS)/pblockwidth;
|
||||
posy = 0;
|
||||
for (j = 0; j < pblockheight; j++)
|
||||
{
|
||||
|
@ -1265,7 +1330,8 @@ static void HWR_CacheFadeMask(GLMipmap_t *grMipmap, lumpnum_t fademasklumpnum)
|
|||
|
||||
void HWR_GetFadeMask(lumpnum_t fademasklumpnum)
|
||||
{
|
||||
GLMipmap_t *grmip = HWR_GetCachedGLPatch(fademasklumpnum)->mipmap;
|
||||
patch_t *patch = HWR_GetCachedGLPatch(fademasklumpnum);
|
||||
GLMipmap_t *grmip = ((GLPatch_t *)Patch_AllocateHardwarePatch(patch))->mipmap;
|
||||
if (!grmip->downloaded && !grmip->data)
|
||||
HWR_CacheFadeMask(grmip, fademasklumpnum);
|
||||
|
||||
|
|
|
@ -39,59 +39,53 @@ typedef enum GLTextureFormat_e
|
|||
GL_TEXFMT_ALPHA_INTENSITY_88 = 0x22,
|
||||
} GLTextureFormat_t;
|
||||
|
||||
// data holds the address of the graphics data cached in heap memory
|
||||
// NULL if the texture is not in Doom heap cache.
|
||||
// Colormap structure for mipmaps.
|
||||
struct GLColormap_s
|
||||
{
|
||||
const UINT8 *source;
|
||||
UINT8 data[256];
|
||||
};
|
||||
typedef struct GLColormap_s GLColormap_t;
|
||||
|
||||
|
||||
// Texture information (misleadingly named "mipmap" all over the code.)
|
||||
// The *data pointer holds the address of the graphics data cached in heap memory.
|
||||
// NULL if the texture is not in SRB2's heap cache.
|
||||
struct GLMipmap_s
|
||||
{
|
||||
//for TexDownloadMipMap
|
||||
GLTextureFormat_t format;
|
||||
void *data;
|
||||
// for UpdateTexture
|
||||
GLTextureFormat_t format;
|
||||
void *data;
|
||||
|
||||
UINT32 flags;
|
||||
UINT16 height;
|
||||
UINT16 width;
|
||||
UINT32 downloaded; // the dll driver have it in there cache ?
|
||||
UINT32 flags;
|
||||
UINT16 height;
|
||||
UINT16 width;
|
||||
UINT32 downloaded; // The GPU has this texture.
|
||||
|
||||
struct GLMipmap_s *nextcolormap;
|
||||
const UINT8 *colormap;
|
||||
|
||||
// opengl
|
||||
struct GLMipmap_s *nextmipmap; // opengl : liste of all texture in opengl driver
|
||||
struct GLColormap_s *colormap;
|
||||
};
|
||||
typedef struct GLMipmap_s GLMipmap_t;
|
||||
|
||||
|
||||
//
|
||||
// Doom texture info, as cached for hardware rendering
|
||||
// Level textures, as cached for hardware rendering.
|
||||
//
|
||||
struct GLMapTexture_s
|
||||
{
|
||||
GLMipmap_t mipmap;
|
||||
float scaleX; //used for scaling textures on walls
|
||||
float scaleX; // Used for scaling textures on walls
|
||||
float scaleY;
|
||||
};
|
||||
typedef struct GLMapTexture_s GLMapTexture_t;
|
||||
|
||||
|
||||
// a cached patch as converted to hardware format, holding the original patch_t
|
||||
// header so that the existing code can retrieve ->width, ->height as usual
|
||||
// This is returned by W_CachePatchNum()/W_CachePatchName(), when rendermode
|
||||
// is 'render_opengl'. Else it returns the normal patch_t data.
|
||||
|
||||
// Patch information for the hardware renderer.
|
||||
struct GLPatch_s
|
||||
{
|
||||
// the 4 first fields come right away from the original patch_t
|
||||
INT16 width;
|
||||
INT16 height;
|
||||
INT16 leftoffset; // pixels to the left of origin
|
||||
INT16 topoffset; // pixels below the origin
|
||||
//
|
||||
float max_s,max_t;
|
||||
UINT16 wadnum; // the software patch lump num for when the hardware patch
|
||||
UINT16 lumpnum; // was flushed, and we need to re-create it
|
||||
void *rawpatch; // :^)
|
||||
GLMipmap_t *mipmap;
|
||||
} ATTRPACK;
|
||||
GLMipmap_t *mipmap; // Texture data. Allocated whenever the patch is.
|
||||
float max_s, max_t;
|
||||
};
|
||||
typedef struct GLPatch_s GLPatch_t;
|
||||
|
||||
#endif //_HWR_DATA_
|
||||
|
|
|
@ -212,35 +212,32 @@ typedef struct
|
|||
// You pass a combination of these flags to DrawPolygon()
|
||||
enum EPolyFlags
|
||||
{
|
||||
// the first 5 are mutually exclusive
|
||||
|
||||
PF_Masked = 0x00000001, // Poly is alpha scaled and 0 alpha pels are discarded (holes in texture)
|
||||
// Mutually exclusive blend flags
|
||||
PF_Masked = 0x00000001, // Poly is alpha scaled and 0 alpha pixels are discarded (holes in texture)
|
||||
PF_Translucent = 0x00000002, // Poly is transparent, alpha = level of transparency
|
||||
PF_Additive = 0x00000004, // Poly is added to the frame buffer
|
||||
PF_Environment = 0x00000008, // Poly should be drawn environment mapped.
|
||||
// Hurdler: used for text drawing
|
||||
PF_Substractive = 0x00000010, // for splat
|
||||
PF_NoAlphaTest = 0x00000020, // hiden param
|
||||
PF_Fog = 0x00000040, // Fog blocks
|
||||
PF_Blending = (PF_Environment|PF_Additive|PF_Translucent|PF_Masked|PF_Substractive|PF_Fog)&~PF_NoAlphaTest,
|
||||
PF_Environment = 0x00000004, // Poly should be drawn environment mapped. (Hurdler: used for text drawing)
|
||||
PF_Additive = 0x00000008, // Additive color blending
|
||||
PF_AdditiveSource = 0x00000010, // Source blending factor is additive. This is the opposite of regular additive blending.
|
||||
PF_Subtractive = 0x00000020, // Subtractive color blending
|
||||
PF_ReverseSubtract = 0x00000040, // Reverse subtract, used in wall splats (decals)
|
||||
PF_Multiplicative = 0x00000080, // Multiplicative color blending
|
||||
PF_Fog = 0x20000000, // Fog blocks
|
||||
PF_NoAlphaTest = 0x40000000, // Disables alpha testing
|
||||
PF_Blending = (PF_Masked|PF_Translucent|PF_Environment|PF_Additive|PF_AdditiveSource|PF_Subtractive|PF_ReverseSubtract|PF_Multiplicative|PF_Fog) & ~PF_NoAlphaTest,
|
||||
|
||||
// other flag bits
|
||||
|
||||
PF_Occlude = 0x00000100, // Update the depth buffer
|
||||
PF_NoDepthTest = 0x00000200, // Disable the depth test mode
|
||||
PF_Invisible = 0x00000400, // Disable write to color buffer
|
||||
PF_Decal = 0x00000800, // Enable polygon offset
|
||||
// other flag bits
|
||||
PF_Occlude = 0x00000100, // Updates the depth buffer
|
||||
PF_NoDepthTest = 0x00000200, // Disables the depth test mode
|
||||
PF_Invisible = 0x00000400, // Disables write to color buffer
|
||||
PF_Decal = 0x00000800, // Enables polygon offset
|
||||
PF_Modulated = 0x00001000, // Modulation (multiply output with constant ARGB)
|
||||
// When set, pass the color constant into the FSurfaceInfo -> PolyColor
|
||||
PF_NoTexture = 0x00002000, // Use the small white texture
|
||||
PF_Corona = 0x00004000, // Tell the rendrer we are drawing a corona
|
||||
PF_Ripple = 0x00008000, // Water shader effect
|
||||
PF_RemoveYWrap = 0x00010000, // Force clamp texture on Y
|
||||
PF_ForceWrapX = 0x00020000, // Force repeat texture on X
|
||||
PF_ForceWrapY = 0x00040000, // Force repeat texture on Y
|
||||
PF_Clip = 0x40000000, // clip to frustum and nearz plane (glide only, automatic in opengl)
|
||||
PF_NoZClip = 0x20000000, // in conjonction with PF_Clip
|
||||
PF_Debug = 0x80000000 // print debug message in driver :)
|
||||
PF_NoTexture = 0x00002000, // Disables texturing
|
||||
PF_Corona = 0x00004000, // Tells the renderer we are drawing a corona
|
||||
PF_Ripple = 0x00008000, // Water effect shader
|
||||
PF_RemoveYWrap = 0x00010000, // Forces clamp texture on Y
|
||||
PF_ForceWrapX = 0x00020000, // Forces repeat texture on X
|
||||
PF_ForceWrapY = 0x00040000 // Forces repeat texture on Y
|
||||
};
|
||||
|
||||
|
||||
|
@ -258,7 +255,16 @@ enum ETextureFlags
|
|||
TF_TRANSPARENT = 0x00000040, // texture with some alpha == 0
|
||||
};
|
||||
|
||||
typedef struct GLMipmap_s FTextureInfo;
|
||||
struct FTextureInfo
|
||||
{
|
||||
UINT32 width, height;
|
||||
UINT32 downloaded;
|
||||
UINT32 format;
|
||||
|
||||
struct GLMipmap_s *texture;
|
||||
struct FTextureInfo *prev, *next;
|
||||
};
|
||||
typedef struct FTextureInfo FTextureInfo;
|
||||
|
||||
// jimita 14032019
|
||||
struct FLightInfo
|
||||
|
|
|
@ -68,10 +68,11 @@ static UINT8 softwaretranstogl_lo[11] = { 0, 12, 24, 36, 48, 60, 71, 83, 95,111
|
|||
// Notes : x,y : positions relative to the original Doom resolution
|
||||
// : textes(console+score) + menus + status bar
|
||||
// -----------------+
|
||||
void HWR_DrawPatch(GLPatch_t *gpatch, INT32 x, INT32 y, INT32 option)
|
||||
void HWR_DrawPatch(patch_t *gpatch, INT32 x, INT32 y, INT32 option)
|
||||
{
|
||||
FOutVector v[4];
|
||||
FBITFIELD flags;
|
||||
GLPatch_t *hwrPatch;
|
||||
|
||||
// 3--2
|
||||
// | /|
|
||||
|
@ -84,6 +85,7 @@ void HWR_DrawPatch(GLPatch_t *gpatch, INT32 x, INT32 y, INT32 option)
|
|||
|
||||
// make patch ready in hardware cache
|
||||
HWR_GetPatch(gpatch);
|
||||
hwrPatch = ((GLPatch_t *)gpatch->hardware);
|
||||
|
||||
switch (option & V_SCALEPATCHMASK)
|
||||
{
|
||||
|
@ -103,17 +105,17 @@ void HWR_DrawPatch(GLPatch_t *gpatch, INT32 x, INT32 y, INT32 option)
|
|||
if (option & V_NOSCALESTART)
|
||||
sdupx = sdupy = 2.0f;
|
||||
|
||||
v[0].x = v[3].x = (x*sdupx-SHORT(gpatch->leftoffset)*pdupx)/vid.width - 1;
|
||||
v[2].x = v[1].x = (x*sdupx+(SHORT(gpatch->width)-SHORT(gpatch->leftoffset))*pdupx)/vid.width - 1;
|
||||
v[0].y = v[1].y = 1-(y*sdupy-SHORT(gpatch->topoffset)*pdupy)/vid.height;
|
||||
v[2].y = v[3].y = 1-(y*sdupy+(SHORT(gpatch->height)-SHORT(gpatch->topoffset))*pdupy)/vid.height;
|
||||
v[0].x = v[3].x = (x*sdupx-(gpatch->leftoffset)*pdupx)/vid.width - 1;
|
||||
v[2].x = v[1].x = (x*sdupx+(gpatch->width-gpatch->leftoffset)*pdupx)/vid.width - 1;
|
||||
v[0].y = v[1].y = 1-(y*sdupy-(gpatch->topoffset)*pdupy)/vid.height;
|
||||
v[2].y = v[3].y = 1-(y*sdupy+(gpatch->height-gpatch->topoffset)*pdupy)/vid.height;
|
||||
|
||||
v[0].z = v[1].z = v[2].z = v[3].z = 1.0f;
|
||||
|
||||
v[0].s = v[3].s = 0.0f;
|
||||
v[2].s = v[1].s = gpatch->max_s;
|
||||
v[2].s = v[1].s = hwrPatch->max_s;
|
||||
v[0].t = v[1].t = 0.0f;
|
||||
v[2].t = v[3].t = gpatch->max_t;
|
||||
v[2].t = v[3].t = hwrPatch->max_t;
|
||||
|
||||
flags = PF_Translucent|PF_NoDepthTest;
|
||||
|
||||
|
@ -126,13 +128,14 @@ void HWR_DrawPatch(GLPatch_t *gpatch, INT32 x, INT32 y, INT32 option)
|
|||
HWD.pfnDrawPolygon(NULL, v, 4, flags);
|
||||
}
|
||||
|
||||
void HWR_DrawStretchyFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, fixed_t vscale, INT32 option, const UINT8 *colormap)
|
||||
void HWR_DrawStretchyFixedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, fixed_t vscale, INT32 option, const UINT8 *colormap)
|
||||
{
|
||||
FOutVector v[4];
|
||||
FBITFIELD flags;
|
||||
float cx = FIXED_TO_FLOAT(x);
|
||||
float cy = FIXED_TO_FLOAT(y);
|
||||
UINT8 alphalevel = ((option & V_ALPHAMASK) >> V_ALPHASHIFT);
|
||||
GLPatch_t *hwrPatch;
|
||||
|
||||
// 3--2
|
||||
// | /|
|
||||
|
@ -151,6 +154,8 @@ void HWR_DrawStretchyFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t
|
|||
else
|
||||
HWR_GetMappedPatch(gpatch, colormap);
|
||||
|
||||
hwrPatch = ((GLPatch_t *)gpatch->hardware);
|
||||
|
||||
dupx = (float)vid.dupx;
|
||||
dupy = (float)vid.dupy;
|
||||
|
||||
|
@ -181,13 +186,13 @@ void HWR_DrawStretchyFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t
|
|||
|
||||
// left offset
|
||||
if (option & V_FLIP)
|
||||
offsetx = (float)(SHORT(gpatch->width) - SHORT(gpatch->leftoffset)) * fscalew;
|
||||
offsetx = (float)(gpatch->width - gpatch->leftoffset) * fscalew;
|
||||
else
|
||||
offsetx = (float)SHORT(gpatch->leftoffset) * fscalew;
|
||||
offsetx = (float)(gpatch->leftoffset) * fscalew;
|
||||
|
||||
// top offset
|
||||
// TODO: make some kind of vertical version of V_FLIP, maybe by deprecating V_OFFSET in future?!?
|
||||
offsety = (float)SHORT(gpatch->topoffset) * fscaleh;
|
||||
offsety = (float)(gpatch->topoffset) * fscaleh;
|
||||
|
||||
if ((option & (V_NOSCALESTART|V_OFFSET)) == (V_NOSCALESTART|V_OFFSET)) // Multiply by dupx/dupy for crosshairs
|
||||
{
|
||||
|
@ -277,17 +282,14 @@ void HWR_DrawStretchyFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t
|
|||
// 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 && SHORT(gpatch->width) == BASEVIDWIDTH && cy >= -0.1f && cy <= 0.1f && SHORT(gpatch->height) == BASEVIDHEIGHT)
|
||||
if (cx >= -0.1f && cx <= 0.1f && gpatch->width == BASEVIDWIDTH && cy >= -0.1f && cy <= 0.1f && gpatch->height == BASEVIDHEIGHT)
|
||||
{
|
||||
// Need to temporarily cache the real patch to get the colour of the top left pixel
|
||||
patch_t *realpatch = W_CacheSoftwarePatchNumPwad(gpatch->wadnum, gpatch->lumpnum, PU_STATIC);
|
||||
const column_t *column = (const column_t *)((const UINT8 *)(realpatch) + LONG((realpatch)->columnofs[0]));
|
||||
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]));
|
||||
}
|
||||
Z_Free(realpatch);
|
||||
}
|
||||
// centre screen
|
||||
if (fabsf((float)vid.width - (float)BASEVIDWIDTH * dupx) > 1.0E-36f)
|
||||
|
@ -317,13 +319,13 @@ void HWR_DrawStretchyFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t
|
|||
|
||||
if (pscale != FRACUNIT || (splitscreen && option & V_PERPLAYER))
|
||||
{
|
||||
fwidth = (float)SHORT(gpatch->width) * fscalew * dupx;
|
||||
fheight = (float)SHORT(gpatch->height) * fscaleh * dupy;
|
||||
fwidth = (float)(gpatch->width) * fscalew * dupx;
|
||||
fheight = (float)(gpatch->height) * fscaleh * dupy;
|
||||
}
|
||||
else
|
||||
{
|
||||
fwidth = (float)SHORT(gpatch->width) * dupx;
|
||||
fheight = (float)SHORT(gpatch->height) * dupy;
|
||||
fwidth = (float)(gpatch->width) * dupx;
|
||||
fheight = (float)(gpatch->height) * dupy;
|
||||
}
|
||||
|
||||
// positions of the cx, cy, are between 0 and vid.width/vid.height now, we need them to be between -1 and 1
|
||||
|
@ -345,17 +347,17 @@ void HWR_DrawStretchyFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t
|
|||
|
||||
if (option & V_FLIP)
|
||||
{
|
||||
v[0].s = v[3].s = gpatch->max_s;
|
||||
v[0].s = v[3].s = hwrPatch->max_s;
|
||||
v[2].s = v[1].s = 0.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
v[0].s = v[3].s = 0.0f;
|
||||
v[2].s = v[1].s = gpatch->max_s;
|
||||
v[2].s = v[1].s = hwrPatch->max_s;
|
||||
}
|
||||
|
||||
v[0].t = v[1].t = 0.0f;
|
||||
v[2].t = v[3].t = gpatch->max_t;
|
||||
v[2].t = v[3].t = hwrPatch->max_t;
|
||||
|
||||
flags = PF_Translucent|PF_NoDepthTest;
|
||||
|
||||
|
@ -380,13 +382,14 @@ void HWR_DrawStretchyFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t
|
|||
HWD.pfnDrawPolygon(NULL, v, 4, flags);
|
||||
}
|
||||
|
||||
void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, INT32 option, fixed_t sx, fixed_t sy, fixed_t w, fixed_t h)
|
||||
void HWR_DrawCroppedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, INT32 option, fixed_t sx, fixed_t sy, fixed_t w, fixed_t h)
|
||||
{
|
||||
FOutVector v[4];
|
||||
FBITFIELD flags;
|
||||
float cx = FIXED_TO_FLOAT(x);
|
||||
float cy = FIXED_TO_FLOAT(y);
|
||||
UINT8 alphalevel = ((option & V_ALPHAMASK) >> V_ALPHASHIFT);
|
||||
GLPatch_t *hwrPatch;
|
||||
|
||||
// 3--2
|
||||
// | /|
|
||||
|
@ -399,6 +402,7 @@ void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscal
|
|||
|
||||
// make patch ready in hardware cache
|
||||
HWR_GetPatch(gpatch);
|
||||
hwrPatch = ((GLPatch_t *)gpatch->hardware);
|
||||
|
||||
dupx = (float)vid.dupx;
|
||||
dupy = (float)vid.dupy;
|
||||
|
@ -423,8 +427,8 @@ void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscal
|
|||
|
||||
// fuck it, no GL support for croppedpatch v_perplayer right now. it's not like it's accessible to Lua or anything, and we only use it for menus...
|
||||
|
||||
cy -= (float)SHORT(gpatch->topoffset) * fscale;
|
||||
cx -= (float)SHORT(gpatch->leftoffset) * fscale;
|
||||
cy -= (float)(gpatch->topoffset) * fscale;
|
||||
cx -= (float)(gpatch->leftoffset) * fscale;
|
||||
|
||||
if (!(option & V_NOSCALESTART))
|
||||
{
|
||||
|
@ -436,17 +440,14 @@ void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscal
|
|||
// 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 && SHORT(gpatch->width) == BASEVIDWIDTH && cy >= -0.1f && cy <= 0.1f && SHORT(gpatch->height) == BASEVIDHEIGHT)
|
||||
if (cx >= -0.1f && cx <= 0.1f && gpatch->width == BASEVIDWIDTH && cy >= -0.1f && cy <= 0.1f && gpatch->height == BASEVIDHEIGHT)
|
||||
{
|
||||
// Need to temporarily cache the real patch to get the colour of the top left pixel
|
||||
patch_t *realpatch = W_CacheSoftwarePatchNumPwad(gpatch->wadnum, gpatch->lumpnum, PU_STATIC);
|
||||
const column_t *column = (const column_t *)((const UINT8 *)(realpatch) + LONG((realpatch)->columnofs[0]));
|
||||
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]));
|
||||
}
|
||||
Z_Free(realpatch);
|
||||
}
|
||||
// centre screen
|
||||
if (fabsf((float)vid.width - (float)BASEVIDWIDTH * dupx) > 1.0E-36f)
|
||||
|
@ -469,11 +470,11 @@ void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscal
|
|||
fwidth = w;
|
||||
fheight = h;
|
||||
|
||||
if (fwidth > SHORT(gpatch->width))
|
||||
fwidth = SHORT(gpatch->width);
|
||||
if (fwidth > gpatch->width)
|
||||
fwidth = gpatch->width;
|
||||
|
||||
if (fheight > SHORT(gpatch->height))
|
||||
fheight = SHORT(gpatch->height);
|
||||
if (fheight > gpatch->height)
|
||||
fheight = gpatch->height;
|
||||
|
||||
if (pscale != FRACUNIT)
|
||||
{
|
||||
|
@ -503,17 +504,17 @@ void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscal
|
|||
|
||||
v[0].z = v[1].z = v[2].z = v[3].z = 1.0f;
|
||||
|
||||
v[0].s = v[3].s = ((sx )/(float)SHORT(gpatch->width) )*gpatch->max_s;
|
||||
if (sx + w > SHORT(gpatch->width))
|
||||
v[2].s = v[1].s = gpatch->max_s;
|
||||
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;
|
||||
else
|
||||
v[2].s = v[1].s = ((sx+w)/(float)SHORT(gpatch->width) )*gpatch->max_s;
|
||||
v[2].s = v[1].s = ((sx+w)/(float)(gpatch->width))*hwrPatch->max_s;
|
||||
|
||||
v[0].t = v[1].t = ((sy )/(float)SHORT(gpatch->height))*gpatch->max_t;
|
||||
if (sy + h > SHORT(gpatch->height))
|
||||
v[2].t = v[3].t = gpatch->max_t;
|
||||
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;
|
||||
else
|
||||
v[2].t = v[3].t = ((sy+h)/(float)SHORT(gpatch->height))*gpatch->max_t;
|
||||
v[2].t = v[3].t = ((sy+h)/(float)(gpatch->height))*hwrPatch->max_t;
|
||||
|
||||
flags = PF_Translucent|PF_NoDepthTest;
|
||||
|
||||
|
@ -541,7 +542,7 @@ void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscal
|
|||
void HWR_DrawPic(INT32 x, INT32 y, lumpnum_t lumpnum)
|
||||
{
|
||||
FOutVector v[4];
|
||||
const GLPatch_t *patch;
|
||||
const patch_t *patch;
|
||||
|
||||
// make pic ready in hardware cache
|
||||
patch = HWR_GetPic(lumpnum);
|
||||
|
@ -558,10 +559,10 @@ void HWR_DrawPic(INT32 x, INT32 y, lumpnum_t lumpnum)
|
|||
|
||||
v[0].z = v[1].z = v[2].z = v[3].z = 1.0f;
|
||||
|
||||
v[0].s = v[3].s = 0;
|
||||
v[2].s = v[1].s = patch->max_s;
|
||||
v[0].t = v[1].t = 0;
|
||||
v[2].t = v[3].t = patch->max_t;
|
||||
v[0].s = v[3].s = 0;
|
||||
v[2].s = v[1].s = ((GLPatch_t *)patch->hardware)->max_s;
|
||||
v[0].t = v[1].t = 0;
|
||||
v[2].t = v[3].t = ((GLPatch_t *)patch->hardware)->max_t;
|
||||
|
||||
|
||||
//Hurdler: Boris, the same comment as above... but maybe for pics
|
||||
|
@ -570,7 +571,7 @@ void HWR_DrawPic(INT32 x, INT32 y, lumpnum_t lumpnum)
|
|||
// But then, the question is: why not 0 instead of PF_Masked ?
|
||||
// or maybe PF_Environment ??? (like what I said above)
|
||||
// BP: PF_Environment don't change anything ! and 0 is undifined
|
||||
HWD.pfnDrawPolygon(NULL, v, 4, PF_Translucent | PF_NoDepthTest | PF_Clip | PF_NoZClip);
|
||||
HWD.pfnDrawPolygon(NULL, v, 4, PF_Translucent | PF_NoDepthTest);
|
||||
}
|
||||
|
||||
// ==========================================================================
|
||||
|
@ -638,7 +639,7 @@ void HWR_DrawFlatFill (INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatlumpnum
|
|||
v[0].t = v[1].t = (float)((y & flatflag)/dflatsize);
|
||||
v[2].t = v[3].t = (float)(v[0].t + h/dflatsize);
|
||||
|
||||
HWR_LiterallyGetFlat(flatlumpnum);
|
||||
HWR_GetRawFlat(flatlumpnum);
|
||||
|
||||
//Hurdler: Boris, the same comment as above... but maybe for pics
|
||||
// it not a problem since they don't have any transparent pixel
|
||||
|
@ -934,7 +935,7 @@ void HWR_DrawViewBorder(INT32 clearlines)
|
|||
INT32 top, side;
|
||||
INT32 baseviewwidth, baseviewheight;
|
||||
INT32 basewindowx, basewindowy;
|
||||
GLPatch_t *patch;
|
||||
patch_t *patch;
|
||||
|
||||
// if (gl_viewwidth == vid.width)
|
||||
// return;
|
||||
|
|
|
@ -40,8 +40,9 @@ EXPORT void HWRAPI(DrawIndexedTriangles) (FSurfaceInfo *pSurf, FOutVector *pOutV
|
|||
EXPORT void HWRAPI(RenderSkyDome) (gl_sky_t *sky);
|
||||
EXPORT void HWRAPI(SetBlend) (FBITFIELD PolyFlags);
|
||||
EXPORT void HWRAPI(ClearBuffer) (FBOOLEAN ColorMask, FBOOLEAN DepthMask, FRGBAFloat *ClearColor);
|
||||
EXPORT void HWRAPI(SetTexture) (FTextureInfo *TexInfo);
|
||||
EXPORT void HWRAPI(UpdateTexture) (FTextureInfo *TexInfo);
|
||||
EXPORT void HWRAPI(SetTexture) (GLMipmap_t *TexInfo);
|
||||
EXPORT void HWRAPI(UpdateTexture) (GLMipmap_t *TexInfo);
|
||||
EXPORT void HWRAPI(DeleteTexture) (GLMipmap_t *TexInfo);
|
||||
EXPORT void HWRAPI(ReadRect) (INT32 x, INT32 y, INT32 width, INT32 height, INT32 dst_stride, UINT16 *dst_data);
|
||||
EXPORT void HWRAPI(GClipRect) (INT32 minx, INT32 miny, INT32 maxx, INT32 maxy, float nearclip);
|
||||
EXPORT void HWRAPI(ClearMipMapCache) (void);
|
||||
|
@ -95,6 +96,7 @@ struct hwdriver_s
|
|||
ClearBuffer pfnClearBuffer;
|
||||
SetTexture pfnSetTexture;
|
||||
UpdateTexture pfnUpdateTexture;
|
||||
DeleteTexture pfnDeleteTexture;
|
||||
ReadRect pfnReadRect;
|
||||
GClipRect pfnGClipRect;
|
||||
ClearMipMapCache pfnClearMipMapCache;
|
||||
|
|
|
@ -62,19 +62,32 @@ typedef struct
|
|||
typedef struct gl_vissprite_s
|
||||
{
|
||||
float x1, x2;
|
||||
float tz, ty;
|
||||
float z1, z2;
|
||||
float gz, gzt;
|
||||
|
||||
float tz;
|
||||
float tracertz; // for MF2_LINKDRAW sprites, this contains tracer's tz for use in sorting
|
||||
//lumpnum_t patchlumpnum;
|
||||
GLPatch_t *gpatch;
|
||||
boolean flip;
|
||||
UINT8 translucency; //alpha level 0-255
|
||||
mobj_t *mobj; // NOTE: This is a precipmobj_t if precip is true !!! Watch out.
|
||||
|
||||
float scale;
|
||||
float shadowheight, shadowscale;
|
||||
|
||||
float spritexscale, spriteyscale;
|
||||
float spritexoffset, spriteyoffset;
|
||||
|
||||
UINT32 renderflags;
|
||||
UINT8 rotateflags;
|
||||
|
||||
boolean flip, vflip;
|
||||
boolean precip; // Tails 08-25-2002
|
||||
boolean vflip;
|
||||
//Hurdler: 25/04/2000: now support colormap in hardware mode
|
||||
boolean rotated;
|
||||
UINT8 translucency; //alpha level 0-255
|
||||
|
||||
//Hurdler: 25/04/2000: now support colormap in hardware mode
|
||||
UINT8 *colormap;
|
||||
INT32 dispoffset; // copy of info->dispoffset, affects ordering but not drawing
|
||||
float z1, z2;
|
||||
|
||||
patch_t *gpatch;
|
||||
mobj_t *mobj; // NOTE: This is a precipmobj_t if precip is true !!! Watch out.
|
||||
} gl_vissprite_t;
|
||||
|
||||
// --------
|
||||
|
@ -86,25 +99,36 @@ extern size_t addsubsector;
|
|||
void HWR_InitPolyPool(void);
|
||||
void HWR_FreePolyPool(void);
|
||||
|
||||
void HWR_FreeExtraSubsectors(void);
|
||||
|
||||
// --------
|
||||
// hw_cache.c
|
||||
// --------
|
||||
void HWR_InitTextureCache(void);
|
||||
void HWR_FreeTextureCache(void);
|
||||
void HWR_FreeMipmapCache(void);
|
||||
void HWR_FreeExtraSubsectors(void);
|
||||
void HWR_InitMapTextures(void);
|
||||
void HWR_LoadMapTextures(size_t pnumtextures);
|
||||
void HWR_FreeMapTextures(void);
|
||||
|
||||
void HWR_GetLevelFlat(levelflat_t *levelflat);
|
||||
void HWR_LiterallyGetFlat(lumpnum_t flatlumpnum);
|
||||
GLMapTexture_t *HWR_GetTexture(INT32 tex);
|
||||
void HWR_GetPatch(GLPatch_t *gpatch);
|
||||
void HWR_GetMappedPatch(GLPatch_t *gpatch, const UINT8 *colormap);
|
||||
void HWR_UnlockCachedPatch(GLPatch_t *gpatch);
|
||||
GLPatch_t *HWR_GetPic(lumpnum_t lumpnum);
|
||||
void HWR_SetPalette(RGBA_t *palette);
|
||||
GLPatch_t *HWR_GetCachedGLPatchPwad(UINT16 wad, UINT16 lump);
|
||||
GLPatch_t *HWR_GetCachedGLPatch(lumpnum_t lumpnum);
|
||||
patch_t *HWR_GetCachedGLPatchPwad(UINT16 wad, UINT16 lump);
|
||||
patch_t *HWR_GetCachedGLPatch(lumpnum_t lumpnum);
|
||||
|
||||
void HWR_GetPatch(patch_t *patch);
|
||||
void HWR_GetMappedPatch(patch_t *patch, const UINT8 *colormap);
|
||||
void HWR_GetFadeMask(lumpnum_t fademasklumpnum);
|
||||
patch_t *HWR_GetPic(lumpnum_t lumpnum);
|
||||
|
||||
GLMapTexture_t *HWR_GetTexture(INT32 tex);
|
||||
void HWR_GetLevelFlat(levelflat_t *levelflat);
|
||||
void HWR_GetRawFlat(lumpnum_t flatlumpnum);
|
||||
|
||||
void HWR_FreeTexture(patch_t *patch);
|
||||
void HWR_FreeTextureData(patch_t *patch);
|
||||
void HWR_FreeTextureColormaps(patch_t *patch);
|
||||
void HWR_ClearAllTextures(void);
|
||||
void HWR_FreeColormapCache(void);
|
||||
void HWR_UnlockCachedPatch(GLPatch_t *gpatch);
|
||||
|
||||
void HWR_SetPalette(RGBA_t *palette);
|
||||
|
||||
|
||||
// --------
|
||||
// hw_draw.c
|
||||
|
|
|
@ -35,8 +35,7 @@
|
|||
|
||||
#define DL_HIGH_QUALITY
|
||||
//#define STATICLIGHT //Hurdler: TODO!
|
||||
//#define LIGHTMAPFLAGS (PF_Masked|PF_Clip|PF_NoAlphaTest) // debug see overdraw
|
||||
#define LIGHTMAPFLAGS (PF_Modulated|PF_Additive|PF_Clip)
|
||||
#define LIGHTMAPFLAGS (PF_Modulated|PF_AdditiveSource)
|
||||
|
||||
#ifdef ALAM_LIGHTING
|
||||
static dynlights_t view_dynlights[2]; // 2 players in splitscreen mode
|
||||
|
@ -254,6 +253,7 @@ light_t *t_lspr[NUMSPRITES] =
|
|||
&lspr[NOLIGHT], // SPR_SIGN
|
||||
&lspr[NOLIGHT], // SPR_SPIK
|
||||
&lspr[NOLIGHT], // SPR_SFLM
|
||||
&lspr[NOLIGHT], // SPR_TFLM
|
||||
&lspr[NOLIGHT], // SPR_USPK
|
||||
&lspr[NOLIGHT], // SPR_WSPK
|
||||
&lspr[NOLIGHT], // SPR_WSPB
|
||||
|
@ -1056,7 +1056,7 @@ void HWR_DoCoronasLighting(FOutVector *outVerts, gl_vissprite_t *spr)
|
|||
|
||||
HWR_GetPic(coronalumpnum); /// \todo use different coronas
|
||||
|
||||
HWD.pfnDrawPolygon (&Surf, light, 4, PF_Modulated | PF_Additive | PF_Clip | PF_Corona | PF_NoDepthTest);
|
||||
HWD.pfnDrawPolygon (&Surf, light, 4, PF_Modulated | PF_AdditiveSource | PF_Corona | PF_NoDepthTest);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -1144,7 +1144,7 @@ void HWR_DrawCoronas(void)
|
|||
light[3].y = cy+size*1.33f;
|
||||
light[3].s = 0.0f; light[3].t = 1.0f;
|
||||
|
||||
HWD.pfnDrawPolygon (&Surf, light, 4, PF_Modulated | PF_Additive | PF_Clip | PF_NoDepthTest | PF_Corona);
|
||||
HWD.pfnDrawPolygon (&Surf, light, 4, PF_Modulated | PF_AdditiveSource | PF_NoDepthTest | PF_Corona);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -37,13 +37,12 @@ void HWR_DrawViewBorder(INT32 clearlines);
|
|||
void HWR_DrawFlatFill(INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatlumpnum);
|
||||
void HWR_InitTextureMapping(void);
|
||||
void HWR_SetViewSize(void);
|
||||
void HWR_DrawPatch(GLPatch_t *gpatch, INT32 x, INT32 y, INT32 option);
|
||||
void HWR_DrawStretchyFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, fixed_t vscale, INT32 option, const UINT8 *colormap);
|
||||
void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t scale, INT32 option, fixed_t sx, fixed_t sy, fixed_t w, fixed_t h);
|
||||
void HWR_DrawPatch(patch_t *gpatch, INT32 x, INT32 y, INT32 option);
|
||||
void HWR_DrawStretchyFixedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, fixed_t vscale, INT32 option, const UINT8 *colormap);
|
||||
void HWR_DrawCroppedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t scale, INT32 option, fixed_t sx, fixed_t sy, fixed_t w, fixed_t h);
|
||||
void HWR_MakePatch(const patch_t *patch, GLPatch_t *grPatch, GLMipmap_t *grMipmap, boolean makebitmap);
|
||||
void HWR_CreatePlanePolygons(INT32 bspnum);
|
||||
void HWR_CreateStaticLightmaps(INT32 bspnum);
|
||||
void HWR_LoadTextures(size_t pnumtextures);
|
||||
void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color);
|
||||
void HWR_DrawFadeFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color, UINT16 actualcolor, UINT8 strength);
|
||||
void HWR_DrawConsoleFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color, UINT32 actualcolor); // Lat: separate flags from color since color needs to be an uint to work right.
|
||||
|
@ -55,7 +54,6 @@ boolean HWR_Screenshot(const char *pathname);
|
|||
void HWR_AddCommands(void);
|
||||
void HWR_AddSessionCommands(void);
|
||||
void transform(float *cx, float *cy, float *cz);
|
||||
FBITFIELD HWR_TranstableToAlpha(INT32 transtablenum, FSurfaceInfo *pSurf);
|
||||
INT32 HWR_GetTextureUsed(void);
|
||||
void HWR_DoPostProcessor(player_t *player);
|
||||
void HWR_StartScreenWipe(void);
|
||||
|
@ -66,10 +64,15 @@ void HWR_DoTintedWipe(UINT8 wipenum, UINT8 scrnnum);
|
|||
void HWR_MakeScreenFinalTexture(void);
|
||||
void HWR_DrawScreenFinalTexture(int width, int height);
|
||||
|
||||
// This stuff is put here so MD2's can use them
|
||||
// This stuff is put here so models can use them
|
||||
void HWR_Lighting(FSurfaceInfo *Surface, INT32 light_level, extracolormap_t *colormap);
|
||||
UINT8 HWR_FogBlockAlpha(INT32 light, extracolormap_t *colormap); // Let's see if this can work
|
||||
|
||||
UINT8 HWR_GetTranstableAlpha(INT32 transtablenum);
|
||||
FBITFIELD HWR_GetBlendModeFlag(INT32 ast);
|
||||
FBITFIELD HWR_SurfaceBlend(INT32 style, INT32 transtablenum, FSurfaceInfo *pSurf);
|
||||
FBITFIELD HWR_TranstableToAlpha(INT32 transtablenum, FSurfaceInfo *pSurf);
|
||||
|
||||
boolean HWR_CompileShaders(void);
|
||||
|
||||
void HWR_LoadAllCustomShaders(void);
|
||||
|
@ -113,11 +116,11 @@ extern FTransform atransform;
|
|||
|
||||
|
||||
// Render stats
|
||||
extern int ps_hw_skyboxtime;
|
||||
extern int ps_hw_nodesorttime;
|
||||
extern int ps_hw_nodedrawtime;
|
||||
extern int ps_hw_spritesorttime;
|
||||
extern int ps_hw_spritedrawtime;
|
||||
extern precise_t ps_hw_skyboxtime;
|
||||
extern precise_t ps_hw_nodesorttime;
|
||||
extern precise_t ps_hw_nodedrawtime;
|
||||
extern precise_t ps_hw_spritesorttime;
|
||||
extern precise_t ps_hw_spritedrawtime;
|
||||
|
||||
// Render stats for batching
|
||||
extern int ps_hw_numpolys;
|
||||
|
@ -127,9 +130,13 @@ extern int ps_hw_numshaders;
|
|||
extern int ps_hw_numtextures;
|
||||
extern int ps_hw_numpolyflags;
|
||||
extern int ps_hw_numcolors;
|
||||
extern int ps_hw_batchsorttime;
|
||||
extern int ps_hw_batchdrawtime;
|
||||
extern precise_t ps_hw_batchsorttime;
|
||||
extern precise_t ps_hw_batchdrawtime;
|
||||
|
||||
extern boolean gl_init;
|
||||
extern boolean gl_maploaded;
|
||||
extern boolean gl_maptexturesloaded;
|
||||
extern boolean gl_sessioncommandsadded;
|
||||
extern boolean gl_shadersavailable;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
@ -364,48 +364,53 @@ static GLTextureFormat_t PCX_Load(const char *filename, int *w, int *h,
|
|||
// -----------------+
|
||||
static void md2_loadTexture(md2_t *model)
|
||||
{
|
||||
GLPatch_t *grpatch;
|
||||
patch_t *patch;
|
||||
GLPatch_t *grPatch = NULL;
|
||||
const char *filename = model->filename;
|
||||
|
||||
if (model->grpatch)
|
||||
{
|
||||
grpatch = model->grpatch;
|
||||
Z_Free(grpatch->mipmap->data);
|
||||
patch = model->grpatch;
|
||||
grPatch = (GLPatch_t *)(patch->hardware);
|
||||
if (grPatch)
|
||||
Z_Free(grPatch->mipmap->data);
|
||||
}
|
||||
else
|
||||
{
|
||||
grpatch = Z_Calloc(sizeof *grpatch, PU_HWRPATCHINFO,
|
||||
&(model->grpatch));
|
||||
grpatch->mipmap = Z_Calloc(sizeof (GLMipmap_t), PU_HWRPATCHINFO, NULL);
|
||||
}
|
||||
model->grpatch = patch = Patch_Create(NULL, 0, NULL);
|
||||
|
||||
if (!grpatch->mipmap->downloaded && !grpatch->mipmap->data)
|
||||
if (!patch->hardware)
|
||||
Patch_AllocateHardwarePatch(patch);
|
||||
|
||||
if (grPatch == NULL)
|
||||
grPatch = (GLPatch_t *)(patch->hardware);
|
||||
|
||||
if (!grPatch->mipmap->downloaded && !grPatch->mipmap->data)
|
||||
{
|
||||
int w = 0, h = 0;
|
||||
UINT32 size;
|
||||
RGBA_t *image;
|
||||
|
||||
#ifdef HAVE_PNG
|
||||
grpatch->mipmap->format = PNG_Load(filename, &w, &h, grpatch);
|
||||
if (grpatch->mipmap->format == 0)
|
||||
grPatch->mipmap->format = PNG_Load(filename, &w, &h, grPatch);
|
||||
if (grPatch->mipmap->format == 0)
|
||||
#endif
|
||||
grpatch->mipmap->format = PCX_Load(filename, &w, &h, grpatch);
|
||||
if (grpatch->mipmap->format == 0)
|
||||
grPatch->mipmap->format = PCX_Load(filename, &w, &h, grPatch);
|
||||
if (grPatch->mipmap->format == 0)
|
||||
{
|
||||
model->notexturefile = true; // mark it so its not searched for again repeatedly
|
||||
return;
|
||||
}
|
||||
|
||||
grpatch->mipmap->downloaded = 0;
|
||||
grpatch->mipmap->flags = 0;
|
||||
grPatch->mipmap->downloaded = 0;
|
||||
grPatch->mipmap->flags = 0;
|
||||
|
||||
grpatch->width = (INT16)w;
|
||||
grpatch->height = (INT16)h;
|
||||
grpatch->mipmap->width = (UINT16)w;
|
||||
grpatch->mipmap->height = (UINT16)h;
|
||||
patch->width = (INT16)w;
|
||||
patch->height = (INT16)h;
|
||||
grPatch->mipmap->width = (UINT16)w;
|
||||
grPatch->mipmap->height = (UINT16)h;
|
||||
|
||||
// Lactozilla: Apply colour cube
|
||||
image = grpatch->mipmap->data;
|
||||
image = grPatch->mipmap->data;
|
||||
size = w*h;
|
||||
while (size--)
|
||||
{
|
||||
|
@ -413,7 +418,7 @@ static void md2_loadTexture(md2_t *model)
|
|||
image++;
|
||||
}
|
||||
}
|
||||
HWD.pfnSetTexture(grpatch->mipmap);
|
||||
HWD.pfnSetTexture(grPatch->mipmap);
|
||||
}
|
||||
|
||||
// -----------------+
|
||||
|
@ -421,48 +426,53 @@ static void md2_loadTexture(md2_t *model)
|
|||
// -----------------+
|
||||
static void md2_loadBlendTexture(md2_t *model)
|
||||
{
|
||||
GLPatch_t *grpatch;
|
||||
patch_t *patch;
|
||||
GLPatch_t *grPatch = NULL;
|
||||
char *filename = Z_Malloc(strlen(model->filename)+7, PU_STATIC, NULL);
|
||||
strcpy(filename, model->filename);
|
||||
|
||||
strcpy(filename, model->filename);
|
||||
FIL_ForceExtension(filename, "_blend.png");
|
||||
|
||||
if (model->blendgrpatch)
|
||||
{
|
||||
grpatch = model->blendgrpatch;
|
||||
Z_Free(grpatch->mipmap->data);
|
||||
patch = model->blendgrpatch;
|
||||
grPatch = (GLPatch_t *)(patch->hardware);
|
||||
if (grPatch)
|
||||
Z_Free(grPatch->mipmap->data);
|
||||
}
|
||||
else
|
||||
{
|
||||
grpatch = Z_Calloc(sizeof *grpatch, PU_HWRPATCHINFO,
|
||||
&(model->blendgrpatch));
|
||||
grpatch->mipmap = Z_Calloc(sizeof (GLMipmap_t), PU_HWRPATCHINFO, NULL);
|
||||
}
|
||||
model->blendgrpatch = patch = Patch_Create(NULL, 0, NULL);
|
||||
|
||||
if (!grpatch->mipmap->downloaded && !grpatch->mipmap->data)
|
||||
if (!patch->hardware)
|
||||
Patch_AllocateHardwarePatch(patch);
|
||||
|
||||
if (grPatch == NULL)
|
||||
grPatch = (GLPatch_t *)(patch->hardware);
|
||||
|
||||
if (!grPatch->mipmap->downloaded && !grPatch->mipmap->data)
|
||||
{
|
||||
int w = 0, h = 0;
|
||||
#ifdef HAVE_PNG
|
||||
grpatch->mipmap->format = PNG_Load(filename, &w, &h, grpatch);
|
||||
if (grpatch->mipmap->format == 0)
|
||||
grPatch->mipmap->format = PNG_Load(filename, &w, &h, grPatch);
|
||||
if (grPatch->mipmap->format == 0)
|
||||
#endif
|
||||
grpatch->mipmap->format = PCX_Load(filename, &w, &h, grpatch);
|
||||
if (grpatch->mipmap->format == 0)
|
||||
grPatch->mipmap->format = PCX_Load(filename, &w, &h, grPatch);
|
||||
if (grPatch->mipmap->format == 0)
|
||||
{
|
||||
model->noblendfile = true; // mark it so its not searched for again repeatedly
|
||||
Z_Free(filename);
|
||||
return;
|
||||
}
|
||||
|
||||
grpatch->mipmap->downloaded = 0;
|
||||
grpatch->mipmap->flags = 0;
|
||||
grPatch->mipmap->downloaded = 0;
|
||||
grPatch->mipmap->flags = 0;
|
||||
|
||||
grpatch->width = (INT16)w;
|
||||
grpatch->height = (INT16)h;
|
||||
grpatch->mipmap->width = (UINT16)w;
|
||||
grpatch->mipmap->height = (UINT16)h;
|
||||
patch->width = (INT16)w;
|
||||
patch->height = (INT16)h;
|
||||
grPatch->mipmap->width = (UINT16)w;
|
||||
grPatch->mipmap->height = (UINT16)h;
|
||||
}
|
||||
HWD.pfnSetTexture(grpatch->mipmap); // We do need to do this so that it can be cleared and knows to recreate it when necessary
|
||||
HWD.pfnSetTexture(grPatch->mipmap); // We do need to do this so that it can be cleared and knows to recreate it when necessary
|
||||
|
||||
Z_Free(filename);
|
||||
}
|
||||
|
@ -517,7 +527,7 @@ void HWR_InitModels(void)
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// length of the player model prefix
|
||||
prefixlen = strlen(PLAYERMODELPREFIX);
|
||||
|
||||
|
@ -692,8 +702,10 @@ spritemodelfound:
|
|||
#define SETBRIGHTNESS(brightness,r,g,b) \
|
||||
brightness = (UINT8)(((1063*(UINT16)(r))/5000) + ((3576*(UINT16)(g))/5000) + ((361*(UINT16)(b))/5000))
|
||||
|
||||
static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, GLMipmap_t *grmip, INT32 skinnum, skincolornum_t color)
|
||||
static void HWR_CreateBlendedTexture(patch_t *gpatch, patch_t *blendgpatch, GLMipmap_t *grMipmap, INT32 skinnum, skincolornum_t color)
|
||||
{
|
||||
GLPatch_t *hwrPatch = gpatch->hardware;
|
||||
GLPatch_t *hwrBlendPatch = blendgpatch->hardware;
|
||||
UINT16 w = gpatch->width, h = gpatch->height;
|
||||
UINT32 size = w*h;
|
||||
RGBA_t *image, *blendimage, *cur, blendcolor;
|
||||
|
@ -706,28 +718,29 @@ static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch,
|
|||
memset(translation, 0, sizeof(translation));
|
||||
memset(cutoff, 0, sizeof(cutoff));
|
||||
|
||||
if (grmip->width == 0)
|
||||
if (grMipmap->width == 0)
|
||||
{
|
||||
grmip->width = gpatch->width;
|
||||
grmip->height = gpatch->height;
|
||||
grMipmap->width = gpatch->width;
|
||||
grMipmap->height = gpatch->height;
|
||||
|
||||
// no wrap around, no chroma key
|
||||
grmip->flags = 0;
|
||||
grMipmap->flags = 0;
|
||||
|
||||
// setup the texture info
|
||||
grmip->format = GL_TEXFMT_RGBA;
|
||||
grMipmap->format = GL_TEXFMT_RGBA;
|
||||
}
|
||||
|
||||
if (grmip->data)
|
||||
if (grMipmap->data)
|
||||
{
|
||||
Z_Free(grmip->data);
|
||||
grmip->data = NULL;
|
||||
Z_Free(grMipmap->data);
|
||||
grMipmap->data = NULL;
|
||||
}
|
||||
|
||||
cur = Z_Malloc(size*4, PU_HWRMODELTEXTURE, &grmip->data);
|
||||
cur = Z_Malloc(size*4, PU_HWRMODELTEXTURE, &grMipmap->data);
|
||||
memset(cur, 0x00, size*4);
|
||||
|
||||
image = gpatch->mipmap->data;
|
||||
blendimage = blendgpatch->mipmap->data;
|
||||
image = hwrPatch->mipmap->data;
|
||||
blendimage = hwrBlendPatch->mipmap->data;
|
||||
|
||||
// TC_METALSONIC includes an actual skincolor translation, on top of its flashing.
|
||||
if (skinnum == TC_METALSONIC)
|
||||
|
@ -1066,37 +1079,47 @@ skippixel:
|
|||
|
||||
#undef SETBRIGHTNESS
|
||||
|
||||
static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, INT32 skinnum, const UINT8 *colormap, skincolornum_t color)
|
||||
static void HWR_GetBlendedTexture(patch_t *patch, patch_t *blendpatch, INT32 skinnum, const UINT8 *colormap, skincolornum_t color)
|
||||
{
|
||||
// mostly copied from HWR_GetMappedPatch, hence the similarities and comment
|
||||
GLMipmap_t *grmip, *newmip;
|
||||
GLPatch_t *grPatch = patch->hardware;
|
||||
GLPatch_t *grBlendPatch = NULL;
|
||||
GLMipmap_t *grMipmap, *newMipmap;
|
||||
|
||||
if (colormap == colormaps || colormap == NULL)
|
||||
if (blendpatch == NULL || colormap == colormaps || colormap == NULL)
|
||||
{
|
||||
// Don't do any blending
|
||||
HWD.pfnSetTexture(gpatch->mipmap);
|
||||
HWD.pfnSetTexture(grPatch->mipmap);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((blendgpatch && blendgpatch->mipmap->format)
|
||||
&& (gpatch->width != blendgpatch->width || gpatch->height != blendgpatch->height))
|
||||
if ((blendpatch && (grBlendPatch = blendpatch->hardware) && grBlendPatch->mipmap->format)
|
||||
&& (patch->width != blendpatch->width || patch->height != blendpatch->height))
|
||||
{
|
||||
// Blend image exists, but it's bad.
|
||||
HWD.pfnSetTexture(gpatch->mipmap);
|
||||
HWD.pfnSetTexture(grPatch->mipmap);
|
||||
return;
|
||||
}
|
||||
|
||||
// search for the mipmap
|
||||
// skip the first (no colormap translated)
|
||||
for (grmip = gpatch->mipmap; grmip->nextcolormap; )
|
||||
for (grMipmap = grPatch->mipmap; grMipmap->nextcolormap; )
|
||||
{
|
||||
grmip = grmip->nextcolormap;
|
||||
if (grmip->colormap == colormap)
|
||||
grMipmap = grMipmap->nextcolormap;
|
||||
if (grMipmap->colormap && grMipmap->colormap->source == colormap)
|
||||
{
|
||||
if (grmip->downloaded && grmip->data)
|
||||
if (grMipmap->downloaded && grMipmap->data)
|
||||
{
|
||||
HWD.pfnSetTexture(grmip); // found the colormap, set it to the correct texture
|
||||
Z_ChangeTag(grmip->data, PU_HWRMODELTEXTURE_UNLOCKED);
|
||||
if (memcmp(grMipmap->colormap->data, colormap, 256 * sizeof(UINT8)))
|
||||
{
|
||||
M_Memcpy(grMipmap->colormap->data, colormap, 256 * sizeof(UINT8));
|
||||
HWR_CreateBlendedTexture(patch, blendpatch, grMipmap, skinnum, color);
|
||||
HWD.pfnUpdateTexture(grMipmap);
|
||||
}
|
||||
else
|
||||
HWD.pfnSetTexture(grMipmap); // found the colormap, set it to the correct texture
|
||||
|
||||
Z_ChangeTag(grMipmap->data, PU_HWRMODELTEXTURE_UNLOCKED);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -1107,18 +1130,21 @@ static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, INT
|
|||
|
||||
//BP: WARNING: don't free it manually without clearing the cache of harware renderer
|
||||
// (it have a liste of mipmap)
|
||||
// this malloc is cleared in HWR_FreeTextureCache
|
||||
// this malloc is cleared in HWR_FreeColormapCache
|
||||
// (...) unfortunately z_malloc fragment alot the memory :(so malloc is better
|
||||
newmip = calloc(1, sizeof (*newmip));
|
||||
if (newmip == NULL)
|
||||
newMipmap = calloc(1, sizeof (*newMipmap));
|
||||
if (newMipmap == NULL)
|
||||
I_Error("%s: Out of memory", "HWR_GetBlendedTexture");
|
||||
grmip->nextcolormap = newmip;
|
||||
newmip->colormap = colormap;
|
||||
grMipmap->nextcolormap = newMipmap;
|
||||
|
||||
HWR_CreateBlendedTexture(gpatch, blendgpatch, newmip, skinnum, color);
|
||||
newMipmap->colormap = Z_Calloc(sizeof(*newMipmap->colormap), PU_HWRPATCHCOLMIPMAP, NULL);
|
||||
newMipmap->colormap->source = colormap;
|
||||
M_Memcpy(newMipmap->colormap->data, colormap, 256 * sizeof(UINT8));
|
||||
|
||||
HWD.pfnSetTexture(newmip);
|
||||
Z_ChangeTag(newmip->data, PU_HWRMODELTEXTURE_UNLOCKED);
|
||||
HWR_CreateBlendedTexture(patch, blendpatch, newMipmap, skinnum, color);
|
||||
|
||||
HWD.pfnSetTexture(newMipmap);
|
||||
Z_ChangeTag(newMipmap->data, PU_HWRMODELTEXTURE_UNLOCKED);
|
||||
}
|
||||
|
||||
#define NORMALFOG 0x00000000
|
||||
|
@ -1206,9 +1232,11 @@ static UINT8 HWR_GetModelSprite2(md2_t *md2, skin_t *skin, UINT8 spr2, player_t
|
|||
}
|
||||
|
||||
// Adjust texture coords of model to fit into a patch's max_s and max_t
|
||||
static void adjustTextureCoords(model_t *model, GLPatch_t *gpatch)
|
||||
static void adjustTextureCoords(model_t *model, patch_t *patch)
|
||||
{
|
||||
int i;
|
||||
GLPatch_t *gpatch = ((GLPatch_t *)patch->hardware);
|
||||
|
||||
for (i = 0; i < model->numMeshes; i++)
|
||||
{
|
||||
int j;
|
||||
|
@ -1286,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)
|
||||
|
@ -1294,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)
|
||||
|
@ -1308,13 +1336,13 @@ boolean HWR_DrawModel(gl_vissprite_t *spr)
|
|||
|
||||
// Look at HWR_ProjectSprite for more
|
||||
{
|
||||
GLPatch_t *gpatch;
|
||||
patch_t *gpatch, *blendgpatch;
|
||||
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;
|
||||
|
@ -1326,15 +1354,16 @@ boolean HWR_DrawModel(gl_vissprite_t *spr)
|
|||
//if (tics > durs)
|
||||
//durs = tics;
|
||||
|
||||
if (spr->mobj->flags2 & MF2_SHADOW)
|
||||
Surf.PolyColor.s.alpha = 0x40;
|
||||
else if (spr->mobj->frame & FF_TRANSMASK)
|
||||
HWR_TranstableToAlpha((spr->mobj->frame & FF_TRANSMASK)>>FF_TRANSSHIFT, &Surf);
|
||||
if (spr->mobj->frame & FF_TRANSMASK)
|
||||
Surf.PolyFlags = HWR_SurfaceBlend(spr->mobj->blendmode, (spr->mobj->frame & FF_TRANSMASK)>>FF_TRANSSHIFT, &Surf);
|
||||
else
|
||||
Surf.PolyColor.s.alpha = 0xFF;
|
||||
{
|
||||
Surf.PolyColor.s.alpha = (spr->mobj->flags2 & MF2_SHADOW) ? 0x40 : 0xff;
|
||||
Surf.PolyFlags = HWR_GetBlendModeFlag(spr->mobj->blendmode);
|
||||
}
|
||||
|
||||
// dont forget to enabled the depth test because we can't do this like
|
||||
// before: polygons models are not sorted
|
||||
// don't forget to enable the depth test because we can't do this
|
||||
// like before: model polygons are not sorted
|
||||
|
||||
// 1. load model+texture if not already loaded
|
||||
// 2. draw model with correct position, rotation,...
|
||||
|
@ -1353,16 +1382,33 @@ boolean HWR_DrawModel(gl_vissprite_t *spr)
|
|||
// texture loading before model init, so it knows if sprite graphics are used, which
|
||||
// means that texture coordinates have to be adjusted
|
||||
gpatch = md2->grpatch;
|
||||
if (!gpatch || ((!gpatch->mipmap->format || !gpatch->mipmap->downloaded) && !md2->notexturefile))
|
||||
md2_loadTexture(md2);
|
||||
gpatch = md2->grpatch; // Load it again, because it isn't being loaded into gpatch after md2_loadtexture...
|
||||
if (gpatch)
|
||||
hwrPatch = ((GLPatch_t *)gpatch->hardware);
|
||||
|
||||
if ((gpatch && gpatch->mipmap->format) // don't load the blend texture if the base texture isn't available
|
||||
&& (!md2->blendgrpatch
|
||||
|| ((!((GLPatch_t *)md2->blendgrpatch)->mipmap->format || !((GLPatch_t *)md2->blendgrpatch)->mipmap->downloaded)
|
||||
&& !md2->noblendfile)))
|
||||
if (!gpatch || !hwrPatch
|
||||
|| ((!hwrPatch->mipmap->format || !hwrPatch->mipmap->downloaded) && !md2->notexturefile))
|
||||
md2_loadTexture(md2);
|
||||
|
||||
// Load it again, because it isn't being loaded into gpatch after md2_loadtexture...
|
||||
gpatch = md2->grpatch;
|
||||
if (gpatch)
|
||||
hwrPatch = ((GLPatch_t *)gpatch->hardware);
|
||||
|
||||
// Load blend texture
|
||||
blendgpatch = md2->blendgrpatch;
|
||||
if (blendgpatch)
|
||||
hwrBlendPatch = ((GLPatch_t *)blendgpatch->hardware);
|
||||
|
||||
if ((gpatch && hwrPatch && hwrPatch->mipmap->format) // don't load the blend texture if the base texture isn't available
|
||||
&& (!blendgpatch || !hwrBlendPatch
|
||||
|| ((!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)
|
||||
|
@ -1376,7 +1422,7 @@ boolean HWR_DrawModel(gl_vissprite_t *spr)
|
|||
md2_printModelInfo(md2->model);
|
||||
// If model uses sprite patch as texture, then
|
||||
// adjust texture coordinates to take power of two textures into account
|
||||
if (!gpatch || !gpatch->mipmap->format)
|
||||
if (!gpatch || !hwrPatch->mipmap->format)
|
||||
adjustTextureCoords(md2->model, spr->gpatch);
|
||||
// note down the max_s and max_t that end up in the VBO
|
||||
md2->model->vbo_max_s = md2->model->max_s;
|
||||
|
@ -1395,7 +1441,7 @@ boolean HWR_DrawModel(gl_vissprite_t *spr)
|
|||
finalscale = md2->scale;
|
||||
//Hurdler: arf, I don't like that implementation at all... too much crappy
|
||||
|
||||
if (gpatch && gpatch->mipmap->format) // else if meant that if a texture couldn't be loaded, it would just end up using something else's texture
|
||||
if (gpatch && hwrPatch && hwrPatch->mipmap->format) // else if meant that if a texture couldn't be loaded, it would just end up using something else's texture
|
||||
{
|
||||
INT32 skinnum = TC_DEFAULT;
|
||||
|
||||
|
@ -1428,21 +1474,19 @@ boolean HWR_DrawModel(gl_vissprite_t *spr)
|
|||
}
|
||||
|
||||
// Translation or skin number found
|
||||
HWR_GetBlendedTexture(gpatch, (GLPatch_t *)md2->blendgrpatch, skinnum, spr->colormap, (skincolornum_t)spr->mobj->color);
|
||||
HWR_GetBlendedTexture(gpatch, blendgpatch, skinnum, spr->colormap, (skincolornum_t)spr->mobj->color);
|
||||
}
|
||||
else
|
||||
else // Sprite
|
||||
{
|
||||
// Sprite
|
||||
gpatch = spr->gpatch; //W_CachePatchNum(spr->patchlumpnum, PU_CACHE);
|
||||
// Check if sprite dimensions are different from previously used sprite.
|
||||
// If so, uvs need to be readjusted.
|
||||
// Comparing floats with the != operator here should be okay because they
|
||||
// are just copies of glpatches' max_s and max_t values.
|
||||
// Instead of the != operator, memcmp is used to avoid a compiler warning.
|
||||
if (memcmp(&(gpatch->max_s), &(md2->model->max_s), sizeof(md2->model->max_s)) != 0 ||
|
||||
memcmp(&(gpatch->max_t), &(md2->model->max_t), sizeof(md2->model->max_t)) != 0)
|
||||
adjustTextureCoords(md2->model, gpatch);
|
||||
HWR_GetMappedPatch(gpatch, spr->colormap);
|
||||
if (memcmp(&(hwrPatch->max_s), &(md2->model->max_s), sizeof(md2->model->max_s)) != 0 ||
|
||||
memcmp(&(hwrPatch->max_t), &(md2->model->max_t), sizeof(md2->model->max_t)) != 0)
|
||||
adjustTextureCoords(md2->model, spr->gpatch);
|
||||
HWR_GetMappedPatch(spr->gpatch, spr->colormap);
|
||||
}
|
||||
|
||||
if (spr->mobj->frame & FF_ANIMATE)
|
||||
|
|
|
@ -58,8 +58,9 @@ static GLuint tex_downloaded = 0;
|
|||
static GLfloat fov = 90.0f;
|
||||
static FBITFIELD CurrentPolyFlags;
|
||||
|
||||
static FTextureInfo *gl_cachetail = NULL;
|
||||
static FTextureInfo *gl_cachehead = NULL;
|
||||
// Linked list of all textures.
|
||||
static FTextureInfo *TexCacheTail = NULL;
|
||||
static FTextureInfo *TexCacheHead = NULL;
|
||||
|
||||
RGBA_t myPaletteData[256];
|
||||
GLint screen_width = 0; // used by Draw2DLine()
|
||||
|
@ -419,6 +420,10 @@ static PFNglBufferData pglBufferData;
|
|||
typedef void (APIENTRY * PFNglDeleteBuffers) (GLsizei n, const GLuint *buffers);
|
||||
static PFNglDeleteBuffers pglDeleteBuffers;
|
||||
|
||||
/* 2.0 functions */
|
||||
typedef void (APIENTRY * PFNglBlendEquation) (GLenum mode);
|
||||
static PFNglBlendEquation pglBlendEquation;
|
||||
|
||||
|
||||
/* 1.2 Parms */
|
||||
/* GL_CLAMP_TO_EDGE_EXT */
|
||||
|
@ -874,6 +879,9 @@ void SetupGLFunc4(void)
|
|||
pglBufferData = GetGLFunc("glBufferData");
|
||||
pglDeleteBuffers = GetGLFunc("glDeleteBuffers");
|
||||
|
||||
/* 2.0 funcs */
|
||||
pglBlendEquation = GetGLFunc("glBlendEquation");
|
||||
|
||||
#ifdef GL_SHADERS
|
||||
pglCreateShader = GetGLFunc("glCreateShader");
|
||||
pglShaderSource = GetGLFunc("glShaderSource");
|
||||
|
@ -954,8 +962,6 @@ EXPORT boolean HWRAPI(CompileShaders) (void)
|
|||
}
|
||||
}
|
||||
|
||||
SetShader(SHADER_DEFAULT);
|
||||
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
|
@ -1234,6 +1240,7 @@ void SetStates(void)
|
|||
|
||||
pglTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
|
||||
pglEnable(GL_ALPHA_TEST);
|
||||
pglAlphaFunc(GL_NOTEQUAL, 0.0f);
|
||||
|
||||
//pglBlendFunc(GL_ONE, GL_ZERO); // copy pixel to frame buffer (opaque)
|
||||
|
@ -1276,6 +1283,37 @@ void SetStates(void)
|
|||
}
|
||||
|
||||
|
||||
// -----------------+
|
||||
// DeleteTexture : Deletes a texture from the GPU and frees its data
|
||||
// -----------------+
|
||||
EXPORT void HWRAPI(DeleteTexture) (GLMipmap_t *pTexInfo)
|
||||
{
|
||||
FTextureInfo *head = TexCacheHead;
|
||||
|
||||
if (!pTexInfo)
|
||||
return;
|
||||
else if (pTexInfo->downloaded)
|
||||
pglDeleteTextures(1, (GLuint *)&pTexInfo->downloaded);
|
||||
|
||||
while (head)
|
||||
{
|
||||
if (head->downloaded == pTexInfo->downloaded)
|
||||
{
|
||||
if (head->next)
|
||||
head->next->prev = head->prev;
|
||||
if (head->prev)
|
||||
head->prev->next = head->next;
|
||||
free(head);
|
||||
break;
|
||||
}
|
||||
|
||||
head = head->next;
|
||||
}
|
||||
|
||||
pTexInfo->downloaded = 0;
|
||||
}
|
||||
|
||||
|
||||
// -----------------+
|
||||
// Flush : flush OpenGL textures
|
||||
// : Clear list of downloaded mipmaps
|
||||
|
@ -1284,15 +1322,25 @@ void Flush(void)
|
|||
{
|
||||
//GL_DBG_Printf ("HWR_Flush()\n");
|
||||
|
||||
while (gl_cachehead)
|
||||
while (TexCacheHead)
|
||||
{
|
||||
if (gl_cachehead->downloaded)
|
||||
pglDeleteTextures(1, (GLuint *)&gl_cachehead->downloaded);
|
||||
gl_cachehead->downloaded = 0;
|
||||
gl_cachehead = gl_cachehead->nextmipmap;
|
||||
}
|
||||
gl_cachetail = gl_cachehead = NULL; //Hurdler: well, gl_cachehead is already NULL
|
||||
FTextureInfo *pTexInfo = TexCacheHead;
|
||||
GLMipmap_t *texture = pTexInfo->texture;
|
||||
|
||||
if (pTexInfo->downloaded)
|
||||
{
|
||||
pglDeleteTextures(1, (GLuint *)&pTexInfo->downloaded);
|
||||
pTexInfo->downloaded = 0;
|
||||
}
|
||||
|
||||
if (texture)
|
||||
texture->downloaded = 0;
|
||||
|
||||
TexCacheHead = pTexInfo->next;
|
||||
free(pTexInfo);
|
||||
}
|
||||
|
||||
TexCacheTail = TexCacheHead = NULL; //Hurdler: well, TexCacheHead is already NULL
|
||||
tex_downloaded = 0;
|
||||
}
|
||||
|
||||
|
@ -1493,64 +1541,110 @@ EXPORT void HWRAPI(Draw2DLine) (F2DCoord * v1,
|
|||
pglEnable(GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
static void Clamp2D(GLenum pname)
|
||||
{
|
||||
pglTexParameteri(GL_TEXTURE_2D, pname, GL_CLAMP); // fallback clamp
|
||||
pglTexParameteri(GL_TEXTURE_2D, pname, GL_CLAMP_TO_EDGE);
|
||||
}
|
||||
|
||||
|
||||
// -----------------+
|
||||
// SetBlend : Set render mode
|
||||
// -----------------+
|
||||
// PF_Masked - we could use an ALPHA_TEST of GL_EQUAL, and alpha ref of 0,
|
||||
// is it faster when pixels are discarded ?
|
||||
|
||||
static void Clamp2D(GLenum pname)
|
||||
{
|
||||
pglTexParameteri(GL_TEXTURE_2D, pname, GL_CLAMP); // fallback clamp
|
||||
pglTexParameteri(GL_TEXTURE_2D, pname, GL_CLAMP_TO_EDGE);
|
||||
}
|
||||
|
||||
static void SetBlendEquation(GLenum mode)
|
||||
{
|
||||
if (pglBlendEquation)
|
||||
pglBlendEquation(mode);
|
||||
}
|
||||
|
||||
static void SetBlendMode(FBITFIELD flags)
|
||||
{
|
||||
// Set blending function
|
||||
switch (flags)
|
||||
{
|
||||
case PF_Translucent & PF_Blending:
|
||||
pglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // alpha = level of transparency
|
||||
break;
|
||||
case PF_Masked & PF_Blending:
|
||||
// Hurdler: does that mean lighting is only made by alpha src?
|
||||
// it sounds ok, but not for polygonsmooth
|
||||
pglBlendFunc(GL_SRC_ALPHA, GL_ZERO); // 0 alpha = holes in texture
|
||||
break;
|
||||
case PF_Additive & PF_Blending:
|
||||
case PF_Subtractive & PF_Blending:
|
||||
case PF_ReverseSubtract & PF_Blending:
|
||||
case PF_Environment & PF_Blending:
|
||||
pglBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
|
||||
break;
|
||||
case PF_AdditiveSource & PF_Blending:
|
||||
pglBlendFunc(GL_SRC_ALPHA, GL_ONE); // src * alpha + dest
|
||||
break;
|
||||
case PF_Multiplicative & PF_Blending:
|
||||
pglBlendFunc(GL_DST_COLOR, GL_ZERO);
|
||||
break;
|
||||
case PF_Fog & PF_Fog:
|
||||
// Sryder: Fog
|
||||
// multiplies input colour by input alpha, and destination colour by input colour, then adds them
|
||||
pglBlendFunc(GL_SRC_ALPHA, GL_SRC_COLOR);
|
||||
break;
|
||||
default: // must be 0, otherwise it's an error
|
||||
// No blending
|
||||
pglBlendFunc(GL_ONE, GL_ZERO); // the same as no blending
|
||||
break;
|
||||
}
|
||||
|
||||
// Set blending equation
|
||||
switch (flags)
|
||||
{
|
||||
case PF_Subtractive & PF_Blending:
|
||||
SetBlendEquation(GL_FUNC_SUBTRACT);
|
||||
break;
|
||||
case PF_ReverseSubtract & PF_Blending:
|
||||
// good for shadow
|
||||
// not really but what else ?
|
||||
SetBlendEquation(GL_FUNC_REVERSE_SUBTRACT);
|
||||
break;
|
||||
default:
|
||||
SetBlendEquation(GL_FUNC_ADD);
|
||||
break;
|
||||
}
|
||||
|
||||
// Alpha test
|
||||
switch (flags)
|
||||
{
|
||||
case PF_Masked & PF_Blending:
|
||||
pglAlphaFunc(GL_GREATER, 0.5f);
|
||||
break;
|
||||
case PF_Translucent & PF_Blending:
|
||||
case PF_Additive & PF_Blending:
|
||||
case PF_AdditiveSource & PF_Blending:
|
||||
case PF_Subtractive & PF_Blending:
|
||||
case PF_ReverseSubtract & PF_Blending:
|
||||
case PF_Environment & PF_Blending:
|
||||
case PF_Multiplicative & PF_Blending:
|
||||
pglAlphaFunc(GL_NOTEQUAL, 0.0f);
|
||||
break;
|
||||
case PF_Fog & PF_Fog:
|
||||
pglAlphaFunc(GL_ALWAYS, 0.0f); // Don't discard zero alpha fragments
|
||||
break;
|
||||
default:
|
||||
pglAlphaFunc(GL_GREATER, 0.5f);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
EXPORT void HWRAPI(SetBlend) (FBITFIELD PolyFlags)
|
||||
{
|
||||
FBITFIELD Xor;
|
||||
Xor = CurrentPolyFlags^PolyFlags;
|
||||
if (Xor & (PF_Blending|PF_RemoveYWrap|PF_ForceWrapX|PF_ForceWrapY|PF_Occlude|PF_NoTexture|PF_Modulated|PF_NoDepthTest|PF_Decal|PF_Invisible|PF_NoAlphaTest))
|
||||
if (Xor & (PF_Blending|PF_RemoveYWrap|PF_ForceWrapX|PF_ForceWrapY|PF_Occlude|PF_NoTexture|PF_Modulated|PF_NoDepthTest|PF_Decal|PF_Invisible))
|
||||
{
|
||||
if (Xor&(PF_Blending)) // if blending mode must be changed
|
||||
{
|
||||
switch (PolyFlags & PF_Blending) {
|
||||
case PF_Translucent & PF_Blending:
|
||||
pglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // alpha = level of transparency
|
||||
pglAlphaFunc(GL_NOTEQUAL, 0.0f);
|
||||
break;
|
||||
case PF_Masked & PF_Blending:
|
||||
// Hurdler: does that mean lighting is only made by alpha src?
|
||||
// it sounds ok, but not for polygonsmooth
|
||||
pglBlendFunc(GL_SRC_ALPHA, GL_ZERO); // 0 alpha = holes in texture
|
||||
pglAlphaFunc(GL_GREATER, 0.5f);
|
||||
break;
|
||||
case PF_Additive & PF_Blending:
|
||||
pglBlendFunc(GL_SRC_ALPHA, GL_ONE); // src * alpha + dest
|
||||
pglAlphaFunc(GL_NOTEQUAL, 0.0f);
|
||||
break;
|
||||
case PF_Environment & PF_Blending:
|
||||
pglBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
|
||||
pglAlphaFunc(GL_NOTEQUAL, 0.0f);
|
||||
break;
|
||||
case PF_Substractive & PF_Blending:
|
||||
// good for shadow
|
||||
// not really but what else ?
|
||||
pglBlendFunc(GL_ZERO, GL_ONE_MINUS_SRC_COLOR);
|
||||
pglAlphaFunc(GL_NOTEQUAL, 0.0f);
|
||||
break;
|
||||
case PF_Fog & PF_Fog:
|
||||
// Sryder: Fog
|
||||
// multiplies input colour by input alpha, and destination colour by input colour, then adds them
|
||||
pglBlendFunc(GL_SRC_ALPHA, GL_SRC_COLOR);
|
||||
pglAlphaFunc(GL_ALWAYS, 0.0f); // Don't discard zero alpha fragments
|
||||
break;
|
||||
default : // must be 0, otherwise it's an error
|
||||
// No blending
|
||||
pglBlendFunc(GL_ONE, GL_ZERO); // the same as no blending
|
||||
pglAlphaFunc(GL_GREATER, 0.5f);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (Xor & PF_Blending) // if blending mode must be changed
|
||||
SetBlendMode(PolyFlags & PF_Blending);
|
||||
|
||||
if (Xor & PF_NoAlphaTest)
|
||||
{
|
||||
if (PolyFlags & PF_NoAlphaTest)
|
||||
|
@ -1567,7 +1661,7 @@ EXPORT void HWRAPI(SetBlend) (FBITFIELD PolyFlags)
|
|||
pglDisable(GL_POLYGON_OFFSET_FILL);
|
||||
}
|
||||
|
||||
if (Xor&PF_NoDepthTest)
|
||||
if (Xor & PF_NoDepthTest)
|
||||
{
|
||||
if (PolyFlags & PF_NoDepthTest)
|
||||
pglDepthFunc(GL_ALWAYS); //pglDisable(GL_DEPTH_TEST);
|
||||
|
@ -1575,25 +1669,25 @@ EXPORT void HWRAPI(SetBlend) (FBITFIELD PolyFlags)
|
|||
pglDepthFunc(GL_LEQUAL); //pglEnable(GL_DEPTH_TEST);
|
||||
}
|
||||
|
||||
if (Xor&PF_RemoveYWrap)
|
||||
if (Xor & PF_RemoveYWrap)
|
||||
{
|
||||
if (PolyFlags & PF_RemoveYWrap)
|
||||
Clamp2D(GL_TEXTURE_WRAP_T);
|
||||
}
|
||||
|
||||
if (Xor&PF_ForceWrapX)
|
||||
if (Xor & PF_ForceWrapX)
|
||||
{
|
||||
if (PolyFlags & PF_ForceWrapX)
|
||||
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
||||
}
|
||||
|
||||
if (Xor&PF_ForceWrapY)
|
||||
if (Xor & PF_ForceWrapY)
|
||||
{
|
||||
if (PolyFlags & PF_ForceWrapY)
|
||||
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
||||
}
|
||||
|
||||
if (Xor&PF_Modulated)
|
||||
if (Xor & PF_Modulated)
|
||||
{
|
||||
#if defined (__unix__) || defined (UNIXCOMMON)
|
||||
if (oglflags & GLF_NOTEXENV)
|
||||
|
@ -1646,7 +1740,7 @@ EXPORT void HWRAPI(SetBlend) (FBITFIELD PolyFlags)
|
|||
// -----------------+
|
||||
// UpdateTexture : Updates the texture data.
|
||||
// -----------------+
|
||||
EXPORT void HWRAPI(UpdateTexture) (FTextureInfo *pTexInfo)
|
||||
EXPORT void HWRAPI(UpdateTexture) (GLMipmap_t *pTexInfo)
|
||||
{
|
||||
// Download a mipmap
|
||||
boolean updatemipmap = true;
|
||||
|
@ -1848,7 +1942,7 @@ EXPORT void HWRAPI(UpdateTexture) (FTextureInfo *pTexInfo)
|
|||
// -----------------+
|
||||
// SetTexture : The mipmap becomes the current texture source
|
||||
// -----------------+
|
||||
EXPORT void HWRAPI(SetTexture) (FTextureInfo *pTexInfo)
|
||||
EXPORT void HWRAPI(SetTexture) (GLMipmap_t *pTexInfo)
|
||||
{
|
||||
if (!pTexInfo)
|
||||
{
|
||||
|
@ -1865,15 +1959,25 @@ EXPORT void HWRAPI(SetTexture) (FTextureInfo *pTexInfo)
|
|||
}
|
||||
else
|
||||
{
|
||||
FTextureInfo *newTex = calloc(1, sizeof (*newTex));
|
||||
|
||||
UpdateTexture(pTexInfo);
|
||||
pTexInfo->nextmipmap = NULL;
|
||||
if (gl_cachetail)
|
||||
{ // insertion at the tail
|
||||
gl_cachetail->nextmipmap = pTexInfo;
|
||||
gl_cachetail = pTexInfo;
|
||||
|
||||
newTex->texture = pTexInfo;
|
||||
newTex->downloaded = (UINT32)pTexInfo->downloaded;
|
||||
newTex->width = (UINT32)pTexInfo->width;
|
||||
newTex->height = (UINT32)pTexInfo->height;
|
||||
newTex->format = (UINT32)pTexInfo->format;
|
||||
|
||||
// insertion at the tail
|
||||
if (TexCacheTail)
|
||||
{
|
||||
newTex->prev = TexCacheTail;
|
||||
TexCacheTail->next = newTex;
|
||||
TexCacheTail = newTex;
|
||||
}
|
||||
else // initialization of the linked list
|
||||
gl_cachetail = gl_cachehead = pTexInfo;
|
||||
TexCacheTail = TexCacheHead = newTex;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2569,6 +2673,7 @@ static void DrawModelEx(model_t *model, INT32 frameIndex, INT32 duration, INT32
|
|||
|
||||
boolean useVBO = true;
|
||||
|
||||
FBITFIELD flags;
|
||||
int i;
|
||||
|
||||
// Because otherwise, scaling the screen negatively vertically breaks the lighting
|
||||
|
@ -2636,8 +2741,6 @@ static void DrawModelEx(model_t *model, INT32 frameIndex, INT32 duration, INT32
|
|||
else
|
||||
pglColor4ubv((GLubyte*)&Surface->PolyColor.s);
|
||||
|
||||
SetBlend((poly.alpha < 1 ? PF_Translucent : (PF_Masked|PF_Occlude))|PF_Modulated);
|
||||
|
||||
tint.red = byte2float[Surface->TintColor.s.red];
|
||||
tint.green = byte2float[Surface->TintColor.s.green];
|
||||
tint.blue = byte2float[Surface->TintColor.s.blue];
|
||||
|
@ -2648,6 +2751,13 @@ static void DrawModelEx(model_t *model, INT32 frameIndex, INT32 duration, INT32
|
|||
fade.blue = byte2float[Surface->FadeColor.s.blue];
|
||||
fade.alpha = byte2float[Surface->FadeColor.s.alpha];
|
||||
|
||||
flags = (Surface->PolyFlags | PF_Modulated);
|
||||
if (Surface->PolyFlags & (PF_Additive|PF_AdditiveSource|PF_Subtractive|PF_ReverseSubtract|PF_Multiplicative))
|
||||
flags |= PF_Occlude;
|
||||
else if (Surface->PolyColor.s.alpha == 0xFF)
|
||||
flags |= (PF_Occlude | PF_Masked);
|
||||
|
||||
SetBlend(flags);
|
||||
Shader_SetUniforms(Surface, &poly, &tint, &fade);
|
||||
|
||||
pglEnable(GL_CULL_FACE);
|
||||
|
@ -2931,7 +3041,7 @@ EXPORT void HWRAPI(SetTransform) (FTransform *stransform)
|
|||
|
||||
EXPORT INT32 HWRAPI(GetTextureUsed) (void)
|
||||
{
|
||||
FTextureInfo *tmp = gl_cachehead;
|
||||
FTextureInfo *tmp = TexCacheHead;
|
||||
INT32 res = 0;
|
||||
|
||||
while (tmp)
|
||||
|
@ -2948,7 +3058,7 @@ EXPORT INT32 HWRAPI(GetTextureUsed) (void)
|
|||
|
||||
// Add it up!
|
||||
res += tmp->height*tmp->width*bpp;
|
||||
tmp = tmp->nextmipmap;
|
||||
tmp = tmp->next;
|
||||
}
|
||||
|
||||
return res;
|
||||
|
@ -3217,7 +3327,7 @@ EXPORT void HWRAPI(DoScreenWipe)(void)
|
|||
|
||||
pglClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
SetBlend(PF_Modulated|PF_NoDepthTest|PF_Clip|PF_NoZClip);
|
||||
SetBlend(PF_Modulated|PF_NoDepthTest);
|
||||
pglEnable(GL_TEXTURE_2D);
|
||||
|
||||
// Draw the original screen
|
||||
|
@ -3227,7 +3337,7 @@ EXPORT void HWRAPI(DoScreenWipe)(void)
|
|||
pglVertexPointer(3, GL_FLOAT, 0, screenVerts);
|
||||
pglDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||
|
||||
SetBlend(PF_Modulated|PF_Translucent|PF_NoDepthTest|PF_Clip|PF_NoZClip);
|
||||
SetBlend(PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||
|
||||
// Draw the end screen that fades in
|
||||
pglActiveTexture(GL_TEXTURE0);
|
||||
|
|
128
src/hu_stuff.c
128
src/hu_stuff.c
|
@ -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);
|
||||
|
@ -1794,8 +1796,8 @@ static void HU_DrawChat_Old(void)
|
|||
size_t i = 0;
|
||||
const char *ntalk = "Say: ", *ttalk = "Say-Team: ";
|
||||
const char *talk = ntalk;
|
||||
INT32 charwidth = 8 * con_scalefactor; //SHORT(hu_font['A'-HU_FONTSTART]->width) * con_scalefactor;
|
||||
INT32 charheight = 8 * con_scalefactor; //SHORT(hu_font['A'-HU_FONTSTART]->height) * con_scalefactor;
|
||||
INT32 charwidth = 8 * con_scalefactor; //(hu_font['A'-HU_FONTSTART]->width) * con_scalefactor;
|
||||
INT32 charheight = 8 * con_scalefactor; //(hu_font['A'-HU_FONTSTART]->height) * con_scalefactor;
|
||||
if (teamtalk)
|
||||
{
|
||||
talk = ttalk;
|
||||
|
@ -1816,7 +1818,7 @@ static void HU_DrawChat_Old(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
//charwidth = SHORT(hu_font[talk[i]-HU_FONTSTART]->width) * con_scalefactor;
|
||||
//charwidth = (hu_font[talk[i]-HU_FONTSTART]->width) * con_scalefactor;
|
||||
V_DrawCharacter(HU_INPUTX + c, y, talk[i++] | cv_constextsize.value | V_NOSCALESTART, true);
|
||||
}
|
||||
c += charwidth;
|
||||
|
@ -1844,7 +1846,7 @@ static void HU_DrawChat_Old(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
//charwidth = SHORT(hu_font[w_chat[i]-HU_FONTSTART]->width) * con_scalefactor;
|
||||
//charwidth = (hu_font[w_chat[i]-HU_FONTSTART]->width) * con_scalefactor;
|
||||
V_DrawCharacter(HU_INPUTX + c, y, w_chat[i++] | cv_constextsize.value | V_NOSCALESTART | t, true);
|
||||
}
|
||||
|
||||
|
@ -2109,15 +2111,18 @@ void HU_Drawer(void)
|
|||
return;
|
||||
|
||||
// draw the crosshair, not when viewing demos nor with chasecam
|
||||
if (!automapactive && cv_crosshair.value && !demoplayback &&
|
||||
(!camera.chase || ticcmd_ztargetfocus[0])
|
||||
&& !players[displayplayer].spectator)
|
||||
HU_DrawCrosshair();
|
||||
if (LUA_HudEnabled(hud_crosshair))
|
||||
{
|
||||
if (!automapactive && cv_crosshair.value && !demoplayback &&
|
||||
(!camera.chase || ticcmd_ztargetfocus[0])
|
||||
&& !players[displayplayer].spectator)
|
||||
HU_DrawCrosshair();
|
||||
|
||||
if (!automapactive && cv_crosshair2.value && !demoplayback &&
|
||||
(!camera2.chase || ticcmd_ztargetfocus[1])
|
||||
&& !players[secondarydisplayplayer].spectator)
|
||||
HU_DrawCrosshair2();
|
||||
if (!automapactive && cv_crosshair2.value && !demoplayback &&
|
||||
(!camera2.chase || ticcmd_ztargetfocus[1])
|
||||
&& !players[secondarydisplayplayer].spectator)
|
||||
HU_DrawCrosshair2();
|
||||
}
|
||||
|
||||
// draw desynch text
|
||||
if (hu_redownloadinggamestate)
|
||||
|
@ -2243,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),
|
||||
|
@ -2257,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
|
||||
|
@ -2272,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);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -2298,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))
|
||||
|
@ -2364,7 +2378,7 @@ void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, I
|
|||
}
|
||||
|
||||
if (players[tab[i].num].exiting || (players[tab[i].num].pflags & PF_FINISHED))
|
||||
V_DrawSmallScaledPatch(x - SHORT(exiticon->width)/2 - 1, y-3, 0, exiticon);
|
||||
V_DrawSmallScaledPatch(x - exiticon->width/2 - 1, y-3, 0, exiticon);
|
||||
|
||||
if (gametyperankings[gametype] == GT_RACE)
|
||||
{
|
||||
|
@ -2455,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)
|
||||
{
|
||||
|
@ -2497,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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2583,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)
|
||||
{
|
||||
|
@ -2621,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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2652,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));
|
||||
|
@ -2668,7 +2685,7 @@ void HU_DrawDualTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scoreline
|
|||
V_DrawSmallScaledPatch(x-28, y-4, 0, tagico);
|
||||
|
||||
if (players[tab[i].num].exiting || (players[tab[i].num].pflags & PF_FINISHED))
|
||||
V_DrawSmallScaledPatch(x - SHORT(exiticon->width)/2 - 1, y-3, 0, exiticon);
|
||||
V_DrawSmallScaledPatch(x - exiticon->width/2 - 1, y-3, 0, exiticon);
|
||||
|
||||
// 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))
|
||||
|
@ -2760,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));
|
||||
|
@ -3094,7 +3112,7 @@ static void HU_DrawCoopOverlay(void)
|
|||
if (LUA_HudEnabled(hud_tabemblems) && (!modifiedgame || savemoddata))
|
||||
{
|
||||
V_DrawString(160, 144, 0, va("- %d/%d", M_CountEmblems(), numemblems+numextraemblems));
|
||||
V_DrawScaledPatch(128, 144 - SHORT(emblemicon->height)/4, 0, emblemicon);
|
||||
V_DrawScaledPatch(128, 144 - emblemicon->height/4, 0, emblemicon);
|
||||
}
|
||||
|
||||
if (!LUA_HudEnabled(hud_coopemeralds))
|
||||
|
|
|
@ -21,15 +21,12 @@
|
|||
// copied from SDL mixer, plus GME
|
||||
typedef enum {
|
||||
MU_NONE,
|
||||
MU_CMD,
|
||||
MU_WAV,
|
||||
MU_MOD,
|
||||
MU_MID,
|
||||
MU_OGG,
|
||||
MU_MP3,
|
||||
MU_MP3_MAD_UNUSED, // use MU_MP3 instead
|
||||
MU_FLAC,
|
||||
MU_MODPLUG_UNUSED, // use MU_MOD instead
|
||||
MU_GME,
|
||||
MU_MOD_EX, // libopenmpt
|
||||
MU_MID_EX // Non-native MIDI
|
||||
|
|
|
@ -46,7 +46,13 @@ UINT32 I_GetFreeMem(UINT32 *total);
|
|||
*/
|
||||
tic_t I_GetTime(void);
|
||||
|
||||
int I_GetTimeMicros(void);// provides microsecond counter for render stats
|
||||
/** \brief Returns precise time value for performance measurement.
|
||||
*/
|
||||
precise_t I_GetPreciseTime(void);
|
||||
|
||||
/** \brief Returns the difference between precise times as microseconds.
|
||||
*/
|
||||
int I_PreciseToMicros(precise_t);
|
||||
|
||||
/** \brief The I_Sleep function
|
||||
|
||||
|
|
236
src/i_tcp.c
236
src/i_tcp.c
|
@ -20,127 +20,121 @@
|
|||
#endif
|
||||
|
||||
#ifndef NO_IPV6
|
||||
#define HAVE_IPV6
|
||||
#define HAVE_IPV6
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#define USE_WINSOCK
|
||||
#if defined (_WIN64) || defined (HAVE_IPV6)
|
||||
#define USE_WINSOCK2
|
||||
#else //_WIN64/HAVE_IPV6
|
||||
#define USE_WINSOCK1
|
||||
#endif
|
||||
#define USE_WINSOCK
|
||||
#if defined (_WIN64) || defined (HAVE_IPV6)
|
||||
#define USE_WINSOCK2
|
||||
#else //_WIN64/HAVE_IPV6
|
||||
#define USE_WINSOCK1
|
||||
#endif
|
||||
#endif //WIN32 OS
|
||||
|
||||
#ifdef USE_WINSOCK2
|
||||
#include <ws2tcpip.h>
|
||||
#include <ws2tcpip.h>
|
||||
#endif
|
||||
|
||||
#include "doomdef.h"
|
||||
|
||||
#if defined (NOMD5) && !defined (NONET)
|
||||
//#define NONET
|
||||
//#define NONET
|
||||
#endif
|
||||
|
||||
#ifdef NONET
|
||||
#undef HAVE_MINIUPNPC
|
||||
#undef HAVE_MINIUPNPC
|
||||
#else
|
||||
#ifdef USE_WINSOCK1
|
||||
#include <winsock.h>
|
||||
#elif !defined (SCOUW2) && !defined (SCOUW7)
|
||||
#ifndef USE_WINSOCK
|
||||
#include <arpa/inet.h>
|
||||
#endif //normal BSD API
|
||||
#ifdef USE_WINSOCK1
|
||||
#include <winsock.h>
|
||||
#else
|
||||
#ifndef USE_WINSOCK
|
||||
#include <arpa/inet.h>
|
||||
#ifdef __APPLE_CC__
|
||||
#ifndef _BSD_SOCKLEN_T_
|
||||
#define _BSD_SOCKLEN_T_
|
||||
#endif //_BSD_SOCKLEN_T_
|
||||
#endif //__APPLE_CC__
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netdb.h>
|
||||
#include <sys/ioctl.h>
|
||||
#endif //normal BSD API
|
||||
|
||||
#ifndef USE_WINSOCK
|
||||
#ifdef __APPLE_CC__
|
||||
#ifndef _BSD_SOCKLEN_T_
|
||||
#define _BSD_SOCKLEN_T_
|
||||
#endif //_BSD_SOCKLEN_T_
|
||||
#endif //__APPLE_CC__
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#endif //normal BSD API
|
||||
#include <errno.h>
|
||||
#include <time.h>
|
||||
|
||||
#ifndef USE_WINSOCK
|
||||
#include <netdb.h>
|
||||
#include <sys/ioctl.h>
|
||||
#endif //normal BSD API
|
||||
#if (defined (__unix__) && !defined (MSDOS)) || defined(__APPLE__) || defined (UNIXCOMMON)
|
||||
#include <sys/time.h>
|
||||
#endif // UNIXCOMMON
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
#include <time.h>
|
||||
#ifdef USE_WINSOCK
|
||||
// some undefined under win32
|
||||
#undef errno
|
||||
//#define errno WSAGetLastError() //Alam_GBC: this is the correct way, right?
|
||||
#define errno h_errno // some very strange things happen when not using h_error?!?
|
||||
#ifdef EWOULDBLOCK
|
||||
#undef EWOULDBLOCK
|
||||
#endif
|
||||
#define EWOULDBLOCK WSAEWOULDBLOCK
|
||||
#ifdef EMSGSIZE
|
||||
#undef EMSGSIZE
|
||||
#endif
|
||||
#define EMSGSIZE WSAEMSGSIZE
|
||||
#ifdef ECONNREFUSED
|
||||
#undef ECONNREFUSED
|
||||
#endif
|
||||
#define ECONNREFUSED WSAECONNREFUSED
|
||||
#ifdef ETIMEDOUT
|
||||
#undef ETIMEDOUT
|
||||
#endif
|
||||
#define ETIMEDOUT WSAETIMEDOUT
|
||||
#ifndef IOC_VENDOR
|
||||
#define IOC_VENDOR 0x18000000
|
||||
#endif
|
||||
#ifndef _WSAIOW
|
||||
#define _WSAIOW(x,y) (IOC_IN|(x)|(y))
|
||||
#endif
|
||||
#ifndef SIO_UDP_CONNRESET
|
||||
#define SIO_UDP_CONNRESET _WSAIOW(IOC_VENDOR,12)
|
||||
#endif
|
||||
#ifndef AI_ADDRCONFIG
|
||||
#define AI_ADDRCONFIG 0x00000400
|
||||
#endif
|
||||
#ifndef STATUS_INVALID_PARAMETER
|
||||
#define STATUS_INVALID_PARAMETER 0xC000000D
|
||||
#endif
|
||||
#endif // USE_WINSOCK
|
||||
|
||||
#if (defined (__unix__) && !defined (MSDOS)) || defined(__APPLE__) || defined (UNIXCOMMON)
|
||||
#include <sys/time.h>
|
||||
#endif // UNIXCOMMON
|
||||
#endif // !NONET
|
||||
#ifdef __DJGPP__
|
||||
#ifdef WATTCP // Alam_GBC: Wattcp may need this
|
||||
#include <tcp.h>
|
||||
#define strerror strerror_s
|
||||
#else // wattcp
|
||||
#include <lsck/lsck.h>
|
||||
#endif // libsocket
|
||||
#endif // djgpp
|
||||
|
||||
#ifdef USE_WINSOCK
|
||||
// some undefined under win32
|
||||
#undef errno
|
||||
//#define errno WSAGetLastError() //Alam_GBC: this is the correct way, right?
|
||||
#define errno h_errno // some very strange things happen when not using h_error?!?
|
||||
#ifdef EWOULDBLOCK
|
||||
#undef EWOULDBLOCK
|
||||
typedef union
|
||||
{
|
||||
struct sockaddr any;
|
||||
struct sockaddr_in ip4;
|
||||
#ifdef HAVE_IPV6
|
||||
struct sockaddr_in6 ip6;
|
||||
#endif
|
||||
#define EWOULDBLOCK WSAEWOULDBLOCK
|
||||
#ifdef EMSGSIZE
|
||||
#undef EMSGSIZE
|
||||
#endif
|
||||
#define EMSGSIZE WSAEMSGSIZE
|
||||
#ifdef ECONNREFUSED
|
||||
#undef ECONNREFUSED
|
||||
#endif
|
||||
#define ECONNREFUSED WSAECONNREFUSED
|
||||
#ifdef ETIMEDOUT
|
||||
#undef ETIMEDOUT
|
||||
#endif
|
||||
#define ETIMEDOUT WSAETIMEDOUT
|
||||
#ifndef IOC_VENDOR
|
||||
#define IOC_VENDOR 0x18000000
|
||||
#endif
|
||||
#ifndef _WSAIOW
|
||||
#define _WSAIOW(x,y) (IOC_IN|(x)|(y))
|
||||
#endif
|
||||
#ifndef SIO_UDP_CONNRESET
|
||||
#define SIO_UDP_CONNRESET _WSAIOW(IOC_VENDOR,12)
|
||||
#endif
|
||||
#ifndef AI_ADDRCONFIG
|
||||
#define AI_ADDRCONFIG 0x00000400
|
||||
#endif
|
||||
#ifndef STATUS_INVALID_PARAMETER
|
||||
#define STATUS_INVALID_PARAMETER 0xC000000D
|
||||
#endif
|
||||
#endif
|
||||
} mysockaddr_t;
|
||||
|
||||
#ifdef __DJGPP__
|
||||
#ifdef WATTCP // Alam_GBC: Wattcp may need this
|
||||
#include <tcp.h>
|
||||
#define strerror strerror_s
|
||||
#else // wattcp
|
||||
#include <lsck/lsck.h>
|
||||
#endif // libsocket
|
||||
#endif // djgpp
|
||||
|
||||
typedef union
|
||||
{
|
||||
struct sockaddr any;
|
||||
struct sockaddr_in ip4;
|
||||
#ifdef HAVE_IPV6
|
||||
struct sockaddr_in6 ip6;
|
||||
#endif
|
||||
} mysockaddr_t;
|
||||
|
||||
#ifdef HAVE_MINIUPNPC
|
||||
#ifdef STATIC_MINIUPNPC
|
||||
#define STATICLIB
|
||||
#endif
|
||||
#include "miniupnpc/miniwget.h"
|
||||
#include "miniupnpc/miniupnpc.h"
|
||||
#include "miniupnpc/upnpcommands.h"
|
||||
#undef STATICLIB
|
||||
static UINT8 UPNP_support = TRUE;
|
||||
#endif
|
||||
#ifdef HAVE_MINIUPNPC
|
||||
#ifdef STATIC_MINIUPNPC
|
||||
#define STATICLIB
|
||||
#endif
|
||||
#include "miniupnpc/miniwget.h"
|
||||
#include "miniupnpc/miniupnpc.h"
|
||||
#include "miniupnpc/upnpcommands.h"
|
||||
#undef STATICLIB
|
||||
static UINT8 UPNP_support = TRUE;
|
||||
#endif // HAVE_MINIUPNC
|
||||
|
||||
#endif // !NONET
|
||||
|
||||
|
@ -177,32 +171,32 @@ static UINT8 UPNP_support = TRUE;
|
|||
#define DEFAULTPORT "5029"
|
||||
|
||||
#if defined (USE_WINSOCK) && !defined (NONET)
|
||||
typedef SOCKET SOCKET_TYPE;
|
||||
#define ERRSOCKET (SOCKET_ERROR)
|
||||
typedef SOCKET SOCKET_TYPE;
|
||||
#define ERRSOCKET (SOCKET_ERROR)
|
||||
#else
|
||||
#if (defined (__unix__) && !defined (MSDOS)) || defined (__APPLE__) || defined (__HAIKU__)
|
||||
typedef int SOCKET_TYPE;
|
||||
#else
|
||||
typedef unsigned long SOCKET_TYPE;
|
||||
#endif
|
||||
#define ERRSOCKET (-1)
|
||||
#endif
|
||||
|
||||
#if (defined (WATTCP) && !defined (__libsocket_socklen_t)) || defined (USE_WINSOCK1)
|
||||
typedef int socklen_t;
|
||||
#if (defined (__unix__) && !defined (MSDOS)) || defined (__APPLE__) || defined (__HAIKU__)
|
||||
typedef int SOCKET_TYPE;
|
||||
#else
|
||||
typedef unsigned long SOCKET_TYPE;
|
||||
#endif
|
||||
#define ERRSOCKET (-1)
|
||||
#endif
|
||||
|
||||
#ifndef NONET
|
||||
static SOCKET_TYPE mysockets[MAXNETNODES+1] = {ERRSOCKET};
|
||||
static size_t mysocketses = 0;
|
||||
static int myfamily[MAXNETNODES+1] = {0};
|
||||
static SOCKET_TYPE nodesocket[MAXNETNODES+1] = {ERRSOCKET};
|
||||
static mysockaddr_t clientaddress[MAXNETNODES+1];
|
||||
static mysockaddr_t broadcastaddress[MAXNETNODES+1];
|
||||
static size_t broadcastaddresses = 0;
|
||||
static boolean nodeconnected[MAXNETNODES+1];
|
||||
static mysockaddr_t banned[MAXBANS];
|
||||
static UINT8 bannedmask[MAXBANS];
|
||||
// define socklen_t in DOS/Windows if it is not already defined
|
||||
#if (defined (WATTCP) && !defined (__libsocket_socklen_t)) || defined (USE_WINSOCK1)
|
||||
typedef int socklen_t;
|
||||
#endif
|
||||
static SOCKET_TYPE mysockets[MAXNETNODES+1] = {ERRSOCKET};
|
||||
static size_t mysocketses = 0;
|
||||
static int myfamily[MAXNETNODES+1] = {0};
|
||||
static SOCKET_TYPE nodesocket[MAXNETNODES+1] = {ERRSOCKET};
|
||||
static mysockaddr_t clientaddress[MAXNETNODES+1];
|
||||
static mysockaddr_t broadcastaddress[MAXNETNODES+1];
|
||||
static size_t broadcastaddresses = 0;
|
||||
static boolean nodeconnected[MAXNETNODES+1];
|
||||
static mysockaddr_t banned[MAXBANS];
|
||||
static UINT8 bannedmask[MAXBANS];
|
||||
#endif
|
||||
|
||||
static size_t numbans = 0;
|
||||
|
|
|
@ -36,10 +36,9 @@ typedef enum
|
|||
*/
|
||||
extern rendermode_t rendermode;
|
||||
|
||||
/** \brief OpenGL state
|
||||
0 = never loaded, 1 = loaded successfully, -1 = failed loading
|
||||
/** \brief render mode set by command line arguments
|
||||
*/
|
||||
extern INT32 vid_opengl_state;
|
||||
extern rendermode_t chosenrendermode;
|
||||
|
||||
/** \brief use highcolor modes if true
|
||||
*/
|
||||
|
@ -90,8 +89,9 @@ INT32 VID_GetModeForSize(INT32 w, INT32 h);
|
|||
INT32 VID_SetMode(INT32 modenum);
|
||||
|
||||
/** \brief Checks the render state
|
||||
\return true if the renderer changed
|
||||
*/
|
||||
void VID_CheckRenderer(void);
|
||||
boolean VID_CheckRenderer(void);
|
||||
|
||||
/** \brief Load OpenGL mode
|
||||
*/
|
||||
|
|
40
src/info.c
40
src/info.c
|
@ -150,6 +150,7 @@ char sprnames[NUMSPRITES + 1][5] =
|
|||
"SIGN", // Level end sign
|
||||
"SPIK", // Spike Ball
|
||||
"SFLM", // Spin fire
|
||||
"TFLM", // Spin fire (team)
|
||||
"USPK", // Floor spike
|
||||
"WSPK", // Wall spike
|
||||
"WSPB", // Wall spike base
|
||||
|
@ -1894,6 +1895,13 @@ state_t states[NUMSTATES] =
|
|||
{SPR_SFLM, FF_FULLBRIGHT|4, 2, {NULL}, 0, 0, S_SPINFIRE6}, // S_SPINFIRE5
|
||||
{SPR_SFLM, FF_FULLBRIGHT|5, 2, {NULL}, 0, 0, S_SPINFIRE1}, // S_SPINFIRE6
|
||||
|
||||
{SPR_TFLM, FF_FULLBRIGHT, 2, {NULL}, 0, 0, S_TEAM_SPINFIRE2}, // S_TEAM_SPINFIRE1
|
||||
{SPR_TFLM, FF_FULLBRIGHT|1, 2, {NULL}, 0, 0, S_TEAM_SPINFIRE3}, // S_TEAM_SPINFIRE2
|
||||
{SPR_TFLM, FF_FULLBRIGHT|2, 2, {NULL}, 0, 0, S_TEAM_SPINFIRE4}, // S_TEAM_SPINFIRE3
|
||||
{SPR_TFLM, FF_FULLBRIGHT|3, 2, {NULL}, 0, 0, S_TEAM_SPINFIRE5}, // S_TEAM_SPINFIRE4
|
||||
{SPR_TFLM, FF_FULLBRIGHT|4, 2, {NULL}, 0, 0, S_TEAM_SPINFIRE6}, // S_TEAM_SPINFIRE5
|
||||
{SPR_TFLM, FF_FULLBRIGHT|5, 2, {NULL}, 0, 0, S_TEAM_SPINFIRE1}, // S_TEAM_SPINFIRE6
|
||||
|
||||
// Floor Spike
|
||||
{SPR_USPK, 0,-1, {A_SpikeRetract}, 1, 0, S_SPIKE2}, // S_SPIKE1 -- Fully extended
|
||||
{SPR_USPK, 1, 2, {A_Pain}, 0, 0, S_SPIKE3}, // S_SPIKE2
|
||||
|
@ -3291,18 +3299,18 @@ state_t states[NUMSTATES] =
|
|||
{SPR_WZAP, FF_TRANS10|FF_ANIMATE|FF_RANDOMANIM, 4, {NULL}, 3, 2, S_NULL}, // S_WATERZAP
|
||||
|
||||
// Spindash dust
|
||||
{SPR_DUST, 0, 7, {NULL}, 0, 0, S_SPINDUST2}, // S_SPINDUST1
|
||||
{SPR_DUST, 1, 6, {NULL}, 0, 0, S_SPINDUST3}, // S_SPINDUST2
|
||||
{SPR_DUST, FF_TRANS30|2, 4, {NULL}, 0, 0, S_SPINDUST4}, // S_SPINDUST3
|
||||
{SPR_DUST, FF_TRANS60|3, 3, {NULL}, 0, 0, S_NULL}, // S_SPINDUST4
|
||||
{SPR_BUBL, 0, 7, {NULL}, 0, 0, S_SPINDUST_BUBBLE2}, // S_SPINDUST_BUBBLE1
|
||||
{SPR_BUBL, 0, 6, {NULL}, 0, 0, S_SPINDUST_BUBBLE3}, // S_SPINDUST_BUBBLE2
|
||||
{SPR_BUBL, FF_TRANS30|0, 4, {NULL}, 0, 0, S_SPINDUST_BUBBLE4}, // S_SPINDUST_BUBBLE3
|
||||
{SPR_BUBL, FF_TRANS60|0, 3, {NULL}, 0, 0, S_NULL}, // S_SPINDUST_BUBBLE4
|
||||
{SPR_FPRT, 0, 7, {NULL}, 0, 0, S_SPINDUST_FIRE2}, // S_SPINDUST_FIRE1
|
||||
{SPR_FPRT, 0, 6, {NULL}, 0, 0, S_SPINDUST_FIRE3}, // S_SPINDUST_FIRE2
|
||||
{SPR_FPRT, FF_TRANS30|0, 4, {NULL}, 0, 0, S_SPINDUST_FIRE4}, // S_SPINDUST_FIRE3
|
||||
{SPR_FPRT, FF_TRANS60|0, 3, {NULL}, 0, 0, S_NULL}, // S_SPINDUST_FIRE4
|
||||
{SPR_DUST, 0, 7, {NULL}, 0, 0, S_SPINDUST2}, // S_SPINDUST1
|
||||
{SPR_DUST, 1, 6, {NULL}, 0, 0, S_SPINDUST3}, // S_SPINDUST2
|
||||
{SPR_DUST, FF_TRANS30|2, 4, {NULL}, 0, 0, S_SPINDUST4}, // S_SPINDUST3
|
||||
{SPR_DUST, FF_TRANS60|3, 3, {NULL}, 0, 0, S_NULL}, // S_SPINDUST4
|
||||
{SPR_BUBL, 0, 7, {NULL}, 0, 0, S_SPINDUST_BUBBLE2}, // S_SPINDUST_BUBBLE1
|
||||
{SPR_BUBL, 0, 6, {NULL}, 0, 0, S_SPINDUST_BUBBLE3}, // S_SPINDUST_BUBBLE2
|
||||
{SPR_BUBL, FF_TRANS30|0, 4, {NULL}, 0, 0, S_SPINDUST_BUBBLE4}, // S_SPINDUST_BUBBLE3
|
||||
{SPR_BUBL, FF_TRANS60|0, 3, {NULL}, 0, 0, S_NULL}, // S_SPINDUST_BUBBLE4
|
||||
{SPR_FPRT, FF_FULLBRIGHT|0, 7, {NULL}, 0, 0, S_SPINDUST_FIRE2}, // S_SPINDUST_FIRE1
|
||||
{SPR_FPRT, FF_FULLBRIGHT|0, 6, {NULL}, 0, 0, S_SPINDUST_FIRE3}, // S_SPINDUST_FIRE2
|
||||
{SPR_FPRT, FF_FULLBRIGHT|FF_TRANS30|0, 4, {NULL}, 0, 0, S_SPINDUST_FIRE4}, // S_SPINDUST_FIRE3
|
||||
{SPR_FPRT, FF_FULLBRIGHT|FF_TRANS60|0, 3, {NULL}, 0, 0, S_NULL}, // S_SPINDUST_FIRE4
|
||||
|
||||
|
||||
{SPR_TFOG, FF_FULLBRIGHT|FF_TRANS50, 2, {NULL}, 0, 0, S_FOG2}, // S_FOG1
|
||||
|
@ -3924,9 +3932,7 @@ state_t states[NUMSTATES] =
|
|||
{SPR_BRIB, FF_ANIMATE|FF_RANDOMANIM, -1, {NULL}, 31, 1, S_NULL}, // S_BLUEBRICKDEBRIS
|
||||
{SPR_BRIY, FF_ANIMATE|FF_RANDOMANIM, -1, {NULL}, 31, 1, S_NULL}, // S_YELLOWBRICKDEBRIS
|
||||
|
||||
#ifdef SEENAMES
|
||||
{SPR_NULL, 0, 1, {NULL}, 0, 0, S_NULL}, // S_NAMECHECK
|
||||
#endif
|
||||
};
|
||||
|
||||
mobjinfo_t mobjinfo[NUMMOBJTYPES] =
|
||||
|
@ -6458,8 +6464,8 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
|
|||
S_NULL, // xdeathstate
|
||||
sfx_fizzle, // deathsound
|
||||
10*FRACUNIT, // speed
|
||||
48*FRACUNIT, // radius
|
||||
160*FRACUNIT, // height
|
||||
24*FRACUNIT, // radius
|
||||
80*FRACUNIT, // height
|
||||
0, // display offset
|
||||
DMG_ELECTRIC, // mass
|
||||
1, // damage
|
||||
|
@ -21653,7 +21659,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
|
|||
S_NULL // raisestate
|
||||
},
|
||||
|
||||
#ifdef SEENAMES
|
||||
{ // MT_NAMECHECK
|
||||
-1, // doomednum
|
||||
S_NAMECHECK, // spawnstate
|
||||
|
@ -21680,7 +21685,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
|
|||
MF_NOBLOCKMAP|MF_MISSILE|MF_NOGRAVITY|MF_NOSECTOR, // flags
|
||||
S_NULL // raisestate
|
||||
},
|
||||
#endif
|
||||
};
|
||||
|
||||
skincolor_t skincolors[MAXSKINCOLORS] = {
|
||||
|
|
286
src/info.h
286
src/info.h
|
@ -19,11 +19,279 @@
|
|||
#include "sounds.h"
|
||||
#include "m_fixed.h"
|
||||
|
||||
// dehacked.c now has lists for the more named enums! PLEASE keep them up to date!
|
||||
// deh_tables.c now has lists for the more named enums! PLEASE keep them up to date!
|
||||
// For great modding!!
|
||||
|
||||
// IMPORTANT!
|
||||
// DO NOT FORGET TO SYNC THIS LIST WITH THE ACTIONPOINTERS ARRAY IN DEH_TABLES.C
|
||||
enum actionnum
|
||||
{
|
||||
A_EXPLODE = 0,
|
||||
A_PAIN,
|
||||
A_FALL,
|
||||
A_MONITORPOP,
|
||||
A_GOLDMONITORPOP,
|
||||
A_GOLDMONITORRESTORE,
|
||||
A_GOLDMONITORSPARKLE,
|
||||
A_LOOK,
|
||||
A_CHASE,
|
||||
A_FACESTABCHASE,
|
||||
A_FACESTABREV,
|
||||
A_FACESTABHURL,
|
||||
A_FACESTABMISS,
|
||||
A_STATUEBURST,
|
||||
A_FACETARGET,
|
||||
A_FACETRACER,
|
||||
A_SCREAM,
|
||||
A_BOSSDEATH,
|
||||
A_CUSTOMPOWER,
|
||||
A_GIVEWEAPON,
|
||||
A_RINGBOX,
|
||||
A_INVINCIBILITY,
|
||||
A_SUPERSNEAKERS,
|
||||
A_BUNNYHOP,
|
||||
A_BUBBLESPAWN,
|
||||
A_FANBUBBLESPAWN,
|
||||
A_BUBBLERISE,
|
||||
A_BUBBLECHECK,
|
||||
A_AWARDSCORE,
|
||||
A_EXTRALIFE,
|
||||
A_GIVESHIELD,
|
||||
A_GRAVITYBOX,
|
||||
A_SCORERISE,
|
||||
A_ATTRACTCHASE,
|
||||
A_DROPMINE,
|
||||
A_FISHJUMP,
|
||||
A_THROWNRING,
|
||||
A_SETSOLIDSTEAM,
|
||||
A_UNSETSOLIDSTEAM,
|
||||
A_SIGNSPIN,
|
||||
A_SIGNPLAYER,
|
||||
A_OVERLAYTHINK,
|
||||
A_JETCHASE,
|
||||
A_JETBTHINK,
|
||||
A_JETGTHINK,
|
||||
A_JETGSHOOT,
|
||||
A_SHOOTBULLET,
|
||||
A_MINUSDIGGING,
|
||||
A_MINUSPOPUP,
|
||||
A_MINUSCHECK,
|
||||
A_CHICKENCHECK,
|
||||
A_MOUSETHINK,
|
||||
A_DETONCHASE,
|
||||
A_CAPECHASE,
|
||||
A_ROTATESPIKEBALL,
|
||||
A_SLINGAPPEAR,
|
||||
A_UNIDUSBALL,
|
||||
A_ROCKSPAWN,
|
||||
A_SETFUSE,
|
||||
A_CRAWLACOMMANDERTHINK,
|
||||
A_SMOKETRAILER,
|
||||
A_RINGEXPLODE,
|
||||
A_OLDRINGEXPLODE,
|
||||
A_MIXUP,
|
||||
A_RECYCLEPOWERS,
|
||||
A_BOSS1CHASE,
|
||||
A_FOCUSTARGET,
|
||||
A_BOSS2CHASE,
|
||||
A_BOSS2POGO,
|
||||
A_BOSSZOOM,
|
||||
A_BOSSSCREAM,
|
||||
A_BOSS2TAKEDAMAGE,
|
||||
A_BOSS7CHASE,
|
||||
A_GOOPSPLAT,
|
||||
A_BOSS2POGOSFX,
|
||||
A_BOSS2POGOTARGET,
|
||||
A_BOSSJETFUME,
|
||||
A_EGGMANBOX,
|
||||
A_TURRETFIRE,
|
||||
A_SUPERTURRETFIRE,
|
||||
A_TURRETSTOP,
|
||||
A_JETJAWROAM,
|
||||
A_JETJAWCHOMP,
|
||||
A_POINTYTHINK,
|
||||
A_CHECKBUDDY,
|
||||
A_HOODFIRE,
|
||||
A_HOODTHINK,
|
||||
A_HOODFALL,
|
||||
A_ARROWBONKS,
|
||||
A_SNAILERTHINK,
|
||||
A_SHARPCHASE,
|
||||
A_SHARPSPIN,
|
||||
A_SHARPDECEL,
|
||||
A_CRUSHSTACEANWALK,
|
||||
A_CRUSHSTACEANPUNCH,
|
||||
A_CRUSHCLAWAIM,
|
||||
A_CRUSHCLAWLAUNCH,
|
||||
A_VULTUREVTOL,
|
||||
A_VULTURECHECK,
|
||||
A_VULTUREHOVER,
|
||||
A_VULTUREBLAST,
|
||||
A_VULTUREFLY,
|
||||
A_SKIMCHASE,
|
||||
A_1UPTHINKER,
|
||||
A_SKULLATTACK,
|
||||
A_LOBSHOT,
|
||||
A_FIRESHOT,
|
||||
A_SUPERFIRESHOT,
|
||||
A_BOSSFIRESHOT,
|
||||
A_BOSS7FIREMISSILES,
|
||||
A_BOSS1LASER,
|
||||
A_BOSS4REVERSE,
|
||||
A_BOSS4SPEEDUP,
|
||||
A_BOSS4RAISE,
|
||||
A_SPARKFOLLOW,
|
||||
A_BUZZFLY,
|
||||
A_GUARDCHASE,
|
||||
A_EGGSHIELD,
|
||||
A_SETREACTIONTIME,
|
||||
A_BOSS1SPIKEBALLS,
|
||||
A_BOSS3TAKEDAMAGE,
|
||||
A_BOSS3PATH,
|
||||
A_BOSS3SHOCKTHINK,
|
||||
A_LINEDEFEXECUTE,
|
||||
A_PLAYSEESOUND,
|
||||
A_PLAYATTACKSOUND,
|
||||
A_PLAYACTIVESOUND,
|
||||
A_SPAWNOBJECTABSOLUTE,
|
||||
A_SPAWNOBJECTRELATIVE,
|
||||
A_CHANGEANGLERELATIVE,
|
||||
A_CHANGEANGLEABSOLUTE,
|
||||
A_ROLLANGLE,
|
||||
A_CHANGEROLLANGLERELATIVE,
|
||||
A_CHANGEROLLANGLEABSOLUTE,
|
||||
A_PLAYSOUND,
|
||||
A_FINDTARGET,
|
||||
A_FINDTRACER,
|
||||
A_SETTICS,
|
||||
A_SETRANDOMTICS,
|
||||
A_CHANGECOLORRELATIVE,
|
||||
A_CHANGECOLORABSOLUTE,
|
||||
A_DYE,
|
||||
A_MOVERELATIVE,
|
||||
A_MOVEABSOLUTE,
|
||||
A_THRUST,
|
||||
A_ZTHRUST,
|
||||
A_SETTARGETSTARGET,
|
||||
A_SETOBJECTFLAGS,
|
||||
A_SETOBJECTFLAGS2,
|
||||
A_RANDOMSTATE,
|
||||
A_RANDOMSTATERANGE,
|
||||
A_DUALACTION,
|
||||
A_REMOTEACTION,
|
||||
A_TOGGLEFLAMEJET,
|
||||
A_ORBITNIGHTS,
|
||||
A_GHOSTME,
|
||||
A_SETOBJECTSTATE,
|
||||
A_SETOBJECTTYPESTATE,
|
||||
A_KNOCKBACK,
|
||||
A_PUSHAWAY,
|
||||
A_RINGDRAIN,
|
||||
A_SPLITSHOT,
|
||||
A_MISSILESPLIT,
|
||||
A_MULTISHOT,
|
||||
A_INSTALOOP,
|
||||
A_CUSTOM3DROTATE,
|
||||
A_SEARCHFORPLAYERS,
|
||||
A_CHECKRANDOM,
|
||||
A_CHECKTARGETRINGS,
|
||||
A_CHECKRINGS,
|
||||
A_CHECKTOTALRINGS,
|
||||
A_CHECKHEALTH,
|
||||
A_CHECKRANGE,
|
||||
A_CHECKHEIGHT,
|
||||
A_CHECKTRUERANGE,
|
||||
A_CHECKTHINGCOUNT,
|
||||
A_CHECKAMBUSH,
|
||||
A_CHECKCUSTOMVALUE,
|
||||
A_CHECKCUSVALMEMO,
|
||||
A_SETCUSTOMVALUE,
|
||||
A_USECUSVALMEMO,
|
||||
A_RELAYCUSTOMVALUE,
|
||||
A_CUSVALACTION,
|
||||
A_FORCESTOP,
|
||||
A_FORCEWIN,
|
||||
A_SPIKERETRACT,
|
||||
A_INFOSTATE,
|
||||
A_REPEAT,
|
||||
A_SETSCALE,
|
||||
A_REMOTEDAMAGE,
|
||||
A_HOMINGCHASE,
|
||||
A_TRAPSHOT,
|
||||
A_VILETARGET,
|
||||
A_VILEATTACK,
|
||||
A_VILEFIRE,
|
||||
A_BRAKCHASE,
|
||||
A_BRAKFIRESHOT,
|
||||
A_BRAKLOBSHOT,
|
||||
A_NAPALMSCATTER,
|
||||
A_SPAWNFRESHCOPY,
|
||||
A_FLICKYSPAWN,
|
||||
A_FLICKYCENTER,
|
||||
A_FLICKYAIM,
|
||||
A_FLICKYFLY,
|
||||
A_FLICKYSOAR,
|
||||
A_FLICKYCOAST,
|
||||
A_FLICKYHOP,
|
||||
A_FLICKYFLOUNDER,
|
||||
A_FLICKYCHECK,
|
||||
A_FLICKYHEIGHTCHECK,
|
||||
A_FLICKYFLUTTER,
|
||||
A_FLAMEPARTICLE,
|
||||
A_FADEOVERLAY,
|
||||
A_BOSS5JUMP,
|
||||
A_LIGHTBEAMRESET,
|
||||
A_MINEEXPLODE,
|
||||
A_MINERANGE,
|
||||
A_CONNECTTOGROUND,
|
||||
A_SPAWNPARTICLERELATIVE,
|
||||
A_MULTISHOTDIST,
|
||||
A_WHOCARESIFYOURSONISABEE,
|
||||
A_PARENTTRIESTOSLEEP,
|
||||
A_CRYINGTOMOMMA,
|
||||
A_CHECKFLAGS2,
|
||||
A_BOSS5FINDWAYPOINT,
|
||||
A_DONPCSKID,
|
||||
A_DONPCPAIN,
|
||||
A_PREPAREREPEAT,
|
||||
A_BOSS5EXTRAREPEAT,
|
||||
A_BOSS5CALM,
|
||||
A_BOSS5CHECKONGROUND,
|
||||
A_BOSS5CHECKFALLING,
|
||||
A_BOSS5PINCHSHOT,
|
||||
A_BOSS5MAKEITRAIN,
|
||||
A_BOSS5MAKEJUNK,
|
||||
A_LOOKFORBETTER,
|
||||
A_BOSS5BOMBEXPLODE,
|
||||
A_DUSTDEVILTHINK,
|
||||
A_TNTEXPLODE,
|
||||
A_DEBRISRANDOM,
|
||||
A_TRAINCAMEO,
|
||||
A_TRAINCAMEO2,
|
||||
A_CANARIVOREGAS,
|
||||
A_KILLSEGMENTS,
|
||||
A_SNAPPERSPAWN,
|
||||
A_SNAPPERTHINKER,
|
||||
A_SALOONDOORSPAWN,
|
||||
A_MINECARTSPARKTHINK,
|
||||
A_MODULOTOSTATE,
|
||||
A_LAVAFALLROCKS,
|
||||
A_LAVAFALLLAVA,
|
||||
A_FALLINGLAVACHECK,
|
||||
A_FIRESHRINK,
|
||||
A_SPAWNPTERABYTES,
|
||||
A_PTERABYTEHOVER,
|
||||
A_ROLLOUTSPAWN,
|
||||
A_ROLLOUTROCK,
|
||||
A_DRAGONBOMBERSPAWN,
|
||||
A_DRAGONWING,
|
||||
A_DRAGONSEGMENT,
|
||||
A_CHANGEHEIGHT,
|
||||
NUMACTIONS
|
||||
};
|
||||
|
||||
// IMPORTANT NOTE: If you add/remove from this list of action
|
||||
// functions, don't forget to update them in dehacked.c!
|
||||
// functions, don't forget to update them in deh_tables.c!
|
||||
void A_Explode();
|
||||
void A_Pain();
|
||||
void A_Fall();
|
||||
|
@ -286,6 +554,8 @@ void A_DragonWing();
|
|||
void A_DragonSegment();
|
||||
void A_ChangeHeight();
|
||||
|
||||
extern boolean actionsoverridden[NUMACTIONS];
|
||||
|
||||
// ratio of states to sprites to mobj types is roughly 6 : 1 : 1
|
||||
#define NUMMOBJFREESLOTS 512
|
||||
#define NUMSPRITEFREESLOTS NUMMOBJFREESLOTS
|
||||
|
@ -414,6 +684,7 @@ typedef enum sprite
|
|||
SPR_SIGN, // Level end sign
|
||||
SPR_SPIK, // Spike Ball
|
||||
SPR_SFLM, // Spin fire
|
||||
SPR_TFLM, // Spin fire (team)
|
||||
SPR_USPK, // Floor spike
|
||||
SPR_WSPK, // Wall spike
|
||||
SPR_WSPB, // Wall spike base
|
||||
|
@ -2054,6 +2325,13 @@ typedef enum state
|
|||
S_SPINFIRE5,
|
||||
S_SPINFIRE6,
|
||||
|
||||
S_TEAM_SPINFIRE1,
|
||||
S_TEAM_SPINFIRE2,
|
||||
S_TEAM_SPINFIRE3,
|
||||
S_TEAM_SPINFIRE4,
|
||||
S_TEAM_SPINFIRE5,
|
||||
S_TEAM_SPINFIRE6,
|
||||
|
||||
// Spikes
|
||||
S_SPIKE1,
|
||||
S_SPIKE2,
|
||||
|
@ -4010,9 +4288,7 @@ typedef enum state
|
|||
S_BLUEBRICKDEBRIS, // for CEZ3
|
||||
S_YELLOWBRICKDEBRIS, // for CEZ3
|
||||
|
||||
#ifdef SEENAMES
|
||||
S_NAMECHECK,
|
||||
#endif
|
||||
|
||||
S_FIRSTFREESLOT,
|
||||
S_LASTFREESLOT = S_FIRSTFREESLOT + NUMSTATEFREESLOTS - 1,
|
||||
|
@ -4812,9 +5088,7 @@ typedef enum mobj_type
|
|||
MT_BLUEBRICKDEBRIS, // for CEZ3
|
||||
MT_YELLOWBRICKDEBRIS, // for CEZ3
|
||||
|
||||
#ifdef SEENAMES
|
||||
MT_NAMECHECK,
|
||||
#endif
|
||||
|
||||
MT_FIRSTFREESLOT,
|
||||
MT_LASTFREESLOT = MT_FIRSTFREESLOT + NUMMOBJFREESLOTS - 1,
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "lua_script.h"
|
||||
#include "lua_libs.h"
|
||||
#include "lua_hud.h" // hud_running errors
|
||||
#include "taglist.h" // P_FindSpecialLineFromTag
|
||||
#include "lua_hook.h" // hook_cmd_running errors
|
||||
|
||||
#define NOHUD if (hud_running)\
|
||||
|
@ -154,6 +155,8 @@ static const struct {
|
|||
{META_PIVOTLIST, "spriteframepivot_t[]"},
|
||||
{META_FRAMEPIVOT, "spriteframepivot_t"},
|
||||
|
||||
{META_TAGLIST, "taglist"},
|
||||
|
||||
{META_MOBJ, "mobj_t"},
|
||||
{META_MAPTHING, "mapthing_t"},
|
||||
|
||||
|
@ -162,6 +165,8 @@ static const struct {
|
|||
{META_SKIN, "skin_t"},
|
||||
{META_POWERS, "player_t.powers"},
|
||||
{META_SOUNDSID, "skin_t.soundsid"},
|
||||
{META_SKINSPRITES, "skin_t.sprites"},
|
||||
{META_SKINSPRITESLIST, "skin_t.sprites[]"},
|
||||
|
||||
{META_VERTEX, "vertex_t"},
|
||||
{META_LINE, "line_t"},
|
||||
|
@ -183,6 +188,9 @@ static const struct {
|
|||
{META_CVAR, "consvar_t"},
|
||||
|
||||
{META_SECTORLINES, "sector_t.lines"},
|
||||
#ifdef MUTABLE_TAGS
|
||||
{META_SECTORTAGLIST, "sector_t.taglist"},
|
||||
#endif
|
||||
{META_SIDENUM, "line_t.sidenum"},
|
||||
{META_LINEARGS, "line_t.args"},
|
||||
{META_LINESTRINGARGS, "line_t.stringargs"},
|
||||
|
@ -424,7 +432,7 @@ static int lib_pAproxDistance(lua_State *L)
|
|||
fixed_t dx = luaL_checkfixed(L, 1);
|
||||
fixed_t dy = luaL_checkfixed(L, 2);
|
||||
//HUDSAFE
|
||||
lua_pushfixed(L, P_AproxDistance(dx, dy));
|
||||
lua_pushfixed(L, R_PointToDist2(0, 0, dx, dy));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -965,6 +973,28 @@ static int lib_pMaceRotate(lua_State *L)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int lib_pCreateFloorSpriteSlope(lua_State *L)
|
||||
{
|
||||
mobj_t *mobj = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||
NOHUD
|
||||
INLEVEL
|
||||
if (!mobj)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
LUA_PushUserdata(L, (pslope_t *)P_CreateFloorSpriteSlope(mobj), META_SLOPE);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lib_pRemoveFloorSpriteSlope(lua_State *L)
|
||||
{
|
||||
mobj_t *mobj = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||
NOHUD
|
||||
INLEVEL
|
||||
if (!mobj)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
P_RemoveFloorSpriteSlope(mobj);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lib_pRailThinker(lua_State *L)
|
||||
{
|
||||
mobj_t *mobj = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||
|
@ -3056,6 +3086,185 @@ static int lib_sStartMusicCaption(lua_State *L)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int lib_sMusicType(lua_State *L)
|
||||
{
|
||||
player_t *player = NULL;
|
||||
NOHUD
|
||||
if (!lua_isnone(L, 1) && lua_isuserdata(L, 1))
|
||||
{
|
||||
player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
if (!player)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
}
|
||||
if (!player || P_IsLocalPlayer(player))
|
||||
lua_pushinteger(L, S_MusicType());
|
||||
else
|
||||
lua_pushnil(L);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lib_sMusicPlaying(lua_State *L)
|
||||
{
|
||||
player_t *player = NULL;
|
||||
NOHUD
|
||||
if (!lua_isnone(L, 1) && lua_isuserdata(L, 1))
|
||||
{
|
||||
player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
if (!player)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
}
|
||||
if (!player || P_IsLocalPlayer(player))
|
||||
lua_pushboolean(L, S_MusicPlaying());
|
||||
else
|
||||
lua_pushnil(L);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lib_sMusicPaused(lua_State *L)
|
||||
{
|
||||
player_t *player = NULL;
|
||||
NOHUD
|
||||
if (!lua_isnone(L, 1) && lua_isuserdata(L, 1))
|
||||
{
|
||||
player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
if (!player)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
}
|
||||
if (!player || P_IsLocalPlayer(player))
|
||||
lua_pushboolean(L, S_MusicPaused());
|
||||
else
|
||||
lua_pushnil(L);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lib_sMusicName(lua_State *L)
|
||||
{
|
||||
player_t *player = NULL;
|
||||
NOHUD
|
||||
if (!lua_isnone(L, 1) && lua_isuserdata(L, 1))
|
||||
{
|
||||
player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
if (!player)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
}
|
||||
if (!player || P_IsLocalPlayer(player))
|
||||
lua_pushstring(L, S_MusicName());
|
||||
else
|
||||
lua_pushnil(L);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lib_sMusicExists(lua_State *L)
|
||||
{
|
||||
boolean checkMIDI = lua_opttrueboolean(L, 2);
|
||||
boolean checkDigi = lua_opttrueboolean(L, 3);
|
||||
#ifdef MUSICSLOT_COMPATIBILITY
|
||||
const char *music_name;
|
||||
UINT32 music_num;
|
||||
char music_compat_name[7];
|
||||
UINT16 music_flags = 0;
|
||||
NOHUD
|
||||
if (lua_isnumber(L, 1))
|
||||
{
|
||||
music_num = (UINT32)luaL_checkinteger(L, 1);
|
||||
music_flags = (UINT16)(music_num & 0x0000FFFF);
|
||||
if (music_flags && music_flags <= 1035)
|
||||
snprintf(music_compat_name, 7, "%sM", G_BuildMapName((INT32)music_flags));
|
||||
else if (music_flags && music_flags <= 1050)
|
||||
strncpy(music_compat_name, compat_special_music_slots[music_flags - 1036], 7);
|
||||
else
|
||||
music_compat_name[0] = 0; // becomes empty string
|
||||
music_compat_name[6] = 0;
|
||||
music_name = (const char *)&music_compat_name;
|
||||
}
|
||||
else
|
||||
{
|
||||
music_num = 0;
|
||||
music_name = luaL_checkstring(L, 1);
|
||||
}
|
||||
#else
|
||||
const char *music_name = luaL_checkstring(L, 1);
|
||||
#endif
|
||||
NOHUD
|
||||
lua_pushboolean(L, S_MusicExists(music_name, checkMIDI, checkDigi));
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lib_sSetMusicLoopPoint(lua_State *L)
|
||||
{
|
||||
UINT32 looppoint = (UINT32)luaL_checkinteger(L, 1);
|
||||
player_t *player = NULL;
|
||||
NOHUD
|
||||
if (!lua_isnone(L, 2) && lua_isuserdata(L, 2))
|
||||
{
|
||||
player = *((player_t **)luaL_checkudata(L, 2, META_PLAYER));
|
||||
if (!player)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
}
|
||||
if (!player || P_IsLocalPlayer(player))
|
||||
lua_pushboolean(L, S_SetMusicLoopPoint(looppoint));
|
||||
else
|
||||
lua_pushnil(L);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lib_sGetMusicLoopPoint(lua_State *L)
|
||||
{
|
||||
player_t *player = NULL;
|
||||
NOHUD
|
||||
if (!lua_isnone(L, 1) && lua_isuserdata(L, 1))
|
||||
{
|
||||
player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
if (!player)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
}
|
||||
if (!player || P_IsLocalPlayer(player))
|
||||
lua_pushinteger(L, (int)S_GetMusicLoopPoint());
|
||||
else
|
||||
lua_pushnil(L);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lib_sPauseMusic(lua_State *L)
|
||||
{
|
||||
player_t *player = NULL;
|
||||
NOHUD
|
||||
if (!lua_isnone(L, 1) && lua_isuserdata(L, 1))
|
||||
{
|
||||
player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
if (!player)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
}
|
||||
if (!player || P_IsLocalPlayer(player))
|
||||
{
|
||||
S_PauseAudio();
|
||||
lua_pushboolean(L, true);
|
||||
}
|
||||
else
|
||||
lua_pushnil(L);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lib_sResumeMusic(lua_State *L)
|
||||
{
|
||||
player_t *player = NULL;
|
||||
NOHUD
|
||||
if (!lua_isnone(L, 1) && lua_isuserdata(L, 1))
|
||||
{
|
||||
player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
if (!player)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
}
|
||||
if (!player || P_IsLocalPlayer(player))
|
||||
{
|
||||
S_ResumeAudio();
|
||||
lua_pushboolean(L, true);
|
||||
}
|
||||
else
|
||||
lua_pushnil(L);
|
||||
return 1;
|
||||
}
|
||||
|
||||
// G_GAME
|
||||
////////////
|
||||
|
||||
|
@ -3605,6 +3814,8 @@ static luaL_Reg lib[] = {
|
|||
{"P_CheckSolidLava",lib_pCheckSolidLava},
|
||||
{"P_CanRunOnWater",lib_pCanRunOnWater},
|
||||
{"P_MaceRotate",lib_pMaceRotate},
|
||||
{"P_CreateFloorSpriteSlope",lib_pCreateFloorSpriteSlope},
|
||||
{"P_RemoveFloorSpriteSlope",lib_pRemoveFloorSpriteSlope},
|
||||
{"P_RailThinker",lib_pRailThinker},
|
||||
{"P_XYMovement",lib_pXYMovement},
|
||||
{"P_RingXYMovement",lib_pRingXYMovement},
|
||||
|
@ -3764,6 +3975,15 @@ static luaL_Reg lib[] = {
|
|||
{"S_IdPlaying",lib_sIdPlaying},
|
||||
{"S_SoundPlaying",lib_sSoundPlaying},
|
||||
{"S_StartMusicCaption", lib_sStartMusicCaption},
|
||||
{"S_MusicType",lib_sMusicType},
|
||||
{"S_MusicPlaying",lib_sMusicPlaying},
|
||||
{"S_MusicPaused",lib_sMusicPaused},
|
||||
{"S_MusicName",lib_sMusicName},
|
||||
{"S_MusicExists",lib_sMusicExists},
|
||||
{"S_SetMusicLoopPoint",lib_sSetMusicLoopPoint},
|
||||
{"S_GetMusicLoopPoint",lib_sGetMusicLoopPoint},
|
||||
{"S_PauseMusic",lib_sPauseMusic},
|
||||
{"S_ResumeMusic", lib_sResumeMusic},
|
||||
|
||||
// g_game
|
||||
{"G_AddGametype", lib_gAddGametype},
|
||||
|
|
|
@ -40,6 +40,10 @@ void Got_Luacmd(UINT8 **cp, INT32 playernum)
|
|||
// like sending random junk lua commands to crash the server
|
||||
|
||||
if (!gL) goto deny;
|
||||
|
||||
lua_settop(gL, 0); // Just in case...
|
||||
lua_pushcfunction(gL, LUA_GetErrorMessage);
|
||||
|
||||
lua_getfield(gL, LUA_REGISTRYINDEX, "COM_Command"); // push COM_Command
|
||||
if (!lua_istable(gL, -1)) goto deny;
|
||||
|
||||
|
@ -76,7 +80,7 @@ void Got_Luacmd(UINT8 **cp, INT32 playernum)
|
|||
READSTRINGN(*cp, buf, 255);
|
||||
lua_pushstring(gL, buf);
|
||||
}
|
||||
LUA_Call(gL, (int)argc); // argc is 1-based, so this will cover the player we passed too.
|
||||
LUA_Call(gL, (int)argc, 0, 1); // argc is 1-based, so this will cover the player we passed too.
|
||||
return;
|
||||
|
||||
deny:
|
||||
|
@ -98,6 +102,10 @@ void COM_Lua_f(void)
|
|||
INT32 playernum = consoleplayer;
|
||||
|
||||
I_Assert(gL != NULL);
|
||||
|
||||
lua_settop(gL, 0); // Just in case...
|
||||
lua_pushcfunction(gL, LUA_GetErrorMessage);
|
||||
|
||||
lua_getfield(gL, LUA_REGISTRYINDEX, "COM_Command"); // push COM_Command
|
||||
I_Assert(lua_istable(gL, -1));
|
||||
|
||||
|
@ -167,7 +175,7 @@ void COM_Lua_f(void)
|
|||
LUA_PushUserdata(gL, &players[playernum], META_PLAYER);
|
||||
for (i = 1; i < COM_Argc(); i++)
|
||||
lua_pushstring(gL, COM_Argv(i));
|
||||
LUA_Call(gL, (int)COM_Argc()); // COM_Argc is 1-based, so this will cover the player we passed too.
|
||||
LUA_Call(gL, (int)COM_Argc(), 0, 1); // COM_Argc is 1-based, so this will cover the player we passed too.
|
||||
}
|
||||
|
||||
// Wrapper for COM_AddCommand
|
||||
|
@ -277,6 +285,9 @@ static void Lua_OnChange(void)
|
|||
|
||||
/// \todo Network this! XD_LUAVAR
|
||||
|
||||
lua_pushcfunction(gL, LUA_GetErrorMessage);
|
||||
lua_insert(gL, 1); // Because LUA_Call wants it at index 1.
|
||||
|
||||
// From CV_OnChange registry field, get the function for this cvar by name.
|
||||
lua_getfield(gL, LUA_REGISTRYINDEX, "CV_OnChange");
|
||||
I_Assert(lua_istable(gL, -1));
|
||||
|
@ -288,8 +299,9 @@ static void Lua_OnChange(void)
|
|||
lua_getfield(gL, -1, cvname); // get consvar_t* userdata.
|
||||
lua_remove(gL, -2); // pop the CV_Vars table.
|
||||
|
||||
LUA_Call(gL, 1); // call function(cvar)
|
||||
LUA_Call(gL, 1, 0, 1); // call function(cvar)
|
||||
lua_pop(gL, 1); // pop CV_OnChange table
|
||||
lua_remove(gL, 1); // remove LUA_GetErrorMessage
|
||||
}
|
||||
|
||||
static int lib_cvRegisterVar(lua_State *L)
|
||||
|
@ -440,6 +452,9 @@ static int CVarSetFunction
|
|||
){
|
||||
consvar_t *cvar = (consvar_t *)luaL_checkudata(L, 1, META_CVAR);
|
||||
|
||||
if (cvar->flags & CV_NOLUA)
|
||||
return luaL_error(L, "Variable %s cannot be set from Lua.", cvar->name);
|
||||
|
||||
switch (lua_type(L, 2))
|
||||
{
|
||||
case LUA_TSTRING:
|
||||
|
@ -468,7 +483,12 @@ static int lib_cvStealthSet(lua_State *L)
|
|||
static int lib_cvAddValue(lua_State *L)
|
||||
{
|
||||
consvar_t *cvar = (consvar_t *)luaL_checkudata(L, 1, META_CVAR);
|
||||
|
||||
if (cvar->flags & CV_NOLUA)
|
||||
return luaL_error(L, "Variable %s cannot be set from Lua.", cvar->name);
|
||||
|
||||
CV_AddValue(cvar, (INT32)luaL_checknumber(L, 2));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -60,6 +60,7 @@ enum hook {
|
|||
hook_ShouldJingleContinue,
|
||||
hook_GameQuit,
|
||||
hook_PlayerCmd,
|
||||
hook_MusicChange,
|
||||
|
||||
hook_MAX // last hook
|
||||
};
|
||||
|
@ -111,10 +112,9 @@ void LUAh_PlayerQuit(player_t *plr, kickreason_t reason); // Hook for player qui
|
|||
void LUAh_IntermissionThinker(void); // Hook for Y_Ticker
|
||||
boolean LUAh_TeamSwitch(player_t *player, int newteam, boolean fromspectators, boolean tryingautobalance, boolean tryingscramble); // Hook for team switching in... uh....
|
||||
UINT8 LUAh_ViewpointSwitch(player_t *player, player_t *newdisplayplayer, boolean forced); // Hook for spy mode
|
||||
#ifdef SEENAMES
|
||||
boolean LUAh_SeenPlayer(player_t *player, player_t *seenfriend); // Hook for MT_NAMECHECK
|
||||
#endif
|
||||
#define LUAh_PlayerThink(player) LUAh_PlayerHook(player, hook_PlayerThink) // Hook for P_PlayerThink
|
||||
boolean LUAh_ShouldJingleContinue(player_t *player, const char *musname); // Hook for whether a jingle of the given music should continue playing
|
||||
void LUAh_GameQuit(void); // Hook for game quitting
|
||||
void LUAh_GameQuit(boolean quitting); // Hook for game quitting
|
||||
boolean LUAh_PlayerCmd(player_t *player, ticcmd_t *cmd); // Hook for building player's ticcmd struct (Ported from SRB2Kart)
|
||||
boolean LUAh_MusicChange(const char *oldname, char *newname, UINT16 *mflags, boolean *looping, UINT32 *position, UINT32 *prefadems, UINT32 *fadeinms); // Hook for music changes
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
#include "m_perfstats.h"
|
||||
#include "d_netcmd.h" // for cv_perfstats
|
||||
#include "i_system.h" // I_GetTimeMicros
|
||||
#include "i_system.h" // I_GetPreciseTime
|
||||
|
||||
static UINT8 hooksAvailable[(hook_MAX/8)+1];
|
||||
|
||||
|
@ -76,6 +76,7 @@ const char *const hookNames[hook_MAX+1] = {
|
|||
"ShouldJingleContinue",
|
||||
"GameQuit",
|
||||
"PlayerCmd",
|
||||
"MusicChange",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
@ -480,7 +481,7 @@ void LUAh_ThinkFrame(void)
|
|||
continue;
|
||||
|
||||
if (cv_perfstats.value == 3)
|
||||
time_taken = I_GetTimeMicros();
|
||||
time_taken = I_GetPreciseTime();
|
||||
PushHook(gL, hookp);
|
||||
if (lua_pcall(gL, 0, 0, 1)) {
|
||||
if (!hookp->error || cv_debug & DBG_LUA)
|
||||
|
@ -491,7 +492,7 @@ void LUAh_ThinkFrame(void)
|
|||
if (cv_perfstats.value == 3)
|
||||
{
|
||||
lua_Debug ar;
|
||||
time_taken = I_GetTimeMicros() - time_taken;
|
||||
time_taken = I_GetPreciseTime() - time_taken;
|
||||
// we need the function, let's just retrieve it again
|
||||
PushHook(gL, hookp);
|
||||
lua_getinfo(gL, ">S", &ar);
|
||||
|
@ -1753,7 +1754,6 @@ UINT8 LUAh_ViewpointSwitch(player_t *player, player_t *newdisplayplayer, boolean
|
|||
}
|
||||
|
||||
// Hook for MT_NAMECHECK
|
||||
#ifdef SEENAMES
|
||||
boolean LUAh_SeenPlayer(player_t *player, player_t *seenfriend)
|
||||
{
|
||||
hook_p hookp;
|
||||
|
@ -1797,7 +1797,6 @@ boolean LUAh_SeenPlayer(player_t *player, player_t *seenfriend)
|
|||
|
||||
return hasSeenPlayer;
|
||||
}
|
||||
#endif // SEENAMES
|
||||
|
||||
boolean LUAh_ShouldJingleContinue(player_t *player, const char *musname)
|
||||
{
|
||||
|
@ -1845,7 +1844,7 @@ boolean LUAh_ShouldJingleContinue(player_t *player, const char *musname)
|
|||
}
|
||||
|
||||
// Hook for game quitting
|
||||
void LUAh_GameQuit(void)
|
||||
void LUAh_GameQuit(boolean quitting)
|
||||
{
|
||||
hook_p hookp;
|
||||
if (!gL || !(hooksAvailable[hook_GameQuit/8] & (1<<(hook_GameQuit%8))))
|
||||
|
@ -1859,7 +1858,8 @@ void LUAh_GameQuit(void)
|
|||
continue;
|
||||
|
||||
PushHook(gL, hookp);
|
||||
if (lua_pcall(gL, 0, 0, 1)) {
|
||||
lua_pushboolean(gL, quitting);
|
||||
if (lua_pcall(gL, 1, 0, 1)) {
|
||||
if (!hookp->error || cv_debug & DBG_LUA)
|
||||
CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1));
|
||||
lua_pop(gL, 1);
|
||||
|
@ -1912,3 +1912,62 @@ boolean LUAh_PlayerCmd(player_t *player, ticcmd_t *cmd)
|
|||
hook_cmd_running = false;
|
||||
return hooked;
|
||||
}
|
||||
|
||||
// Hook for music changes
|
||||
boolean LUAh_MusicChange(const char *oldname, char *newname, UINT16 *mflags, boolean *looping,
|
||||
UINT32 *position, UINT32 *prefadems, UINT32 *fadeinms)
|
||||
{
|
||||
hook_p hookp;
|
||||
boolean hooked = false;
|
||||
|
||||
if (!gL || !(hooksAvailable[hook_MusicChange/8] & (1<<(hook_MusicChange%8))))
|
||||
return false;
|
||||
|
||||
lua_settop(gL, 0);
|
||||
lua_pushcfunction(gL, LUA_GetErrorMessage);
|
||||
|
||||
for (hookp = roothook; hookp; hookp = hookp->next)
|
||||
if (hookp->type == hook_MusicChange)
|
||||
{
|
||||
PushHook(gL, hookp);
|
||||
lua_pushstring(gL, oldname);
|
||||
lua_pushstring(gL, newname);
|
||||
lua_pushinteger(gL, *mflags);
|
||||
lua_pushboolean(gL, *looping);
|
||||
lua_pushinteger(gL, *position);
|
||||
lua_pushinteger(gL, *prefadems);
|
||||
lua_pushinteger(gL, *fadeinms);
|
||||
if (lua_pcall(gL, 7, 6, 1)) {
|
||||
CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL,-1));
|
||||
lua_pop(gL, 1);
|
||||
continue;
|
||||
}
|
||||
|
||||
// output 1: true, false, or string musicname override
|
||||
if (lua_isboolean(gL, -6) && lua_toboolean(gL, -6))
|
||||
hooked = true;
|
||||
else if (lua_isstring(gL, -6))
|
||||
strncpy(newname, lua_tostring(gL, -6), 7);
|
||||
// output 2: mflags override
|
||||
if (lua_isnumber(gL, -5))
|
||||
*mflags = lua_tonumber(gL, -5);
|
||||
// output 3: looping override
|
||||
if (lua_isboolean(gL, -4))
|
||||
*looping = lua_toboolean(gL, -4);
|
||||
// output 4: position override
|
||||
if (lua_isboolean(gL, -3))
|
||||
*position = lua_tonumber(gL, -3);
|
||||
// output 5: prefadems override
|
||||
if (lua_isboolean(gL, -2))
|
||||
*prefadems = lua_tonumber(gL, -2);
|
||||
// output 6: fadeinms override
|
||||
if (lua_isboolean(gL, -1))
|
||||
*fadeinms = lua_tonumber(gL, -1);
|
||||
|
||||
lua_pop(gL, 7); // Pop returned values and error handler
|
||||
}
|
||||
|
||||
lua_settop(gL, 0);
|
||||
newname[6] = 0;
|
||||
return hooked;
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
enum hud {
|
||||
hud_stagetitle = 0,
|
||||
hud_textspectator,
|
||||
hud_crosshair,
|
||||
// Singleplayer / Co-op
|
||||
hud_score,
|
||||
hud_time,
|
||||
|
|
149
src/lua_hudlib.c
149
src/lua_hudlib.c
|
@ -35,15 +35,11 @@ static UINT8 hud_enabled[(hud_MAX/8)+1];
|
|||
|
||||
static UINT8 hudAvailable; // hud hooks field
|
||||
|
||||
#ifdef LUA_PATCH_SAFETY
|
||||
static patchinfo_t *patchinfo, *patchinfohead;
|
||||
static int numluapatches;
|
||||
#endif
|
||||
|
||||
// must match enum hud in lua_hud.h
|
||||
static const char *const hud_disable_options[] = {
|
||||
"stagetitle",
|
||||
"textspectator",
|
||||
"crosshair",
|
||||
|
||||
"score",
|
||||
"time",
|
||||
|
@ -292,11 +288,7 @@ static int colormap_get(lua_State *L)
|
|||
|
||||
static int patch_get(lua_State *L)
|
||||
{
|
||||
#ifdef LUA_PATCH_SAFETY
|
||||
patch_t *patch = *((patch_t **)luaL_checkudata(L, 1, META_PATCH));
|
||||
#else
|
||||
patchinfo_t *patch = *((patchinfo_t **)luaL_checkudata(L, 1, META_PATCH));
|
||||
#endif
|
||||
enum patch field = luaL_checkoption(L, 2, NULL, patch_opt);
|
||||
|
||||
// patches are invalidated when switching renderers
|
||||
|
@ -314,16 +306,16 @@ static int patch_get(lua_State *L)
|
|||
lua_pushboolean(L, patch != NULL);
|
||||
break;
|
||||
case patch_width:
|
||||
lua_pushinteger(L, SHORT(patch->width));
|
||||
lua_pushinteger(L, patch->width);
|
||||
break;
|
||||
case patch_height:
|
||||
lua_pushinteger(L, SHORT(patch->height));
|
||||
lua_pushinteger(L, patch->height);
|
||||
break;
|
||||
case patch_leftoffset:
|
||||
lua_pushinteger(L, SHORT(patch->leftoffset));
|
||||
lua_pushinteger(L, patch->leftoffset);
|
||||
break;
|
||||
case patch_topoffset:
|
||||
lua_pushinteger(L, SHORT(patch->topoffset));
|
||||
lua_pushinteger(L, patch->topoffset);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
|
@ -403,59 +395,8 @@ static int libd_patchExists(lua_State *L)
|
|||
|
||||
static int libd_cachePatch(lua_State *L)
|
||||
{
|
||||
#ifdef LUA_PATCH_SAFETY
|
||||
int i;
|
||||
lumpnum_t lumpnum;
|
||||
patchinfo_t *luapat;
|
||||
patch_t *realpatch;
|
||||
|
||||
HUDONLY
|
||||
|
||||
luapat = patchinfohead;
|
||||
lumpnum = W_CheckNumForLongName(luaL_checkstring(L, 1));
|
||||
if (lumpnum == LUMPERROR)
|
||||
lumpnum = W_GetNumForLongName("MISSING");
|
||||
|
||||
for (i = 0; i < numluapatches; i++)
|
||||
{
|
||||
// check if already cached
|
||||
if (luapat->wadnum == WADFILENUM(lumpnum) && luapat->lumpnum == LUMPNUM(lumpnum))
|
||||
{
|
||||
LUA_PushUserdata(L, luapat, META_PATCH);
|
||||
return 1;
|
||||
}
|
||||
luapat = luapat->next;
|
||||
if (!luapat)
|
||||
break;
|
||||
}
|
||||
|
||||
if (numluapatches > 0)
|
||||
{
|
||||
patchinfo->next = Z_Malloc(sizeof(patchinfo_t), PU_STATIC, NULL);
|
||||
patchinfo = patchinfo->next;
|
||||
}
|
||||
else
|
||||
{
|
||||
patchinfo = Z_Malloc(sizeof(patchinfo_t), PU_STATIC, NULL);
|
||||
patchinfohead = patchinfo;
|
||||
}
|
||||
|
||||
realpatch = W_CachePatchNum(lumpnum, PU_PATCH);
|
||||
|
||||
patchinfo->width = realpatch->width;
|
||||
patchinfo->height = realpatch->height;
|
||||
patchinfo->leftoffset = realpatch->leftoffset;
|
||||
patchinfo->topoffset = realpatch->topoffset;
|
||||
|
||||
patchinfo->wadnum = WADFILENUM(lumpnum);
|
||||
patchinfo->lumpnum = LUMPNUM(lumpnum);
|
||||
|
||||
LUA_PushUserdata(L, patchinfo, META_PATCH);
|
||||
numluapatches++;
|
||||
#else
|
||||
HUDONLY
|
||||
LUA_PushUserdata(L, W_CachePatchLongName(luaL_checkstring(L, 1), PU_PATCH), META_PATCH);
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -518,9 +459,8 @@ static int libd_getSpritePatch(lua_State *L)
|
|||
INT32 rot = R_GetRollAngle(rollangle);
|
||||
|
||||
if (rot) {
|
||||
if (!(sprframe->rotsprite.cached & (1<<angle)))
|
||||
R_CacheRotSprite(i, frame, NULL, sprframe, angle, sprframe->flip & (1<<angle));
|
||||
LUA_PushUserdata(L, sprframe->rotsprite.patch[angle][rot], META_PATCH);
|
||||
patch_t *rotsprite = Patch_GetRotatedSprite(sprframe, frame, angle, sprframe->flip & (1<<angle), true, &spriteinfo[i], rot);
|
||||
LUA_PushUserdata(L, rotsprite, META_PATCH);
|
||||
lua_pushboolean(L, false);
|
||||
lua_pushboolean(L, true);
|
||||
return 3;
|
||||
|
@ -529,7 +469,7 @@ static int libd_getSpritePatch(lua_State *L)
|
|||
#endif
|
||||
|
||||
// push both the patch and it's "flip" value
|
||||
LUA_PushUserdata(L, W_CachePatchNum(sprframe->lumppat[angle], PU_PATCH), META_PATCH);
|
||||
LUA_PushUserdata(L, W_CachePatchNum(sprframe->lumppat[angle], PU_SPRITE), META_PATCH);
|
||||
lua_pushboolean(L, (sprframe->flip & (1<<angle)) != 0);
|
||||
return 2;
|
||||
}
|
||||
|
@ -631,9 +571,8 @@ static int libd_getSprite2Patch(lua_State *L)
|
|||
INT32 rot = R_GetRollAngle(rollangle);
|
||||
|
||||
if (rot) {
|
||||
if (!(sprframe->rotsprite.cached & (1<<angle)))
|
||||
R_CacheRotSprite(SPR_PLAY, frame, &skins[i].sprinfo[j], sprframe, angle, sprframe->flip & (1<<angle));
|
||||
LUA_PushUserdata(L, sprframe->rotsprite.patch[angle][rot], META_PATCH);
|
||||
patch_t *rotsprite = Patch_GetRotatedSprite(sprframe, frame, angle, sprframe->flip & (1<<angle), true, &skins[i].sprinfo[j], rot);
|
||||
LUA_PushUserdata(L, rotsprite, META_PATCH);
|
||||
lua_pushboolean(L, false);
|
||||
lua_pushboolean(L, true);
|
||||
return 3;
|
||||
|
@ -642,7 +581,7 @@ static int libd_getSprite2Patch(lua_State *L)
|
|||
#endif
|
||||
|
||||
// push both the patch and it's "flip" value
|
||||
LUA_PushUserdata(L, W_CachePatchNum(sprframe->lumppat[angle], PU_PATCH), META_PATCH);
|
||||
LUA_PushUserdata(L, W_CachePatchNum(sprframe->lumppat[angle], PU_SPRITE), META_PATCH);
|
||||
lua_pushboolean(L, (sprframe->flip & (1<<angle)) != 0);
|
||||
return 2;
|
||||
}
|
||||
|
@ -651,22 +590,14 @@ static int libd_draw(lua_State *L)
|
|||
{
|
||||
INT32 x, y, flags;
|
||||
patch_t *patch;
|
||||
#ifdef LUA_PATCH_SAFETY
|
||||
patchinfo_t *luapat;
|
||||
#endif
|
||||
const UINT8 *colormap = NULL;
|
||||
|
||||
HUDONLY
|
||||
x = luaL_checkinteger(L, 1);
|
||||
y = luaL_checkinteger(L, 2);
|
||||
#ifdef LUA_PATCH_SAFETY
|
||||
luapat = *((patchinfo_t **)luaL_checkudata(L, 3, META_PATCH));
|
||||
patch = W_CachePatchNum((luapat->wadnum<<16)+luapat->lumpnum, PU_PATCH);
|
||||
#else
|
||||
patch = *((patch_t **)luaL_checkudata(L, 3, META_PATCH));
|
||||
if (!patch)
|
||||
return LUA_ErrInvalid(L, "patch_t");
|
||||
#endif
|
||||
flags = luaL_optinteger(L, 4, 0);
|
||||
if (!lua_isnoneornil(L, 5))
|
||||
colormap = *((UINT8 **)luaL_checkudata(L, 5, META_COLORMAP));
|
||||
|
@ -682,9 +613,6 @@ static int libd_drawScaled(lua_State *L)
|
|||
fixed_t x, y, scale;
|
||||
INT32 flags;
|
||||
patch_t *patch;
|
||||
#ifdef LUA_PATCH_SAFETY
|
||||
patchinfo_t *luapat;
|
||||
#endif
|
||||
const UINT8 *colormap = NULL;
|
||||
|
||||
HUDONLY
|
||||
|
@ -693,14 +621,9 @@ static int libd_drawScaled(lua_State *L)
|
|||
scale = luaL_checkinteger(L, 3);
|
||||
if (scale < 0)
|
||||
return luaL_error(L, "negative scale");
|
||||
#ifdef LUA_PATCH_SAFETY
|
||||
luapat = *((patchinfo_t **)luaL_checkudata(L, 4, META_PATCH));
|
||||
patch = W_CachePatchNum((luapat->wadnum<<16)+luapat->lumpnum, PU_PATCH);
|
||||
#else
|
||||
patch = *((patch_t **)luaL_checkudata(L, 4, META_PATCH));
|
||||
if (!patch)
|
||||
return LUA_ErrInvalid(L, "patch_t");
|
||||
#endif
|
||||
flags = luaL_optinteger(L, 5, 0);
|
||||
if (!lua_isnoneornil(L, 6))
|
||||
colormap = *((UINT8 **)luaL_checkudata(L, 6, META_COLORMAP));
|
||||
|
@ -974,8 +897,10 @@ static int libd_getColormap(lua_State *L)
|
|||
else if (lua_type(L, 1) == LUA_TNUMBER) // skin number
|
||||
{
|
||||
skinnum = (INT32)luaL_checkinteger(L, 1);
|
||||
if (skinnum < TC_BLINK || skinnum >= MAXSKINS)
|
||||
return luaL_error(L, "skin number %d is out of range (%d - %d)", skinnum, TC_BLINK, MAXSKINS-1);
|
||||
if (skinnum >= MAXSKINS)
|
||||
return luaL_error(L, "skin number %d is out of range (>%d)", skinnum, MAXSKINS-1);
|
||||
else if (skinnum < 0 && skinnum > TC_DEFAULT)
|
||||
return luaL_error(L, "translation colormap index is out of range");
|
||||
}
|
||||
else // skin name
|
||||
{
|
||||
|
@ -1261,10 +1186,6 @@ int LUA_HudLib(lua_State *L)
|
|||
{
|
||||
memset(hud_enabled, 0xff, (hud_MAX/8)+1);
|
||||
|
||||
#ifdef LUA_PATCH_SAFETY
|
||||
numluapatches = 0;
|
||||
#endif
|
||||
|
||||
lua_newtable(L); // HUD registry table
|
||||
lua_newtable(L);
|
||||
luaL_register(L, NULL, lib_draw);
|
||||
|
@ -1343,7 +1264,9 @@ void LUAh_GameHUD(player_t *stplayr)
|
|||
return;
|
||||
|
||||
hud_running = true;
|
||||
lua_pop(gL, -1);
|
||||
lua_settop(gL, 0);
|
||||
|
||||
lua_pushcfunction(gL, LUA_GetErrorMessage);
|
||||
|
||||
lua_getfield(gL, LUA_REGISTRYINDEX, "HUD");
|
||||
I_Assert(lua_istable(gL, -1));
|
||||
|
@ -1365,9 +1288,9 @@ void LUAh_GameHUD(player_t *stplayr)
|
|||
lua_pushvalue(gL, -5); // graphics library (HUD[1])
|
||||
lua_pushvalue(gL, -5); // stplayr
|
||||
lua_pushvalue(gL, -5); // camera
|
||||
LUA_Call(gL, 3);
|
||||
LUA_Call(gL, 3, 0, 1);
|
||||
}
|
||||
lua_pop(gL, -1);
|
||||
lua_settop(gL, 0);
|
||||
hud_running = false;
|
||||
}
|
||||
|
||||
|
@ -1377,7 +1300,9 @@ void LUAh_ScoresHUD(void)
|
|||
return;
|
||||
|
||||
hud_running = true;
|
||||
lua_pop(gL, -1);
|
||||
lua_settop(gL, 0);
|
||||
|
||||
lua_pushcfunction(gL, LUA_GetErrorMessage);
|
||||
|
||||
lua_getfield(gL, LUA_REGISTRYINDEX, "HUD");
|
||||
I_Assert(lua_istable(gL, -1));
|
||||
|
@ -1390,9 +1315,9 @@ void LUAh_ScoresHUD(void)
|
|||
lua_pushnil(gL);
|
||||
while (lua_next(gL, -3) != 0) {
|
||||
lua_pushvalue(gL, -3); // graphics library (HUD[1])
|
||||
LUA_Call(gL, 1);
|
||||
LUA_Call(gL, 1, 0, 1);
|
||||
}
|
||||
lua_pop(gL, -1);
|
||||
lua_settop(gL, 0);
|
||||
hud_running = false;
|
||||
}
|
||||
|
||||
|
@ -1402,7 +1327,9 @@ void LUAh_TitleHUD(void)
|
|||
return;
|
||||
|
||||
hud_running = true;
|
||||
lua_pop(gL, -1);
|
||||
lua_settop(gL, 0);
|
||||
|
||||
lua_pushcfunction(gL, LUA_GetErrorMessage);
|
||||
|
||||
lua_getfield(gL, LUA_REGISTRYINDEX, "HUD");
|
||||
I_Assert(lua_istable(gL, -1));
|
||||
|
@ -1415,9 +1342,9 @@ void LUAh_TitleHUD(void)
|
|||
lua_pushnil(gL);
|
||||
while (lua_next(gL, -3) != 0) {
|
||||
lua_pushvalue(gL, -3); // graphics library (HUD[1])
|
||||
LUA_Call(gL, 1);
|
||||
LUA_Call(gL, 1, 0, 1);
|
||||
}
|
||||
lua_pop(gL, -1);
|
||||
lua_settop(gL, 0);
|
||||
hud_running = false;
|
||||
}
|
||||
|
||||
|
@ -1427,7 +1354,9 @@ void LUAh_TitleCardHUD(player_t *stplayr)
|
|||
return;
|
||||
|
||||
hud_running = true;
|
||||
lua_pop(gL, -1);
|
||||
lua_settop(gL, 0);
|
||||
|
||||
lua_pushcfunction(gL, LUA_GetErrorMessage);
|
||||
|
||||
lua_getfield(gL, LUA_REGISTRYINDEX, "HUD");
|
||||
I_Assert(lua_istable(gL, -1));
|
||||
|
@ -1448,10 +1377,10 @@ void LUAh_TitleCardHUD(player_t *stplayr)
|
|||
lua_pushvalue(gL, -6); // stplayr
|
||||
lua_pushvalue(gL, -6); // lt_ticker
|
||||
lua_pushvalue(gL, -6); // lt_endtime
|
||||
LUA_Call(gL, 4);
|
||||
LUA_Call(gL, 4, 0, 1);
|
||||
}
|
||||
|
||||
lua_pop(gL, -1);
|
||||
lua_settop(gL, 0);
|
||||
hud_running = false;
|
||||
}
|
||||
|
||||
|
@ -1461,7 +1390,9 @@ void LUAh_IntermissionHUD(void)
|
|||
return;
|
||||
|
||||
hud_running = true;
|
||||
lua_pop(gL, -1);
|
||||
lua_settop(gL, 0);
|
||||
|
||||
lua_pushcfunction(gL, LUA_GetErrorMessage);
|
||||
|
||||
lua_getfield(gL, LUA_REGISTRYINDEX, "HUD");
|
||||
I_Assert(lua_istable(gL, -1));
|
||||
|
@ -1474,8 +1405,8 @@ void LUAh_IntermissionHUD(void)
|
|||
lua_pushnil(gL);
|
||||
while (lua_next(gL, -3) != 0) {
|
||||
lua_pushvalue(gL, -3); // graphics library (HUD[1])
|
||||
LUA_Call(gL, 1);
|
||||
LUA_Call(gL, 1, 0, 1);
|
||||
}
|
||||
lua_pop(gL, -1);
|
||||
lua_settop(gL, 0);
|
||||
hud_running = false;
|
||||
}
|
||||
|
|
|
@ -14,9 +14,12 @@
|
|||
#include "fastcmp.h"
|
||||
#include "info.h"
|
||||
#include "dehacked.h"
|
||||
#include "deh_tables.h"
|
||||
#include "deh_lua.h"
|
||||
#include "p_mobj.h"
|
||||
#include "p_local.h"
|
||||
#include "z_zone.h"
|
||||
#include "r_patch.h"
|
||||
#include "r_picformats.h"
|
||||
#include "r_things.h"
|
||||
#include "r_draw.h" // R_GetColorByName
|
||||
|
@ -30,7 +33,7 @@
|
|||
extern CV_PossibleValue_t Color_cons_t[];
|
||||
extern UINT8 skincolor_modified[];
|
||||
|
||||
boolean LUA_CallAction(const char *action, mobj_t *actor);
|
||||
boolean LUA_CallAction(enum actionnum actionnum, mobj_t *actor);
|
||||
state_t *astate;
|
||||
|
||||
enum sfxinfo_read {
|
||||
|
@ -63,6 +66,8 @@ const char *const sfxinfo_wopt[] = {
|
|||
"caption",
|
||||
NULL};
|
||||
|
||||
boolean actionsoverridden[NUMACTIONS] = {false};
|
||||
|
||||
//
|
||||
// Sprite Names
|
||||
//
|
||||
|
@ -375,17 +380,13 @@ static int lib_setSpriteInfo(lua_State *L)
|
|||
if (hud_running)
|
||||
return luaL_error(L, "Do not alter spriteinfo_t in HUD rendering code!");
|
||||
if (hook_cmd_running)
|
||||
return luaL_error(L, "Do not alter spriteinfo_t in CMD building code!");
|
||||
return luaL_error(L, "Do not alter spriteinfo_t in CMD building code!");
|
||||
|
||||
lua_remove(L, 1);
|
||||
{
|
||||
UINT32 i = luaL_checkinteger(L, 1);
|
||||
if (i == 0 || i >= NUMSPRITES)
|
||||
return luaL_error(L, "spriteinfo[] index %d out of range (1 - %d)", i, NUMSPRITES-1);
|
||||
#ifdef ROTSPRITE
|
||||
if (sprites != NULL)
|
||||
R_FreeSingleRotSprite(&sprites[i]);
|
||||
#endif
|
||||
info = &spriteinfo[i]; // get the spriteinfo to assign to.
|
||||
}
|
||||
luaL_checktype(L, 2, LUA_TTABLE); // check that we've been passed a table.
|
||||
|
@ -469,11 +470,6 @@ static int spriteinfo_set(lua_State *L)
|
|||
lua_remove(L, 1); // remove field
|
||||
lua_settop(L, 1); // leave only one value
|
||||
|
||||
#ifdef ROTSPRITE
|
||||
if (sprites != NULL)
|
||||
R_FreeSingleRotSprite(&sprites[sprinfo-spriteinfo]);
|
||||
#endif
|
||||
|
||||
if (fastcmp(field, "pivot"))
|
||||
{
|
||||
// pivot[] is a table
|
||||
|
@ -630,6 +626,9 @@ static void A_Lua(mobj_t *actor)
|
|||
boolean found = false;
|
||||
I_Assert(actor != NULL);
|
||||
|
||||
lua_settop(gL, 0); // Just in case...
|
||||
lua_pushcfunction(gL, LUA_GetErrorMessage);
|
||||
|
||||
// get the action for this state
|
||||
lua_getfield(gL, LUA_REGISTRYINDEX, LREG_STATEACTION);
|
||||
I_Assert(lua_istable(gL, -1));
|
||||
|
@ -658,7 +657,7 @@ static void A_Lua(mobj_t *actor)
|
|||
LUA_PushUserdata(gL, actor, META_MOBJ);
|
||||
lua_pushinteger(gL, var1);
|
||||
lua_pushinteger(gL, var2);
|
||||
LUA_Call(gL, 3);
|
||||
LUA_Call(gL, 3, 0, 1);
|
||||
|
||||
if (found)
|
||||
{
|
||||
|
@ -813,36 +812,33 @@ boolean LUA_SetLuaAction(void *stv, const char *action)
|
|||
return true; // action successfully set.
|
||||
}
|
||||
|
||||
boolean LUA_CallAction(const char *csaction, mobj_t *actor)
|
||||
boolean LUA_CallAction(enum actionnum actionnum, mobj_t *actor)
|
||||
{
|
||||
I_Assert(csaction != NULL);
|
||||
I_Assert(actor != NULL);
|
||||
|
||||
if (!gL) // Lua isn't loaded,
|
||||
if (!actionsoverridden[actionnum]) // The action is not overriden,
|
||||
return false; // action not called.
|
||||
|
||||
if (superstack && fasticmp(csaction, superactions[superstack-1])) // the action is calling itself,
|
||||
if (superstack && fasticmp(actionpointers[actionnum].name, superactions[superstack-1])) // the action is calling itself,
|
||||
return false; // let it call the hardcoded function instead.
|
||||
|
||||
lua_pushcfunction(gL, LUA_GetErrorMessage);
|
||||
|
||||
// grab function by uppercase name.
|
||||
lua_getfield(gL, LUA_REGISTRYINDEX, LREG_ACTIONS);
|
||||
{
|
||||
char *action = Z_StrDup(csaction);
|
||||
strupr(action);
|
||||
lua_getfield(gL, -1, action);
|
||||
Z_Free(action);
|
||||
}
|
||||
lua_getfield(gL, -1, actionpointers[actionnum].name);
|
||||
lua_remove(gL, -2); // pop LREG_ACTIONS
|
||||
|
||||
if (lua_isnil(gL, -1)) // no match
|
||||
{
|
||||
lua_pop(gL, 1); // pop nil
|
||||
lua_pop(gL, 2); // pop nil and error handler
|
||||
return false; // action not called.
|
||||
}
|
||||
|
||||
if (superstack == MAXRECURSION)
|
||||
{
|
||||
CONS_Alert(CONS_WARNING, "Max Lua Action recursion reached! Cool it on the calling A_Action functions from inside A_Action functions!\n");
|
||||
lua_pop(gL, 2); // pop function and error handler
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -853,10 +849,11 @@ boolean LUA_CallAction(const char *csaction, mobj_t *actor)
|
|||
lua_pushinteger(gL, var1);
|
||||
lua_pushinteger(gL, var2);
|
||||
|
||||
superactions[superstack] = csaction;
|
||||
superactions[superstack] = actionpointers[actionnum].name;
|
||||
++superstack;
|
||||
|
||||
LUA_Call(gL, 3);
|
||||
LUA_Call(gL, 3, 0, -(2 + 3));
|
||||
lua_pop(gL, -1); // Error handler
|
||||
|
||||
--superstack;
|
||||
superactions[superstack] = NULL;
|
||||
|
@ -1638,8 +1635,10 @@ static int skincolor_get(lua_State *L)
|
|||
lua_pushinteger(L, info->chatcolor);
|
||||
else if (fastcmp(field,"accessible"))
|
||||
lua_pushboolean(L, info->accessible);
|
||||
else
|
||||
else {
|
||||
CONS_Debug(DBG_LUA, M_GetText("'%s' has no field named '%s'; returning nil.\n"), "skincolor_t", field);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
|
||||
extern lua_State *gL;
|
||||
|
||||
#define MUTABLE_TAGS
|
||||
|
||||
#define LREG_VALID "VALID_USERDATA"
|
||||
#define LREG_EXTVARS "LUA_VARS"
|
||||
#define LREG_STATEACTION "STATE_ACTION"
|
||||
|
@ -27,6 +29,8 @@ extern lua_State *gL;
|
|||
#define META_PIVOTLIST "SPRITEFRAMEPIVOT_T[]"
|
||||
#define META_FRAMEPIVOT "SPRITEFRAMEPIVOT_T*"
|
||||
|
||||
#define META_TAGLIST "TAGLIST"
|
||||
|
||||
#define META_MOBJ "MOBJ_T*"
|
||||
#define META_MAPTHING "MAPTHING_T*"
|
||||
|
||||
|
@ -35,6 +39,8 @@ extern lua_State *gL;
|
|||
#define META_SKIN "SKIN_T*"
|
||||
#define META_POWERS "PLAYER_T*POWERS"
|
||||
#define META_SOUNDSID "SKIN_T*SOUNDSID"
|
||||
#define META_SKINSPRITES "SKIN_T*SPRITES"
|
||||
#define META_SKINSPRITESLIST "SKIN_T*SPRITES[]"
|
||||
|
||||
#define META_VERTEX "VERTEX_T*"
|
||||
#define META_LINE "LINE_T*"
|
||||
|
@ -56,6 +62,9 @@ extern lua_State *gL;
|
|||
#define META_CVAR "CONSVAR_T*"
|
||||
|
||||
#define META_SECTORLINES "SECTOR_T*LINES"
|
||||
#ifdef MUTABLE_TAGS
|
||||
#define META_SECTORTAGLIST "sector_t.taglist"
|
||||
#endif
|
||||
#define META_SIDENUM "LINE_T*SIDENUM"
|
||||
#define META_LINEARGS "LINE_T*ARGS"
|
||||
#define META_LINESTRINGARGS "LINE_T*STRINGARGS"
|
||||
|
@ -93,6 +102,7 @@ int LUA_PlayerLib(lua_State *L);
|
|||
int LUA_SkinLib(lua_State *L);
|
||||
int LUA_ThinkerLib(lua_State *L);
|
||||
int LUA_MapLib(lua_State *L);
|
||||
int LUA_TagLib(lua_State *L);
|
||||
int LUA_PolyObjLib(lua_State *L);
|
||||
int LUA_BlockmapLib(lua_State *L);
|
||||
int LUA_HudLib(lua_State *L);
|
||||
|
|
101
src/lua_maplib.c
101
src/lua_maplib.c
|
@ -37,6 +37,7 @@ enum sector_e {
|
|||
sector_lightlevel,
|
||||
sector_special,
|
||||
sector_tag,
|
||||
sector_taglist,
|
||||
sector_thinglist,
|
||||
sector_heightsec,
|
||||
sector_camsec,
|
||||
|
@ -55,6 +56,7 @@ static const char *const sector_opt[] = {
|
|||
"lightlevel",
|
||||
"special",
|
||||
"tag",
|
||||
"taglist",
|
||||
"thinglist",
|
||||
"heightsec",
|
||||
"camsec",
|
||||
|
@ -89,6 +91,7 @@ enum line_e {
|
|||
line_flags,
|
||||
line_special,
|
||||
line_tag,
|
||||
line_taglist,
|
||||
line_args,
|
||||
line_stringargs,
|
||||
line_sidenum,
|
||||
|
@ -99,8 +102,6 @@ enum line_e {
|
|||
line_slopetype,
|
||||
line_frontsector,
|
||||
line_backsector,
|
||||
line_firsttag,
|
||||
line_nexttag,
|
||||
line_polyobj,
|
||||
line_text,
|
||||
line_callcount
|
||||
|
@ -115,6 +116,7 @@ static const char *const line_opt[] = {
|
|||
"flags",
|
||||
"special",
|
||||
"tag",
|
||||
"taglist",
|
||||
"args",
|
||||
"stringargs",
|
||||
"sidenum",
|
||||
|
@ -125,8 +127,6 @@ static const char *const line_opt[] = {
|
|||
"slopetype",
|
||||
"frontsector",
|
||||
"backsector",
|
||||
"firsttag",
|
||||
"nexttag",
|
||||
"polyobj",
|
||||
"text",
|
||||
"callcount",
|
||||
|
@ -583,7 +583,10 @@ static int sector_get(lua_State *L)
|
|||
lua_pushinteger(L, sector->special);
|
||||
return 1;
|
||||
case sector_tag:
|
||||
lua_pushinteger(L, sector->tag);
|
||||
lua_pushinteger(L, (UINT16)Tag_FGet(§or->tags));
|
||||
return 1;
|
||||
case sector_taglist:
|
||||
LUA_PushUserdata(L, §or->tags, META_SECTORTAGLIST);
|
||||
return 1;
|
||||
case sector_thinglist: // thinglist
|
||||
lua_pushcfunction(L, lib_iterateSectorThinglist);
|
||||
|
@ -684,8 +687,10 @@ static int sector_set(lua_State *L)
|
|||
sector->special = (INT16)luaL_checkinteger(L, 3);
|
||||
break;
|
||||
case sector_tag:
|
||||
P_ChangeSectorTag((UINT32)(sector - sectors), (INT16)luaL_checkinteger(L, 3));
|
||||
Tag_SectorFSet((UINT32)(sector - sectors), (INT16)luaL_checkinteger(L, 3));
|
||||
break;
|
||||
case sector_taglist:
|
||||
return LUA_ErrSetDirectly(L, "sector_t", "taglist");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -823,7 +828,21 @@ static int line_get(lua_State *L)
|
|||
lua_pushinteger(L, line->special);
|
||||
return 1;
|
||||
case line_tag:
|
||||
lua_pushinteger(L, 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:
|
||||
LUA_PushUserdata(L, &line->tags, META_TAGLIST);
|
||||
return 1;
|
||||
case line_args:
|
||||
LUA_PushUserdata(L, line->args, META_LINEARGS);
|
||||
|
@ -871,12 +890,6 @@ static int line_get(lua_State *L)
|
|||
case line_backsector:
|
||||
LUA_PushUserdata(L, line->backsector, META_SECTOR);
|
||||
return 1;
|
||||
case line_firsttag:
|
||||
lua_pushinteger(L, line->firsttag);
|
||||
return 1;
|
||||
case line_nexttag:
|
||||
lua_pushinteger(L, line->nexttag);
|
||||
return 1;
|
||||
case line_polyobj:
|
||||
LUA_PushUserdata(L, line->polyobj, META_POLYOBJ);
|
||||
return 1;
|
||||
|
@ -1395,25 +1408,15 @@ static int lib_iterateSectors(lua_State *L)
|
|||
|
||||
static int lib_getSector(lua_State *L)
|
||||
{
|
||||
int field;
|
||||
INLEVEL
|
||||
lua_settop(L, 2);
|
||||
lua_remove(L, 1); // dummy userdata table is unused.
|
||||
if (lua_isnumber(L, 1))
|
||||
if (lua_isnumber(L, 2))
|
||||
{
|
||||
size_t i = lua_tointeger(L, 1);
|
||||
size_t i = lua_tointeger(L, 2);
|
||||
if (i >= numsectors)
|
||||
return 0;
|
||||
LUA_PushUserdata(L, §ors[i], META_SECTOR);
|
||||
return 1;
|
||||
}
|
||||
field = luaL_checkoption(L, 1, NULL, array_opt);
|
||||
switch(field)
|
||||
{
|
||||
case 0: // iterate
|
||||
lua_pushcfunction(L, lib_iterateSectors);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1499,25 +1502,15 @@ static int lib_iterateLines(lua_State *L)
|
|||
|
||||
static int lib_getLine(lua_State *L)
|
||||
{
|
||||
int field;
|
||||
INLEVEL
|
||||
lua_settop(L, 2);
|
||||
lua_remove(L, 1); // dummy userdata table is unused.
|
||||
if (lua_isnumber(L, 1))
|
||||
if (lua_isnumber(L, 2))
|
||||
{
|
||||
size_t i = lua_tointeger(L, 1);
|
||||
size_t i = lua_tointeger(L, 2);
|
||||
if (i >= numlines)
|
||||
return 0;
|
||||
LUA_PushUserdata(L, &lines[i], META_LINE);
|
||||
return 1;
|
||||
}
|
||||
field = luaL_checkoption(L, 1, NULL, array_opt);
|
||||
switch(field)
|
||||
{
|
||||
case 0: // iterate
|
||||
lua_pushcfunction(L, lib_iterateLines);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -2199,6 +2192,8 @@ static int mapheaderinfo_get(lua_State *L)
|
|||
lua_pushinteger(L, header->levelflags);
|
||||
else if (fastcmp(field,"menuflags"))
|
||||
lua_pushinteger(L, header->menuflags);
|
||||
else if (fastcmp(field,"selectheading"))
|
||||
lua_pushstring(L, header->selectheading);
|
||||
else if (fastcmp(field,"startrings"))
|
||||
lua_pushinteger(L, header->startrings);
|
||||
else if (fastcmp(field, "sstimer"))
|
||||
|
@ -2368,15 +2363,13 @@ int LUA_MapLib(lua_State *L)
|
|||
//lua_setfield(L, -2, "__len");
|
||||
lua_pop(L, 1);
|
||||
|
||||
lua_newuserdata(L, 0);
|
||||
lua_createtable(L, 0, 2);
|
||||
lua_pushcfunction(L, lib_getSector);
|
||||
lua_setfield(L, -2, "__index");
|
||||
|
||||
lua_pushcfunction(L, lib_numsectors);
|
||||
lua_setfield(L, -2, "__len");
|
||||
lua_setmetatable(L, -2);
|
||||
lua_setglobal(L, "sectors");
|
||||
LUA_PushTaggableObjectArray(L, "sectors",
|
||||
lib_iterateSectors,
|
||||
lib_getSector,
|
||||
lib_numsectors,
|
||||
tags_sectors,
|
||||
&numsectors, §ors,
|
||||
sizeof (sector_t), META_SECTOR);
|
||||
|
||||
lua_newuserdata(L, 0);
|
||||
lua_createtable(L, 0, 2);
|
||||
|
@ -2388,15 +2381,13 @@ int LUA_MapLib(lua_State *L)
|
|||
lua_setmetatable(L, -2);
|
||||
lua_setglobal(L, "subsectors");
|
||||
|
||||
lua_newuserdata(L, 0);
|
||||
lua_createtable(L, 0, 2);
|
||||
lua_pushcfunction(L, lib_getLine);
|
||||
lua_setfield(L, -2, "__index");
|
||||
|
||||
lua_pushcfunction(L, lib_numlines);
|
||||
lua_setfield(L, -2, "__len");
|
||||
lua_setmetatable(L, -2);
|
||||
lua_setglobal(L, "lines");
|
||||
LUA_PushTaggableObjectArray(L, "lines",
|
||||
lib_iterateLines,
|
||||
lib_getLine,
|
||||
lib_numlines,
|
||||
tags_lines,
|
||||
&numlines, &lines,
|
||||
sizeof (line_t), META_LINE);
|
||||
|
||||
lua_newuserdata(L, 0);
|
||||
lua_createtable(L, 0, 2);
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "tables.h"
|
||||
#include "p_local.h"
|
||||
#include "doomstat.h" // for ALL7EMERALDS
|
||||
#include "r_main.h" // for R_PointToDist2
|
||||
|
||||
#include "lua_script.h"
|
||||
#include "lua_libs.h"
|
||||
|
@ -129,7 +130,7 @@ static int lib_fixedsqrt(lua_State *L)
|
|||
|
||||
static int lib_fixedhypot(lua_State *L)
|
||||
{
|
||||
lua_pushfixed(L, FixedHypot(luaL_checkfixed(L, 1), luaL_checkfixed(L, 2)));
|
||||
lua_pushfixed(L, R_PointToDist2(0, 0, luaL_checkfixed(L, 1), luaL_checkfixed(L, 2)));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -192,18 +193,30 @@ static luaL_Reg lib[] = {
|
|||
{"cos", lib_finecosine},
|
||||
{"tan", lib_finetangent},
|
||||
{"FixedAngle", lib_fixedangle},
|
||||
{"fixangle" , lib_fixedangle},
|
||||
{"AngleFixed", lib_anglefixed},
|
||||
{"anglefix" , lib_anglefixed},
|
||||
{"InvAngle", lib_invangle},
|
||||
{"FixedMul", lib_fixedmul},
|
||||
{"fixmul" , lib_fixedmul},
|
||||
{"FixedInt", lib_fixedint},
|
||||
{"fixint" , lib_fixedint},
|
||||
{"FixedDiv", lib_fixeddiv},
|
||||
{"fixdiv" , lib_fixeddiv},
|
||||
{"FixedRem", lib_fixedrem},
|
||||
{"fixrem" , lib_fixedrem},
|
||||
{"FixedSqrt", lib_fixedsqrt},
|
||||
{"fixsqrt" , lib_fixedsqrt},
|
||||
{"FixedHypot", lib_fixedhypot},
|
||||
{"fixhypot" , lib_fixedhypot},
|
||||
{"FixedFloor", lib_fixedfloor},
|
||||
{"fixfloor" , lib_fixedfloor},
|
||||
{"FixedTrunc", lib_fixedtrunc},
|
||||
{"fixtrunc" , lib_fixedtrunc},
|
||||
{"FixedCeil", lib_fixedceil},
|
||||
{"fixceil" , lib_fixedceil},
|
||||
{"FixedRound", lib_fixedround},
|
||||
{"fixround" , lib_fixedround},
|
||||
{"GetSecSpecial", lib_getsecspecial},
|
||||
{"All7Emeralds", lib_all7emeralds},
|
||||
{"ColorOpposite", lib_coloropposite},
|
||||
|
|
|
@ -22,8 +22,6 @@
|
|||
#include "lua_hud.h" // hud_running errors
|
||||
#include "lua_hook.h" // hook_cmd_running errors
|
||||
|
||||
static const char *const array_opt[] ={"iterate",NULL};
|
||||
|
||||
enum mobj_e {
|
||||
mobj_valid = 0,
|
||||
mobj_x,
|
||||
|
@ -39,6 +37,11 @@ enum mobj_e {
|
|||
mobj_frame,
|
||||
mobj_sprite2,
|
||||
mobj_anim_duration,
|
||||
mobj_spritexscale,
|
||||
mobj_spriteyscale,
|
||||
mobj_spritexoffset,
|
||||
mobj_spriteyoffset,
|
||||
mobj_floorspriteslope,
|
||||
mobj_touching_sectorlist,
|
||||
mobj_subsector,
|
||||
mobj_floorz,
|
||||
|
@ -56,8 +59,10 @@ enum mobj_e {
|
|||
mobj_flags,
|
||||
mobj_flags2,
|
||||
mobj_eflags,
|
||||
mobj_renderflags,
|
||||
mobj_skin,
|
||||
mobj_color,
|
||||
mobj_blendmode,
|
||||
mobj_bnext,
|
||||
mobj_bprev,
|
||||
mobj_hnext,
|
||||
|
@ -108,6 +113,11 @@ static const char *const mobj_opt[] = {
|
|||
"frame",
|
||||
"sprite2",
|
||||
"anim_duration",
|
||||
"spritexscale",
|
||||
"spriteyscale",
|
||||
"spritexoffset",
|
||||
"spriteyoffset",
|
||||
"floorspriteslope",
|
||||
"touching_sectorlist",
|
||||
"subsector",
|
||||
"floorz",
|
||||
|
@ -125,8 +135,10 @@ static const char *const mobj_opt[] = {
|
|||
"flags",
|
||||
"flags2",
|
||||
"eflags",
|
||||
"renderflags",
|
||||
"skin",
|
||||
"color",
|
||||
"blendmode",
|
||||
"bnext",
|
||||
"bprev",
|
||||
"hnext",
|
||||
|
@ -227,6 +239,21 @@ static int mobj_get(lua_State *L)
|
|||
case mobj_anim_duration:
|
||||
lua_pushinteger(L, mo->anim_duration);
|
||||
break;
|
||||
case mobj_spritexscale:
|
||||
lua_pushfixed(L, mo->spritexscale);
|
||||
break;
|
||||
case mobj_spriteyscale:
|
||||
lua_pushfixed(L, mo->spriteyscale);
|
||||
break;
|
||||
case mobj_spritexoffset:
|
||||
lua_pushfixed(L, mo->spritexoffset);
|
||||
break;
|
||||
case mobj_spriteyoffset:
|
||||
lua_pushfixed(L, mo->spriteyoffset);
|
||||
break;
|
||||
case mobj_floorspriteslope:
|
||||
LUA_PushUserdata(L, mo->floorspriteslope, META_SLOPE);
|
||||
break;
|
||||
case mobj_touching_sectorlist:
|
||||
return UNIMPLEMENTED;
|
||||
case mobj_subsector:
|
||||
|
@ -277,6 +304,9 @@ static int mobj_get(lua_State *L)
|
|||
case mobj_eflags:
|
||||
lua_pushinteger(L, mo->eflags);
|
||||
break;
|
||||
case mobj_renderflags:
|
||||
lua_pushinteger(L, mo->renderflags);
|
||||
break;
|
||||
case mobj_skin: // skin name or nil, not struct
|
||||
if (!mo->skin)
|
||||
return 0;
|
||||
|
@ -285,6 +315,9 @@ static int mobj_get(lua_State *L)
|
|||
case mobj_color:
|
||||
lua_pushinteger(L, mo->color);
|
||||
break;
|
||||
case mobj_blendmode:
|
||||
lua_pushinteger(L, mo->blendmode);
|
||||
break;
|
||||
case mobj_bnext:
|
||||
LUA_PushUserdata(L, mo->bnext, META_MOBJ);
|
||||
break;
|
||||
|
@ -492,6 +525,20 @@ static int mobj_set(lua_State *L)
|
|||
case mobj_anim_duration:
|
||||
mo->anim_duration = (UINT16)luaL_checkinteger(L, 3);
|
||||
break;
|
||||
case mobj_spritexscale:
|
||||
mo->spritexscale = luaL_checkfixed(L, 3);
|
||||
break;
|
||||
case mobj_spriteyscale:
|
||||
mo->spriteyscale = luaL_checkfixed(L, 3);
|
||||
break;
|
||||
case mobj_spritexoffset:
|
||||
mo->spritexoffset = luaL_checkfixed(L, 3);
|
||||
break;
|
||||
case mobj_spriteyoffset:
|
||||
mo->spriteyoffset = luaL_checkfixed(L, 3);
|
||||
break;
|
||||
case mobj_floorspriteslope:
|
||||
return NOSET;
|
||||
case mobj_touching_sectorlist:
|
||||
return UNIMPLEMENTED;
|
||||
case mobj_subsector:
|
||||
|
@ -580,6 +627,9 @@ static int mobj_set(lua_State *L)
|
|||
case mobj_eflags:
|
||||
mo->eflags = (UINT32)luaL_checkinteger(L, 3);
|
||||
break;
|
||||
case mobj_renderflags:
|
||||
mo->renderflags = (UINT32)luaL_checkinteger(L, 3);
|
||||
break;
|
||||
case mobj_skin: // set skin by name
|
||||
{
|
||||
INT32 i;
|
||||
|
@ -603,6 +653,9 @@ static int mobj_set(lua_State *L)
|
|||
mo->color = newcolor;
|
||||
break;
|
||||
}
|
||||
case mobj_blendmode:
|
||||
mo->blendmode = (INT32)luaL_checkinteger(L, 3);
|
||||
break;
|
||||
case mobj_bnext:
|
||||
return NOSETPOS;
|
||||
case mobj_bprev:
|
||||
|
@ -848,7 +901,12 @@ static int mapthing_get(lua_State *L)
|
|||
else if(fastcmp(field,"extrainfo"))
|
||||
number = mt->extrainfo;
|
||||
else if(fastcmp(field,"tag"))
|
||||
number = mt->tag;
|
||||
number = Tag_FGet(&mt->tags);
|
||||
else if(fastcmp(field,"taglist"))
|
||||
{
|
||||
LUA_PushUserdata(L, &mt->tags, META_TAGLIST);
|
||||
return 1;
|
||||
}
|
||||
else if(fastcmp(field,"args"))
|
||||
{
|
||||
LUA_PushUserdata(L, mt->args, META_THINGARGS);
|
||||
|
@ -910,7 +968,9 @@ static int mapthing_set(lua_State *L)
|
|||
mt->extrainfo = (UINT8)extrainfo;
|
||||
}
|
||||
else if (fastcmp(field,"tag"))
|
||||
mt->tag = (INT16)luaL_checkinteger(L, 3);
|
||||
Tag_FSet(&mt->tags, (INT16)luaL_checkinteger(L, 3));
|
||||
else if (fastcmp(field,"taglist"))
|
||||
return LUA_ErrSetDirectly(L, "mapthing_t", "taglist");
|
||||
else if(fastcmp(field,"mobj"))
|
||||
mt->mobj = *((mobj_t **)luaL_checkudata(L, 3, META_MOBJ));
|
||||
else
|
||||
|
@ -948,25 +1008,15 @@ static int lib_iterateMapthings(lua_State *L)
|
|||
|
||||
static int lib_getMapthing(lua_State *L)
|
||||
{
|
||||
int field;
|
||||
INLEVEL
|
||||
lua_settop(L, 2);
|
||||
lua_remove(L, 1); // dummy userdata table is unused.
|
||||
if (lua_isnumber(L, 1))
|
||||
if (lua_isnumber(L, 2))
|
||||
{
|
||||
size_t i = lua_tointeger(L, 1);
|
||||
size_t i = lua_tointeger(L, 2);
|
||||
if (i >= nummapthings)
|
||||
return 0;
|
||||
LUA_PushUserdata(L, &mapthings[i], META_MAPTHING);
|
||||
return 1;
|
||||
}
|
||||
field = luaL_checkoption(L, 1, NULL, array_opt);
|
||||
switch(field)
|
||||
{
|
||||
case 0: // iterate
|
||||
lua_pushcfunction(L, lib_iterateMapthings);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1013,14 +1063,13 @@ int LUA_MobjLib(lua_State *L)
|
|||
lua_setfield(L, -2, "__len");
|
||||
lua_pop(L,1);
|
||||
|
||||
lua_newuserdata(L, 0);
|
||||
lua_createtable(L, 0, 2);
|
||||
lua_pushcfunction(L, lib_getMapthing);
|
||||
lua_setfield(L, -2, "__index");
|
||||
LUA_PushTaggableObjectArray(L, "mapthings",
|
||||
lib_iterateMapthings,
|
||||
lib_getMapthing,
|
||||
lib_nummapthings,
|
||||
tags_mapthings,
|
||||
&nummapthings, &mapthings,
|
||||
sizeof (mapthing_t), META_MAPTHING);
|
||||
|
||||
lua_pushcfunction(L, lib_nummapthings);
|
||||
lua_setfield(L, -2, "__len");
|
||||
lua_setmetatable(L, -2);
|
||||
lua_setglobal(L, "mapthings");
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -158,6 +158,10 @@ static int player_get(lua_State *L)
|
|||
lua_pushinteger(L, plr->flashpal);
|
||||
else if (fastcmp(field,"skincolor"))
|
||||
lua_pushinteger(L, plr->skincolor);
|
||||
else if (fastcmp(field,"skin"))
|
||||
lua_pushinteger(L, plr->skin);
|
||||
else if (fastcmp(field,"availabilities"))
|
||||
lua_pushinteger(L, plr->availabilities);
|
||||
else if (fastcmp(field,"score"))
|
||||
lua_pushinteger(L, plr->score);
|
||||
else if (fastcmp(field,"dashspeed"))
|
||||
|
@ -469,6 +473,10 @@ static int player_set(lua_State *L)
|
|||
return luaL_error(L, "player.skincolor %d out of range (0 - %d).", newcolor, numskincolors-1);
|
||||
plr->skincolor = newcolor;
|
||||
}
|
||||
else if (fastcmp(field,"skin"))
|
||||
return NOSET;
|
||||
else if (fastcmp(field,"availabilities"))
|
||||
return NOSET;
|
||||
else if (fastcmp(field,"score"))
|
||||
plr->score = (UINT32)luaL_checkinteger(L, 3);
|
||||
else if (fastcmp(field,"dashspeed"))
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
127
src/lua_script.c
127
src/lua_script.c
|
@ -13,6 +13,7 @@
|
|||
#include "doomdef.h"
|
||||
#include "fastcmp.h"
|
||||
#include "dehacked.h"
|
||||
#include "deh_lua.h"
|
||||
#include "z_zone.h"
|
||||
#include "w_wad.h"
|
||||
#include "p_setup.h"
|
||||
|
@ -52,6 +53,7 @@ static lua_CFunction liblist[] = {
|
|||
LUA_SkinLib, // skin_t, skins[]
|
||||
LUA_ThinkerLib, // thinker_t
|
||||
LUA_MapLib, // line_t, side_t, sector_t, subsector_t
|
||||
LUA_TagLib, // tags
|
||||
LUA_PolyObjLib, // polyobj_t
|
||||
LUA_BlockmapLib, // blockmap stuff
|
||||
LUA_HudLib, // HUD stuff
|
||||
|
@ -133,6 +135,19 @@ int LUA_GetErrorMessage(lua_State *L)
|
|||
return 1;
|
||||
}
|
||||
|
||||
int LUA_Call(lua_State *L, int nargs, int nresults, int errorhandlerindex)
|
||||
{
|
||||
int err = lua_pcall(L, nargs, nresults, errorhandlerindex);
|
||||
|
||||
if (err)
|
||||
{
|
||||
CONS_Alert(CONS_WARNING, "%s\n", lua_tostring(L, -1));
|
||||
lua_pop(L, 1);
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
// Moved here from lib_getenum.
|
||||
int LUA_PushGlobals(lua_State *L, const char *word)
|
||||
{
|
||||
|
@ -318,7 +333,7 @@ int LUA_PushGlobals(lua_State *L, const char *word)
|
|||
return 1;
|
||||
// local player variables, by popular request
|
||||
} else if (fastcmp(word,"consoleplayer")) { // player controlling console (aka local player 1)
|
||||
if (consoleplayer < 0 || !playeringame[consoleplayer])
|
||||
if (!addedtogame || consoleplayer < 0 || !playeringame[consoleplayer])
|
||||
return 0;
|
||||
LUA_PushUserdata(L, &players[consoleplayer], META_PLAYER);
|
||||
return 1;
|
||||
|
@ -376,6 +391,44 @@ int LUA_CheckGlobals(lua_State *L, const char *word)
|
|||
redscore = (UINT32)luaL_checkinteger(L, 2);
|
||||
else if (fastcmp(word, "bluescore"))
|
||||
bluescore = (UINT32)luaL_checkinteger(L, 2);
|
||||
else if (fastcmp(word, "skincolor_redteam"))
|
||||
skincolor_redteam = (UINT16)luaL_checkinteger(L, 2);
|
||||
else if (fastcmp(word, "skincolor_blueteam"))
|
||||
skincolor_blueteam = (UINT16)luaL_checkinteger(L, 2);
|
||||
else if (fastcmp(word, "skincolor_redring"))
|
||||
skincolor_redring = (UINT16)luaL_checkinteger(L, 2);
|
||||
else if (fastcmp(word, "skincolor_bluering"))
|
||||
skincolor_bluering = (UINT16)luaL_checkinteger(L, 2);
|
||||
else if (fastcmp(word, "emeralds"))
|
||||
emeralds = (UINT16)luaL_checkinteger(L, 2);
|
||||
else if (fastcmp(word, "token"))
|
||||
token = (UINT32)luaL_checkinteger(L, 2);
|
||||
else if (fastcmp(word, "gravity"))
|
||||
gravity = (fixed_t)luaL_checkinteger(L, 2);
|
||||
else if (fastcmp(word, "stoppedclock"))
|
||||
stoppedclock = luaL_checkboolean(L, 2);
|
||||
else if (fastcmp(word, "displayplayer"))
|
||||
{
|
||||
player_t *player = *((player_t **)luaL_checkudata(L, 2, META_PLAYER));
|
||||
|
||||
if (player)
|
||||
displayplayer = player - players;
|
||||
}
|
||||
else if (fastcmp(word, "mapmusname"))
|
||||
{
|
||||
size_t strlength;
|
||||
const char *str = luaL_checklstring(L, 2, &strlength);
|
||||
|
||||
if (strlength > 6)
|
||||
return luaL_error(L, "string length out of range (maximum 6 characters)");
|
||||
|
||||
if (strlen(str) < strlength)
|
||||
return luaL_error(L, "string must not contain embedded zeros!");
|
||||
|
||||
strncpy(mapmusname, str, strlength);
|
||||
}
|
||||
else if (fastcmp(word, "mapmusflags"))
|
||||
mapmusflags = (UINT16)luaL_checkinteger(L, 2);
|
||||
else
|
||||
return 0;
|
||||
|
||||
|
@ -388,6 +441,7 @@ static int setglobals(lua_State *L)
|
|||
{
|
||||
const char *csname;
|
||||
char *name;
|
||||
enum actionnum actionnum;
|
||||
|
||||
lua_remove(L, 1); // we're not gonna be using _G
|
||||
csname = lua_tostring(L, 1);
|
||||
|
@ -406,6 +460,10 @@ static int setglobals(lua_State *L)
|
|||
lua_rawset(L, -3); // rawset doesn't trigger this metatable again.
|
||||
// otherwise we would've used setfield, obviously.
|
||||
|
||||
actionnum = LUA_GetActionNumByName(name);
|
||||
if (actionnum < NUMACTIONS)
|
||||
actionsoverridden[actionnum] = true;
|
||||
|
||||
Z_Free(name);
|
||||
return 0;
|
||||
}
|
||||
|
@ -437,7 +495,7 @@ static void LUA_ClearState(void)
|
|||
|
||||
// open base libraries
|
||||
luaL_openlibs(L);
|
||||
lua_pop(L, -1);
|
||||
lua_settop(L, 0);
|
||||
|
||||
// make LREG_VALID table for all pushed userdata cache.
|
||||
lua_newtable(L);
|
||||
|
@ -640,7 +698,7 @@ fixed_t LUA_EvalMath(const char *word)
|
|||
*b = '\0';
|
||||
|
||||
// eval string.
|
||||
lua_pop(L, -1);
|
||||
lua_settop(L, 0);
|
||||
if (luaL_dostring(L, buf))
|
||||
{
|
||||
p = lua_tostring(L, -1);
|
||||
|
@ -682,25 +740,37 @@ void LUA_PushLightUserdata (lua_State *L, void *data, const char *meta)
|
|||
// Pushes it to the stack and stores it in the registry.
|
||||
void LUA_PushUserdata(lua_State *L, void *data, const char *meta)
|
||||
{
|
||||
if (LUA_RawPushUserdata(L, data) == LPUSHED_NEW)
|
||||
{
|
||||
luaL_getmetatable(L, meta);
|
||||
lua_setmetatable(L, -2);
|
||||
}
|
||||
}
|
||||
|
||||
// Same as LUA_PushUserdata but don't set a metatable yet.
|
||||
lpushed_t LUA_RawPushUserdata(lua_State *L, void *data)
|
||||
{
|
||||
lpushed_t status = LPUSHED_NIL;
|
||||
|
||||
void **userdata;
|
||||
|
||||
if (!data) { // push a NULL
|
||||
lua_pushnil(L);
|
||||
return;
|
||||
return status;
|
||||
}
|
||||
|
||||
lua_getfield(L, LUA_REGISTRYINDEX, LREG_VALID);
|
||||
I_Assert(lua_istable(L, -1));
|
||||
|
||||
lua_pushlightuserdata(L, data);
|
||||
lua_rawget(L, -2);
|
||||
|
||||
if (lua_isnil(L, -1)) { // no userdata? deary me, we'll have to make one.
|
||||
lua_pop(L, 1); // pop the nil
|
||||
|
||||
// create the userdata
|
||||
userdata = lua_newuserdata(L, sizeof(void *));
|
||||
*userdata = data;
|
||||
luaL_getmetatable(L, meta);
|
||||
lua_setmetatable(L, -2);
|
||||
|
||||
// Set it in the registry so we can find it again
|
||||
lua_pushlightuserdata(L, data); // k (store the userdata via the data's pointer)
|
||||
|
@ -708,8 +778,15 @@ void LUA_PushUserdata(lua_State *L, void *data, const char *meta)
|
|||
lua_rawset(L, -4);
|
||||
|
||||
// stack is left with the userdata on top, as if getting it had originally succeeded.
|
||||
|
||||
status = LPUSHED_NEW;
|
||||
}
|
||||
else
|
||||
status = LPUSHED_EXISTING;
|
||||
|
||||
lua_remove(L, -2); // remove LREG_VALID
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
// When userdata is freed, use this function to remove it from Lua.
|
||||
|
@ -769,6 +846,7 @@ void LUA_InvalidateLevel(void)
|
|||
{
|
||||
LUA_InvalidateUserdata(§ors[i]);
|
||||
LUA_InvalidateUserdata(§ors[i].lines);
|
||||
LUA_InvalidateUserdata(§ors[i].tags);
|
||||
if (sectors[i].ffloors)
|
||||
{
|
||||
for (rover = sectors[i].ffloors; rover; rover = rover->next)
|
||||
|
@ -778,6 +856,7 @@ void LUA_InvalidateLevel(void)
|
|||
for (i = 0; i < numlines; i++)
|
||||
{
|
||||
LUA_InvalidateUserdata(&lines[i]);
|
||||
LUA_InvalidateUserdata(&lines[i].tags);
|
||||
LUA_InvalidateUserdata(lines[i].sidenum);
|
||||
}
|
||||
for (i = 0; i < numsides; i++)
|
||||
|
@ -809,7 +888,10 @@ void LUA_InvalidateMapthings(void)
|
|||
return;
|
||||
|
||||
for (i = 0; i < nummapthings; i++)
|
||||
{
|
||||
LUA_InvalidateUserdata(&mapthings[i]);
|
||||
LUA_InvalidateUserdata(&mapthings[i].tags);
|
||||
}
|
||||
}
|
||||
|
||||
void LUA_InvalidatePlayer(player_t *player)
|
||||
|
@ -1624,3 +1706,36 @@ int Lua_optoption(lua_State *L, int narg,
|
|||
return i;
|
||||
return -1;
|
||||
}
|
||||
|
||||
void LUA_PushTaggableObjectArray
|
||||
( lua_State *L,
|
||||
const char *field,
|
||||
lua_CFunction iterator,
|
||||
lua_CFunction indexer,
|
||||
lua_CFunction counter,
|
||||
taggroup_t *garray[],
|
||||
size_t * max_elements,
|
||||
void * element_array,
|
||||
size_t sizeof_element,
|
||||
const char *meta)
|
||||
{
|
||||
lua_newuserdata(L, 0);
|
||||
lua_createtable(L, 0, 2);
|
||||
lua_createtable(L, 0, 2);
|
||||
lua_pushcfunction(L, iterator);
|
||||
lua_setfield(L, -2, "iterate");
|
||||
|
||||
LUA_InsertTaggroupIterator(L, garray,
|
||||
max_elements, element_array, sizeof_element, meta);
|
||||
|
||||
lua_createtable(L, 0, 1);
|
||||
lua_pushcfunction(L, indexer);
|
||||
lua_setfield(L, -2, "__index");
|
||||
lua_setmetatable(L, -2);
|
||||
lua_setfield(L, -2, "__index");
|
||||
|
||||
lua_pushcfunction(L, counter);
|
||||
lua_setfield(L, -2, "__len");
|
||||
lua_setmetatable(L, -2);
|
||||
lua_setglobal(L, field);
|
||||
}
|
||||
|
|
|
@ -10,10 +10,14 @@
|
|||
/// \file lua_script.h
|
||||
/// \brief Lua scripting basics
|
||||
|
||||
#ifndef LUA_SCRIPT_H
|
||||
#define LUA_SCRIPT_H
|
||||
|
||||
#include "m_fixed.h"
|
||||
#include "doomtype.h"
|
||||
#include "d_player.h"
|
||||
#include "g_state.h"
|
||||
#include "taglist.h"
|
||||
|
||||
#include "blua/lua.h"
|
||||
#include "blua/lualib.h"
|
||||
|
@ -40,17 +44,12 @@ void LUA_ClearExtVars(void);
|
|||
extern INT32 lua_lumploading; // is LUA_LoadLump being called?
|
||||
|
||||
int LUA_GetErrorMessage(lua_State *L);
|
||||
int LUA_Call(lua_State *L, int nargs, int nresults, int errorhandlerindex);
|
||||
void LUA_LoadLump(UINT16 wad, UINT16 lump, boolean noresults);
|
||||
#ifdef LUA_ALLOW_BYTECODE
|
||||
void LUA_DumpFile(const char *filename);
|
||||
#endif
|
||||
fixed_t LUA_EvalMath(const char *word);
|
||||
void LUA_PushLightUserdata(lua_State *L, void *data, const char *meta);
|
||||
void LUA_PushUserdata(lua_State *L, void *data, const char *meta);
|
||||
void LUA_InvalidateUserdata(void *data);
|
||||
void LUA_InvalidateLevel(void);
|
||||
void LUA_InvalidateMapthings(void);
|
||||
void LUA_InvalidatePlayer(player_t *player);
|
||||
void LUA_Step(void);
|
||||
void LUA_Archive(void);
|
||||
void LUA_UnArchive(void);
|
||||
|
@ -62,19 +61,49 @@ int Lua_optoption(lua_State *L, int narg,
|
|||
const char *def, const char *const lst[]);
|
||||
void LUAh_NetArchiveHook(lua_CFunction archFunc);
|
||||
|
||||
void LUA_PushTaggableObjectArray
|
||||
( lua_State *L,
|
||||
const char *field,
|
||||
lua_CFunction iterator,
|
||||
lua_CFunction indexer,
|
||||
lua_CFunction counter,
|
||||
taggroup_t *garray[],
|
||||
size_t * max_elements,
|
||||
void * element_array,
|
||||
size_t sizeof_element,
|
||||
const char *meta);
|
||||
|
||||
void LUA_InsertTaggroupIterator
|
||||
( lua_State *L,
|
||||
taggroup_t *garray[],
|
||||
size_t * max_elements,
|
||||
void * element_array,
|
||||
size_t sizeof_element,
|
||||
const char * meta);
|
||||
|
||||
typedef enum {
|
||||
LPUSHED_NIL,
|
||||
LPUSHED_NEW,
|
||||
LPUSHED_EXISTING,
|
||||
} lpushed_t;
|
||||
|
||||
void LUA_PushLightUserdata(lua_State *L, void *data, const char *meta);
|
||||
void LUA_PushUserdata(lua_State *L, void *data, const char *meta);
|
||||
lpushed_t LUA_RawPushUserdata(lua_State *L, void *data);
|
||||
|
||||
void LUA_InvalidateUserdata(void *data);
|
||||
|
||||
void LUA_InvalidateLevel(void);
|
||||
void LUA_InvalidateMapthings(void);
|
||||
void LUA_InvalidatePlayer(player_t *player);
|
||||
|
||||
// Console wrapper
|
||||
void COM_Lua_f(void);
|
||||
|
||||
#define LUA_Call(L,a)\
|
||||
{\
|
||||
if (lua_pcall(L, a, 0, 0)) {\
|
||||
CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(L,-1));\
|
||||
lua_pop(L, 1);\
|
||||
}\
|
||||
}
|
||||
|
||||
#define LUA_ErrInvalid(L, type) luaL_error(L, "accessed " type " doesn't exist anymore, please check 'valid' before using " type ".");
|
||||
|
||||
#define LUA_ErrSetDirectly(L, type, field) luaL_error(L, type " field " LUA_QL(field) " cannot be set directly.")
|
||||
|
||||
// Deprecation warnings
|
||||
// Shows once upon use. Then doesn't show again.
|
||||
#define LUA_Deprecated(L,this_func,use_instead)\
|
||||
|
@ -105,3 +134,5 @@ void COM_Lua_f(void);
|
|||
|
||||
#define INLEVEL if (! ISINLEVEL)\
|
||||
return luaL_error(L, "This can only be used in a level!");
|
||||
|
||||
#endif/*LUA_SCRIPT_H*/
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
enum skin {
|
||||
skin_valid = 0,
|
||||
skin_name,
|
||||
skin_spritedef,
|
||||
skin_wadnum,
|
||||
skin_flags,
|
||||
skin_realname,
|
||||
|
@ -54,12 +53,12 @@ enum skin {
|
|||
skin_contspeed,
|
||||
skin_contangle,
|
||||
skin_soundsid,
|
||||
skin_availability
|
||||
skin_availability,
|
||||
skin_sprites
|
||||
};
|
||||
static const char *const skin_opt[] = {
|
||||
"valid",
|
||||
"name",
|
||||
"spritedef",
|
||||
"wadnum",
|
||||
"flags",
|
||||
"realname",
|
||||
|
@ -93,6 +92,7 @@ static const char *const skin_opt[] = {
|
|||
"contangle",
|
||||
"soundsid",
|
||||
"availability",
|
||||
"sprites",
|
||||
NULL};
|
||||
|
||||
#define UNIMPLEMENTED luaL_error(L, LUA_QL("skin_t") " field " LUA_QS " is not implemented for Lua and cannot be accessed.", skin_opt[field])
|
||||
|
@ -113,8 +113,6 @@ static int skin_get(lua_State *L)
|
|||
case skin_name:
|
||||
lua_pushstring(L, skin->name);
|
||||
break;
|
||||
case skin_spritedef:
|
||||
return UNIMPLEMENTED;
|
||||
case skin_wadnum:
|
||||
// !!WARNING!! May differ between clients due to music wads, therefore NOT NETWORK SAFE
|
||||
return UNIMPLEMENTED;
|
||||
|
@ -214,6 +212,9 @@ static int skin_get(lua_State *L)
|
|||
case skin_availability:
|
||||
lua_pushinteger(L, skin->availability);
|
||||
break;
|
||||
case skin_sprites:
|
||||
LUA_PushLightUserdata(L, skin->sprites, META_SKINSPRITES);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
@ -324,6 +325,49 @@ static int soundsid_num(lua_State *L)
|
|||
return 1;
|
||||
}
|
||||
|
||||
enum spritesopt {
|
||||
numframes = 0
|
||||
};
|
||||
|
||||
static const char *const sprites_opt[] = {
|
||||
"numframes",
|
||||
NULL};
|
||||
|
||||
// skin.sprites[i] -> sprites[i]
|
||||
static int lib_getSkinSprite(lua_State *L)
|
||||
{
|
||||
spritedef_t *sprites = (spritedef_t *)luaL_checkudata(L, 1, META_SKINSPRITES);
|
||||
playersprite_t i = luaL_checkinteger(L, 2);
|
||||
|
||||
if (i < 0 || i >= NUMPLAYERSPRITES*2)
|
||||
return luaL_error(L, LUA_QL("skin_t") " field 'sprites' index %d out of range (0 - %d)", i, (NUMPLAYERSPRITES*2)-1);
|
||||
|
||||
LUA_PushLightUserdata(L, &sprites[i], META_SKINSPRITESLIST);
|
||||
return 1;
|
||||
}
|
||||
|
||||
// #skin.sprites -> NUMPLAYERSPRITES*2
|
||||
static int lib_numSkinsSprites(lua_State *L)
|
||||
{
|
||||
lua_pushinteger(L, NUMPLAYERSPRITES*2);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int sprite_get(lua_State *L)
|
||||
{
|
||||
spritedef_t *sprite = (spritedef_t *)luaL_checkudata(L, 1, META_SKINSPRITESLIST);
|
||||
enum spritesopt field = luaL_checkoption(L, 2, NULL, sprites_opt);
|
||||
|
||||
switch (field)
|
||||
{
|
||||
case numframes:
|
||||
lua_pushinteger(L, sprite->numframes);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int LUA_SkinLib(lua_State *L)
|
||||
{
|
||||
luaL_newmetatable(L, META_SKIN);
|
||||
|
@ -345,6 +389,19 @@ int LUA_SkinLib(lua_State *L)
|
|||
lua_setfield(L, -2, "__len");
|
||||
lua_pop(L,1);
|
||||
|
||||
luaL_newmetatable(L, META_SKINSPRITES);
|
||||
lua_pushcfunction(L, lib_getSkinSprite);
|
||||
lua_setfield(L, -2, "__index");
|
||||
|
||||
lua_pushcfunction(L, lib_numSkinsSprites);
|
||||
lua_setfield(L, -2, "__len");
|
||||
lua_pop(L,1);
|
||||
|
||||
luaL_newmetatable(L, META_SKINSPRITESLIST);
|
||||
lua_pushcfunction(L, sprite_get);
|
||||
lua_setfield(L, -2, "__index");
|
||||
lua_pop(L,1);
|
||||
|
||||
lua_newuserdata(L, 0);
|
||||
lua_createtable(L, 0, 2);
|
||||
lua_pushcfunction(L, lib_getSkin);
|
||||
|
|
451
src/lua_taglib.c
Normal file
451
src/lua_taglib.c
Normal file
|
@ -0,0 +1,451 @@
|
|||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 2020 by James R.
|
||||
// Copyright (C) 2020 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
// See the 'LICENSE' file for more details.
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file lua_taglib.c
|
||||
/// \brief tag list iterator for Lua scripting
|
||||
|
||||
#include "doomdef.h"
|
||||
#include "taglist.h"
|
||||
#include "r_state.h"
|
||||
|
||||
#include "lua_script.h"
|
||||
#include "lua_libs.h"
|
||||
|
||||
#ifdef MUTABLE_TAGS
|
||||
#include "z_zone.h"
|
||||
#endif
|
||||
|
||||
static int tag_iterator(lua_State *L)
|
||||
{
|
||||
INT32 tag = lua_isnil(L, 2) ? -1 : lua_tonumber(L, 2);
|
||||
do
|
||||
{
|
||||
if (++tag >= MAXTAGS)
|
||||
return 0;
|
||||
}
|
||||
while (! in_bit_array(tags_available, tag)) ;
|
||||
lua_pushnumber(L, tag);
|
||||
return 1;
|
||||
}
|
||||
|
||||
enum {
|
||||
#define UPVALUE lua_upvalueindex
|
||||
up_garray = UPVALUE(1),
|
||||
up_max_elements = UPVALUE(2),
|
||||
up_element_array = UPVALUE(3),
|
||||
up_sizeof_element = UPVALUE(4),
|
||||
up_meta = UPVALUE(5),
|
||||
#undef UPVALUE
|
||||
};
|
||||
|
||||
static INT32 next_element(lua_State *L, const mtag_t tag, const size_t p)
|
||||
{
|
||||
taggroup_t ** garray = lua_touserdata(L, up_garray);
|
||||
const size_t * max_elements = lua_touserdata(L, up_max_elements);
|
||||
return Taggroup_Iterate(garray, *max_elements, tag, p);
|
||||
}
|
||||
|
||||
static void push_element(lua_State *L, void *element)
|
||||
{
|
||||
if (LUA_RawPushUserdata(L, element) == LPUSHED_NEW)
|
||||
{
|
||||
lua_pushvalue(L, up_meta);
|
||||
lua_setmetatable(L, -2);
|
||||
}
|
||||
}
|
||||
|
||||
static void push_next_element(lua_State *L, const INT32 element)
|
||||
{
|
||||
char * element_array = *(char **)lua_touserdata(L, up_element_array);
|
||||
const size_t sizeof_element = lua_tonumber(L, up_sizeof_element);
|
||||
push_element(L, &element_array[element * sizeof_element]);
|
||||
}
|
||||
|
||||
struct element_iterator_state {
|
||||
mtag_t tag;
|
||||
size_t p;
|
||||
};
|
||||
|
||||
static int element_iterator(lua_State *L)
|
||||
{
|
||||
struct element_iterator_state * state = lua_touserdata(L, 1);
|
||||
if (lua_isnoneornil(L, 3))
|
||||
state->p = 0;
|
||||
lua_pushnumber(L, ++state->p);
|
||||
lua_gettable(L, 1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lib_iterateTags(lua_State *L)
|
||||
{
|
||||
if (lua_gettop(L) < 2)
|
||||
{
|
||||
lua_pushcfunction(L, tag_iterator);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
return tag_iterator(L);
|
||||
}
|
||||
|
||||
static int lib_numTags(lua_State *L)
|
||||
{
|
||||
lua_pushnumber(L, num_tags);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lib_getTaggroup(lua_State *L)
|
||||
{
|
||||
struct element_iterator_state *state;
|
||||
|
||||
mtag_t tag;
|
||||
|
||||
if (lua_gettop(L) > 1)
|
||||
return luaL_error(L, "too many arguments");
|
||||
|
||||
if (lua_isnoneornil(L, 1))
|
||||
{
|
||||
tag = MTAG_GLOBAL;
|
||||
}
|
||||
else
|
||||
{
|
||||
tag = lua_tonumber(L, 1);
|
||||
luaL_argcheck(L, tag >= -1, 1, "tag out of range");
|
||||
}
|
||||
|
||||
state = lua_newuserdata(L, sizeof *state);
|
||||
state->tag = tag;
|
||||
state->p = 0;
|
||||
|
||||
lua_pushvalue(L, lua_upvalueindex(1));
|
||||
lua_setmetatable(L, -2);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lib_getTaggroupElement(lua_State *L)
|
||||
{
|
||||
const size_t p = luaL_checknumber(L, 2) - 1;
|
||||
const mtag_t tag = *(mtag_t *)lua_touserdata(L, 1);
|
||||
const INT32 element = next_element(L, tag, p);
|
||||
|
||||
if (element == -1)
|
||||
return 0;
|
||||
else
|
||||
{
|
||||
push_next_element(L, element);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
static int lib_numTaggroupElements(lua_State *L)
|
||||
{
|
||||
const mtag_t tag = *(mtag_t *)lua_touserdata(L, 1);
|
||||
if (tag == MTAG_GLOBAL)
|
||||
lua_pushnumber(L, *(size_t *)lua_touserdata(L, up_max_elements));
|
||||
else
|
||||
{
|
||||
const taggroup_t ** garray = lua_touserdata(L, up_garray);
|
||||
lua_pushnumber(L, Taggroup_Count(garray[tag]));
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
#ifdef MUTABLE_TAGS
|
||||
static int meta_ref[2];
|
||||
#endif
|
||||
|
||||
static int has_valid_field(lua_State *L)
|
||||
{
|
||||
int equal;
|
||||
lua_rawgeti(L, LUA_ENVIRONINDEX, 1);
|
||||
equal = lua_rawequal(L, 2, -1);
|
||||
lua_pop(L, 1);
|
||||
return equal;
|
||||
}
|
||||
|
||||
static taglist_t * valid_taglist(lua_State *L, int idx, boolean getting)
|
||||
{
|
||||
taglist_t *list = *(taglist_t **)lua_touserdata(L, idx);
|
||||
|
||||
if (list == NULL)
|
||||
{
|
||||
if (getting && has_valid_field(L))
|
||||
lua_pushboolean(L, 0);
|
||||
else
|
||||
LUA_ErrInvalid(L, "taglist");/* doesn't actually return */
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
return list;
|
||||
}
|
||||
|
||||
static taglist_t * check_taglist(lua_State *L, int idx)
|
||||
{
|
||||
if (lua_isuserdata(L, idx) && lua_getmetatable(L, idx))
|
||||
{
|
||||
lua_getref(L, meta_ref[0]);
|
||||
lua_getref(L, meta_ref[1]);
|
||||
|
||||
if (lua_rawequal(L, -3, -2) || lua_rawequal(L, -3, -1))
|
||||
{
|
||||
lua_pop(L, 3);
|
||||
return valid_taglist(L, idx, false);
|
||||
}
|
||||
}
|
||||
|
||||
return luaL_argerror(L, idx, "must be a tag list"), NULL;
|
||||
}
|
||||
|
||||
static int taglist_get(lua_State *L)
|
||||
{
|
||||
const taglist_t *list = valid_taglist(L, 1, true);
|
||||
|
||||
if (list == NULL)/* valid check */
|
||||
return 1;
|
||||
|
||||
if (lua_isnumber(L, 2))
|
||||
{
|
||||
const size_t i = lua_tonumber(L, 2);
|
||||
|
||||
if (list && i <= list->count)
|
||||
{
|
||||
lua_pushnumber(L, list->tags[i - 1]);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
else if (has_valid_field(L))
|
||||
{
|
||||
lua_pushboolean(L, 1);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
lua_getmetatable(L, 1);
|
||||
lua_replace(L, 1);
|
||||
lua_rawget(L, 1);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
static int taglist_len(lua_State *L)
|
||||
{
|
||||
const taglist_t *list = valid_taglist(L, 1, false);
|
||||
lua_pushnumber(L, list->count);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int taglist_equal(lua_State *L)
|
||||
{
|
||||
const taglist_t *lhs = check_taglist(L, 1);
|
||||
const taglist_t *rhs = check_taglist(L, 2);
|
||||
lua_pushboolean(L, Tag_Compare(lhs, rhs));
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int taglist_iterator(lua_State *L)
|
||||
{
|
||||
const taglist_t *list = valid_taglist(L, 1, false);
|
||||
const size_t i = 1 + lua_tonumber(L, lua_upvalueindex(1));
|
||||
if (i <= list->count)
|
||||
{
|
||||
lua_pushnumber(L, list->tags[i - 1]);
|
||||
/* watch me exploit an upvalue as a control because
|
||||
I want to use the control as the value */
|
||||
lua_pushnumber(L, i);
|
||||
lua_replace(L, lua_upvalueindex(1));
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int taglist_iterate(lua_State *L)
|
||||
{
|
||||
check_taglist(L, 1);
|
||||
lua_pushnumber(L, 0);
|
||||
lua_pushcclosure(L, taglist_iterator, 1);
|
||||
lua_pushvalue(L, 1);
|
||||
return 2;
|
||||
}
|
||||
|
||||
static int taglist_find(lua_State *L)
|
||||
{
|
||||
const taglist_t *list = check_taglist(L, 1);
|
||||
const mtag_t tag = luaL_checknumber(L, 2);
|
||||
lua_pushboolean(L, Tag_Find(list, tag));
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int taglist_shares(lua_State *L)
|
||||
{
|
||||
const taglist_t *lhs = check_taglist(L, 1);
|
||||
const taglist_t *rhs = check_taglist(L, 2);
|
||||
lua_pushboolean(L, Tag_Share(lhs, rhs));
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* only sector tags are mutable... */
|
||||
|
||||
#ifdef MUTABLE_TAGS
|
||||
static size_t sector_of_taglist(taglist_t *list)
|
||||
{
|
||||
return (sector_t *)((char *)list - offsetof (sector_t, tags)) - sectors;
|
||||
}
|
||||
|
||||
static int this_taglist(lua_State *L)
|
||||
{
|
||||
lua_settop(L, 1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int taglist_add(lua_State *L)
|
||||
{
|
||||
taglist_t *list = *(taglist_t **)luaL_checkudata(L, 1, META_SECTORTAGLIST);
|
||||
const mtag_t tag = luaL_checknumber(L, 2);
|
||||
|
||||
if (! Tag_Find(list, tag))
|
||||
{
|
||||
Taggroup_Add(tags_sectors, tag, sector_of_taglist(list));
|
||||
Tag_Add(list, tag);
|
||||
}
|
||||
|
||||
return this_taglist(L);
|
||||
}
|
||||
|
||||
static int taglist_remove(lua_State *L)
|
||||
{
|
||||
taglist_t *list = *(taglist_t **)luaL_checkudata(L, 1, META_SECTORTAGLIST);
|
||||
const mtag_t tag = luaL_checknumber(L, 2);
|
||||
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < list->count; ++i)
|
||||
{
|
||||
if (list->tags[i] == tag)
|
||||
{
|
||||
if (list->count > 1)
|
||||
{
|
||||
memmove(&list->tags[i], &list->tags[i + 1],
|
||||
(list->count - 1 - i) * sizeof (mtag_t));
|
||||
list->tags = Z_Realloc(list->tags,
|
||||
(--list->count) * sizeof (mtag_t), PU_LEVEL, NULL);
|
||||
Taggroup_Remove(tags_sectors, tag, sector_of_taglist(list));
|
||||
}
|
||||
else/* reset to default tag */
|
||||
Tag_SectorFSet(sector_of_taglist(list), 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return this_taglist(L);
|
||||
}
|
||||
#endif/*MUTABLE_TAGS*/
|
||||
|
||||
void LUA_InsertTaggroupIterator
|
||||
( lua_State *L,
|
||||
taggroup_t *garray[],
|
||||
size_t * max_elements,
|
||||
void * element_array,
|
||||
size_t sizeof_element,
|
||||
const char * meta)
|
||||
{
|
||||
lua_createtable(L, 0, 3);
|
||||
lua_pushlightuserdata(L, garray);
|
||||
lua_pushlightuserdata(L, max_elements);
|
||||
|
||||
lua_pushvalue(L, -2);
|
||||
lua_pushvalue(L, -2);
|
||||
lua_pushlightuserdata(L, element_array);
|
||||
lua_pushnumber(L, sizeof_element);
|
||||
luaL_getmetatable(L, meta);
|
||||
lua_pushcclosure(L, lib_getTaggroupElement, 5);
|
||||
lua_setfield(L, -4, "__index");
|
||||
|
||||
lua_pushcclosure(L, lib_numTaggroupElements, 2);
|
||||
lua_setfield(L, -2, "__len");
|
||||
|
||||
lua_pushcfunction(L, element_iterator);
|
||||
lua_setfield(L, -2, "__call");
|
||||
lua_pushcclosure(L, lib_getTaggroup, 1);
|
||||
lua_setfield(L, -2, "tagged");
|
||||
}
|
||||
|
||||
static luaL_Reg taglist_lib[] = {
|
||||
{"iterate", taglist_iterate},
|
||||
{"find", taglist_find},
|
||||
{"shares", taglist_shares},
|
||||
#ifdef MUTABLE_TAGS
|
||||
{"add", taglist_add},
|
||||
{"remove", taglist_remove},
|
||||
#endif
|
||||
{0}
|
||||
};
|
||||
|
||||
static void open_taglist(lua_State *L)
|
||||
{
|
||||
luaL_register(L, "taglist", taglist_lib);
|
||||
|
||||
lua_getfield(L, -1, "find");
|
||||
lua_setfield(L, -2, "has");
|
||||
}
|
||||
|
||||
#define new_literal(L, s) \
|
||||
(lua_pushliteral(L, s), luaL_ref(L, -2))
|
||||
|
||||
#ifdef MUTABLE_TAGS
|
||||
static int
|
||||
#else
|
||||
static void
|
||||
#endif
|
||||
set_taglist_metatable(lua_State *L, const char *meta)
|
||||
{
|
||||
luaL_newmetatable(L, meta);
|
||||
lua_pushcfunction(L, taglist_get);
|
||||
lua_createtable(L, 0, 1);
|
||||
new_literal(L, "valid");
|
||||
lua_setfenv(L, -2);
|
||||
lua_setfield(L, -2, "__index");
|
||||
|
||||
lua_pushcfunction(L, taglist_len);
|
||||
lua_setfield(L, -2, "__len");
|
||||
|
||||
lua_pushcfunction(L, taglist_equal);
|
||||
lua_setfield(L, -2, "__eq");
|
||||
#ifdef MUTABLE_TAGS
|
||||
return luaL_ref(L, LUA_REGISTRYINDEX);
|
||||
#endif
|
||||
}
|
||||
|
||||
int LUA_TagLib(lua_State *L)
|
||||
{
|
||||
lua_newuserdata(L, 0);
|
||||
lua_createtable(L, 0, 2);
|
||||
lua_createtable(L, 0, 1);
|
||||
lua_pushcfunction(L, lib_iterateTags);
|
||||
lua_setfield(L, -2, "iterate");
|
||||
lua_setfield(L, -2, "__index");
|
||||
|
||||
lua_pushcfunction(L, lib_numTags);
|
||||
lua_setfield(L, -2, "__len");
|
||||
lua_setmetatable(L, -2);
|
||||
lua_setglobal(L, "tags");
|
||||
|
||||
open_taglist(L);
|
||||
|
||||
#ifdef MUTABLE_TAGS
|
||||
meta_ref[0] = set_taglist_metatable(L, META_TAGLIST);
|
||||
meta_ref[1] = set_taglist_metatable(L, META_SECTORTAGLIST);
|
||||
#else
|
||||
set_taglist_metatable(L, META_TAGLIST);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -18,7 +18,7 @@
|
|||
#include "z_zone.h"
|
||||
#include "v_video.h"
|
||||
#include "i_video.h"
|
||||
#include "i_system.h" // I_GetTimeMicros
|
||||
#include "i_system.h" // I_GetPreciseTime
|
||||
#include "m_misc.h"
|
||||
#include "st_stuff.h" // st_palette
|
||||
|
||||
|
@ -53,8 +53,8 @@ static RGBA_t *gif_framepalette = NULL;
|
|||
|
||||
static FILE *gif_out = NULL;
|
||||
static INT32 gif_frames = 0;
|
||||
static UINT32 gif_prevframeus = 0; // "us" is microseconds
|
||||
static UINT32 gif_delayus = 0;
|
||||
static precise_t gif_prevframetime = 0;
|
||||
static UINT32 gif_delayus = 0; // "us" is microseconds
|
||||
static UINT8 gif_writeover = 0;
|
||||
|
||||
|
||||
|
@ -608,7 +608,7 @@ static void GIF_framewrite(void)
|
|||
{
|
||||
// golden's attempt at creating a "dynamic delay"
|
||||
UINT16 mingifdelay = 10; // minimum gif delay in milliseconds (keep at 10 because gifs can't get more precise).
|
||||
gif_delayus += (I_GetTimeMicros() - gif_prevframeus); // increase delay by how much time was spent between last measurement
|
||||
gif_delayus += I_PreciseToMicros(I_GetPreciseTime() - gif_prevframetime); // increase delay by how much time was spent between last measurement
|
||||
|
||||
if (gif_delayus/1000 >= mingifdelay) // delay is big enough to be able to effect gif frame delay?
|
||||
{
|
||||
|
@ -621,7 +621,7 @@ static void GIF_framewrite(void)
|
|||
{
|
||||
float delayf = ceil(100.0f/NEWTICRATE);
|
||||
|
||||
delay = (UINT16)((I_GetTimeMicros() - gif_prevframeus)/10/1000);
|
||||
delay = (UINT16)I_PreciseToMicros((I_GetPreciseTime() - gif_prevframetime))/10/1000;
|
||||
|
||||
if (delay < (UINT16)(delayf))
|
||||
delay = (UINT16)(delayf);
|
||||
|
@ -711,7 +711,7 @@ static void GIF_framewrite(void)
|
|||
}
|
||||
fwrite(gifframe_data, 1, (p - gifframe_data), gif_out);
|
||||
++gif_frames;
|
||||
gif_prevframeus = I_GetTimeMicros();
|
||||
gif_prevframetime = I_GetPreciseTime();
|
||||
}
|
||||
|
||||
|
||||
|
@ -739,7 +739,7 @@ INT32 GIF_open(const char *filename)
|
|||
|
||||
GIF_headwrite();
|
||||
gif_frames = 0;
|
||||
gif_prevframeus = I_GetTimeMicros();
|
||||
gif_prevframetime = I_GetPreciseTime();
|
||||
gif_delayus = 0;
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -1108,7 +1108,6 @@ static mapthing_t *OP_CreateNewMapThing(player_t *player, UINT16 type, boolean c
|
|||
|
||||
mt->options = (mt->z << ZSHIFT) | (UINT16)cv_opflags.value;
|
||||
mt->scale = player->mo->scale;
|
||||
mt->tag = 0;
|
||||
memset(mt->args, 0, NUMMAPTHINGARGS*sizeof(*mt->args));
|
||||
memset(mt->stringargs, 0x00, NUMMAPTHINGSTRINGARGS*sizeof(*mt->stringargs));
|
||||
mt->pitch = mt->roll = 0;
|
||||
|
|
247
src/m_menu.c
247
src/m_menu.c
|
@ -425,7 +425,7 @@ static CV_PossibleValue_t skins_cons_t[MAXSKINS+1] = {{1, DEFAULTSKIN}};
|
|||
consvar_t cv_chooseskin = CVAR_INIT ("chooseskin", DEFAULTSKIN, CV_HIDEN|CV_CALL, skins_cons_t, Nextmap_OnChange);
|
||||
|
||||
// This gametype list is integral for many different reasons.
|
||||
// When you add gametypes here, don't forget to update them in dehacked.c and doomstat.h!
|
||||
// When you add gametypes here, don't forget to update them in deh_tables.c and doomstat.h!
|
||||
CV_PossibleValue_t gametype_cons_t[NUMGAMETYPES+1];
|
||||
|
||||
consvar_t cv_newgametype = CVAR_INIT ("newgametype", "Co-op", CV_HIDEN|CV_CALL, gametype_cons_t, Newgametype_OnChange);
|
||||
|
@ -1356,9 +1356,7 @@ static menuitem_t OP_VideoOptionsMenu[] =
|
|||
{IT_STRING | IT_CVAR, NULL, "Score/Time/Rings", &cv_timetic, 71},
|
||||
{IT_STRING | IT_CVAR, NULL, "Show Powerups", &cv_powerupdisplay, 76},
|
||||
{IT_STRING | IT_CVAR, NULL, "Local ping display", &cv_showping, 81}, // shows ping next to framerate if we want to.
|
||||
#ifdef SEENAMES
|
||||
{IT_STRING | IT_CVAR, NULL, "Show player names", &cv_seenames, 86},
|
||||
#endif
|
||||
|
||||
{IT_HEADER, NULL, "Console", NULL, 95},
|
||||
{IT_STRING | IT_CVAR, NULL, "Background color", &cons_backcolor, 101},
|
||||
|
@ -1483,7 +1481,7 @@ static menuitem_t OP_SoundOptionsMenu[] =
|
|||
|
||||
{IT_STRING | IT_CVAR, NULL, "MIDI Music", &cv_gamemidimusic, 36},
|
||||
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "MIDI Music Volume", &cv_midimusicvolume, 41},
|
||||
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Music Preference", &cv_musicpref, 51},
|
||||
|
||||
{IT_HEADER, NULL, "Miscellaneous", NULL, 61},
|
||||
|
@ -1551,18 +1549,19 @@ static menuitem_t OP_ScreenshotOptionsMenu[] =
|
|||
{IT_STRING|IT_CVAR, NULL, "Window Size", &cv_zlib_window_bits, 57},
|
||||
|
||||
{IT_HEADER, NULL, "Movie Mode (F9)", NULL, 64},
|
||||
{IT_STRING|IT_CVAR, NULL, "Storage Location", &cv_movie_option, 70},
|
||||
{IT_STRING|IT_CVAR|IT_CV_STRING, NULL, "Custom Folder", &cv_movie_folder, 75},
|
||||
{IT_STRING|IT_CVAR, NULL, "Capture Mode", &cv_moviemode, 90},
|
||||
{IT_STRING|IT_CVAR, NULL, "Storage Location", &cv_movie_option, 70},
|
||||
{IT_STRING|IT_CVAR|IT_CV_STRING, NULL, "Custom Folder", &cv_movie_folder, 75},
|
||||
{IT_STRING|IT_CVAR, NULL, "Capture Mode", &cv_moviemode, 90},
|
||||
|
||||
{IT_STRING|IT_CVAR, NULL, "Region Optimizing", &cv_gif_optimize, 95},
|
||||
{IT_STRING|IT_CVAR, NULL, "Downscaling", &cv_gif_downscale, 100},
|
||||
{IT_STRING|IT_CVAR, NULL, "Downscaling", &cv_gif_downscale, 95},
|
||||
{IT_STRING|IT_CVAR, NULL, "Region Optimizing", &cv_gif_optimize, 100},
|
||||
{IT_STRING|IT_CVAR, NULL, "Local Color Table", &cv_gif_localcolortable, 105},
|
||||
|
||||
{IT_STRING|IT_CVAR, NULL, "Memory Level", &cv_zlib_memorya, 95},
|
||||
{IT_STRING|IT_CVAR, NULL, "Compression Level", &cv_zlib_levela, 100},
|
||||
{IT_STRING|IT_CVAR, NULL, "Strategy", &cv_zlib_strategya, 105},
|
||||
{IT_STRING|IT_CVAR, NULL, "Window Size", &cv_zlib_window_bitsa, 110},
|
||||
{IT_STRING|IT_CVAR, NULL, "Downscaling", &cv_apng_downscale, 95},
|
||||
{IT_STRING|IT_CVAR, NULL, "Memory Level", &cv_zlib_memorya, 100},
|
||||
{IT_STRING|IT_CVAR, NULL, "Compression Level", &cv_zlib_levela, 105},
|
||||
{IT_STRING|IT_CVAR, NULL, "Strategy", &cv_zlib_strategya, 110},
|
||||
{IT_STRING|IT_CVAR, NULL, "Window Size", &cv_zlib_window_bitsa, 115},
|
||||
};
|
||||
|
||||
enum
|
||||
|
@ -1575,7 +1574,7 @@ enum
|
|||
op_screenshot_gif_start = 13,
|
||||
op_screenshot_gif_end = 15,
|
||||
op_screenshot_apng_start = 16,
|
||||
op_screenshot_apng_end = 19,
|
||||
op_screenshot_apng_end = 20,
|
||||
};
|
||||
|
||||
static menuitem_t OP_EraseDataMenu[] =
|
||||
|
@ -1613,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
|
||||
};
|
||||
|
||||
|
@ -2145,15 +2145,20 @@ menu_t OP_PlaystyleDef = {
|
|||
static void M_VideoOptions(INT32 choice)
|
||||
{
|
||||
(void)choice;
|
||||
#ifdef HWRENDER
|
||||
if (vid_opengl_state == -1)
|
||||
{
|
||||
OP_VideoOptionsMenu[op_video_renderer].status = (IT_TRANSTEXT | IT_PAIR);
|
||||
OP_VideoOptionsMenu[op_video_renderer].patch = "Renderer";
|
||||
OP_VideoOptionsMenu[op_video_renderer].text = "Software";
|
||||
}
|
||||
|
||||
OP_VideoOptionsMenu[op_video_renderer].status = (IT_TRANSTEXT | IT_PAIR);
|
||||
OP_VideoOptionsMenu[op_video_renderer].patch = "Renderer";
|
||||
OP_VideoOptionsMenu[op_video_renderer].text = "Software";
|
||||
|
||||
#ifdef HWRENDER
|
||||
if (vid.glstate != VID_GL_LIBRARY_ERROR)
|
||||
{
|
||||
OP_VideoOptionsMenu[op_video_renderer].status = (IT_STRING | IT_CVAR);
|
||||
OP_VideoOptionsMenu[op_video_renderer].patch = NULL;
|
||||
OP_VideoOptionsMenu[op_video_renderer].text = "Renderer";
|
||||
}
|
||||
#endif
|
||||
|
||||
M_SetupNextMenu(&OP_VideoOptionsDef);
|
||||
}
|
||||
|
||||
|
@ -4026,7 +4031,7 @@ static void M_DrawThermo(INT32 x, INT32 y, consvar_t *cv)
|
|||
cursorlump = W_GetNumForName("M_THERMO");
|
||||
|
||||
V_DrawScaledPatch(xx, y, 0, p = W_CachePatchNum(leftlump,PU_PATCH));
|
||||
xx += SHORT(p->width) - SHORT(p->leftoffset);
|
||||
xx += p->width - p->leftoffset;
|
||||
for (i = 0; i < 16; i++)
|
||||
{
|
||||
V_DrawScaledPatch(xx, y, V_WRAPX, W_CachePatchNum(centerlump[i & 1], PU_PATCH));
|
||||
|
@ -4165,7 +4170,7 @@ static void M_DrawStaticBox(fixed_t x, fixed_t y, INT32 flags, fixed_t w, fixed_
|
|||
fixed_t sw, pw;
|
||||
|
||||
patch = W_CachePatchName("LSSTATIC", PU_PATCH);
|
||||
pw = SHORT(patch->width) - (sw = w*2); //FixedDiv(w, scale); -- for scale FRACUNIT/2
|
||||
pw = patch->width - (sw = w*2); //FixedDiv(w, scale); -- for scale FRACUNIT/2
|
||||
|
||||
/*if (pw > 0) -- model code for modders providing weird LSSTATIC
|
||||
{
|
||||
|
@ -4262,8 +4267,8 @@ static void M_DrawMenuTitle(void)
|
|||
|
||||
if (p->height > 24) // title is larger than normal
|
||||
{
|
||||
INT32 xtitle = (BASEVIDWIDTH - (SHORT(p->width)/2))/2;
|
||||
INT32 ytitle = (30 - (SHORT(p->height)/2))/2;
|
||||
INT32 xtitle = (BASEVIDWIDTH - (p->width/2))/2;
|
||||
INT32 ytitle = (30 - (p->height/2))/2;
|
||||
|
||||
if (xtitle < 0)
|
||||
xtitle = 0;
|
||||
|
@ -4274,8 +4279,8 @@ static void M_DrawMenuTitle(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
INT32 xtitle = (BASEVIDWIDTH - SHORT(p->width))/2;
|
||||
INT32 ytitle = (30 - SHORT(p->height))/2;
|
||||
INT32 xtitle = (BASEVIDWIDTH - p->width)/2;
|
||||
INT32 ytitle = (30 - p->height)/2;
|
||||
|
||||
if (xtitle < 0)
|
||||
xtitle = 0;
|
||||
|
@ -4311,7 +4316,7 @@ static void M_DrawGenericMenu(void)
|
|||
{
|
||||
patch_t *p;
|
||||
p = W_CachePatchName(currentMenu->menuitems[i].patch, PU_PATCH);
|
||||
V_DrawScaledPatch((BASEVIDWIDTH - SHORT(p->width))/2, y, 0, p);
|
||||
V_DrawScaledPatch((BASEVIDWIDTH - p->width)/2, y, 0, p);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -4842,7 +4847,7 @@ static void M_DrawCenteredMenu(void)
|
|||
{
|
||||
patch_t *p;
|
||||
p = W_CachePatchName(currentMenu->menuitems[i].patch, PU_PATCH);
|
||||
V_DrawScaledPatch((BASEVIDWIDTH - SHORT(p->width))/2, y, 0, p);
|
||||
V_DrawScaledPatch((BASEVIDWIDTH - p->width)/2, y, 0, p);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -5585,9 +5590,6 @@ static void M_DrawLevelPlatterWideMap(UINT8 row, UINT8 col, INT32 x, INT32 y, bo
|
|||
if (map <= 0)
|
||||
return;
|
||||
|
||||
if (needpatchrecache)
|
||||
M_CacheLevelPlatter();
|
||||
|
||||
// A 564x100 image of the level as entry MAPxxW
|
||||
if (!(levelselect.rows[row].mapavailable[col]))
|
||||
{
|
||||
|
@ -5619,9 +5621,6 @@ static void M_DrawLevelPlatterMap(UINT8 row, UINT8 col, INT32 x, INT32 y, boolea
|
|||
if (map <= 0)
|
||||
return;
|
||||
|
||||
if (needpatchrecache)
|
||||
M_CacheLevelPlatter();
|
||||
|
||||
// A 160x100 image of the level as entry MAPxxP
|
||||
if (!(levelselect.rows[row].mapavailable[col]))
|
||||
{
|
||||
|
@ -5696,7 +5695,7 @@ static void M_DrawRecordAttackForeground(void)
|
|||
angle_t fa;
|
||||
|
||||
INT32 i;
|
||||
INT32 height = (SHORT(fg->height)/2);
|
||||
INT32 height = (fg->height / 2);
|
||||
INT32 dupz = (vid.dupx < vid.dupy ? vid.dupx : vid.dupy);
|
||||
|
||||
for (i = -12; i < (BASEVIDHEIGHT/height) + 12; i++)
|
||||
|
@ -5731,9 +5730,9 @@ static void M_DrawNightsAttackMountains(void)
|
|||
static INT32 bgscrollx;
|
||||
INT32 dupz = (vid.dupx < vid.dupy ? vid.dupx : vid.dupy);
|
||||
patch_t *background = W_CachePatchName(curbgname, PU_PATCH);
|
||||
INT16 w = SHORT(background->width);
|
||||
INT16 w = background->width;
|
||||
INT32 x = FixedInt(-bgscrollx) % w;
|
||||
INT32 y = BASEVIDHEIGHT - SHORT(background->height)*2;
|
||||
INT32 y = BASEVIDHEIGHT - (background->height * 2);
|
||||
|
||||
if (vid.height != BASEVIDHEIGHT * dupz)
|
||||
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 158);
|
||||
|
@ -5758,18 +5757,18 @@ static void M_DrawNightsAttackBackground(void)
|
|||
// top
|
||||
patch_t *backtopfg = W_CachePatchName("NTSATKT1", PU_PATCH);
|
||||
patch_t *fronttopfg = W_CachePatchName("NTSATKT2", PU_PATCH);
|
||||
INT32 backtopwidth = SHORT(backtopfg->width);
|
||||
//INT32 backtopheight = SHORT(backtopfg->height);
|
||||
INT32 fronttopwidth = SHORT(fronttopfg->width);
|
||||
//INT32 fronttopheight = SHORT(fronttopfg->height);
|
||||
INT32 backtopwidth = backtopfg->width;
|
||||
//INT32 backtopheight = backtopfg->height;
|
||||
INT32 fronttopwidth = fronttopfg->width;
|
||||
//INT32 fronttopheight = fronttopfg->height;
|
||||
|
||||
// bottom
|
||||
patch_t *backbottomfg = W_CachePatchName("NTSATKB1", PU_PATCH);
|
||||
patch_t *frontbottomfg = W_CachePatchName("NTSATKB2", PU_PATCH);
|
||||
INT32 backbottomwidth = SHORT(backbottomfg->width);
|
||||
INT32 backbottomheight = SHORT(backbottomfg->height);
|
||||
INT32 frontbottomwidth = SHORT(frontbottomfg->width);
|
||||
INT32 frontbottomheight = SHORT(frontbottomfg->height);
|
||||
INT32 backbottomwidth = backbottomfg->width;
|
||||
INT32 backbottomheight = backbottomfg->height;
|
||||
INT32 frontbottomwidth = frontbottomfg->width;
|
||||
INT32 frontbottomheight = frontbottomfg->height;
|
||||
|
||||
// background
|
||||
M_DrawNightsAttackMountains();
|
||||
|
@ -5831,8 +5830,6 @@ static void M_DrawNightsAttackSuperSonic(void)
|
|||
const UINT8 *colormap = R_GetTranslationColormap(TC_DEFAULT, SKINCOLOR_YELLOW, GTC_CACHE);
|
||||
INT32 timer = (ntsatkdrawtimer/4) % 2;
|
||||
angle_t fa = (FixedAngle(((ntsatkdrawtimer * 4) % 360)<<FRACBITS)>>ANGLETOFINESHIFT) & FINEMASK;
|
||||
ntssupersonic[0] = W_CachePatchName("NTSSONC1", PU_PATCH);
|
||||
ntssupersonic[1] = W_CachePatchName("NTSSONC2", PU_PATCH);
|
||||
V_DrawFixedPatch(235<<FRACBITS, (120<<FRACBITS) - (8*FINESINE(fa)), FRACUNIT, 0, ntssupersonic[timer], colormap);
|
||||
}
|
||||
|
||||
|
@ -6154,7 +6151,7 @@ static void M_DrawMessageMenu(void)
|
|||
}
|
||||
|
||||
V_DrawString((BASEVIDWIDTH - V_StringWidth(string, 0))/2,y,V_ALLOWLOWERCASE,string);
|
||||
y += 8; //SHORT(hu_font[0]->height);
|
||||
y += 8; //hu_font[0]->height;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6176,7 +6173,7 @@ static void M_StopMessage(INT32 choice)
|
|||
static void M_DrawImageDef(void)
|
||||
{
|
||||
// Grr. Need to autodetect for pic_ts.
|
||||
pic_t *pictest = (pic_t *)W_CachePatchName(currentMenu->menuitems[itemOn].text,PU_CACHE);
|
||||
pic_t *pictest = (pic_t *)W_CacheLumpName(currentMenu->menuitems[itemOn].text,PU_CACHE);
|
||||
if (!pictest->zero)
|
||||
V_DrawScaledPic(0,0,0,W_GetNumForName(currentMenu->menuitems[itemOn].text));
|
||||
else
|
||||
|
@ -6444,10 +6441,6 @@ static void M_DrawAddons(void)
|
|||
return;
|
||||
}
|
||||
|
||||
// Lactozilla: Load addons menu patches.
|
||||
if (needpatchrecache)
|
||||
M_LoadAddonsPatches();
|
||||
|
||||
if (Playing())
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, 5, warningflags, "Adding files mid-game may cause problems.");
|
||||
else
|
||||
|
@ -6944,8 +6937,7 @@ static void M_SelectableClearMenus(INT32 choice)
|
|||
static void M_UltimateCheat(INT32 choice)
|
||||
{
|
||||
(void)choice;
|
||||
if (Playing())
|
||||
LUAh_GameQuit();
|
||||
LUAh_GameQuit(true);
|
||||
I_Quit();
|
||||
}
|
||||
|
||||
|
@ -7602,9 +7594,6 @@ static void M_DrawSoundTest(void)
|
|||
fixed_t hscale = FRACUNIT/2, vscale = FRACUNIT/2, bounce = 0;
|
||||
UINT8 frame[4] = {0, 0, -1, SKINCOLOR_RUBY};
|
||||
|
||||
if (needpatchrecache)
|
||||
M_CacheSoundTest();
|
||||
|
||||
// let's handle the ticker first. ideally we'd tick this somewhere else, BUT...
|
||||
if (curplaying)
|
||||
{
|
||||
|
@ -8252,9 +8241,6 @@ static void M_DrawLoadGameData(void)
|
|||
if (vid.width != BASEVIDWIDTH*vid.dupx)
|
||||
hsep = (hsep*vid.width)/(BASEVIDWIDTH*vid.dupx);
|
||||
|
||||
if (needpatchrecache)
|
||||
M_CacheLoadGameData();
|
||||
|
||||
for (i = 2; prev_i; i = -(i + ((UINT32)i >> 31))) // draws from outwards in; 2, -2, 1, -1, 0
|
||||
{
|
||||
prev_i = i;
|
||||
|
@ -8436,7 +8422,7 @@ static void M_DrawLoadGameData(void)
|
|||
sprdef = &charbotskin->sprites[SPR2_SIGN];
|
||||
if (!sprdef->numframes)
|
||||
goto skipbot;
|
||||
colormap = R_GetTranslationColormap(savegameinfo[savetodraw].botskin-1, charbotskin->prefcolor, 0);
|
||||
colormap = R_GetTranslationColormap(savegameinfo[savetodraw].botskin-1, charbotskin->prefcolor, GTC_CACHE);
|
||||
sprframe = &sprdef->spriteframes[0];
|
||||
patch = W_CachePatchNum(sprframe->lumppat[0], PU_PATCH);
|
||||
|
||||
|
@ -8446,8 +8432,6 @@ static void M_DrawLoadGameData(void)
|
|||
charbotskin->highresscale,
|
||||
0, patch, colormap);
|
||||
|
||||
Z_Free(colormap);
|
||||
|
||||
tempx -= (20<<FRACBITS);
|
||||
//flip = V_FLIP;
|
||||
}
|
||||
|
@ -8456,7 +8440,7 @@ skipbot:
|
|||
if (!charskin) // shut up compiler
|
||||
goto skipsign;
|
||||
sprdef = &charskin->sprites[SPR2_SIGN];
|
||||
colormap = R_GetTranslationColormap(savegameinfo[savetodraw].skinnum, charskin->prefcolor, 0);
|
||||
colormap = R_GetTranslationColormap(savegameinfo[savetodraw].skinnum, charskin->prefcolor, GTC_CACHE);
|
||||
if (!sprdef->numframes)
|
||||
goto skipsign;
|
||||
sprframe = &sprdef->spriteframes[0];
|
||||
|
@ -8496,8 +8480,6 @@ skipsign:
|
|||
charskin->highresscale/2,
|
||||
0, patch, colormap);
|
||||
skiplife:
|
||||
if (colormap)
|
||||
Z_Free(colormap);
|
||||
|
||||
patch = W_CachePatchName("STLIVEX", PU_PATCH);
|
||||
|
||||
|
@ -8958,6 +8940,7 @@ void M_ForceSaveSlotSelected(INT32 sslot)
|
|||
// ================
|
||||
// CHARACTER SELECT
|
||||
// ================
|
||||
|
||||
static void M_CacheCharacterSelectEntry(INT32 i, INT32 skinnum)
|
||||
{
|
||||
if (!(description[i].picname[0]))
|
||||
|
@ -8978,22 +8961,6 @@ static void M_CacheCharacterSelectEntry(INT32 i, INT32 skinnum)
|
|||
description[i].namepic = W_CachePatchName(description[i].nametag, PU_PATCH);
|
||||
}
|
||||
|
||||
static void M_CacheCharacterSelect(void)
|
||||
{
|
||||
INT32 i, skinnum;
|
||||
|
||||
for (i = 0; i < MAXSKINS; i++)
|
||||
{
|
||||
if (!description[i].used)
|
||||
continue;
|
||||
|
||||
// Already set in M_SetupChoosePlayer
|
||||
skinnum = description[i].skinnum[0];
|
||||
if ((skinnum != -1) && (R_SkinUsable(-1, skinnum)))
|
||||
M_CacheCharacterSelectEntry(i, skinnum);
|
||||
}
|
||||
}
|
||||
|
||||
static UINT8 M_SetupChoosePlayerDirect(INT32 choice)
|
||||
{
|
||||
INT32 skinnum;
|
||||
|
@ -9193,16 +9160,13 @@ static void M_DrawSetupChoosePlayerMenu(void)
|
|||
|
||||
patch_t *charbg = W_CachePatchName("CHARBG", PU_PATCH);
|
||||
patch_t *charfg = W_CachePatchName("CHARFG", PU_PATCH);
|
||||
INT16 bgheight = SHORT(charbg->height);
|
||||
INT16 fgheight = SHORT(charfg->height);
|
||||
INT16 bgwidth = SHORT(charbg->width);
|
||||
INT16 fgwidth = SHORT(charfg->width);
|
||||
INT16 bgheight = charbg->height;
|
||||
INT16 fgheight = charfg->height;
|
||||
INT16 bgwidth = charbg->width;
|
||||
INT16 fgwidth = charfg->width;
|
||||
INT32 x, y;
|
||||
INT32 w = (vid.width/vid.dupx);
|
||||
|
||||
if (needpatchrecache)
|
||||
M_CacheCharacterSelect();
|
||||
|
||||
if (abs(char_scroll) > FRACUNIT)
|
||||
char_scroll -= (char_scroll>>2);
|
||||
else // close enough.
|
||||
|
@ -9291,14 +9255,14 @@ static void M_DrawSetupChoosePlayerMenu(void)
|
|||
curoutlinecolor = col = skincolors[charskin->prefcolor].invcolor;
|
||||
|
||||
txsh = oxsh;
|
||||
ox = 8 + SHORT((description[char_on].charpic)->width)/2;
|
||||
ox = 8 + ((description[char_on].charpic)->width)/2;
|
||||
y = my + 144;
|
||||
|
||||
// cur
|
||||
{
|
||||
x = ox - txsh;
|
||||
if (curpatch)
|
||||
x -= (SHORT(curpatch->width)/2);
|
||||
x -= curpatch->width / 2;
|
||||
|
||||
if (curtext[0] != '\0')
|
||||
{
|
||||
|
@ -9331,7 +9295,7 @@ static void M_DrawSetupChoosePlayerMenu(void)
|
|||
|
||||
x = (ox - txsh) - w;
|
||||
if (prevpatch)
|
||||
x -= (SHORT(prevpatch->width)/2);
|
||||
x -= prevpatch->width / 2;
|
||||
|
||||
if (prevtext[0] != '\0')
|
||||
{
|
||||
|
@ -9361,7 +9325,7 @@ static void M_DrawSetupChoosePlayerMenu(void)
|
|||
|
||||
x = (ox - txsh) + w;
|
||||
if (nextpatch)
|
||||
x -= (SHORT(nextpatch->width)/2);
|
||||
x -= nextpatch->width / 2;
|
||||
|
||||
if (nexttext[0] != '\0')
|
||||
{
|
||||
|
@ -9383,7 +9347,7 @@ static void M_DrawSetupChoosePlayerMenu(void)
|
|||
{
|
||||
patch_t *header = W_CachePatchName("M_PICKP", PU_PATCH);
|
||||
INT32 xtitle = 146;
|
||||
INT32 ytitle = (35 - SHORT(header->height))/2;
|
||||
INT32 ytitle = (35 - header->height) / 2;
|
||||
V_DrawFixedPatch(xtitle<<FRACBITS, ytitle<<FRACBITS, FRACUNIT/2, 0, header, NULL);
|
||||
}
|
||||
#endif // CHOOSEPLAYER_DRAWHEADER
|
||||
|
@ -9849,8 +9813,8 @@ void M_DrawTimeAttackMenu(void)
|
|||
|
||||
empatch = W_CachePatchName(M_GetEmblemPatch(em, true), PU_PATCH);
|
||||
|
||||
empatx = SHORT(empatch->leftoffset)/2;
|
||||
empaty = SHORT(empatch->topoffset)/2;
|
||||
empatx = empatch->leftoffset / 2;
|
||||
empaty = empatch->topoffset / 2;
|
||||
|
||||
if (em->collected)
|
||||
V_DrawSmallMappedPatch(104+76+empatx, yHeight+lsheadingheight/2+empaty, 0, empatch,
|
||||
|
@ -10086,7 +10050,7 @@ void M_DrawNightsAttackMenu(void)
|
|||
// Super Sonic
|
||||
M_DrawNightsAttackSuperSonic();
|
||||
//if (P_HasGrades(cv_nextmap.value, 0))
|
||||
// V_DrawScaledPatch(235 - (SHORT((ngradeletters[bestoverall])->width)*3)/2, 135, 0, ngradeletters[bestoverall]);
|
||||
// V_DrawScaledPatch(235 - (((ngradeletters[bestoverall])->width)*3)/2, 135, 0, ngradeletters[bestoverall]);
|
||||
|
||||
if (P_HasGrades(cv_nextmap.value, cv_dummymares.value))
|
||||
{//make bigger again
|
||||
|
@ -10173,6 +10137,9 @@ static void M_NightsAttack(INT32 choice)
|
|||
// This is really just to make sure Sonic is the played character, just in case
|
||||
M_PatchSkinNameTable();
|
||||
|
||||
ntssupersonic[0] = W_CachePatchName("NTSSONC1", PU_PATCH);
|
||||
ntssupersonic[1] = W_CachePatchName("NTSSONC2", PU_PATCH);
|
||||
|
||||
G_SetGamestate(GS_TIMEATTACK); // do this before M_SetupNextMenu so that menu meta state knows that we're switching
|
||||
titlemapinaction = TITLEMAP_OFF; // Nope don't give us HOMs please
|
||||
M_SetupNextMenu(&SP_NightsAttackDef);
|
||||
|
@ -10574,10 +10541,6 @@ void M_DrawMarathon(void)
|
|||
angle_t fa;
|
||||
INT32 dupz = (vid.dupx < vid.dupy ? vid.dupx : vid.dupy), xspan = (vid.width/dupz), yspan = (vid.height/dupz), diffx = (xspan - BASEVIDWIDTH)/2, diffy = (yspan - BASEVIDHEIGHT)/2, maxy = BASEVIDHEIGHT + diffy;
|
||||
|
||||
// lactozilla: the renderer changed so recache patches
|
||||
if (needpatchrecache)
|
||||
M_CacheCharacterSelect();
|
||||
|
||||
curbgxspeed = 0;
|
||||
curbgyspeed = 18;
|
||||
|
||||
|
@ -10644,7 +10607,7 @@ void M_DrawMarathon(void)
|
|||
{
|
||||
patch_t *fg = W_CachePatchName("RECATKFG", PU_PATCH);
|
||||
INT32 trans = V_60TRANS+((cnt&~3)<<(V_ALPHASHIFT-2));
|
||||
INT32 height = (SHORT(fg->height)/2);
|
||||
INT32 height = fg->height / 2;
|
||||
char patchname[7] = "CEMGx0";
|
||||
|
||||
dupz = (w*7)/6; //(w*42*120)/(360*6); -- I don't know why this works but I'm not going to complain.
|
||||
|
@ -11414,7 +11377,7 @@ static void M_DrawServerMenu(void)
|
|||
else
|
||||
PictureOfLevel = W_CachePatchName("BLANKLVL", PU_PATCH);
|
||||
|
||||
V_DrawSmallScaledPatch(319 - (currentMenu->x + (SHORT(PictureOfLevel->width)/2)), currentMenu->y + imgheight, 0, PictureOfLevel);
|
||||
V_DrawSmallScaledPatch(319 - (currentMenu->x + (PictureOfLevel->width / 2)), currentMenu->y + imgheight, 0, PictureOfLevel);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -11787,7 +11750,7 @@ static void M_DrawSetupMultiPlayerMenu(void)
|
|||
goto faildraw;
|
||||
|
||||
// ok, draw player sprite for sure now
|
||||
colormap = R_GetTranslationColormap(setupm_fakeskin, setupm_fakecolor->color, 0);
|
||||
colormap = R_GetTranslationColormap(setupm_fakeskin, setupm_fakecolor->color, GTC_CACHE);
|
||||
|
||||
if (multi_frame >= sprdef->numframes)
|
||||
multi_frame = 0;
|
||||
|
@ -11805,7 +11768,6 @@ static void M_DrawSetupMultiPlayerMenu(void)
|
|||
FixedDiv(skins[setupm_fakeskin].highresscale, skins[setupm_fakeskin].shieldscale),
|
||||
flags, patch, colormap);
|
||||
|
||||
Z_Free(colormap);
|
||||
goto colordraw;
|
||||
|
||||
faildraw:
|
||||
|
@ -13404,8 +13366,7 @@ void M_QuitResponse(INT32 ch)
|
|||
|
||||
if (ch != 'y' && ch != KEY_ENTER)
|
||||
return;
|
||||
if (Playing())
|
||||
LUAh_GameQuit();
|
||||
LUAh_GameQuit(true);
|
||||
if (!(netgame || cv_debug))
|
||||
{
|
||||
S_ResetCaptions();
|
||||
|
|
36
src/m_misc.c
36
src/m_misc.c
|
@ -163,6 +163,9 @@ consvar_t cv_zlib_levela = CVAR_INIT ("apng_compress_level", "4", CV_SAVE, zlib_
|
|||
consvar_t cv_zlib_strategya = CVAR_INIT ("apng_strategy", "RLE", CV_SAVE, zlib_strategy_t, NULL);
|
||||
consvar_t cv_zlib_window_bitsa = CVAR_INIT ("apng_window_size", "32k", CV_SAVE, zlib_window_bits_t, NULL);
|
||||
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);
|
||||
|
||||
static boolean apng_downscale = false; // So nobody can do something dumb like changing cvars mid output
|
||||
|
||||
boolean takescreenshot = false; // Take a screenshot this tic
|
||||
|
||||
|
@ -981,25 +984,38 @@ static inline boolean M_PNGLib(void)
|
|||
|
||||
static void M_PNGFrame(png_structp png_ptr, png_infop png_info_ptr, png_bytep png_buf)
|
||||
{
|
||||
png_uint_16 downscale = apng_downscale ? vid.dupx : 1;
|
||||
|
||||
png_uint_32 pitch = png_get_rowbytes(png_ptr, png_info_ptr);
|
||||
PNG_CONST png_uint_32 height = vid.height;
|
||||
png_bytepp row_pointers = png_malloc(png_ptr, height* sizeof (png_bytep));
|
||||
png_uint_32 y;
|
||||
PNG_CONST png_uint_32 width = vid.width / downscale;
|
||||
PNG_CONST png_uint_32 height = vid.height / downscale;
|
||||
png_bytepp row_pointers = png_malloc(png_ptr, height * sizeof (png_bytep));
|
||||
png_uint_32 x, y;
|
||||
png_uint_16 framedelay = (png_uint_16)cv_apng_delay.value;
|
||||
|
||||
apng_frames++;
|
||||
|
||||
for (y = 0; y < height; y++)
|
||||
{
|
||||
row_pointers[y] = png_buf;
|
||||
png_buf += pitch;
|
||||
row_pointers[y] = malloc(pitch * sizeof(png_byte));
|
||||
for (x = 0; x < width; x++)
|
||||
row_pointers[y][x] = png_buf[x * downscale];
|
||||
png_buf += pitch * (downscale * downscale);
|
||||
}
|
||||
//for (x = 0; x < width; x++)
|
||||
//{
|
||||
// printf("%d", x);
|
||||
// row_pointers[y][x] = 0;
|
||||
//}
|
||||
/* row_pointers[y] = calloc(1, sizeof(png_bytep));
|
||||
png_buf += pitch * 2;
|
||||
}*/
|
||||
|
||||
#ifndef PNG_STATIC
|
||||
if (aPNG_write_frame_head)
|
||||
#endif
|
||||
aPNG_write_frame_head(apng_ptr, apng_info_ptr, row_pointers,
|
||||
vid.width, /* width */
|
||||
width, /* width */
|
||||
height, /* height */
|
||||
0, /* x offset */
|
||||
0, /* y offset */
|
||||
|
@ -1030,6 +1046,12 @@ static void M_PNGfix_acTL(png_structp png_ptr, png_infop png_info_ptr,
|
|||
|
||||
static boolean M_SetupaPNG(png_const_charp filename, png_bytep pal)
|
||||
{
|
||||
png_uint_16 downscale;
|
||||
|
||||
apng_downscale = (!!cv_apng_downscale.value);
|
||||
|
||||
downscale = apng_downscale ? vid.dupx : 1;
|
||||
|
||||
apng_FILE = fopen(filename,"wb+"); // + mode for reading
|
||||
if (!apng_FILE)
|
||||
{
|
||||
|
@ -1080,7 +1102,7 @@ static boolean M_SetupaPNG(png_const_charp filename, png_bytep pal)
|
|||
png_set_compression_strategy(apng_ptr, cv_zlib_strategya.value);
|
||||
png_set_compression_window_bits(apng_ptr, cv_zlib_window_bitsa.value);
|
||||
|
||||
M_PNGhdr(apng_ptr, apng_info_ptr, vid.width, vid.height, pal);
|
||||
M_PNGhdr(apng_ptr, apng_info_ptr, vid.width / downscale, vid.height / downscale, pal);
|
||||
|
||||
M_PNGText(apng_ptr, apng_info_ptr, true);
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ extern consvar_t cv_screenshot_option, cv_screenshot_folder, cv_screenshot_color
|
|||
extern consvar_t cv_moviemode, cv_movie_folder, cv_movie_option;
|
||||
extern consvar_t cv_zlib_memory, cv_zlib_level, cv_zlib_strategy, cv_zlib_window_bits;
|
||||
extern consvar_t cv_zlib_memorya, cv_zlib_levela, cv_zlib_strategya, cv_zlib_window_bitsa;
|
||||
extern consvar_t cv_apng_delay;
|
||||
extern consvar_t cv_apng_delay, cv_apng_downscale;
|
||||
|
||||
void M_StartMovie(void);
|
||||
void M_SaveFrame(void);
|
||||
|
|
|
@ -22,32 +22,37 @@
|
|||
#include "hardware/hw_main.h"
|
||||
#endif
|
||||
|
||||
int ps_tictime = 0;
|
||||
struct perfstatcol;
|
||||
struct perfstatrow;
|
||||
|
||||
int ps_playerthink_time = 0;
|
||||
int ps_thinkertime = 0;
|
||||
typedef struct perfstatcol perfstatcol_t;
|
||||
typedef struct perfstatrow perfstatrow_t;
|
||||
|
||||
int ps_thlist_times[NUM_THINKERLISTS];
|
||||
static const char* thlist_names[] = {
|
||||
"Polyobjects: %d",
|
||||
"Main: %d",
|
||||
"Mobjs: %d",
|
||||
"Dynamic slopes: %d",
|
||||
"Precipitation: %d",
|
||||
NULL
|
||||
struct perfstatcol {
|
||||
INT32 lores_x;
|
||||
INT32 hires_x;
|
||||
INT32 color;
|
||||
perfstatrow_t * rows;
|
||||
};
|
||||
static const char* thlist_shortnames[] = {
|
||||
"plyobjs %d",
|
||||
"main %d",
|
||||
"mobjs %d",
|
||||
"dynslop %d",
|
||||
"precip %d",
|
||||
NULL
|
||||
|
||||
struct perfstatrow {
|
||||
const char * lores_label;
|
||||
const char * hires_label;
|
||||
void * value;
|
||||
};
|
||||
|
||||
static precise_t ps_frametime = 0;
|
||||
|
||||
precise_t ps_tictime = 0;
|
||||
|
||||
precise_t ps_playerthink_time = 0;
|
||||
precise_t ps_thinkertime = 0;
|
||||
|
||||
precise_t ps_thlist_times[NUM_THINKERLISTS];
|
||||
|
||||
int ps_checkposition_calls = 0;
|
||||
|
||||
int ps_lua_thinkframe_time = 0;
|
||||
precise_t ps_lua_thinkframe_time = 0;
|
||||
int ps_lua_mobjhooks = 0;
|
||||
|
||||
// dynamically allocated resizeable array for thinkframe hook stats
|
||||
|
@ -55,6 +60,8 @@ ps_hookinfo_t *thinkframe_hooks = NULL;
|
|||
int thinkframe_hooks_length = 0;
|
||||
int thinkframe_hooks_capacity = 16;
|
||||
|
||||
static INT32 draw_row;
|
||||
|
||||
void PS_SetThinkFrameHookInfo(int index, UINT32 time_taken, char* short_src)
|
||||
{
|
||||
if (!thinkframe_hooks)
|
||||
|
@ -76,379 +83,413 @@ void PS_SetThinkFrameHookInfo(int index, UINT32 time_taken, char* short_src)
|
|||
thinkframe_hooks_length = index + 1;
|
||||
}
|
||||
|
||||
static void PS_SetFrameTime(void)
|
||||
{
|
||||
precise_t currenttime = I_GetPreciseTime();
|
||||
ps_frametime = currenttime - ps_prevframetime;
|
||||
ps_prevframetime = currenttime;
|
||||
}
|
||||
|
||||
static boolean M_HighResolution(void)
|
||||
{
|
||||
return (vid.width >= 640 && vid.height >= 400);
|
||||
}
|
||||
|
||||
enum {
|
||||
PERF_TIME,
|
||||
PERF_COUNT,
|
||||
};
|
||||
|
||||
static void M_DrawPerfString(perfstatcol_t *col, int type)
|
||||
{
|
||||
const boolean hires = M_HighResolution();
|
||||
|
||||
INT32 draw_flags = V_MONOSPACE | col->color;
|
||||
|
||||
perfstatrow_t * row;
|
||||
|
||||
int value;
|
||||
|
||||
if (hires)
|
||||
draw_flags |= V_ALLOWLOWERCASE;
|
||||
|
||||
for (row = col->rows; row->lores_label; ++row)
|
||||
{
|
||||
if (type == PERF_TIME)
|
||||
value = I_PreciseToMicros(*(precise_t *)row->value);
|
||||
else
|
||||
value = *(int *)row->value;
|
||||
|
||||
if (hires)
|
||||
{
|
||||
V_DrawSmallString(col->hires_x, draw_row, draw_flags,
|
||||
va("%s %d", row->hires_label, value));
|
||||
|
||||
draw_row += 5;
|
||||
}
|
||||
else
|
||||
{
|
||||
V_DrawThinString(col->lores_x, draw_row, draw_flags,
|
||||
va("%s %d", row->lores_label, value));
|
||||
|
||||
draw_row += 8;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void M_DrawPerfTiming(perfstatcol_t *col)
|
||||
{
|
||||
M_DrawPerfString(col, PERF_TIME);
|
||||
}
|
||||
|
||||
static void M_DrawPerfCount(perfstatcol_t *col)
|
||||
{
|
||||
M_DrawPerfString(col, PERF_COUNT);
|
||||
}
|
||||
|
||||
static void M_DrawRenderStats(void)
|
||||
{
|
||||
const boolean hires = M_HighResolution();
|
||||
|
||||
const int half_row = hires ? 5 : 4;
|
||||
|
||||
precise_t extrarendertime;
|
||||
|
||||
perfstatrow_t frametime_row[] = {
|
||||
{"frmtime", "Frame time: ", &ps_frametime},
|
||||
{0}
|
||||
};
|
||||
|
||||
perfstatrow_t rendercalltime_row[] = {
|
||||
{"drwtime", "3d rendering: ", &ps_rendercalltime},
|
||||
{0}
|
||||
};
|
||||
|
||||
perfstatrow_t opengltime_row[] = {
|
||||
{"skybox ", "Skybox render: ", &ps_hw_skyboxtime},
|
||||
{"bsptime", "RenderBSPNode: ", &ps_bsptime},
|
||||
{"nodesrt", "Drwnode sort: ", &ps_hw_nodesorttime},
|
||||
{"nodedrw", "Drwnode render:", &ps_hw_nodedrawtime},
|
||||
{"sprsort", "Sprite sort: ", &ps_hw_spritesorttime},
|
||||
{"sprdraw", "Sprite render: ", &ps_hw_spritedrawtime},
|
||||
{"other ", "Other: ", &extrarendertime},
|
||||
{0}
|
||||
};
|
||||
|
||||
perfstatrow_t softwaretime_row[] = {
|
||||
{"bsptime", "RenderBSPNode: ", &ps_bsptime},
|
||||
{"sprclip", "R_ClipSprites: ", &ps_sw_spritecliptime},
|
||||
{"portals", "Portals+Skybox:", &ps_sw_portaltime},
|
||||
{"planes ", "R_DrawPlanes: ", &ps_sw_planetime},
|
||||
{"masked ", "R_DrawMasked: ", &ps_sw_maskedtime},
|
||||
{"other ", "Other: ", &extrarendertime},
|
||||
{0}
|
||||
};
|
||||
|
||||
perfstatrow_t uiswaptime_row[] = {
|
||||
{"ui ", "UI render: ", &ps_uitime},
|
||||
{"finupdt", "I_FinishUpdate:", &ps_swaptime},
|
||||
{0}
|
||||
};
|
||||
|
||||
perfstatrow_t tictime_row[] = {
|
||||
{"logic ", "Game logic: ", &ps_tictime},
|
||||
{0}
|
||||
};
|
||||
|
||||
perfstatrow_t rendercalls_row[] = {
|
||||
{"bspcall", "BSP calls: ", &ps_numbspcalls},
|
||||
{"sprites", "Sprites: ", &ps_numsprites},
|
||||
{"drwnode", "Drawnodes: ", &ps_numdrawnodes},
|
||||
{"plyobjs", "Polyobjects: ", &ps_numpolyobjects},
|
||||
{0}
|
||||
};
|
||||
|
||||
perfstatrow_t batchtime_row[] = {
|
||||
{"batsort", "Batch sort: ", &ps_hw_batchsorttime},
|
||||
{"batdraw", "Batch render:", &ps_hw_batchdrawtime},
|
||||
{0}
|
||||
};
|
||||
|
||||
perfstatrow_t batchcount_row[] = {
|
||||
{"polygon", "Polygons: ", &ps_hw_numpolys},
|
||||
{"vertex ", "Vertices: ", &ps_hw_numverts},
|
||||
{0}
|
||||
};
|
||||
|
||||
perfstatrow_t batchcalls_row[] = {
|
||||
{"drwcall", "Draw calls:", &ps_hw_numcalls},
|
||||
{"shaders", "Shaders: ", &ps_hw_numshaders},
|
||||
{"texture", "Textures: ", &ps_hw_numtextures},
|
||||
{"polyflg", "Polyflags: ", &ps_hw_numpolyflags},
|
||||
{"colors ", "Colors: ", &ps_hw_numcolors},
|
||||
{0}
|
||||
};
|
||||
|
||||
perfstatcol_t frametime_col = {20, 20, V_YELLOWMAP, frametime_row};
|
||||
perfstatcol_t rendercalltime_col = {20, 20, V_YELLOWMAP, rendercalltime_row};
|
||||
|
||||
perfstatcol_t opengltime_col = {24, 24, V_YELLOWMAP, opengltime_row};
|
||||
perfstatcol_t softwaretime_col = {24, 24, V_YELLOWMAP, softwaretime_row};
|
||||
|
||||
perfstatcol_t uiswaptime_col = {20, 20, V_YELLOWMAP, uiswaptime_row};
|
||||
perfstatcol_t tictime_col = {20, 20, V_GRAYMAP, tictime_row};
|
||||
|
||||
perfstatcol_t rendercalls_col = {90, 115, V_BLUEMAP, rendercalls_row};
|
||||
|
||||
perfstatcol_t batchtime_col = {90, 115, V_REDMAP, batchtime_row};
|
||||
|
||||
perfstatcol_t batchcount_col = {155, 200, V_PURPLEMAP, batchcount_row};
|
||||
perfstatcol_t batchcalls_col = {220, 200, V_PURPLEMAP, batchcalls_row};
|
||||
|
||||
|
||||
boolean rendering = (
|
||||
gamestate == GS_LEVEL ||
|
||||
(gamestate == GS_TITLESCREEN && titlemapinaction)
|
||||
);
|
||||
|
||||
draw_row = 10;
|
||||
M_DrawPerfTiming(&frametime_col);
|
||||
|
||||
if (rendering)
|
||||
{
|
||||
M_DrawPerfTiming(&rendercalltime_col);
|
||||
|
||||
// Remember to update this calculation when adding more 3d rendering stats!
|
||||
extrarendertime = ps_rendercalltime - ps_bsptime;
|
||||
|
||||
#ifdef HWRENDER
|
||||
if (rendermode == render_opengl)
|
||||
{
|
||||
extrarendertime -=
|
||||
ps_hw_skyboxtime +
|
||||
ps_hw_nodesorttime +
|
||||
ps_hw_nodedrawtime +
|
||||
ps_hw_spritesorttime +
|
||||
ps_hw_spritedrawtime;
|
||||
|
||||
if (cv_glbatching.value)
|
||||
{
|
||||
extrarendertime -=
|
||||
ps_hw_batchsorttime +
|
||||
ps_hw_batchdrawtime;
|
||||
}
|
||||
|
||||
M_DrawPerfTiming(&opengltime_col);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
extrarendertime -=
|
||||
ps_sw_spritecliptime +
|
||||
ps_sw_portaltime +
|
||||
ps_sw_planetime +
|
||||
ps_sw_maskedtime;
|
||||
|
||||
M_DrawPerfTiming(&softwaretime_col);
|
||||
}
|
||||
}
|
||||
|
||||
M_DrawPerfTiming(&uiswaptime_col);
|
||||
|
||||
draw_row += half_row;
|
||||
M_DrawPerfTiming(&tictime_col);
|
||||
|
||||
if (rendering)
|
||||
{
|
||||
draw_row = 10;
|
||||
M_DrawPerfCount(&rendercalls_col);
|
||||
|
||||
#ifdef HWRENDER
|
||||
if (rendermode == render_opengl && cv_glbatching.value)
|
||||
{
|
||||
draw_row += half_row;
|
||||
M_DrawPerfTiming(&batchtime_col);
|
||||
|
||||
draw_row = 10;
|
||||
M_DrawPerfCount(&batchcount_col);
|
||||
|
||||
if (hires)
|
||||
draw_row += half_row;
|
||||
else
|
||||
draw_row = 10;
|
||||
|
||||
M_DrawPerfCount(&batchcalls_col);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
static void M_DrawTickStats(void)
|
||||
{
|
||||
int i = 0;
|
||||
thinker_t *thinker;
|
||||
int thinkercount = 0;
|
||||
int polythcount = 0;
|
||||
int mainthcount = 0;
|
||||
int mobjcount = 0;
|
||||
int nothinkcount = 0;
|
||||
int scenerycount = 0;
|
||||
int regularcount = 0;
|
||||
int dynslopethcount = 0;
|
||||
int precipcount = 0;
|
||||
int removecount = 0;
|
||||
|
||||
precise_t extratime =
|
||||
ps_tictime -
|
||||
ps_playerthink_time -
|
||||
ps_thinkertime -
|
||||
ps_lua_thinkframe_time;
|
||||
|
||||
perfstatrow_t tictime_row[] = {
|
||||
{"logic ", "Game logic: ", &ps_tictime},
|
||||
{0}
|
||||
};
|
||||
|
||||
perfstatrow_t thinker_time_row[] = {
|
||||
{"plrthnk", "P_PlayerThink: ", &ps_playerthink_time},
|
||||
{"thnkers", "P_RunThinkers: ", &ps_thinkertime},
|
||||
{0}
|
||||
};
|
||||
|
||||
perfstatrow_t detailed_thinker_time_row[] = {
|
||||
{"plyobjs", "Polyobjects: ", &ps_thlist_times[THINK_POLYOBJ]},
|
||||
{"main ", "Main: ", &ps_thlist_times[THINK_MAIN]},
|
||||
{"mobjs ", "Mobjs: ", &ps_thlist_times[THINK_MOBJ]},
|
||||
{"dynslop", "Dynamic slopes: ", &ps_thlist_times[THINK_DYNSLOPE]},
|
||||
{"precip ", "Precipitation: ", &ps_thlist_times[THINK_PRECIP]},
|
||||
{0}
|
||||
};
|
||||
|
||||
perfstatrow_t extra_thinker_time_row[] = {
|
||||
{"lthinkf", "LUAh_ThinkFrame:", &ps_lua_thinkframe_time},
|
||||
{"other ", "Other: ", &extratime},
|
||||
{0}
|
||||
};
|
||||
|
||||
perfstatrow_t thinkercount_row[] = {
|
||||
{"thnkers", "Thinkers: ", &thinkercount},
|
||||
{0}
|
||||
};
|
||||
|
||||
perfstatrow_t detailed_thinkercount_row[] = {
|
||||
{"plyobjs", "Polyobjects: ", &polythcount},
|
||||
{"main ", "Main: ", &mainthcount},
|
||||
{"mobjs ", "Mobjs: ", &mobjcount},
|
||||
{0}
|
||||
};
|
||||
|
||||
perfstatrow_t mobjthinkercount_row[] = {
|
||||
{"regular", "Regular: ", ®ularcount},
|
||||
{"scenery", "Scenery: ", &scenerycount},
|
||||
{0}
|
||||
};
|
||||
|
||||
perfstatrow_t nothinkcount_row[] = {
|
||||
{"nothink", "Nothink: ", ¬hinkcount},
|
||||
{0}
|
||||
};
|
||||
|
||||
perfstatrow_t detailed_thinkercount_row2[] = {
|
||||
{"dynslop", "Dynamic slopes: ", &dynslopethcount},
|
||||
{"precip ", "Precipitation: ", &precipcount},
|
||||
{"remove ", "Pending removal:", &removecount},
|
||||
{0}
|
||||
};
|
||||
|
||||
perfstatrow_t misc_calls_row[] = {
|
||||
{"lmhook", "Lua mobj hooks: ", &ps_lua_mobjhooks},
|
||||
{"chkpos", "P_CheckPosition:", &ps_checkposition_calls},
|
||||
{0}
|
||||
};
|
||||
|
||||
perfstatcol_t tictime_col = {20, 20, V_YELLOWMAP, tictime_row};
|
||||
perfstatcol_t thinker_time_col = {24, 24, V_YELLOWMAP, thinker_time_row};
|
||||
perfstatcol_t detailed_thinker_time_col = {28, 28, V_YELLOWMAP, detailed_thinker_time_row};
|
||||
perfstatcol_t extra_thinker_time_col = {24, 24, V_YELLOWMAP, extra_thinker_time_row};
|
||||
|
||||
perfstatcol_t thinkercount_col = {90, 115, V_BLUEMAP, thinkercount_row};
|
||||
perfstatcol_t detailed_thinkercount_col = {94, 119, V_BLUEMAP, detailed_thinkercount_row};
|
||||
perfstatcol_t mobjthinkercount_col = {98, 123, V_BLUEMAP, mobjthinkercount_row};
|
||||
perfstatcol_t nothinkcount_col = {98, 123, V_BLUEMAP, nothinkcount_row};
|
||||
perfstatcol_t detailed_thinkercount_col2 = {94, 119, V_BLUEMAP, detailed_thinkercount_row2};
|
||||
perfstatcol_t misc_calls_col = {170, 216, V_PURPLEMAP, misc_calls_row};
|
||||
|
||||
for (i = 0; i < NUM_THINKERLISTS; i++)
|
||||
{
|
||||
for (thinker = thlist[i].next; thinker != &thlist[i]; thinker = thinker->next)
|
||||
{
|
||||
thinkercount++;
|
||||
if (thinker->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
removecount++;
|
||||
else if (i == THINK_POLYOBJ)
|
||||
polythcount++;
|
||||
else if (i == THINK_MAIN)
|
||||
mainthcount++;
|
||||
else if (i == THINK_MOBJ)
|
||||
{
|
||||
if (thinker->function.acp1 == (actionf_p1)P_MobjThinker)
|
||||
{
|
||||
mobj_t *mobj = (mobj_t*)thinker;
|
||||
mobjcount++;
|
||||
if (mobj->flags & MF_NOTHINK)
|
||||
nothinkcount++;
|
||||
else if (mobj->flags & MF_SCENERY)
|
||||
scenerycount++;
|
||||
else
|
||||
regularcount++;
|
||||
}
|
||||
}
|
||||
else if (i == THINK_DYNSLOPE)
|
||||
dynslopethcount++;
|
||||
else if (i == THINK_PRECIP)
|
||||
precipcount++;
|
||||
}
|
||||
}
|
||||
|
||||
draw_row = 10;
|
||||
M_DrawPerfTiming(&tictime_col);
|
||||
M_DrawPerfTiming(&thinker_time_col);
|
||||
M_DrawPerfTiming(&detailed_thinker_time_col);
|
||||
M_DrawPerfTiming(&extra_thinker_time_col);
|
||||
|
||||
draw_row = 10;
|
||||
M_DrawPerfCount(&thinkercount_col);
|
||||
M_DrawPerfCount(&detailed_thinkercount_col);
|
||||
M_DrawPerfCount(&mobjthinkercount_col);
|
||||
|
||||
if (nothinkcount)
|
||||
M_DrawPerfCount(¬hinkcount_col);
|
||||
|
||||
M_DrawPerfCount(&detailed_thinkercount_col2);
|
||||
|
||||
if (M_HighResolution())
|
||||
{
|
||||
V_DrawSmallString(212, 10, V_MONOSPACE | V_ALLOWLOWERCASE | V_PURPLEMAP, "Calls:");
|
||||
|
||||
draw_row = 15;
|
||||
}
|
||||
else
|
||||
{
|
||||
draw_row = 10;
|
||||
}
|
||||
|
||||
M_DrawPerfCount(&misc_calls_col);
|
||||
}
|
||||
|
||||
void M_DrawPerfStats(void)
|
||||
{
|
||||
char s[100];
|
||||
int currenttime = I_GetTimeMicros();
|
||||
int frametime = currenttime - ps_prevframetime;
|
||||
ps_prevframetime = currenttime;
|
||||
|
||||
PS_SetFrameTime();
|
||||
|
||||
if (cv_perfstats.value == 1) // rendering
|
||||
{
|
||||
if (vid.width < 640 || vid.height < 400) // low resolution
|
||||
{
|
||||
snprintf(s, sizeof s - 1, "frmtime %d", frametime);
|
||||
V_DrawThinString(20, 10, V_MONOSPACE | V_YELLOWMAP, s);
|
||||
if (!(gamestate == GS_LEVEL || (gamestate == GS_TITLESCREEN && titlemapinaction)))
|
||||
{
|
||||
snprintf(s, sizeof s - 1, "ui %d", ps_uitime);
|
||||
V_DrawThinString(20, 18, V_MONOSPACE | V_YELLOWMAP, s);
|
||||
snprintf(s, sizeof s - 1, "finupdt %d", ps_swaptime);
|
||||
V_DrawThinString(20, 26, V_MONOSPACE | V_YELLOWMAP, s);
|
||||
snprintf(s, sizeof s - 1, "logic %d", ps_tictime);
|
||||
V_DrawThinString(20, 38, V_MONOSPACE | V_GRAYMAP, s);
|
||||
return;
|
||||
}
|
||||
snprintf(s, sizeof s - 1, "drwtime %d", ps_rendercalltime);
|
||||
V_DrawThinString(20, 18, V_MONOSPACE | V_YELLOWMAP, s);
|
||||
snprintf(s, sizeof s - 1, "bspcall %d", ps_numbspcalls);
|
||||
V_DrawThinString(90, 10, V_MONOSPACE | V_BLUEMAP, s);
|
||||
snprintf(s, sizeof s - 1, "sprites %d", ps_numsprites);
|
||||
V_DrawThinString(90, 18, V_MONOSPACE | V_BLUEMAP, s);
|
||||
snprintf(s, sizeof s - 1, "drwnode %d", ps_numdrawnodes);
|
||||
V_DrawThinString(90, 26, V_MONOSPACE | V_BLUEMAP, s);
|
||||
snprintf(s, sizeof s - 1, "plyobjs %d", ps_numpolyobjects);
|
||||
V_DrawThinString(90, 34, V_MONOSPACE | V_BLUEMAP, s);
|
||||
#ifdef HWRENDER
|
||||
if (rendermode == render_opengl) // OpenGL specific stats
|
||||
{
|
||||
snprintf(s, sizeof s - 1, "skybox %d", ps_hw_skyboxtime);
|
||||
V_DrawThinString(24, 26, V_MONOSPACE | V_YELLOWMAP, s);
|
||||
snprintf(s, sizeof s - 1, "bsptime %d", ps_bsptime);
|
||||
V_DrawThinString(24, 34, V_MONOSPACE | V_YELLOWMAP, s);
|
||||
snprintf(s, sizeof s - 1, "nodesrt %d", ps_hw_nodesorttime);
|
||||
V_DrawThinString(24, 42, V_MONOSPACE | V_YELLOWMAP, s);
|
||||
snprintf(s, sizeof s - 1, "nodedrw %d", ps_hw_nodedrawtime);
|
||||
V_DrawThinString(24, 50, V_MONOSPACE | V_YELLOWMAP, s);
|
||||
snprintf(s, sizeof s - 1, "sprsort %d", ps_hw_spritesorttime);
|
||||
V_DrawThinString(24, 58, V_MONOSPACE | V_YELLOWMAP, s);
|
||||
snprintf(s, sizeof s - 1, "sprdraw %d", ps_hw_spritedrawtime);
|
||||
V_DrawThinString(24, 66, V_MONOSPACE | V_YELLOWMAP, s);
|
||||
snprintf(s, sizeof s - 1, "other %d",
|
||||
ps_rendercalltime - ps_hw_skyboxtime - ps_bsptime - ps_hw_nodesorttime
|
||||
- ps_hw_nodedrawtime - ps_hw_spritesorttime - ps_hw_spritedrawtime
|
||||
- ps_hw_batchsorttime - ps_hw_batchdrawtime);
|
||||
V_DrawThinString(24, 74, V_MONOSPACE | V_YELLOWMAP, s);
|
||||
snprintf(s, sizeof s - 1, "ui %d", ps_uitime);
|
||||
V_DrawThinString(20, 82, V_MONOSPACE | V_YELLOWMAP, s);
|
||||
snprintf(s, sizeof s - 1, "finupdt %d", ps_swaptime);
|
||||
V_DrawThinString(20, 90, V_MONOSPACE | V_YELLOWMAP, s);
|
||||
snprintf(s, sizeof s - 1, "logic %d", ps_tictime);
|
||||
V_DrawThinString(20, 102, V_MONOSPACE | V_GRAYMAP, s);
|
||||
if (cv_glbatching.value)
|
||||
{
|
||||
snprintf(s, sizeof s - 1, "batsort %d", ps_hw_batchsorttime);
|
||||
V_DrawThinString(90, 46, V_MONOSPACE | V_REDMAP, s);
|
||||
snprintf(s, sizeof s - 1, "batdraw %d", ps_hw_batchdrawtime);
|
||||
V_DrawThinString(90, 54, V_MONOSPACE | V_REDMAP, s);
|
||||
|
||||
snprintf(s, sizeof s - 1, "polygon %d", ps_hw_numpolys);
|
||||
V_DrawThinString(155, 10, V_MONOSPACE | V_PURPLEMAP, s);
|
||||
snprintf(s, sizeof s - 1, "drwcall %d", ps_hw_numcalls);
|
||||
V_DrawThinString(155, 18, V_MONOSPACE | V_PURPLEMAP, s);
|
||||
snprintf(s, sizeof s - 1, "shaders %d", ps_hw_numshaders);
|
||||
V_DrawThinString(155, 26, V_MONOSPACE | V_PURPLEMAP, s);
|
||||
snprintf(s, sizeof s - 1, "vertex %d", ps_hw_numverts);
|
||||
V_DrawThinString(155, 34, V_MONOSPACE | V_PURPLEMAP, s);
|
||||
snprintf(s, sizeof s - 1, "texture %d", ps_hw_numtextures);
|
||||
V_DrawThinString(220, 10, V_MONOSPACE | V_PURPLEMAP, s);
|
||||
snprintf(s, sizeof s - 1, "polyflg %d", ps_hw_numpolyflags);
|
||||
V_DrawThinString(220, 18, V_MONOSPACE | V_PURPLEMAP, s);
|
||||
snprintf(s, sizeof s - 1, "colors %d", ps_hw_numcolors);
|
||||
V_DrawThinString(220, 26, V_MONOSPACE | V_PURPLEMAP, s);
|
||||
}
|
||||
else
|
||||
{
|
||||
// reset these vars so the "other" measurement isn't off
|
||||
ps_hw_batchsorttime = 0;
|
||||
ps_hw_batchdrawtime = 0;
|
||||
}
|
||||
}
|
||||
else // software specific stats
|
||||
#endif
|
||||
{
|
||||
snprintf(s, sizeof s - 1, "bsptime %d", ps_bsptime);
|
||||
V_DrawThinString(24, 26, V_MONOSPACE | V_YELLOWMAP, s);
|
||||
snprintf(s, sizeof s - 1, "sprclip %d", ps_sw_spritecliptime);
|
||||
V_DrawThinString(24, 34, V_MONOSPACE | V_YELLOWMAP, s);
|
||||
snprintf(s, sizeof s - 1, "portals %d", ps_sw_portaltime);
|
||||
V_DrawThinString(24, 42, V_MONOSPACE | V_YELLOWMAP, s);
|
||||
snprintf(s, sizeof s - 1, "planes %d", ps_sw_planetime);
|
||||
V_DrawThinString(24, 50, V_MONOSPACE | V_YELLOWMAP, s);
|
||||
snprintf(s, sizeof s - 1, "masked %d", ps_sw_maskedtime);
|
||||
V_DrawThinString(24, 58, V_MONOSPACE | V_YELLOWMAP, s);
|
||||
snprintf(s, sizeof s - 1, "other %d",
|
||||
ps_rendercalltime - ps_bsptime - ps_sw_spritecliptime
|
||||
- ps_sw_portaltime - ps_sw_planetime - ps_sw_maskedtime);
|
||||
V_DrawThinString(24, 66, V_MONOSPACE | V_YELLOWMAP, s);
|
||||
snprintf(s, sizeof s - 1, "ui %d", ps_uitime);
|
||||
V_DrawThinString(20, 74, V_MONOSPACE | V_YELLOWMAP, s);
|
||||
snprintf(s, sizeof s - 1, "finupdt %d", ps_swaptime);
|
||||
V_DrawThinString(20, 82, V_MONOSPACE | V_YELLOWMAP, s);
|
||||
snprintf(s, sizeof s - 1, "logic %d", ps_tictime);
|
||||
V_DrawThinString(20, 94, V_MONOSPACE | V_GRAYMAP, s);
|
||||
}
|
||||
}
|
||||
else // high resolution
|
||||
{
|
||||
snprintf(s, sizeof s - 1, "Frame time: %d", frametime);
|
||||
V_DrawSmallString(20, 10, V_MONOSPACE | V_ALLOWLOWERCASE | V_YELLOWMAP, s);
|
||||
if (!(gamestate == GS_LEVEL || (gamestate == GS_TITLESCREEN && titlemapinaction)))
|
||||
{
|
||||
snprintf(s, sizeof s - 1, "UI render: %d", ps_uitime);
|
||||
V_DrawSmallString(20, 15, V_MONOSPACE | V_ALLOWLOWERCASE | V_YELLOWMAP, s);
|
||||
snprintf(s, sizeof s - 1, "I_FinishUpdate: %d", ps_swaptime);
|
||||
V_DrawSmallString(20, 20, V_MONOSPACE | V_ALLOWLOWERCASE | V_YELLOWMAP, s);
|
||||
snprintf(s, sizeof s - 1, "Game logic: %d", ps_tictime);
|
||||
V_DrawSmallString(20, 30, V_MONOSPACE | V_ALLOWLOWERCASE | V_GRAYMAP, s);
|
||||
return;
|
||||
}
|
||||
snprintf(s, sizeof s - 1, "3d rendering: %d", ps_rendercalltime);
|
||||
V_DrawSmallString(20, 15, V_MONOSPACE | V_ALLOWLOWERCASE | V_YELLOWMAP, s);
|
||||
snprintf(s, sizeof s - 1, "BSP calls: %d", ps_numbspcalls);
|
||||
V_DrawSmallString(115, 10, V_MONOSPACE | V_ALLOWLOWERCASE | V_BLUEMAP, s);
|
||||
snprintf(s, sizeof s - 1, "Sprites: %d", ps_numsprites);
|
||||
V_DrawSmallString(115, 15, V_MONOSPACE | V_ALLOWLOWERCASE | V_BLUEMAP, s);
|
||||
snprintf(s, sizeof s - 1, "Drawnodes: %d", ps_numdrawnodes);
|
||||
V_DrawSmallString(115, 20, V_MONOSPACE | V_ALLOWLOWERCASE | V_BLUEMAP, s);
|
||||
snprintf(s, sizeof s - 1, "Polyobjects: %d", ps_numpolyobjects);
|
||||
V_DrawSmallString(115, 25, V_MONOSPACE | V_ALLOWLOWERCASE | V_BLUEMAP, s);
|
||||
#ifdef HWRENDER
|
||||
if (rendermode == render_opengl) // OpenGL specific stats
|
||||
{
|
||||
snprintf(s, sizeof s - 1, "Skybox render: %d", ps_hw_skyboxtime);
|
||||
V_DrawSmallString(24, 20, V_MONOSPACE | V_ALLOWLOWERCASE | V_YELLOWMAP, s);
|
||||
snprintf(s, sizeof s - 1, "RenderBSPNode: %d", ps_bsptime);
|
||||
V_DrawSmallString(24, 25, V_MONOSPACE | V_ALLOWLOWERCASE | V_YELLOWMAP, s);
|
||||
snprintf(s, sizeof s - 1, "Drwnode sort: %d", ps_hw_nodesorttime);
|
||||
V_DrawSmallString(24, 30, V_MONOSPACE | V_ALLOWLOWERCASE | V_YELLOWMAP, s);
|
||||
snprintf(s, sizeof s - 1, "Drwnode render: %d", ps_hw_nodedrawtime);
|
||||
V_DrawSmallString(24, 35, V_MONOSPACE | V_ALLOWLOWERCASE | V_YELLOWMAP, s);
|
||||
snprintf(s, sizeof s - 1, "Sprite sort: %d", ps_hw_spritesorttime);
|
||||
V_DrawSmallString(24, 40, V_MONOSPACE | V_ALLOWLOWERCASE | V_YELLOWMAP, s);
|
||||
snprintf(s, sizeof s - 1, "Sprite render: %d", ps_hw_spritedrawtime);
|
||||
V_DrawSmallString(24, 45, V_MONOSPACE | V_ALLOWLOWERCASE | V_YELLOWMAP, s);
|
||||
// Remember to update this calculation when adding more 3d rendering stats!
|
||||
snprintf(s, sizeof s - 1, "Other: %d",
|
||||
ps_rendercalltime - ps_hw_skyboxtime - ps_bsptime - ps_hw_nodesorttime
|
||||
- ps_hw_nodedrawtime - ps_hw_spritesorttime - ps_hw_spritedrawtime
|
||||
- ps_hw_batchsorttime - ps_hw_batchdrawtime);
|
||||
V_DrawSmallString(24, 50, V_MONOSPACE | V_ALLOWLOWERCASE | V_YELLOWMAP, s);
|
||||
snprintf(s, sizeof s - 1, "UI render: %d", ps_uitime);
|
||||
V_DrawSmallString(20, 55, V_MONOSPACE | V_ALLOWLOWERCASE | V_YELLOWMAP, s);
|
||||
snprintf(s, sizeof s - 1, "I_FinishUpdate: %d", ps_swaptime);
|
||||
V_DrawSmallString(20, 60, V_MONOSPACE | V_ALLOWLOWERCASE | V_YELLOWMAP, s);
|
||||
snprintf(s, sizeof s - 1, "Game logic: %d", ps_tictime);
|
||||
V_DrawSmallString(20, 70, V_MONOSPACE | V_ALLOWLOWERCASE | V_GRAYMAP, s);
|
||||
if (cv_glbatching.value)
|
||||
{
|
||||
snprintf(s, sizeof s - 1, "Batch sort: %d", ps_hw_batchsorttime);
|
||||
V_DrawSmallString(115, 35, V_MONOSPACE | V_ALLOWLOWERCASE | V_REDMAP, s);
|
||||
snprintf(s, sizeof s - 1, "Batch render: %d", ps_hw_batchdrawtime);
|
||||
V_DrawSmallString(115, 40, V_MONOSPACE | V_ALLOWLOWERCASE | V_REDMAP, s);
|
||||
|
||||
snprintf(s, sizeof s - 1, "Polygons: %d", ps_hw_numpolys);
|
||||
V_DrawSmallString(200, 10, V_MONOSPACE | V_ALLOWLOWERCASE | V_PURPLEMAP, s);
|
||||
snprintf(s, sizeof s - 1, "Vertices: %d", ps_hw_numverts);
|
||||
V_DrawSmallString(200, 15, V_MONOSPACE | V_ALLOWLOWERCASE | V_PURPLEMAP, s);
|
||||
snprintf(s, sizeof s - 1, "Draw calls: %d", ps_hw_numcalls);
|
||||
V_DrawSmallString(200, 25, V_MONOSPACE | V_ALLOWLOWERCASE | V_PURPLEMAP, s);
|
||||
snprintf(s, sizeof s - 1, "Shaders: %d", ps_hw_numshaders);
|
||||
V_DrawSmallString(200, 30, V_MONOSPACE | V_ALLOWLOWERCASE | V_PURPLEMAP, s);
|
||||
snprintf(s, sizeof s - 1, "Textures: %d", ps_hw_numtextures);
|
||||
V_DrawSmallString(200, 35, V_MONOSPACE | V_ALLOWLOWERCASE | V_PURPLEMAP, s);
|
||||
snprintf(s, sizeof s - 1, "Polyflags: %d", ps_hw_numpolyflags);
|
||||
V_DrawSmallString(200, 40, V_MONOSPACE | V_ALLOWLOWERCASE | V_PURPLEMAP, s);
|
||||
snprintf(s, sizeof s - 1, "Colors: %d", ps_hw_numcolors);
|
||||
V_DrawSmallString(200, 45, V_MONOSPACE | V_ALLOWLOWERCASE | V_PURPLEMAP, s);
|
||||
}
|
||||
else
|
||||
{
|
||||
// reset these vars so the "other" measurement isn't off
|
||||
ps_hw_batchsorttime = 0;
|
||||
ps_hw_batchdrawtime = 0;
|
||||
}
|
||||
}
|
||||
else // software specific stats
|
||||
#endif
|
||||
{
|
||||
snprintf(s, sizeof s - 1, "RenderBSPNode: %d", ps_bsptime);
|
||||
V_DrawSmallString(24, 20, V_MONOSPACE | V_ALLOWLOWERCASE | V_YELLOWMAP, s);
|
||||
snprintf(s, sizeof s - 1, "R_ClipSprites: %d", ps_sw_spritecliptime);
|
||||
V_DrawSmallString(24, 25, V_MONOSPACE | V_ALLOWLOWERCASE | V_YELLOWMAP, s);
|
||||
snprintf(s, sizeof s - 1, "Portals+Skybox: %d", ps_sw_portaltime);
|
||||
V_DrawSmallString(24, 30, V_MONOSPACE | V_ALLOWLOWERCASE | V_YELLOWMAP, s);
|
||||
snprintf(s, sizeof s - 1, "R_DrawPlanes: %d", ps_sw_planetime);
|
||||
V_DrawSmallString(24, 35, V_MONOSPACE | V_ALLOWLOWERCASE | V_YELLOWMAP, s);
|
||||
snprintf(s, sizeof s - 1, "R_DrawMasked: %d", ps_sw_maskedtime);
|
||||
V_DrawSmallString(24, 40, V_MONOSPACE | V_ALLOWLOWERCASE | V_YELLOWMAP, s);
|
||||
// Remember to update this calculation when adding more 3d rendering stats!
|
||||
snprintf(s, sizeof s - 1, "Other: %d",
|
||||
ps_rendercalltime - ps_bsptime - ps_sw_spritecliptime
|
||||
- ps_sw_portaltime - ps_sw_planetime - ps_sw_maskedtime);
|
||||
V_DrawSmallString(24, 45, V_MONOSPACE | V_ALLOWLOWERCASE | V_YELLOWMAP, s);
|
||||
snprintf(s, sizeof s - 1, "UI render: %d", ps_uitime);
|
||||
V_DrawSmallString(20, 50, V_MONOSPACE | V_ALLOWLOWERCASE | V_YELLOWMAP, s);
|
||||
snprintf(s, sizeof s - 1, "I_FinishUpdate: %d", ps_swaptime);
|
||||
V_DrawSmallString(20, 55, V_MONOSPACE | V_ALLOWLOWERCASE | V_YELLOWMAP, s);
|
||||
snprintf(s, sizeof s - 1, "Game logic: %d", ps_tictime);
|
||||
V_DrawSmallString(20, 65, V_MONOSPACE | V_ALLOWLOWERCASE | V_GRAYMAP, s);
|
||||
}
|
||||
}
|
||||
M_DrawRenderStats();
|
||||
}
|
||||
else if (cv_perfstats.value == 2) // logic
|
||||
{
|
||||
int i = 0;
|
||||
thinker_t *thinker;
|
||||
int thinkercount = 0;
|
||||
int polythcount = 0;
|
||||
int mainthcount = 0;
|
||||
int mobjcount = 0;
|
||||
int nothinkcount = 0;
|
||||
int scenerycount = 0;
|
||||
int dynslopethcount = 0;
|
||||
int precipcount = 0;
|
||||
int removecount = 0;
|
||||
// y offset for drawing columns
|
||||
int yoffset1 = 0;
|
||||
int yoffset2 = 0;
|
||||
|
||||
for (i = 0; i < NUM_THINKERLISTS; i++)
|
||||
{
|
||||
for (thinker = thlist[i].next; thinker != &thlist[i]; thinker = thinker->next)
|
||||
{
|
||||
thinkercount++;
|
||||
if (thinker->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
removecount++;
|
||||
else if (i == THINK_POLYOBJ)
|
||||
polythcount++;
|
||||
else if (i == THINK_MAIN)
|
||||
mainthcount++;
|
||||
else if (i == THINK_MOBJ)
|
||||
{
|
||||
if (thinker->function.acp1 == (actionf_p1)P_MobjThinker)
|
||||
{
|
||||
mobj_t *mobj = (mobj_t*)thinker;
|
||||
mobjcount++;
|
||||
if (mobj->flags & MF_NOTHINK)
|
||||
nothinkcount++;
|
||||
else if (mobj->flags & MF_SCENERY)
|
||||
scenerycount++;
|
||||
}
|
||||
}
|
||||
else if (i == THINK_DYNSLOPE)
|
||||
dynslopethcount++;
|
||||
else if (i == THINK_PRECIP)
|
||||
precipcount++;
|
||||
}
|
||||
}
|
||||
|
||||
if (vid.width < 640 || vid.height < 400) // low resolution
|
||||
{
|
||||
snprintf(s, sizeof s - 1, "logic %d", ps_tictime);
|
||||
V_DrawThinString(20, 10, V_MONOSPACE | V_YELLOWMAP, s);
|
||||
if (!(gamestate == GS_LEVEL || (gamestate == GS_TITLESCREEN && titlemapinaction)))
|
||||
return;
|
||||
snprintf(s, sizeof s - 1, "plrthnk %d", ps_playerthink_time);
|
||||
V_DrawThinString(24, 18, V_MONOSPACE | V_YELLOWMAP, s);
|
||||
snprintf(s, sizeof s - 1, "thnkers %d", ps_thinkertime);
|
||||
V_DrawThinString(24, 26, V_MONOSPACE | V_YELLOWMAP, s);
|
||||
for (i = 0; i < NUM_THINKERLISTS; i++)
|
||||
{
|
||||
yoffset1 += 8;
|
||||
snprintf(s, sizeof s - 1, thlist_shortnames[i], ps_thlist_times[i]);
|
||||
V_DrawThinString(28, 26+yoffset1, V_MONOSPACE | V_YELLOWMAP, s);
|
||||
}
|
||||
snprintf(s, sizeof s - 1, "lthinkf %d", ps_lua_thinkframe_time);
|
||||
V_DrawThinString(24, 34+yoffset1, V_MONOSPACE | V_YELLOWMAP, s);
|
||||
snprintf(s, sizeof s - 1, "other %d",
|
||||
ps_tictime - ps_playerthink_time - ps_thinkertime - ps_lua_thinkframe_time);
|
||||
V_DrawThinString(24, 42+yoffset1, V_MONOSPACE | V_YELLOWMAP, s);
|
||||
|
||||
snprintf(s, sizeof s - 1, "thnkers %d", thinkercount);
|
||||
V_DrawThinString(90, 10, V_MONOSPACE | V_BLUEMAP, s);
|
||||
snprintf(s, sizeof s - 1, "plyobjs %d", polythcount);
|
||||
V_DrawThinString(94, 18, V_MONOSPACE | V_BLUEMAP, s);
|
||||
snprintf(s, sizeof s - 1, "main %d", mainthcount);
|
||||
V_DrawThinString(94, 26, V_MONOSPACE | V_BLUEMAP, s);
|
||||
snprintf(s, sizeof s - 1, "mobjs %d", mobjcount);
|
||||
V_DrawThinString(94, 34, V_MONOSPACE | V_BLUEMAP, s);
|
||||
snprintf(s, sizeof s - 1, "regular %d", mobjcount - scenerycount - nothinkcount);
|
||||
V_DrawThinString(98, 42, V_MONOSPACE | V_BLUEMAP, s);
|
||||
snprintf(s, sizeof s - 1, "scenery %d", scenerycount);
|
||||
V_DrawThinString(98, 50, V_MONOSPACE | V_BLUEMAP, s);
|
||||
if (nothinkcount)
|
||||
{
|
||||
snprintf(s, sizeof s - 1, "nothink %d", nothinkcount);
|
||||
V_DrawThinString(98, 58, V_MONOSPACE | V_BLUEMAP, s);
|
||||
yoffset2 += 8;
|
||||
}
|
||||
snprintf(s, sizeof s - 1, "dynslop %d", dynslopethcount);
|
||||
V_DrawThinString(94, 58+yoffset2, V_MONOSPACE | V_BLUEMAP, s);
|
||||
snprintf(s, sizeof s - 1, "precip %d", precipcount);
|
||||
V_DrawThinString(94, 66+yoffset2, V_MONOSPACE | V_BLUEMAP, s);
|
||||
snprintf(s, sizeof s - 1, "remove %d", removecount);
|
||||
V_DrawThinString(94, 74+yoffset2, V_MONOSPACE | V_BLUEMAP, s);
|
||||
|
||||
snprintf(s, sizeof s - 1, "lmhooks %d", ps_lua_mobjhooks);
|
||||
V_DrawThinString(170, 10, V_MONOSPACE | V_PURPLEMAP, s);
|
||||
snprintf(s, sizeof s - 1, "chkpos %d", ps_checkposition_calls);
|
||||
V_DrawThinString(170, 18, V_MONOSPACE | V_PURPLEMAP, s);
|
||||
}
|
||||
else // high resolution
|
||||
{
|
||||
snprintf(s, sizeof s - 1, "Game logic: %d", ps_tictime);
|
||||
V_DrawSmallString(20, 10, V_MONOSPACE | V_ALLOWLOWERCASE | V_YELLOWMAP, s);
|
||||
if (!(gamestate == GS_LEVEL || (gamestate == GS_TITLESCREEN && titlemapinaction)))
|
||||
return;
|
||||
snprintf(s, sizeof s - 1, "P_PlayerThink: %d", ps_playerthink_time);
|
||||
V_DrawSmallString(24, 15, V_MONOSPACE | V_ALLOWLOWERCASE | V_YELLOWMAP, s);
|
||||
snprintf(s, sizeof s - 1, "P_RunThinkers: %d", ps_thinkertime);
|
||||
V_DrawSmallString(24, 20, V_MONOSPACE | V_ALLOWLOWERCASE | V_YELLOWMAP, s);
|
||||
for (i = 0; i < NUM_THINKERLISTS; i++)
|
||||
{
|
||||
yoffset1 += 5;
|
||||
snprintf(s, sizeof s - 1, thlist_names[i], ps_thlist_times[i]);
|
||||
V_DrawSmallString(28, 20+yoffset1, V_MONOSPACE | V_ALLOWLOWERCASE | V_YELLOWMAP, s);
|
||||
}
|
||||
snprintf(s, sizeof s - 1, "LUAh_ThinkFrame: %d", ps_lua_thinkframe_time);
|
||||
V_DrawSmallString(24, 25+yoffset1, V_MONOSPACE | V_ALLOWLOWERCASE | V_YELLOWMAP, s);
|
||||
snprintf(s, sizeof s - 1, "Other: %d",
|
||||
ps_tictime - ps_playerthink_time - ps_thinkertime - ps_lua_thinkframe_time);
|
||||
V_DrawSmallString(24, 30+yoffset1, V_MONOSPACE | V_ALLOWLOWERCASE | V_YELLOWMAP, s);
|
||||
|
||||
snprintf(s, sizeof s - 1, "Thinkers: %d", thinkercount);
|
||||
V_DrawSmallString(115, 10+yoffset2, V_MONOSPACE | V_ALLOWLOWERCASE | V_BLUEMAP, s);
|
||||
snprintf(s, sizeof s - 1, "Polyobjects: %d", polythcount);
|
||||
V_DrawSmallString(119, 15+yoffset2, V_MONOSPACE | V_ALLOWLOWERCASE | V_BLUEMAP, s);
|
||||
snprintf(s, sizeof s - 1, "Main: %d", mainthcount);
|
||||
V_DrawSmallString(119, 20+yoffset2, V_MONOSPACE | V_ALLOWLOWERCASE | V_BLUEMAP, s);
|
||||
snprintf(s, sizeof s - 1, "Mobjs: %d", mobjcount);
|
||||
V_DrawSmallString(119, 25+yoffset2, V_MONOSPACE | V_ALLOWLOWERCASE | V_BLUEMAP, s);
|
||||
snprintf(s, sizeof s - 1, "Regular: %d", mobjcount - scenerycount - nothinkcount);
|
||||
V_DrawSmallString(123, 30+yoffset2, V_MONOSPACE | V_ALLOWLOWERCASE | V_BLUEMAP, s);
|
||||
snprintf(s, sizeof s - 1, "Scenery: %d", scenerycount);
|
||||
V_DrawSmallString(123, 35+yoffset2, V_MONOSPACE | V_ALLOWLOWERCASE | V_BLUEMAP, s);
|
||||
if (nothinkcount)
|
||||
{
|
||||
snprintf(s, sizeof s - 1, "Nothink: %d", nothinkcount);
|
||||
V_DrawSmallString(123, 40+yoffset2, V_MONOSPACE | V_ALLOWLOWERCASE | V_BLUEMAP, s);
|
||||
yoffset2 += 5;
|
||||
}
|
||||
snprintf(s, sizeof s - 1, "Dynamic slopes: %d", dynslopethcount);
|
||||
V_DrawSmallString(119, 40+yoffset2, V_MONOSPACE | V_ALLOWLOWERCASE | V_BLUEMAP, s);
|
||||
snprintf(s, sizeof s - 1, "Precipitation: %d", precipcount);
|
||||
V_DrawSmallString(119, 45+yoffset2, V_MONOSPACE | V_ALLOWLOWERCASE | V_BLUEMAP, s);
|
||||
snprintf(s, sizeof s - 1, "Pending removal: %d", removecount);
|
||||
V_DrawSmallString(119, 50+yoffset2, V_MONOSPACE | V_ALLOWLOWERCASE | V_BLUEMAP, s);
|
||||
|
||||
snprintf(s, sizeof s - 1, "Calls:");
|
||||
V_DrawSmallString(212, 10, V_MONOSPACE | V_ALLOWLOWERCASE | V_PURPLEMAP, s);
|
||||
snprintf(s, sizeof s - 1, "Lua mobj hooks: %d", ps_lua_mobjhooks);
|
||||
V_DrawSmallString(216, 15, V_MONOSPACE | V_ALLOWLOWERCASE | V_PURPLEMAP, s);
|
||||
snprintf(s, sizeof s - 1, "P_CheckPosition: %d", ps_checkposition_calls);
|
||||
V_DrawSmallString(216, 20, V_MONOSPACE | V_ALLOWLOWERCASE | V_PURPLEMAP, s);
|
||||
}
|
||||
M_DrawTickStats();
|
||||
}
|
||||
else if (cv_perfstats.value == 3) // lua thinkframe
|
||||
{
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue