alnyan/yggdrasil: add yggdrasil integration
This commit is contained in:
@@ -0,0 +1,74 @@
|
|||||||
|
################################################################
|
||||||
|
#
|
||||||
|
# $Id:$
|
||||||
|
#
|
||||||
|
# $Log:$
|
||||||
|
#
|
||||||
|
|
||||||
|
ifeq ($(V),1)
|
||||||
|
VB=''
|
||||||
|
else
|
||||||
|
VB=@
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
RFL=
|
||||||
|
|
||||||
|
ifneq ($(TARGET),)
|
||||||
|
CFLAGS+=-target $(TARGET)
|
||||||
|
LDFLAGS+=-target $(TARGET)
|
||||||
|
RFL+=--target $(TARGET)
|
||||||
|
RDIR=target/$(TARGET)/debug
|
||||||
|
else
|
||||||
|
RDIR=target/debug
|
||||||
|
endif
|
||||||
|
ifneq ($(SYSROOT),)
|
||||||
|
CFLAGS+=--sysroot $(SYSROOT)
|
||||||
|
LDFLAGS+=--sysroot $(SYSROOT)
|
||||||
|
endif
|
||||||
|
|
||||||
|
LDFLAGS+=-Wl,--gc-sections
|
||||||
|
CFLAGS+=-ggdb3 -fno-omit-frame-pointer -Wall -DNORMALUNIX -D_DEFAULT_SOURCE -fPIC # -DUSEASM
|
||||||
|
LIBS+=-lm -lygglibc doomgeneric-yggdrasil/$(RDIR)/libdoomgeneric_yggdrasil.a
|
||||||
|
|
||||||
|
|
||||||
|
CC=clang # gcc or g++
|
||||||
|
|
||||||
|
# subdirectory for objects
|
||||||
|
OBJDIR=build
|
||||||
|
OUTPUT=doomgeneric
|
||||||
|
|
||||||
|
SRC_DOOM = dummy.o am_map.o doomdef.o doomstat.o dstrings.o d_event.o d_items.o d_iwad.o d_loop.o d_main.o d_mode.o d_net.o f_finale.o f_wipe.o g_game.o hu_lib.o hu_stuff.o info.o i_cdmus.o i_endoom.o i_joystick.o i_scale.o i_sound.o i_system.o i_timer.o memio.o m_argv.o m_bbox.o m_cheat.o m_config.o m_controls.o m_fixed.o m_menu.o m_misc.o m_random.o p_ceilng.o p_doors.o p_enemy.o p_floor.o p_inter.o p_lights.o p_map.o p_maputl.o p_mobj.o p_plats.o p_pspr.o p_saveg.o p_setup.o p_sight.o p_spec.o p_switch.o p_telept.o p_tick.o p_user.o r_bsp.o r_data.o r_draw.o r_main.o r_plane.o r_segs.o r_sky.o r_things.o sha1.o sounds.o statdump.o st_lib.o st_stuff.o s_sound.o tables.o v_video.o wi_stuff.o w_checksum.o w_file.o w_main.o w_wad.o z_zone.o w_file_stdc.o i_input.o i_video.o doomgeneric.o doomgeneric_yggdrasil.o
|
||||||
|
OBJS += $(addprefix $(OBJDIR)/, $(SRC_DOOM))
|
||||||
|
|
||||||
|
all: $(OUTPUT)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -rf $(OBJDIR)
|
||||||
|
rm -f $(OUTPUT)
|
||||||
|
rm -f $(OUTPUT).gdb
|
||||||
|
rm -f $(OUTPUT).map
|
||||||
|
|
||||||
|
rust:
|
||||||
|
@echo [Building doomgeneric-yggdrasil Rust library]
|
||||||
|
@cd doomgeneric-yggdrasil; cargo +ygg-stage1 build $(RFL)
|
||||||
|
|
||||||
|
$(OUTPUT): rust $(OBJS)
|
||||||
|
@echo [Linking $@]
|
||||||
|
$(VB)$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) \
|
||||||
|
-o $(OUTPUT) $(LIBS) -Wl,-Map,$(OUTPUT).map
|
||||||
|
@echo [Size]
|
||||||
|
-$(CROSS_COMPILE)size $(OUTPUT)
|
||||||
|
|
||||||
|
$(OBJS): | $(OBJDIR)
|
||||||
|
|
||||||
|
$(OBJDIR):
|
||||||
|
mkdir -p $(OBJDIR)
|
||||||
|
|
||||||
|
$(OBJDIR)/%.o: %.c
|
||||||
|
@echo [Compiling $<]
|
||||||
|
$(VB)$(CC) $(CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
|
print:
|
||||||
|
@echo OBJS: $(OBJS)
|
||||||
|
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
/target
|
||||||
|
/yggdrasil-root
|
||||||
+672
@@ -0,0 +1,672 @@
|
|||||||
|
# This file is automatically @generated by Cargo.
|
||||||
|
# It is not intended for manual editing.
|
||||||
|
version = 4
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "abi-generator"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
"thiserror",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "abi-lib"
|
||||||
|
version = "0.1.0"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "abi-serde"
|
||||||
|
version = "0.1.0"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "aho-corasick"
|
||||||
|
version = "1.1.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916"
|
||||||
|
dependencies = [
|
||||||
|
"memchr",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "anstream"
|
||||||
|
version = "0.6.18"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8acc5369981196006228e28809f761875c0327210a891e941f4c683b3a99529b"
|
||||||
|
dependencies = [
|
||||||
|
"anstyle",
|
||||||
|
"anstyle-parse",
|
||||||
|
"anstyle-query",
|
||||||
|
"anstyle-wincon",
|
||||||
|
"colorchoice",
|
||||||
|
"is_terminal_polyfill",
|
||||||
|
"utf8parse",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "anstyle"
|
||||||
|
version = "1.0.10"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "anstyle-parse"
|
||||||
|
version = "0.2.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3b2d16507662817a6a20a9ea92df6652ee4f94f914589377d69f3b21bc5798a9"
|
||||||
|
dependencies = [
|
||||||
|
"utf8parse",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "anstyle-query"
|
||||||
|
version = "1.1.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c"
|
||||||
|
dependencies = [
|
||||||
|
"windows-sys",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "anstyle-wincon"
|
||||||
|
version = "3.0.7"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ca3534e77181a9cc07539ad51f2141fe32f6c3ffd4df76db8ad92346b003ae4e"
|
||||||
|
dependencies = [
|
||||||
|
"anstyle",
|
||||||
|
"once_cell",
|
||||||
|
"windows-sys",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "atomic-polyfill"
|
||||||
|
version = "1.0.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8cf2bce30dfe09ef0bfaef228b9d414faaf7e563035494d7fe092dba54b300f4"
|
||||||
|
dependencies = [
|
||||||
|
"critical-section",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "autocfg"
|
||||||
|
version = "1.4.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bitflags"
|
||||||
|
version = "2.8.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8f68f53c83ab957f72c32642f3868eec03eb974d1fb82e453128456482613d36"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bytemuck"
|
||||||
|
version = "1.21.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ef657dfab802224e671f5818e9a4935f9b1957ed18e58292690cc39e7a4092a3"
|
||||||
|
dependencies = [
|
||||||
|
"bytemuck_derive",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bytemuck_derive"
|
||||||
|
version = "1.8.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3fa76293b4f7bb636ab88fd78228235b5248b4d05cc589aed610f954af5d7c7a"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "byteorder"
|
||||||
|
version = "1.5.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cc"
|
||||||
|
version = "1.2.15"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c736e259eea577f443d5c86c304f9f4ae0295c43f3ba05c21f1d66b5f06001af"
|
||||||
|
dependencies = [
|
||||||
|
"shlex",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cfg-if"
|
||||||
|
version = "1.0.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cobs"
|
||||||
|
version = "0.2.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "67ba02a97a2bd10f4b59b25c7973101c79642302776489e030cd13cdab09ed15"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "colorchoice"
|
||||||
|
version = "1.0.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "critical-section"
|
||||||
|
version = "1.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "790eea4361631c5e7d22598ecd5723ff611904e3344ce8720784c93e3d83d40b"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cross"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags",
|
||||||
|
"libc",
|
||||||
|
"runtime",
|
||||||
|
"tempfile",
|
||||||
|
"yggdrasil-rt",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "doomgeneric-yggdrasil"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"cross",
|
||||||
|
"libcolors",
|
||||||
|
"log",
|
||||||
|
"logsink",
|
||||||
|
"thiserror",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "embedded-io"
|
||||||
|
version = "0.4.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ef1a6892d9eef45c8fa6b9e0086428a2cca8491aca8f787c534a3d6d0bcb3ced"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "embedded-io"
|
||||||
|
version = "0.6.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "env_filter"
|
||||||
|
version = "0.1.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "186e05a59d4c50738528153b83b0b0194d3a29507dfec16eccd4b342903397d0"
|
||||||
|
dependencies = [
|
||||||
|
"log",
|
||||||
|
"regex",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "env_logger"
|
||||||
|
version = "0.11.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "dcaee3d8e3cfc3fd92428d477bc97fc29ec8716d180c0d74c643bb26166660e0"
|
||||||
|
dependencies = [
|
||||||
|
"anstream",
|
||||||
|
"anstyle",
|
||||||
|
"env_filter",
|
||||||
|
"humantime",
|
||||||
|
"log",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "errno"
|
||||||
|
version = "0.3.10"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
"windows-sys",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "fastrand"
|
||||||
|
version = "2.3.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "getrandom"
|
||||||
|
version = "0.3.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "43a49c392881ce6d5c3b8cb70f98717b7c07aabbdff06687b9030dbfbe2725f8"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
"libc",
|
||||||
|
"wasi",
|
||||||
|
"windows-targets",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "hash32"
|
||||||
|
version = "0.2.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b0c35f58762feb77d74ebe43bdbc3210f09be9fe6742234d573bacc26ed92b67"
|
||||||
|
dependencies = [
|
||||||
|
"byteorder",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "heapless"
|
||||||
|
version = "0.7.17"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "cdc6457c0eb62c71aac4bc17216026d8410337c4126773b9c5daba343f17964f"
|
||||||
|
dependencies = [
|
||||||
|
"atomic-polyfill",
|
||||||
|
"hash32",
|
||||||
|
"rustc_version",
|
||||||
|
"serde",
|
||||||
|
"spin",
|
||||||
|
"stable_deref_trait",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "humantime"
|
||||||
|
version = "2.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "is_terminal_polyfill"
|
||||||
|
version = "1.70.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "libc"
|
||||||
|
version = "0.2.170"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "875b3680cb2f8f71bdcf9a30f38d48282f5d3c95cbf9b3fa57269bb5d5c06828"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "libcolors"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"cross",
|
||||||
|
"log",
|
||||||
|
"serde",
|
||||||
|
"thiserror",
|
||||||
|
"uipc",
|
||||||
|
"yggdrasil-abi",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "linux-raw-sys"
|
||||||
|
version = "0.4.15"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "lock_api"
|
||||||
|
version = "0.4.12"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17"
|
||||||
|
dependencies = [
|
||||||
|
"autocfg",
|
||||||
|
"scopeguard",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "log"
|
||||||
|
version = "0.4.26"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "30bde2b3dc3671ae49d8e2e9f044c7c005836e7a023ee57cffa25ab82764bb9e"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "logsink"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"env_logger",
|
||||||
|
"log",
|
||||||
|
"yggdrasil-rt",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "memchr"
|
||||||
|
version = "2.7.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "once_cell"
|
||||||
|
version = "1.20.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "945462a4b81e43c4e3ba96bd7b49d834c6f61198356aa858733bc4acf3cbe62e"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "postcard"
|
||||||
|
version = "1.1.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "170a2601f67cc9dba8edd8c4870b15f71a6a2dc196daec8c83f72b59dff628a8"
|
||||||
|
dependencies = [
|
||||||
|
"cobs",
|
||||||
|
"embedded-io 0.4.0",
|
||||||
|
"embedded-io 0.6.1",
|
||||||
|
"heapless",
|
||||||
|
"serde",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "prettyplease"
|
||||||
|
version = "0.2.29"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "6924ced06e1f7dfe3fa48d57b9f74f55d8915f5036121bef647ef4b204895fac"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "proc-macro2"
|
||||||
|
version = "1.0.93"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "60946a68e5f9d28b0dc1c21bb8a97ee7d018a8b322fa57838ba31cc878e22d99"
|
||||||
|
dependencies = [
|
||||||
|
"unicode-ident",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "quote"
|
||||||
|
version = "1.0.38"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "regex"
|
||||||
|
version = "1.11.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191"
|
||||||
|
dependencies = [
|
||||||
|
"aho-corasick",
|
||||||
|
"memchr",
|
||||||
|
"regex-automata",
|
||||||
|
"regex-syntax",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "regex-automata"
|
||||||
|
version = "0.4.9"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908"
|
||||||
|
dependencies = [
|
||||||
|
"aho-corasick",
|
||||||
|
"memchr",
|
||||||
|
"regex-syntax",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "regex-syntax"
|
||||||
|
version = "0.8.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "runtime"
|
||||||
|
version = "0.1.0"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rustc_version"
|
||||||
|
version = "0.4.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92"
|
||||||
|
dependencies = [
|
||||||
|
"semver",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rustix"
|
||||||
|
version = "0.38.44"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags",
|
||||||
|
"errno",
|
||||||
|
"libc",
|
||||||
|
"linux-raw-sys",
|
||||||
|
"windows-sys",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "scopeguard"
|
||||||
|
version = "1.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "semver"
|
||||||
|
version = "1.0.25"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f79dfe2d285b0488816f30e700a7438c5a73d816b5b7d3ac72fbc48b0d185e03"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "serde"
|
||||||
|
version = "1.0.218"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e8dfc9d19bdbf6d17e22319da49161d5d0108e4188e8b680aef6299eed22df60"
|
||||||
|
dependencies = [
|
||||||
|
"serde_derive",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "serde_derive"
|
||||||
|
version = "1.0.218"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f09503e191f4e797cb8aac08e9a4a4695c5edf6a2e70e376d961ddd5c969f82b"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "shlex"
|
||||||
|
version = "1.3.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "spin"
|
||||||
|
version = "0.9.8"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67"
|
||||||
|
dependencies = [
|
||||||
|
"lock_api",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "stable_deref_trait"
|
||||||
|
version = "1.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "syn"
|
||||||
|
version = "2.0.98"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "36147f1a48ae0ec2b5b3bc5b537d267457555a10dc06f3dbc8cb11ba3006d3b1"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"unicode-ident",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tempfile"
|
||||||
|
version = "3.17.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "22e5a0acb1f3f55f65cc4a866c361b2fb2a0ff6366785ae6fbb5f85df07ba230"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
"fastrand",
|
||||||
|
"getrandom",
|
||||||
|
"once_cell",
|
||||||
|
"rustix",
|
||||||
|
"windows-sys",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "thiserror"
|
||||||
|
version = "1.0.69"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52"
|
||||||
|
dependencies = [
|
||||||
|
"thiserror-impl",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "thiserror-impl"
|
||||||
|
version = "1.0.69"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "uipc"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"cross",
|
||||||
|
"postcard",
|
||||||
|
"serde",
|
||||||
|
"thiserror",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "unicode-ident"
|
||||||
|
version = "1.0.17"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "00e2473a93778eb0bad35909dff6a10d28e63f792f16ed15e404fca9d5eeedbe"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "utf8parse"
|
||||||
|
version = "0.2.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wasi"
|
||||||
|
version = "0.13.3+wasi-0.2.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "26816d2e1a4a36a2940b96c5296ce403917633dff8f3440e9b236ed6f6bacad2"
|
||||||
|
dependencies = [
|
||||||
|
"wit-bindgen-rt",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows-sys"
|
||||||
|
version = "0.59.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"
|
||||||
|
dependencies = [
|
||||||
|
"windows-targets",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows-targets"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
|
||||||
|
dependencies = [
|
||||||
|
"windows_aarch64_gnullvm",
|
||||||
|
"windows_aarch64_msvc",
|
||||||
|
"windows_i686_gnu",
|
||||||
|
"windows_i686_gnullvm",
|
||||||
|
"windows_i686_msvc",
|
||||||
|
"windows_x86_64_gnu",
|
||||||
|
"windows_x86_64_gnullvm",
|
||||||
|
"windows_x86_64_msvc",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_aarch64_gnullvm"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_aarch64_msvc"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_i686_gnu"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_i686_gnullvm"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_i686_msvc"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_x86_64_gnu"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_x86_64_gnullvm"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_x86_64_msvc"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wit-bindgen-rt"
|
||||||
|
version = "0.33.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3268f3d866458b787f390cf61f4bbb563b922d091359f9608842999eaee3943c"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "yggdrasil-abi"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"abi-generator",
|
||||||
|
"abi-lib",
|
||||||
|
"abi-serde",
|
||||||
|
"bytemuck",
|
||||||
|
"prettyplease",
|
||||||
|
"serde",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "yggdrasil-rt"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"abi-generator",
|
||||||
|
"abi-lib",
|
||||||
|
"abi-serde",
|
||||||
|
"cc",
|
||||||
|
"prettyplease",
|
||||||
|
"yggdrasil-abi",
|
||||||
|
]
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
[package]
|
||||||
|
name = "doomgeneric-yggdrasil"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
[lib]
|
||||||
|
crate-type = ["staticlib"]
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
libcolors.path = "yggdrasil-root/userspace/lib/libcolors"
|
||||||
|
logsink.path = "yggdrasil-root/userspace/lib/logsink"
|
||||||
|
cross.path = "yggdrasil-root/userspace/lib/cross"
|
||||||
|
log = "0.4.22"
|
||||||
|
thiserror = "1.0.64"
|
||||||
@@ -0,0 +1,142 @@
|
|||||||
|
#![feature(yggdrasil_os)]
|
||||||
|
#![allow(non_camel_case_types)]
|
||||||
|
|
||||||
|
use std::{
|
||||||
|
ffi::c_int,
|
||||||
|
io,
|
||||||
|
ptr::null_mut,
|
||||||
|
time::{Duration, Instant},
|
||||||
|
};
|
||||||
|
|
||||||
|
use libcolors::{
|
||||||
|
application::{
|
||||||
|
window::{EventOutcome, Window},
|
||||||
|
Application,
|
||||||
|
},
|
||||||
|
event::KeyEvent,
|
||||||
|
input::Key,
|
||||||
|
surface::Surface,
|
||||||
|
};
|
||||||
|
|
||||||
|
const K_LEFT: c_int = 0;
|
||||||
|
const K_RIGHT: c_int = 1;
|
||||||
|
const K_UP: c_int = 2;
|
||||||
|
const K_DOWN: c_int = 3;
|
||||||
|
const K_SPACE: c_int = 4;
|
||||||
|
const K_ENTER: c_int = 5;
|
||||||
|
const K_ESCAPE: c_int = 6;
|
||||||
|
const K_LCTRL: c_int = 7;
|
||||||
|
const K_RCTRL: c_int = 8;
|
||||||
|
|
||||||
|
type redraw_handler_t = extern "C" fn(*mut u32, c_int, c_int);
|
||||||
|
type key_event_handler_t = extern "C" fn(c_int, c_int);
|
||||||
|
|
||||||
|
struct ydg_context_t {
|
||||||
|
app: Application,
|
||||||
|
start_time: Instant,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, thiserror::Error)]
|
||||||
|
#[error("{0}")]
|
||||||
|
enum Error {
|
||||||
|
Io(#[from] io::Error),
|
||||||
|
Colors(#[from] libcolors::error::Error),
|
||||||
|
}
|
||||||
|
|
||||||
|
static mut REDRAW: Option<redraw_handler_t> = None;
|
||||||
|
static mut HANDLE_KEY_EVENT: Option<key_event_handler_t> = None;
|
||||||
|
|
||||||
|
impl ydg_context_t {
|
||||||
|
fn new() -> Result<&'static mut Self, Error> {
|
||||||
|
let app = Application::new()?;
|
||||||
|
let start_time = Instant::now();
|
||||||
|
|
||||||
|
let this = Box::leak(Box::new(Self { app, start_time }));
|
||||||
|
|
||||||
|
let mut window = Window::new(&this.app)?;
|
||||||
|
|
||||||
|
window.set_on_redraw_requested(|surface| {
|
||||||
|
let w = surface.width() as c_int;
|
||||||
|
let h = surface.height() as c_int;
|
||||||
|
let ptr = surface.as_mut_ptr();
|
||||||
|
unsafe { (REDRAW.unwrap())(ptr, w, h) };
|
||||||
|
});
|
||||||
|
window.set_on_key_pressed(|key| {
|
||||||
|
handle_key_event(true, key);
|
||||||
|
EventOutcome::None
|
||||||
|
});
|
||||||
|
window.set_on_key_released(|key| {
|
||||||
|
handle_key_event(false, key);
|
||||||
|
EventOutcome::None
|
||||||
|
});
|
||||||
|
this.app.add_window(window);
|
||||||
|
|
||||||
|
Ok(this)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn handle_key_event(pressed: bool, key: KeyEvent) {
|
||||||
|
let ckey = match key.key {
|
||||||
|
Key::LControl => K_LCTRL,
|
||||||
|
Key::RControl => K_RCTRL,
|
||||||
|
Key::Char(b'w') => K_UP,
|
||||||
|
Key::Char(b'a') => K_LEFT,
|
||||||
|
Key::Char(b's') => K_DOWN,
|
||||||
|
Key::Char(b'd') => K_RIGHT,
|
||||||
|
Key::Char(b' ') => K_SPACE,
|
||||||
|
Key::Escape => K_ESCAPE,
|
||||||
|
Key::Enter => K_ENTER,
|
||||||
|
_ => return,
|
||||||
|
};
|
||||||
|
if let Some(handler) = unsafe { HANDLE_KEY_EVENT } {
|
||||||
|
handler(ckey, pressed as c_int);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
unsafe extern "C" fn ydg_init(
|
||||||
|
redraw: redraw_handler_t,
|
||||||
|
key: key_event_handler_t,
|
||||||
|
) -> *mut ydg_context_t {
|
||||||
|
logsink::setup_logging(true);
|
||||||
|
log::info!("ydg_init()");
|
||||||
|
REDRAW = Some(redraw);
|
||||||
|
HANDLE_KEY_EVENT = Some(key);
|
||||||
|
match ydg_context_t::new() {
|
||||||
|
Ok(cx) => cx,
|
||||||
|
Err(error) => {
|
||||||
|
log::error!("ydg_init: {error}");
|
||||||
|
null_mut()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
unsafe extern "C" fn ydg_next_event(cx: *mut ydg_context_t) -> c_int {
|
||||||
|
let cx = cx.as_mut().unwrap();
|
||||||
|
if let Err(error) = cx.app.poll_events() {
|
||||||
|
log::error!("ydg_next_event: poll app: {error}");
|
||||||
|
-1
|
||||||
|
} else {
|
||||||
|
0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
unsafe extern "C" fn ydg_get_ticks_ms(cx: *mut ydg_context_t) -> u32 {
|
||||||
|
let cx = cx.as_mut().unwrap();
|
||||||
|
let now = Instant::now();
|
||||||
|
let delta = now - cx.start_time;
|
||||||
|
delta.as_millis() as u32
|
||||||
|
}
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
unsafe extern "C" fn ydg_sleep_ms(time: u32) {
|
||||||
|
std::thread::sleep(Duration::from_millis(time as _));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
unsafe extern "C" fn ydg_request_redraw(cx: *mut ydg_context_t) {
|
||||||
|
let cx = cx.as_mut().unwrap();
|
||||||
|
cx.app.redraw().ok();
|
||||||
|
}
|
||||||
@@ -5,11 +5,11 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#ifndef DOOMGENERIC_RESX
|
#ifndef DOOMGENERIC_RESX
|
||||||
#define DOOMGENERIC_RESX 640
|
#define DOOMGENERIC_RESX (640 * 2)
|
||||||
#endif // DOOMGENERIC_RESX
|
#endif // DOOMGENERIC_RESX
|
||||||
|
|
||||||
#ifndef DOOMGENERIC_RESY
|
#ifndef DOOMGENERIC_RESY
|
||||||
#define DOOMGENERIC_RESY 400
|
#define DOOMGENERIC_RESY (400 * 2)
|
||||||
#endif // DOOMGENERIC_RESY
|
#endif // DOOMGENERIC_RESY
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,152 @@
|
|||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include "doomgeneric.h"
|
||||||
|
#include "doomkeys.h"
|
||||||
|
|
||||||
|
#define EV_TICK 0
|
||||||
|
|
||||||
|
typedef struct ydg_context ydg_context_t;
|
||||||
|
|
||||||
|
typedef void (*redraw_handler_t) (uint32_t *buffer, int width, int height);
|
||||||
|
typedef void (*key_event_handler_t) (int key, int pressed);
|
||||||
|
|
||||||
|
#define K_LEFT 0
|
||||||
|
#define K_RIGHT 1
|
||||||
|
#define K_UP 2
|
||||||
|
#define K_DOWN 3
|
||||||
|
#define K_SPACE 4
|
||||||
|
#define K_ENTER 5
|
||||||
|
#define K_ESCAPE 6
|
||||||
|
#define K_LCTRL 7
|
||||||
|
#define K_RCTRL 8
|
||||||
|
|
||||||
|
extern ydg_context_t *ydg_init(redraw_handler_t redraw, key_event_handler_t key);
|
||||||
|
extern int ydg_next_event(ydg_context_t *cx);
|
||||||
|
extern uint32_t ydg_get_ticks_ms(ydg_context_t *cx);
|
||||||
|
extern void ydg_request_redraw(ydg_context_t *cx);
|
||||||
|
extern void ydg_sleep_ms(uint32_t ms);
|
||||||
|
|
||||||
|
static ydg_context_t *s_ydg_context;
|
||||||
|
|
||||||
|
#define KEYQUEUE_SIZE 16
|
||||||
|
|
||||||
|
static unsigned short s_KeyQueue[KEYQUEUE_SIZE];
|
||||||
|
static unsigned int s_KeyQueueWriteIndex = 0;
|
||||||
|
static unsigned int s_KeyQueueReadIndex = 0;
|
||||||
|
|
||||||
|
static void redraw_handler(uint32_t *buffer, int width, int height) {
|
||||||
|
size_t stride = (size_t) width;
|
||||||
|
int real_width = width;
|
||||||
|
int real_height = height;
|
||||||
|
|
||||||
|
memset(buffer, 0, width * height * 4);
|
||||||
|
if (width > DOOMGENERIC_RESX) {
|
||||||
|
width = DOOMGENERIC_RESX;
|
||||||
|
}
|
||||||
|
if (height > DOOMGENERIC_RESY) {
|
||||||
|
height = DOOMGENERIC_RESY;
|
||||||
|
}
|
||||||
|
|
||||||
|
int yoff = (real_height - height) / 2;
|
||||||
|
int xoff = (real_width - width) / 2;
|
||||||
|
for (int y = 0; y < height; ++y) {
|
||||||
|
memcpy(buffer + (y + yoff) * stride + xoff, DG_ScreenBuffer + y * DOOMGENERIC_RESX, width * 4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static unsigned char convertToDoomKey(int key) {
|
||||||
|
switch (key) {
|
||||||
|
case K_LEFT:
|
||||||
|
return KEY_LEFTARROW;
|
||||||
|
case K_RIGHT:
|
||||||
|
return KEY_RIGHTARROW;
|
||||||
|
case K_UP:
|
||||||
|
return KEY_UPARROW;
|
||||||
|
case K_DOWN:
|
||||||
|
return KEY_DOWNARROW;
|
||||||
|
case K_LCTRL:
|
||||||
|
case K_RCTRL:
|
||||||
|
return KEY_FIRE;
|
||||||
|
case K_SPACE:
|
||||||
|
return KEY_USE;
|
||||||
|
case K_ESCAPE:
|
||||||
|
return KEY_ESCAPE;
|
||||||
|
case K_ENTER:
|
||||||
|
return KEY_ENTER;
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void addKeyToQueue(int pressed, int keyCode) {
|
||||||
|
unsigned char key = convertToDoomKey(keyCode);
|
||||||
|
|
||||||
|
unsigned short keyData = (pressed << 8) | key;
|
||||||
|
|
||||||
|
s_KeyQueue[s_KeyQueueWriteIndex] = keyData;
|
||||||
|
s_KeyQueueWriteIndex++;
|
||||||
|
s_KeyQueueWriteIndex %= KEYQUEUE_SIZE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void key_event_handler(int key, int pressed) {
|
||||||
|
addKeyToQueue(pressed, key);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DG_SetWindowTitle(const char *title) {
|
||||||
|
(void) title;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DG_SleepMs(uint32_t ms) {
|
||||||
|
ydg_sleep_ms(ms);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t DG_GetTicksMs(void) {
|
||||||
|
return ydg_get_ticks_ms(s_ydg_context);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DG_Init(void) {}
|
||||||
|
|
||||||
|
void DG_DrawFrame(void) {
|
||||||
|
ydg_request_redraw(s_ydg_context);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DG_GetKey(int *pressed, unsigned char *doomKey) {
|
||||||
|
if (s_KeyQueueReadIndex == s_KeyQueueWriteIndex) {
|
||||||
|
//key queue is empty
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
unsigned short keyData = s_KeyQueue[s_KeyQueueReadIndex];
|
||||||
|
s_KeyQueueReadIndex++;
|
||||||
|
s_KeyQueueReadIndex %= KEYQUEUE_SIZE;
|
||||||
|
|
||||||
|
*pressed = keyData >> 8;
|
||||||
|
*doomKey = keyData & 0xFF;
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char **argv) {
|
||||||
|
s_ydg_context = ydg_init(redraw_handler, key_event_handler);
|
||||||
|
if (!s_ydg_context) {
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
doomgeneric_Create(argc, argv);
|
||||||
|
|
||||||
|
printf("Start!!!\n");
|
||||||
|
|
||||||
|
while (1) {
|
||||||
|
if (ydg_next_event(s_ydg_context) != 0) {
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
doomgeneric_Tick();
|
||||||
|
}
|
||||||
|
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
+11
-8
@@ -15,7 +15,7 @@
|
|||||||
// DESCRIPTION:
|
// DESCRIPTION:
|
||||||
// Simple basic typedefs, isolated here to make it easier
|
// Simple basic typedefs, isolated here to make it easier
|
||||||
// separating modules.
|
// separating modules.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
#ifndef __DOOMTYPE__
|
#ifndef __DOOMTYPE__
|
||||||
@@ -38,7 +38,7 @@
|
|||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// The packed attribute forces structures to be packed into the minimum
|
// The packed attribute forces structures to be packed into the minimum
|
||||||
// space necessary. If this is not done, the compiler may align structure
|
// space necessary. If this is not done, the compiler may align structure
|
||||||
// fields differently to optimize memory access, inflating the overall
|
// fields differently to optimize memory access, inflating the overall
|
||||||
// structure size. It is important to use the packed attribute on certain
|
// structure size. It is important to use the packed attribute on certain
|
||||||
@@ -52,17 +52,17 @@
|
|||||||
#define PACKEDATTR
|
#define PACKEDATTR
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// C99 integer types; with gcc we just use this. Other compilers
|
// C99 integer types; with gcc we just use this. Other compilers
|
||||||
// should add conditional statements that define the C99 types.
|
// should add conditional statements that define the C99 types.
|
||||||
|
|
||||||
// What is really wanted here is stdint.h; however, some old versions
|
// What is really wanted here is stdint.h; however, some old versions
|
||||||
// of Solaris don't have stdint.h and only have inttypes.h (the
|
// of Solaris don't have stdint.h and only have inttypes.h (the
|
||||||
// pre-standardisation version). inttypes.h is also in the C99
|
// pre-standardisation version). inttypes.h is also in the C99
|
||||||
// standard and defined to include stdint.h, so include this.
|
// standard and defined to include stdint.h, so include this.
|
||||||
|
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#if defined(__cplusplus)
|
||||||
|
|
||||||
// Use builtin bool type with C++.
|
// Use builtin bool type with C++.
|
||||||
|
|
||||||
@@ -70,7 +70,10 @@ typedef bool boolean;
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
typedef enum
|
#undef false
|
||||||
|
#undef true
|
||||||
|
|
||||||
|
typedef enum
|
||||||
{
|
{
|
||||||
false = 0,
|
false = 0,
|
||||||
true = 1,
|
true = 1,
|
||||||
|
|||||||
+16
-16
@@ -184,7 +184,7 @@ char *mapnames_commercial[] =
|
|||||||
HUSTR_9,
|
HUSTR_9,
|
||||||
HUSTR_10,
|
HUSTR_10,
|
||||||
HUSTR_11,
|
HUSTR_11,
|
||||||
|
|
||||||
HUSTR_12,
|
HUSTR_12,
|
||||||
HUSTR_13,
|
HUSTR_13,
|
||||||
HUSTR_14,
|
HUSTR_14,
|
||||||
@@ -194,7 +194,7 @@ char *mapnames_commercial[] =
|
|||||||
HUSTR_18,
|
HUSTR_18,
|
||||||
HUSTR_19,
|
HUSTR_19,
|
||||||
HUSTR_20,
|
HUSTR_20,
|
||||||
|
|
||||||
HUSTR_21,
|
HUSTR_21,
|
||||||
HUSTR_22,
|
HUSTR_22,
|
||||||
HUSTR_23,
|
HUSTR_23,
|
||||||
@@ -221,7 +221,7 @@ char *mapnames_commercial[] =
|
|||||||
PHUSTR_9,
|
PHUSTR_9,
|
||||||
PHUSTR_10,
|
PHUSTR_10,
|
||||||
PHUSTR_11,
|
PHUSTR_11,
|
||||||
|
|
||||||
PHUSTR_12,
|
PHUSTR_12,
|
||||||
PHUSTR_13,
|
PHUSTR_13,
|
||||||
PHUSTR_14,
|
PHUSTR_14,
|
||||||
@@ -231,7 +231,7 @@ char *mapnames_commercial[] =
|
|||||||
PHUSTR_18,
|
PHUSTR_18,
|
||||||
PHUSTR_19,
|
PHUSTR_19,
|
||||||
PHUSTR_20,
|
PHUSTR_20,
|
||||||
|
|
||||||
PHUSTR_21,
|
PHUSTR_21,
|
||||||
PHUSTR_22,
|
PHUSTR_22,
|
||||||
PHUSTR_23,
|
PHUSTR_23,
|
||||||
@@ -244,7 +244,7 @@ char *mapnames_commercial[] =
|
|||||||
PHUSTR_30,
|
PHUSTR_30,
|
||||||
PHUSTR_31,
|
PHUSTR_31,
|
||||||
PHUSTR_32,
|
PHUSTR_32,
|
||||||
|
|
||||||
// TNT WAD map names.
|
// TNT WAD map names.
|
||||||
|
|
||||||
THUSTR_1,
|
THUSTR_1,
|
||||||
@@ -258,7 +258,7 @@ char *mapnames_commercial[] =
|
|||||||
THUSTR_9,
|
THUSTR_9,
|
||||||
THUSTR_10,
|
THUSTR_10,
|
||||||
THUSTR_11,
|
THUSTR_11,
|
||||||
|
|
||||||
THUSTR_12,
|
THUSTR_12,
|
||||||
THUSTR_13,
|
THUSTR_13,
|
||||||
THUSTR_14,
|
THUSTR_14,
|
||||||
@@ -268,7 +268,7 @@ char *mapnames_commercial[] =
|
|||||||
THUSTR_18,
|
THUSTR_18,
|
||||||
THUSTR_19,
|
THUSTR_19,
|
||||||
THUSTR_20,
|
THUSTR_20,
|
||||||
|
|
||||||
THUSTR_21,
|
THUSTR_21,
|
||||||
THUSTR_22,
|
THUSTR_22,
|
||||||
THUSTR_23,
|
THUSTR_23,
|
||||||
@@ -294,7 +294,7 @@ void HU_Init(void)
|
|||||||
j = HU_FONTSTART;
|
j = HU_FONTSTART;
|
||||||
for (i=0;i<HU_FONTSIZE;i++)
|
for (i=0;i<HU_FONTSIZE;i++)
|
||||||
{
|
{
|
||||||
DEH_snprintf(buffer, 9, "STCFN%.3d", j++);
|
DEH_snprintf(buffer, 9, "STCFN%03d", j++);
|
||||||
hu_font[i] = (patch_t *) W_CacheLumpName(buffer, PU_STATIC);
|
hu_font[i] = (patch_t *) W_CacheLumpName(buffer, PU_STATIC);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -331,7 +331,7 @@ void HU_Start(void)
|
|||||||
HU_TITLEX, HU_TITLEY,
|
HU_TITLEX, HU_TITLEY,
|
||||||
hu_font,
|
hu_font,
|
||||||
HU_FONTSTART);
|
HU_FONTSTART);
|
||||||
|
|
||||||
switch ( logical_gamemission )
|
switch ( logical_gamemission )
|
||||||
{
|
{
|
||||||
case doom:
|
case doom:
|
||||||
@@ -362,7 +362,7 @@ void HU_Start(void)
|
|||||||
// dehacked substitution to get modified level name
|
// dehacked substitution to get modified level name
|
||||||
|
|
||||||
s = DEH_String(s);
|
s = DEH_String(s);
|
||||||
|
|
||||||
while (*s)
|
while (*s)
|
||||||
HUlib_addCharToTextLine(&w_title, *(s++));
|
HUlib_addCharToTextLine(&w_title, *(s++));
|
||||||
|
|
||||||
@@ -453,7 +453,7 @@ void HU_Ticker(void)
|
|||||||
HUlib_addMessageToSText(&w_message,
|
HUlib_addMessageToSText(&w_message,
|
||||||
DEH_String(player_names[i]),
|
DEH_String(player_names[i]),
|
||||||
w_inputbuffer[i].l.l);
|
w_inputbuffer[i].l.l);
|
||||||
|
|
||||||
message_nottobefuckedwith = true;
|
message_nottobefuckedwith = true;
|
||||||
message_on = true;
|
message_on = true;
|
||||||
message_counter = HU_MSGTIMEOUT;
|
message_counter = HU_MSGTIMEOUT;
|
||||||
@@ -519,7 +519,7 @@ boolean HU_Responder(event_t *ev)
|
|||||||
unsigned char c;
|
unsigned char c;
|
||||||
int i;
|
int i;
|
||||||
int numplayers;
|
int numplayers;
|
||||||
|
|
||||||
static int num_nobrainers = 0;
|
static int num_nobrainers = 0;
|
||||||
|
|
||||||
numplayers = 0;
|
numplayers = 0;
|
||||||
@@ -594,15 +594,15 @@ boolean HU_Responder(event_t *ev)
|
|||||||
return false;
|
return false;
|
||||||
// fprintf(stderr, "got here\n");
|
// fprintf(stderr, "got here\n");
|
||||||
macromessage = chat_macros[c];
|
macromessage = chat_macros[c];
|
||||||
|
|
||||||
// kill last message with a '\n'
|
// kill last message with a '\n'
|
||||||
HU_queueChatChar(KEY_ENTER); // DEBUG!!!
|
HU_queueChatChar(KEY_ENTER); // DEBUG!!!
|
||||||
|
|
||||||
// send the macro message
|
// send the macro message
|
||||||
while (*macromessage)
|
while (*macromessage)
|
||||||
HU_queueChatChar(*macromessage++);
|
HU_queueChatChar(*macromessage++);
|
||||||
HU_queueChatChar(KEY_ENTER);
|
HU_queueChatChar(KEY_ENTER);
|
||||||
|
|
||||||
// leave chat mode and notify that it was sent
|
// leave chat mode and notify that it was sent
|
||||||
chat_on = false;
|
chat_on = false;
|
||||||
M_StringCopy(lastmessage, chat_macros[c], sizeof(lastmessage));
|
M_StringCopy(lastmessage, chat_macros[c], sizeof(lastmessage));
|
||||||
@@ -618,7 +618,7 @@ boolean HU_Responder(event_t *ev)
|
|||||||
{
|
{
|
||||||
// static unsigned char buf[20]; // DEBUG
|
// static unsigned char buf[20]; // DEBUG
|
||||||
HU_queueChatChar(c);
|
HU_queueChatChar(c);
|
||||||
|
|
||||||
// M_snprintf(buf, sizeof(buf), "KEY: %d => %d", ev->data1, c);
|
// M_snprintf(buf, sizeof(buf), "KEY: %d => %d", ev->data1, c);
|
||||||
// plr->message = buf;
|
// plr->message = buf;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ byte *I_ZoneBase (int *size)
|
|||||||
|
|
||||||
zonemem = AutoAllocMemory(size, default_ram, min_ram);
|
zonemem = AutoAllocMemory(size, default_ram, min_ram);
|
||||||
|
|
||||||
printf("zone memory: %p, %x allocated for zone\n",
|
printf("zone memory: %p, %x allocated for zone\n",
|
||||||
zonemem, *size);
|
zonemem, *size);
|
||||||
|
|
||||||
return zonemem;
|
return zonemem;
|
||||||
@@ -191,7 +191,7 @@ void I_PrintStartupBanner(char *gamedescription)
|
|||||||
I_PrintDivider();
|
I_PrintDivider();
|
||||||
I_PrintBanner(gamedescription);
|
I_PrintBanner(gamedescription);
|
||||||
I_PrintDivider();
|
I_PrintDivider();
|
||||||
|
|
||||||
printf(
|
printf(
|
||||||
" " PACKAGE_NAME " is free software, covered by the GNU General Public\n"
|
" " PACKAGE_NAME " is free software, covered by the GNU General Public\n"
|
||||||
" License. There is NO warranty; not even for MERCHANTABILITY or FITNESS\n"
|
" License. There is NO warranty; not even for MERCHANTABILITY or FITNESS\n"
|
||||||
@@ -201,7 +201,7 @@ void I_PrintStartupBanner(char *gamedescription)
|
|||||||
I_PrintDivider();
|
I_PrintDivider();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// I_ConsoleStdout
|
// I_ConsoleStdout
|
||||||
//
|
//
|
||||||
// Returns true if stdout is a real console, false if it is a file
|
// Returns true if stdout is a real console, false if it is a file
|
||||||
@@ -248,8 +248,8 @@ void I_Quit (void)
|
|||||||
atexit_listentry_t *entry;
|
atexit_listentry_t *entry;
|
||||||
|
|
||||||
// Run through all exit functions
|
// Run through all exit functions
|
||||||
|
|
||||||
entry = exit_funcs;
|
entry = exit_funcs;
|
||||||
|
|
||||||
while (entry != NULL)
|
while (entry != NULL)
|
||||||
{
|
{
|
||||||
@@ -264,7 +264,7 @@ void I_Quit (void)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(_WIN32) && !defined(__MACOSX__) && !defined(__DJGPP__)
|
#if !defined(_WIN32) && !defined(__MACOSX__) && !defined(__DJGPP__) && !defined(__yggdrasil__)
|
||||||
#define ZENITY_BINARY "/usr/bin/zenity"
|
#define ZENITY_BINARY "/usr/bin/zenity"
|
||||||
|
|
||||||
// returns non-zero if zenity is available
|
// returns non-zero if zenity is available
|
||||||
@@ -448,7 +448,7 @@ void I_Error (char *error, ...)
|
|||||||
message,
|
message,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
#elif defined(__DJGPP__)
|
#elif defined(__DJGPP__) || defined(__yggdrasil__)
|
||||||
{
|
{
|
||||||
printf("%s\n", msgbuf);
|
printf("%s\n", msgbuf);
|
||||||
exit(-1);
|
exit(-1);
|
||||||
|
|||||||
+76
-76
@@ -44,7 +44,7 @@
|
|||||||
// is stored in vertical runs of opaque pixels (posts).
|
// is stored in vertical runs of opaque pixels (posts).
|
||||||
// A column is composed of zero or more posts,
|
// A column is composed of zero or more posts,
|
||||||
// a patch or sprite is composed of zero or more columns.
|
// a patch or sprite is composed of zero or more columns.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -74,7 +74,7 @@ typedef struct
|
|||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
char name[8];
|
char name[8];
|
||||||
int masked;
|
int masked;
|
||||||
short width;
|
short width;
|
||||||
short height;
|
short height;
|
||||||
int obsolete;
|
int obsolete;
|
||||||
@@ -91,7 +91,7 @@ typedef struct
|
|||||||
// Block origin (allways UL),
|
// Block origin (allways UL),
|
||||||
// which has allready accounted
|
// which has allready accounted
|
||||||
// for the internal origin of the patch.
|
// for the internal origin of the patch.
|
||||||
short originx;
|
short originx;
|
||||||
short originy;
|
short originy;
|
||||||
int patch;
|
int patch;
|
||||||
} texpatch_t;
|
} texpatch_t;
|
||||||
@@ -106,7 +106,7 @@ typedef struct texture_s texture_t;
|
|||||||
struct texture_s
|
struct texture_s
|
||||||
{
|
{
|
||||||
// Keep name for switch changing, etc.
|
// Keep name for switch changing, etc.
|
||||||
char name[8];
|
char name[8];
|
||||||
short width;
|
short width;
|
||||||
short height;
|
short height;
|
||||||
|
|
||||||
@@ -117,11 +117,11 @@ struct texture_s
|
|||||||
// Next in hash table chain
|
// Next in hash table chain
|
||||||
|
|
||||||
texture_t *next;
|
texture_t *next;
|
||||||
|
|
||||||
// All the patches[patchcount]
|
// All the patches[patchcount]
|
||||||
// are drawn back to front into the cached texture.
|
// are drawn back to front into the cached texture.
|
||||||
short patchcount;
|
short patchcount;
|
||||||
texpatch_t patches[1];
|
texpatch_t patches[1];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -145,7 +145,7 @@ texture_t** textures_hashtable;
|
|||||||
|
|
||||||
int* texturewidthmask;
|
int* texturewidthmask;
|
||||||
// needed for texture pegging
|
// needed for texture pegging
|
||||||
fixed_t* textureheight;
|
fixed_t* textureheight;
|
||||||
int* texturecompositesize;
|
int* texturecompositesize;
|
||||||
short** texturecolumnlump;
|
short** texturecolumnlump;
|
||||||
unsigned short** texturecolumnofs;
|
unsigned short** texturecolumnofs;
|
||||||
@@ -156,7 +156,7 @@ int* flattranslation;
|
|||||||
int* texturetranslation;
|
int* texturetranslation;
|
||||||
|
|
||||||
// needed for pre rendering
|
// needed for pre rendering
|
||||||
fixed_t* spritewidth;
|
fixed_t* spritewidth;
|
||||||
fixed_t* spriteoffset;
|
fixed_t* spriteoffset;
|
||||||
fixed_t* spritetopoffset;
|
fixed_t* spritetopoffset;
|
||||||
|
|
||||||
@@ -210,8 +210,8 @@ R_DrawColumnInCache
|
|||||||
|
|
||||||
if (count > 0)
|
if (count > 0)
|
||||||
memcpy (cache + position, source, count);
|
memcpy (cache + position, source, count);
|
||||||
|
|
||||||
patch = (column_t *)( (byte *)patch + patch->length + 4);
|
patch = (column_t *)( (byte *)patch + patch->length + 4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -227,7 +227,7 @@ void R_GenerateComposite (int texnum)
|
|||||||
{
|
{
|
||||||
byte* block;
|
byte* block;
|
||||||
texture_t* texture;
|
texture_t* texture;
|
||||||
texpatch_t* patch;
|
texpatch_t* patch;
|
||||||
patch_t* realpatch;
|
patch_t* realpatch;
|
||||||
int x;
|
int x;
|
||||||
int x1;
|
int x1;
|
||||||
@@ -236,19 +236,19 @@ void R_GenerateComposite (int texnum)
|
|||||||
column_t* patchcol;
|
column_t* patchcol;
|
||||||
short* collump;
|
short* collump;
|
||||||
unsigned short* colofs;
|
unsigned short* colofs;
|
||||||
|
|
||||||
texture = textures[texnum];
|
texture = textures[texnum];
|
||||||
|
|
||||||
block = Z_Malloc (texturecompositesize[texnum],
|
block = Z_Malloc (texturecompositesize[texnum],
|
||||||
PU_STATIC,
|
PU_STATIC,
|
||||||
&texturecomposite[texnum]);
|
&texturecomposite[texnum]);
|
||||||
|
|
||||||
collump = texturecolumnlump[texnum];
|
collump = texturecolumnlump[texnum];
|
||||||
colofs = texturecolumnofs[texnum];
|
colofs = texturecolumnofs[texnum];
|
||||||
|
|
||||||
// Composite the columns together.
|
// Composite the columns together.
|
||||||
patch = texture->patches;
|
patch = texture->patches;
|
||||||
|
|
||||||
for (i=0 , patch = texture->patches;
|
for (i=0 , patch = texture->patches;
|
||||||
i<texture->patchcount;
|
i<texture->patchcount;
|
||||||
i++, patch++)
|
i++, patch++)
|
||||||
@@ -261,7 +261,7 @@ void R_GenerateComposite (int texnum)
|
|||||||
x = 0;
|
x = 0;
|
||||||
else
|
else
|
||||||
x = x1;
|
x = x1;
|
||||||
|
|
||||||
if (x2 > texture->width)
|
if (x2 > texture->width)
|
||||||
x2 = texture->width;
|
x2 = texture->width;
|
||||||
|
|
||||||
@@ -270,7 +270,7 @@ void R_GenerateComposite (int texnum)
|
|||||||
// Column does not have multiple patches?
|
// Column does not have multiple patches?
|
||||||
if (collump[x] >= 0)
|
if (collump[x] >= 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
patchcol = (column_t *)((byte *)realpatch
|
patchcol = (column_t *)((byte *)realpatch
|
||||||
+ LONG(realpatch->columnofs[x-x1]));
|
+ LONG(realpatch->columnofs[x-x1]));
|
||||||
R_DrawColumnInCache (patchcol,
|
R_DrawColumnInCache (patchcol,
|
||||||
@@ -278,7 +278,7 @@ void R_GenerateComposite (int texnum)
|
|||||||
patch->originy,
|
patch->originy,
|
||||||
texture->height);
|
texture->height);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now that the texture has been built in column cache,
|
// Now that the texture has been built in column cache,
|
||||||
@@ -295,7 +295,7 @@ void R_GenerateLookup (int texnum)
|
|||||||
{
|
{
|
||||||
texture_t* texture;
|
texture_t* texture;
|
||||||
byte* patchcount; // patchcount[texture->width]
|
byte* patchcount; // patchcount[texture->width]
|
||||||
texpatch_t* patch;
|
texpatch_t* patch;
|
||||||
patch_t* realpatch;
|
patch_t* realpatch;
|
||||||
int x;
|
int x;
|
||||||
int x1;
|
int x1;
|
||||||
@@ -303,16 +303,16 @@ void R_GenerateLookup (int texnum)
|
|||||||
int i;
|
int i;
|
||||||
short* collump;
|
short* collump;
|
||||||
unsigned short* colofs;
|
unsigned short* colofs;
|
||||||
|
|
||||||
texture = textures[texnum];
|
texture = textures[texnum];
|
||||||
|
|
||||||
// Composited texture not created yet.
|
// Composited texture not created yet.
|
||||||
texturecomposite[texnum] = 0;
|
texturecomposite[texnum] = 0;
|
||||||
|
|
||||||
texturecompositesize[texnum] = 0;
|
texturecompositesize[texnum] = 0;
|
||||||
collump = texturecolumnlump[texnum];
|
collump = texturecolumnlump[texnum];
|
||||||
colofs = texturecolumnofs[texnum];
|
colofs = texturecolumnofs[texnum];
|
||||||
|
|
||||||
// Now count the number of columns
|
// Now count the number of columns
|
||||||
// that are covered by more than one patch.
|
// that are covered by more than one patch.
|
||||||
// Fill in the lump / offset, so columns
|
// Fill in the lump / offset, so columns
|
||||||
@@ -328,7 +328,7 @@ void R_GenerateLookup (int texnum)
|
|||||||
realpatch = W_CacheLumpNum (patch->patch, PU_CACHE);
|
realpatch = W_CacheLumpNum (patch->patch, PU_CACHE);
|
||||||
x1 = patch->originx;
|
x1 = patch->originx;
|
||||||
x2 = x1 + SHORT(realpatch->width);
|
x2 = x1 + SHORT(realpatch->width);
|
||||||
|
|
||||||
if (x1 < 0)
|
if (x1 < 0)
|
||||||
x = 0;
|
x = 0;
|
||||||
else
|
else
|
||||||
@@ -343,7 +343,7 @@ void R_GenerateLookup (int texnum)
|
|||||||
colofs[x] = LONG(realpatch->columnofs[x-x1])+3;
|
colofs[x] = LONG(realpatch->columnofs[x-x1])+3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (x=0 ; x<texture->width ; x++)
|
for (x=0 ; x<texture->width ; x++)
|
||||||
{
|
{
|
||||||
if (!patchcount[x])
|
if (!patchcount[x])
|
||||||
@@ -353,19 +353,19 @@ void R_GenerateLookup (int texnum)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// I_Error ("R_GenerateLookup: column without a patch");
|
// I_Error ("R_GenerateLookup: column without a patch");
|
||||||
|
|
||||||
if (patchcount[x] > 1)
|
if (patchcount[x] > 1)
|
||||||
{
|
{
|
||||||
// Use the cached block.
|
// Use the cached block.
|
||||||
collump[x] = -1;
|
collump[x] = -1;
|
||||||
colofs[x] = texturecompositesize[texnum];
|
colofs[x] = texturecompositesize[texnum];
|
||||||
|
|
||||||
if (texturecompositesize[texnum] > 0x10000-texture->height)
|
if (texturecompositesize[texnum] > 0x10000-texture->height)
|
||||||
{
|
{
|
||||||
I_Error ("R_GenerateLookup: texture %i is >64k",
|
I_Error ("R_GenerateLookup: texture %i is >64k",
|
||||||
texnum);
|
texnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
texturecompositesize[texnum] += texture->height;
|
texturecompositesize[texnum] += texture->height;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -386,11 +386,11 @@ R_GetColumn
|
|||||||
{
|
{
|
||||||
int lump;
|
int lump;
|
||||||
int ofs;
|
int ofs;
|
||||||
|
|
||||||
col &= texturewidthmask[tex];
|
col &= texturewidthmask[tex];
|
||||||
lump = texturecolumnlump[tex][col];
|
lump = texturecolumnlump[tex][col];
|
||||||
ofs = texturecolumnofs[tex][col];
|
ofs = texturecolumnofs[tex][col];
|
||||||
|
|
||||||
if (lump > 0)
|
if (lump > 0)
|
||||||
return (byte *)W_CacheLumpNum(lump,PU_CACHE)+ofs;
|
return (byte *)W_CacheLumpNum(lump,PU_CACHE)+ofs;
|
||||||
|
|
||||||
@@ -407,7 +407,7 @@ static void GenerateTextureHashTable(void)
|
|||||||
int i;
|
int i;
|
||||||
int key;
|
int key;
|
||||||
|
|
||||||
textures_hashtable
|
textures_hashtable
|
||||||
= Z_Malloc(sizeof(texture_t *) * numtextures, PU_STATIC, 0);
|
= Z_Malloc(sizeof(texture_t *) * numtextures, PU_STATIC, 0);
|
||||||
|
|
||||||
memset(textures_hashtable, 0, sizeof(texture_t *) * numtextures);
|
memset(textures_hashtable, 0, sizeof(texture_t *) * numtextures);
|
||||||
@@ -461,13 +461,13 @@ void R_InitTextures (void)
|
|||||||
int* maptex;
|
int* maptex;
|
||||||
int* maptex2;
|
int* maptex2;
|
||||||
int* maptex1;
|
int* maptex1;
|
||||||
|
|
||||||
char name[9];
|
char name[9];
|
||||||
char* names;
|
char* names;
|
||||||
char* name_p;
|
char* name_p;
|
||||||
|
|
||||||
int* patchlookup;
|
int* patchlookup;
|
||||||
|
|
||||||
int totalwidth;
|
int totalwidth;
|
||||||
int nummappatches;
|
int nummappatches;
|
||||||
int offset;
|
int offset;
|
||||||
@@ -477,12 +477,12 @@ void R_InitTextures (void)
|
|||||||
int numtextures2;
|
int numtextures2;
|
||||||
|
|
||||||
int* directory;
|
int* directory;
|
||||||
|
|
||||||
int temp1;
|
int temp1;
|
||||||
int temp2;
|
int temp2;
|
||||||
int temp3;
|
int temp3;
|
||||||
|
|
||||||
|
|
||||||
// Load the patch names from pnames.lmp.
|
// Load the patch names from pnames.lmp.
|
||||||
name[8] = 0;
|
name[8] = 0;
|
||||||
names = W_CacheLumpName (DEH_String("PNAMES"), PU_STATIC);
|
names = W_CacheLumpName (DEH_String("PNAMES"), PU_STATIC);
|
||||||
@@ -504,7 +504,7 @@ void R_InitTextures (void)
|
|||||||
numtextures1 = LONG(*maptex);
|
numtextures1 = LONG(*maptex);
|
||||||
maxoff = W_LumpLength (W_GetNumForName (DEH_String("TEXTURE1")));
|
maxoff = W_LumpLength (W_GetNumForName (DEH_String("TEXTURE1")));
|
||||||
directory = maptex+1;
|
directory = maptex+1;
|
||||||
|
|
||||||
if (W_CheckNumForName (DEH_String("TEXTURE2")) != -1)
|
if (W_CheckNumForName (DEH_String("TEXTURE2")) != -1)
|
||||||
{
|
{
|
||||||
maptex2 = W_CacheLumpName (DEH_String("TEXTURE2"), PU_STATIC);
|
maptex2 = W_CacheLumpName (DEH_String("TEXTURE2"), PU_STATIC);
|
||||||
@@ -518,7 +518,7 @@ void R_InitTextures (void)
|
|||||||
maxoff2 = 0;
|
maxoff2 = 0;
|
||||||
}
|
}
|
||||||
numtextures = numtextures1 + numtextures2;
|
numtextures = numtextures1 + numtextures2;
|
||||||
|
|
||||||
textures = Z_Malloc (numtextures * sizeof(*textures), PU_STATIC, 0);
|
textures = Z_Malloc (numtextures * sizeof(*textures), PU_STATIC, 0);
|
||||||
texturecolumnlump = Z_Malloc (numtextures * sizeof(*texturecolumnlump), PU_STATIC, 0);
|
texturecolumnlump = Z_Malloc (numtextures * sizeof(*texturecolumnlump), PU_STATIC, 0);
|
||||||
texturecolumnofs = Z_Malloc (numtextures * sizeof(*texturecolumnofs), PU_STATIC, 0);
|
texturecolumnofs = Z_Malloc (numtextures * sizeof(*texturecolumnofs), PU_STATIC, 0);
|
||||||
@@ -528,7 +528,7 @@ void R_InitTextures (void)
|
|||||||
textureheight = Z_Malloc (numtextures * sizeof(*textureheight), PU_STATIC, 0);
|
textureheight = Z_Malloc (numtextures * sizeof(*textureheight), PU_STATIC, 0);
|
||||||
|
|
||||||
totalwidth = 0;
|
totalwidth = 0;
|
||||||
|
|
||||||
// Really complex printing shit...
|
// Really complex printing shit...
|
||||||
temp1 = W_GetNumForName (DEH_String("S_START")); // P_???????
|
temp1 = W_GetNumForName (DEH_String("S_START")); // P_???????
|
||||||
temp2 = W_GetNumForName (DEH_String("S_END")) - 1;
|
temp2 = W_GetNumForName (DEH_String("S_END")) - 1;
|
||||||
@@ -547,7 +547,7 @@ void R_InitTextures (void)
|
|||||||
for (i = 0; i < temp3 + 10; i++)
|
for (i = 0; i < temp3 + 10; i++)
|
||||||
printf("\b");
|
printf("\b");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i=0 ; i<numtextures ; i++, directory++)
|
for (i=0 ; i<numtextures ; i++, directory++)
|
||||||
{
|
{
|
||||||
if (!(i&63))
|
if (!(i&63))
|
||||||
@@ -560,23 +560,23 @@ void R_InitTextures (void)
|
|||||||
maxoff = maxoff2;
|
maxoff = maxoff2;
|
||||||
directory = maptex+1;
|
directory = maptex+1;
|
||||||
}
|
}
|
||||||
|
|
||||||
offset = LONG(*directory);
|
offset = LONG(*directory);
|
||||||
|
|
||||||
if (offset > maxoff)
|
if (offset > maxoff)
|
||||||
I_Error ("R_InitTextures: bad texture directory");
|
I_Error ("R_InitTextures: bad texture directory");
|
||||||
|
|
||||||
mtexture = (maptexture_t *) ( (byte *)maptex + offset);
|
mtexture = (maptexture_t *) ( (byte *)maptex + offset);
|
||||||
|
|
||||||
texture = textures[i] =
|
texture = textures[i] =
|
||||||
Z_Malloc (sizeof(texture_t)
|
Z_Malloc (sizeof(texture_t)
|
||||||
+ sizeof(texpatch_t)*(SHORT(mtexture->patchcount)-1),
|
+ sizeof(texpatch_t)*(SHORT(mtexture->patchcount)-1),
|
||||||
PU_STATIC, 0);
|
PU_STATIC, 0);
|
||||||
|
|
||||||
texture->width = SHORT(mtexture->width);
|
texture->width = SHORT(mtexture->width);
|
||||||
texture->height = SHORT(mtexture->height);
|
texture->height = SHORT(mtexture->height);
|
||||||
texture->patchcount = SHORT(mtexture->patchcount);
|
texture->patchcount = SHORT(mtexture->patchcount);
|
||||||
|
|
||||||
memcpy (texture->name, mtexture->name, sizeof(texture->name));
|
memcpy (texture->name, mtexture->name, sizeof(texture->name));
|
||||||
mpatch = &mtexture->patches[0];
|
mpatch = &mtexture->patches[0];
|
||||||
patch = &texture->patches[0];
|
patch = &texture->patches[0];
|
||||||
@@ -591,7 +591,7 @@ void R_InitTextures (void)
|
|||||||
I_Error ("R_InitTextures: Missing patch in texture %s",
|
I_Error ("R_InitTextures: Missing patch in texture %s",
|
||||||
texture->name);
|
texture->name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
texturecolumnlump[i] = Z_Malloc (texture->width*sizeof(**texturecolumnlump), PU_STATIC,0);
|
texturecolumnlump[i] = Z_Malloc (texture->width*sizeof(**texturecolumnlump), PU_STATIC,0);
|
||||||
texturecolumnofs[i] = Z_Malloc (texture->width*sizeof(**texturecolumnofs), PU_STATIC,0);
|
texturecolumnofs[i] = Z_Malloc (texture->width*sizeof(**texturecolumnofs), PU_STATIC,0);
|
||||||
|
|
||||||
@@ -601,7 +601,7 @@ void R_InitTextures (void)
|
|||||||
|
|
||||||
texturewidthmask[i] = j-1;
|
texturewidthmask[i] = j-1;
|
||||||
textureheight[i] = texture->height<<FRACBITS;
|
textureheight[i] = texture->height<<FRACBITS;
|
||||||
|
|
||||||
totalwidth += texture->width;
|
totalwidth += texture->width;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -610,15 +610,15 @@ void R_InitTextures (void)
|
|||||||
W_ReleaseLumpName(DEH_String("TEXTURE1"));
|
W_ReleaseLumpName(DEH_String("TEXTURE1"));
|
||||||
if (maptex2)
|
if (maptex2)
|
||||||
W_ReleaseLumpName(DEH_String("TEXTURE2"));
|
W_ReleaseLumpName(DEH_String("TEXTURE2"));
|
||||||
|
|
||||||
// Precalculate whatever possible.
|
// Precalculate whatever possible.
|
||||||
|
|
||||||
for (i=0 ; i<numtextures ; i++)
|
for (i=0 ; i<numtextures ; i++)
|
||||||
R_GenerateLookup (i);
|
R_GenerateLookup (i);
|
||||||
|
|
||||||
// Create translation table for global animation.
|
// Create translation table for global animation.
|
||||||
texturetranslation = Z_Malloc ((numtextures+1)*sizeof(*texturetranslation), PU_STATIC, 0);
|
texturetranslation = Z_Malloc ((numtextures+1)*sizeof(*texturetranslation), PU_STATIC, 0);
|
||||||
|
|
||||||
for (i=0 ; i<numtextures ; i++)
|
for (i=0 ; i<numtextures ; i++)
|
||||||
texturetranslation[i] = i;
|
texturetranslation[i] = i;
|
||||||
|
|
||||||
@@ -633,14 +633,14 @@ void R_InitTextures (void)
|
|||||||
void R_InitFlats (void)
|
void R_InitFlats (void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
firstflat = W_GetNumForName (DEH_String("F_START")) + 1;
|
firstflat = W_GetNumForName (DEH_String("F_START")) + 1;
|
||||||
lastflat = W_GetNumForName (DEH_String("F_END")) - 1;
|
lastflat = W_GetNumForName (DEH_String("F_END")) - 1;
|
||||||
numflats = lastflat - firstflat + 1;
|
numflats = lastflat - firstflat + 1;
|
||||||
|
|
||||||
// Create translation table for global animation.
|
// Create translation table for global animation.
|
||||||
flattranslation = Z_Malloc ((numflats+1)*sizeof(*flattranslation), PU_STATIC, 0);
|
flattranslation = Z_Malloc ((numflats+1)*sizeof(*flattranslation), PU_STATIC, 0);
|
||||||
|
|
||||||
for (i=0 ; i<numflats ; i++)
|
for (i=0 ; i<numflats ; i++)
|
||||||
flattranslation[i] = i;
|
flattranslation[i] = i;
|
||||||
}
|
}
|
||||||
@@ -656,15 +656,15 @@ void R_InitSpriteLumps (void)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
patch_t *patch;
|
patch_t *patch;
|
||||||
|
|
||||||
firstspritelump = W_GetNumForName (DEH_String("S_START")) + 1;
|
firstspritelump = W_GetNumForName (DEH_String("S_START")) + 1;
|
||||||
lastspritelump = W_GetNumForName (DEH_String("S_END")) - 1;
|
lastspritelump = W_GetNumForName (DEH_String("S_END")) - 1;
|
||||||
|
|
||||||
numspritelumps = lastspritelump - firstspritelump + 1;
|
numspritelumps = lastspritelump - firstspritelump + 1;
|
||||||
spritewidth = Z_Malloc (numspritelumps*sizeof(*spritewidth), PU_STATIC, 0);
|
spritewidth = Z_Malloc (numspritelumps*sizeof(*spritewidth), PU_STATIC, 0);
|
||||||
spriteoffset = Z_Malloc (numspritelumps*sizeof(*spriteoffset), PU_STATIC, 0);
|
spriteoffset = Z_Malloc (numspritelumps*sizeof(*spriteoffset), PU_STATIC, 0);
|
||||||
spritetopoffset = Z_Malloc (numspritelumps*sizeof(*spritetopoffset), PU_STATIC, 0);
|
spritetopoffset = Z_Malloc (numspritelumps*sizeof(*spritetopoffset), PU_STATIC, 0);
|
||||||
|
|
||||||
for (i=0 ; i< numspritelumps ; i++)
|
for (i=0 ; i< numspritelumps ; i++)
|
||||||
{
|
{
|
||||||
if (!(i&63))
|
if (!(i&63))
|
||||||
@@ -686,7 +686,7 @@ void R_InitColormaps (void)
|
|||||||
{
|
{
|
||||||
int lump;
|
int lump;
|
||||||
|
|
||||||
// Load in the light tables,
|
// Load in the light tables,
|
||||||
// 256 byte align tables.
|
// 256 byte align tables.
|
||||||
lump = W_GetNumForName(DEH_String("COLORMAP"));
|
lump = W_GetNumForName(DEH_String("COLORMAP"));
|
||||||
colormaps = W_CacheLumpNum(lump, PU_STATIC);
|
colormaps = W_CacheLumpNum(lump, PU_STATIC);
|
||||||
@@ -747,13 +747,13 @@ int R_CheckTextureNumForName (char *name)
|
|||||||
int key;
|
int key;
|
||||||
|
|
||||||
// "NoTexture" marker.
|
// "NoTexture" marker.
|
||||||
if (name[0] == '-')
|
if (name[0] == '-')
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
key = W_LumpNameHash(name) % numtextures;
|
key = W_LumpNameHash(name) % numtextures;
|
||||||
|
|
||||||
texture=textures_hashtable[key];
|
texture=textures_hashtable[key];
|
||||||
|
|
||||||
while (texture != NULL)
|
while (texture != NULL)
|
||||||
{
|
{
|
||||||
if (!strncasecmp (texture->name, name, 8) )
|
if (!strncasecmp (texture->name, name, 8) )
|
||||||
@@ -761,7 +761,7 @@ int R_CheckTextureNumForName (char *name)
|
|||||||
|
|
||||||
texture = texture->next;
|
texture = texture->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -775,7 +775,7 @@ int R_CheckTextureNumForName (char *name)
|
|||||||
int R_TextureNumForName (char* name)
|
int R_TextureNumForName (char* name)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
i = R_CheckTextureNumForName (name);
|
i = R_CheckTextureNumForName (name);
|
||||||
|
|
||||||
if (i==-1)
|
if (i==-1)
|
||||||
@@ -807,24 +807,24 @@ void R_PrecacheLevel (void)
|
|||||||
int j;
|
int j;
|
||||||
int k;
|
int k;
|
||||||
int lump;
|
int lump;
|
||||||
|
|
||||||
texture_t* texture;
|
texture_t* texture;
|
||||||
thinker_t* th;
|
thinker_t* th;
|
||||||
spriteframe_t* sf;
|
spriteframe_t* sf;
|
||||||
|
|
||||||
if (demoplayback)
|
// if (demoplayback)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Precache flats.
|
// Precache flats.
|
||||||
flatpresent = Z_Malloc(numflats, PU_STATIC, NULL);
|
flatpresent = Z_Malloc(numflats, PU_STATIC, NULL);
|
||||||
memset (flatpresent,0,numflats);
|
memset (flatpresent,0,numflats);
|
||||||
|
|
||||||
for (i=0 ; i<numsectors ; i++)
|
for (i=0 ; i<numsectors ; i++)
|
||||||
{
|
{
|
||||||
flatpresent[sectors[i].floorpic] = 1;
|
flatpresent[sectors[i].floorpic] = 1;
|
||||||
flatpresent[sectors[i].ceilingpic] = 1;
|
flatpresent[sectors[i].ceilingpic] = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
flatmemory = 0;
|
flatmemory = 0;
|
||||||
|
|
||||||
for (i=0 ; i<numflats ; i++)
|
for (i=0 ; i<numflats ; i++)
|
||||||
@@ -838,11 +838,11 @@ void R_PrecacheLevel (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
Z_Free(flatpresent);
|
Z_Free(flatpresent);
|
||||||
|
|
||||||
// Precache textures.
|
// Precache textures.
|
||||||
texturepresent = Z_Malloc(numtextures, PU_STATIC, NULL);
|
texturepresent = Z_Malloc(numtextures, PU_STATIC, NULL);
|
||||||
memset (texturepresent,0, numtextures);
|
memset (texturepresent,0, numtextures);
|
||||||
|
|
||||||
for (i=0 ; i<numsides ; i++)
|
for (i=0 ; i<numsides ; i++)
|
||||||
{
|
{
|
||||||
texturepresent[sides[i].toptexture] = 1;
|
texturepresent[sides[i].toptexture] = 1;
|
||||||
@@ -857,7 +857,7 @@ void R_PrecacheLevel (void)
|
|||||||
// a wall texture, with an episode dependend
|
// a wall texture, with an episode dependend
|
||||||
// name.
|
// name.
|
||||||
texturepresent[skytexture] = 1;
|
texturepresent[skytexture] = 1;
|
||||||
|
|
||||||
texturememory = 0;
|
texturememory = 0;
|
||||||
for (i=0 ; i<numtextures ; i++)
|
for (i=0 ; i<numtextures ; i++)
|
||||||
{
|
{
|
||||||
@@ -865,7 +865,7 @@ void R_PrecacheLevel (void)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
texture = textures[i];
|
texture = textures[i];
|
||||||
|
|
||||||
for (j=0 ; j<texture->patchcount ; j++)
|
for (j=0 ; j<texture->patchcount ; j++)
|
||||||
{
|
{
|
||||||
lump = texture->patches[j].patch;
|
lump = texture->patches[j].patch;
|
||||||
@@ -875,17 +875,17 @@ void R_PrecacheLevel (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
Z_Free(texturepresent);
|
Z_Free(texturepresent);
|
||||||
|
|
||||||
// Precache sprites.
|
// Precache sprites.
|
||||||
spritepresent = Z_Malloc(numsprites, PU_STATIC, NULL);
|
spritepresent = Z_Malloc(numsprites, PU_STATIC, NULL);
|
||||||
memset (spritepresent,0, numsprites);
|
memset (spritepresent,0, numsprites);
|
||||||
|
|
||||||
for (th = thinkercap.next ; th != &thinkercap ; th=th->next)
|
for (th = thinkercap.next ; th != &thinkercap ; th=th->next)
|
||||||
{
|
{
|
||||||
if (th->function.acp1 == (actionf_p1)P_MobjThinker)
|
if (th->function.acp1 == (actionf_p1)P_MobjThinker)
|
||||||
spritepresent[((mobj_t *)th)->sprite] = 1;
|
spritepresent[((mobj_t *)th)->sprite] = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
spritememory = 0;
|
spritememory = 0;
|
||||||
for (i=0 ; i<numsprites ; i++)
|
for (i=0 ; i<numsprites ; i++)
|
||||||
{
|
{
|
||||||
|
|||||||
+108
-108
@@ -49,7 +49,7 @@ typedef struct
|
|||||||
{
|
{
|
||||||
int x1;
|
int x1;
|
||||||
int x2;
|
int x2;
|
||||||
|
|
||||||
int column;
|
int column;
|
||||||
int topclip;
|
int topclip;
|
||||||
int bottomclip;
|
int bottomclip;
|
||||||
@@ -104,14 +104,14 @@ R_InstallSpriteLump
|
|||||||
boolean flipped )
|
boolean flipped )
|
||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
if (frame >= 29 || rotation > 8)
|
if (frame >= 29 || rotation > 8)
|
||||||
I_Error("R_InstallSpriteLump: "
|
I_Error("R_InstallSpriteLump: "
|
||||||
"Bad frame characters in lump %i", lump);
|
"Bad frame characters in lump %i", lump);
|
||||||
|
|
||||||
if ((int)frame > maxframe)
|
if ((int)frame > maxframe)
|
||||||
maxframe = frame;
|
maxframe = frame;
|
||||||
|
|
||||||
if (rotation == 0)
|
if (rotation == 0)
|
||||||
{
|
{
|
||||||
// the lump should be used for all rotations
|
// the lump should be used for all rotations
|
||||||
@@ -122,7 +122,7 @@ R_InstallSpriteLump
|
|||||||
if (sprtemp[frame].rotate == true)
|
if (sprtemp[frame].rotate == true)
|
||||||
I_Error ("R_InitSprites: Sprite %s frame %c has rotations "
|
I_Error ("R_InitSprites: Sprite %s frame %c has rotations "
|
||||||
"and a rot=0 lump", spritename, 'A'+frame);
|
"and a rot=0 lump", spritename, 'A'+frame);
|
||||||
|
|
||||||
sprtemp[frame].rotate = false;
|
sprtemp[frame].rotate = false;
|
||||||
for (r=0 ; r<8 ; r++)
|
for (r=0 ; r<8 ; r++)
|
||||||
{
|
{
|
||||||
@@ -131,21 +131,21 @@ R_InstallSpriteLump
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// the lump is only used for one rotation
|
// the lump is only used for one rotation
|
||||||
if (sprtemp[frame].rotate == false)
|
if (sprtemp[frame].rotate == false)
|
||||||
I_Error ("R_InitSprites: Sprite %s frame %c has rotations "
|
I_Error ("R_InitSprites: Sprite %s frame %c has rotations "
|
||||||
"and a rot=0 lump", spritename, 'A'+frame);
|
"and a rot=0 lump", spritename, 'A'+frame);
|
||||||
|
|
||||||
sprtemp[frame].rotate = true;
|
sprtemp[frame].rotate = true;
|
||||||
|
|
||||||
// make 0 based
|
// make 0 based
|
||||||
rotation--;
|
rotation--;
|
||||||
if (sprtemp[frame].lump[rotation] != -1)
|
if (sprtemp[frame].lump[rotation] != -1)
|
||||||
I_Error ("R_InitSprites: Sprite %s : %c : %c "
|
I_Error ("R_InitSprites: Sprite %s : %c : %c "
|
||||||
"has two lumps mapped to it",
|
"has two lumps mapped to it",
|
||||||
spritename, 'A'+frame, '1'+rotation);
|
spritename, 'A'+frame, '1'+rotation);
|
||||||
|
|
||||||
sprtemp[frame].lump[rotation] = lump - firstspritelump;
|
sprtemp[frame].lump[rotation] = lump - firstspritelump;
|
||||||
sprtemp[frame].flip[rotation] = (byte)flipped;
|
sprtemp[frame].flip[rotation] = (byte)flipped;
|
||||||
}
|
}
|
||||||
@@ -159,7 +159,7 @@ R_InstallSpriteLump
|
|||||||
// (4 chars exactly) to be used.
|
// (4 chars exactly) to be used.
|
||||||
// Builds the sprite rotation matrixes to account
|
// Builds the sprite rotation matrixes to account
|
||||||
// for horizontally flipped sprites.
|
// for horizontally flipped sprites.
|
||||||
// Will report an error if the lumps are inconsistant.
|
// Will report an error if the lumps are inconsistant.
|
||||||
// Only called at startup.
|
// Only called at startup.
|
||||||
//
|
//
|
||||||
// Sprite lump names are 4 characters for the actor,
|
// Sprite lump names are 4 characters for the actor,
|
||||||
@@ -168,8 +168,8 @@ R_InstallSpriteLump
|
|||||||
// letter/number appended.
|
// letter/number appended.
|
||||||
// The rotation character can be 0 to signify no rotations.
|
// The rotation character can be 0 to signify no rotations.
|
||||||
//
|
//
|
||||||
void R_InitSpriteDefs (char** namelist)
|
void R_InitSpriteDefs (char** namelist)
|
||||||
{
|
{
|
||||||
char** check;
|
char** check;
|
||||||
int i;
|
int i;
|
||||||
int l;
|
int l;
|
||||||
@@ -178,22 +178,22 @@ void R_InitSpriteDefs (char** namelist)
|
|||||||
int start;
|
int start;
|
||||||
int end;
|
int end;
|
||||||
int patched;
|
int patched;
|
||||||
|
|
||||||
// count the number of sprite names
|
// count the number of sprite names
|
||||||
check = namelist;
|
check = namelist;
|
||||||
while (*check != NULL)
|
while (*check != NULL)
|
||||||
check++;
|
check++;
|
||||||
|
|
||||||
numsprites = check-namelist;
|
numsprites = check-namelist;
|
||||||
|
|
||||||
if (!numsprites)
|
if (!numsprites)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
sprites = Z_Malloc(numsprites *sizeof(*sprites), PU_STATIC, NULL);
|
sprites = Z_Malloc(numsprites *sizeof(*sprites), PU_STATIC, NULL);
|
||||||
|
|
||||||
start = firstspritelump-1;
|
start = firstspritelump-1;
|
||||||
end = lastspritelump+1;
|
end = lastspritelump+1;
|
||||||
|
|
||||||
// scan all the lump names for each of the names,
|
// scan all the lump names for each of the names,
|
||||||
// noting the highest frame letter.
|
// noting the highest frame letter.
|
||||||
// Just compare 4 characters as ints
|
// Just compare 4 characters as ints
|
||||||
@@ -201,9 +201,9 @@ void R_InitSpriteDefs (char** namelist)
|
|||||||
{
|
{
|
||||||
spritename = DEH_String(namelist[i]);
|
spritename = DEH_String(namelist[i]);
|
||||||
memset (sprtemp,-1, sizeof(sprtemp));
|
memset (sprtemp,-1, sizeof(sprtemp));
|
||||||
|
|
||||||
maxframe = -1;
|
maxframe = -1;
|
||||||
|
|
||||||
// scan the lumps,
|
// scan the lumps,
|
||||||
// filling in the frames for whatever is found
|
// filling in the frames for whatever is found
|
||||||
for (l=start+1 ; l<end ; l++)
|
for (l=start+1 ; l<end ; l++)
|
||||||
@@ -228,30 +228,30 @@ void R_InitSpriteDefs (char** namelist)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// check the frames that were found for completeness
|
// check the frames that were found for completeness
|
||||||
if (maxframe == -1)
|
if (maxframe == -1)
|
||||||
{
|
{
|
||||||
sprites[i].numframes = 0;
|
sprites[i].numframes = 0;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
maxframe++;
|
maxframe++;
|
||||||
|
|
||||||
for (frame = 0 ; frame < maxframe ; frame++)
|
for (frame = 0 ; frame < maxframe ; frame++)
|
||||||
{
|
{
|
||||||
switch ((int)sprtemp[frame].rotate)
|
switch ((int)sprtemp[frame].rotate)
|
||||||
{
|
{
|
||||||
case -1:
|
case -1:
|
||||||
// no rotations were found for that frame at all
|
// no rotations were found for that frame at all
|
||||||
I_Error ("R_InitSprites: No patches found "
|
// I_Error ("R_InitSprites: No patches found "
|
||||||
"for %s frame %c", spritename, frame+'A');
|
// "for %s frame %c", spritename, frame+'A');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0:
|
case 0:
|
||||||
// only the first rotation is needed
|
// only the first rotation is needed
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
// must have all 8 frames
|
// must have all 8 frames
|
||||||
for (rotation=0 ; rotation<8 ; rotation++)
|
for (rotation=0 ; rotation<8 ; rotation++)
|
||||||
@@ -262,10 +262,10 @@ void R_InitSpriteDefs (char** namelist)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// allocate space for the frames present and copy sprtemp to it
|
// allocate space for the frames present and copy sprtemp to it
|
||||||
sprites[i].numframes = maxframe;
|
sprites[i].numframes = maxframe;
|
||||||
sprites[i].spriteframes =
|
sprites[i].spriteframes =
|
||||||
Z_Malloc (maxframe * sizeof(spriteframe_t), PU_STATIC, NULL);
|
Z_Malloc (maxframe * sizeof(spriteframe_t), PU_STATIC, NULL);
|
||||||
memcpy (sprites[i].spriteframes, sprtemp, maxframe*sizeof(spriteframe_t));
|
memcpy (sprites[i].spriteframes, sprtemp, maxframe*sizeof(spriteframe_t));
|
||||||
}
|
}
|
||||||
@@ -291,12 +291,12 @@ int newvissprite;
|
|||||||
void R_InitSprites (char** namelist)
|
void R_InitSprites (char** namelist)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i=0 ; i<SCREENWIDTH ; i++)
|
for (i=0 ; i<SCREENWIDTH ; i++)
|
||||||
{
|
{
|
||||||
negonearray[i] = -1;
|
negonearray[i] = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
R_InitSpriteDefs (namelist);
|
R_InitSpriteDefs (namelist);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -321,7 +321,7 @@ vissprite_t* R_NewVisSprite (void)
|
|||||||
{
|
{
|
||||||
if (vissprite_p == &vissprites[MAXVISSPRITES])
|
if (vissprite_p == &vissprites[MAXVISSPRITES])
|
||||||
return &overflowsprite;
|
return &overflowsprite;
|
||||||
|
|
||||||
vissprite_p++;
|
vissprite_p++;
|
||||||
return vissprite_p-1;
|
return vissprite_p-1;
|
||||||
}
|
}
|
||||||
@@ -345,10 +345,10 @@ void R_DrawMaskedColumn (column_t* column)
|
|||||||
int topscreen;
|
int topscreen;
|
||||||
int bottomscreen;
|
int bottomscreen;
|
||||||
fixed_t basetexturemid;
|
fixed_t basetexturemid;
|
||||||
|
|
||||||
basetexturemid = dc_texturemid;
|
basetexturemid = dc_texturemid;
|
||||||
|
|
||||||
for ( ; column->topdelta != 0xff ; )
|
for ( ; column->topdelta != 0xff ; )
|
||||||
{
|
{
|
||||||
// calculate unclipped screen coordinates
|
// calculate unclipped screen coordinates
|
||||||
// for post
|
// for post
|
||||||
@@ -357,7 +357,7 @@ void R_DrawMaskedColumn (column_t* column)
|
|||||||
|
|
||||||
dc_yl = (topscreen+FRACUNIT-1)>>FRACBITS;
|
dc_yl = (topscreen+FRACUNIT-1)>>FRACBITS;
|
||||||
dc_yh = (bottomscreen-1)>>FRACBITS;
|
dc_yh = (bottomscreen-1)>>FRACBITS;
|
||||||
|
|
||||||
if (dc_yh >= mfloorclip[dc_x])
|
if (dc_yh >= mfloorclip[dc_x])
|
||||||
dc_yh = mfloorclip[dc_x]-1;
|
dc_yh = mfloorclip[dc_x]-1;
|
||||||
if (dc_yl <= mceilingclip[dc_x])
|
if (dc_yl <= mceilingclip[dc_x])
|
||||||
@@ -371,11 +371,11 @@ void R_DrawMaskedColumn (column_t* column)
|
|||||||
|
|
||||||
// Drawn by either R_DrawColumn
|
// Drawn by either R_DrawColumn
|
||||||
// or (SHADOW) R_DrawFuzzColumn.
|
// or (SHADOW) R_DrawFuzzColumn.
|
||||||
colfunc ();
|
colfunc ();
|
||||||
}
|
}
|
||||||
column = (column_t *)( (byte *)column + column->length + 4);
|
column = (column_t *)( (byte *)column + column->length + 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
dc_texturemid = basetexturemid;
|
dc_texturemid = basetexturemid;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -395,12 +395,12 @@ R_DrawVisSprite
|
|||||||
int texturecolumn;
|
int texturecolumn;
|
||||||
fixed_t frac;
|
fixed_t frac;
|
||||||
patch_t* patch;
|
patch_t* patch;
|
||||||
|
|
||||||
|
|
||||||
patch = W_CacheLumpNum (vis->patch+firstspritelump, PU_CACHE);
|
patch = W_CacheLumpNum (vis->patch+firstspritelump, PU_CACHE);
|
||||||
|
|
||||||
dc_colormap = vis->colormap;
|
dc_colormap = vis->colormap;
|
||||||
|
|
||||||
if (!dc_colormap)
|
if (!dc_colormap)
|
||||||
{
|
{
|
||||||
// NULL colormap = shadow draw
|
// NULL colormap = shadow draw
|
||||||
@@ -412,13 +412,13 @@ R_DrawVisSprite
|
|||||||
dc_translation = translationtables - 256 +
|
dc_translation = translationtables - 256 +
|
||||||
( (vis->mobjflags & MF_TRANSLATION) >> (MF_TRANSSHIFT-8) );
|
( (vis->mobjflags & MF_TRANSLATION) >> (MF_TRANSSHIFT-8) );
|
||||||
}
|
}
|
||||||
|
|
||||||
dc_iscale = abs(vis->xiscale)>>detailshift;
|
dc_iscale = abs(vis->xiscale)>>detailshift;
|
||||||
dc_texturemid = vis->texturemid;
|
dc_texturemid = vis->texturemid;
|
||||||
frac = vis->startfrac;
|
frac = vis->startfrac;
|
||||||
spryscale = vis->scale;
|
spryscale = vis->scale;
|
||||||
sprtopscreen = centeryfrac - FixedMul(dc_texturemid,spryscale);
|
sprtopscreen = centeryfrac - FixedMul(dc_texturemid,spryscale);
|
||||||
|
|
||||||
for (dc_x=vis->x1 ; dc_x<=vis->x2 ; dc_x++, frac += vis->xiscale)
|
for (dc_x=vis->x1 ; dc_x<=vis->x2 ; dc_x++, frac += vis->xiscale)
|
||||||
{
|
{
|
||||||
texturecolumn = frac>>FRACBITS;
|
texturecolumn = frac>>FRACBITS;
|
||||||
@@ -445,55 +445,55 @@ void R_ProjectSprite (mobj_t* thing)
|
|||||||
{
|
{
|
||||||
fixed_t tr_x;
|
fixed_t tr_x;
|
||||||
fixed_t tr_y;
|
fixed_t tr_y;
|
||||||
|
|
||||||
fixed_t gxt;
|
fixed_t gxt;
|
||||||
fixed_t gyt;
|
fixed_t gyt;
|
||||||
|
|
||||||
fixed_t tx;
|
fixed_t tx;
|
||||||
fixed_t tz;
|
fixed_t tz;
|
||||||
|
|
||||||
fixed_t xscale;
|
fixed_t xscale;
|
||||||
|
|
||||||
int x1;
|
int x1;
|
||||||
int x2;
|
int x2;
|
||||||
|
|
||||||
spritedef_t* sprdef;
|
spritedef_t* sprdef;
|
||||||
spriteframe_t* sprframe;
|
spriteframe_t* sprframe;
|
||||||
int lump;
|
int lump;
|
||||||
|
|
||||||
unsigned rot;
|
unsigned rot;
|
||||||
boolean flip;
|
boolean flip;
|
||||||
|
|
||||||
int index;
|
int index;
|
||||||
|
|
||||||
vissprite_t* vis;
|
vissprite_t* vis;
|
||||||
|
|
||||||
angle_t ang;
|
angle_t ang;
|
||||||
fixed_t iscale;
|
fixed_t iscale;
|
||||||
|
|
||||||
// transform the origin point
|
// transform the origin point
|
||||||
tr_x = thing->x - viewx;
|
tr_x = thing->x - viewx;
|
||||||
tr_y = thing->y - viewy;
|
tr_y = thing->y - viewy;
|
||||||
|
|
||||||
gxt = FixedMul(tr_x,viewcos);
|
gxt = FixedMul(tr_x,viewcos);
|
||||||
gyt = -FixedMul(tr_y,viewsin);
|
gyt = -FixedMul(tr_y,viewsin);
|
||||||
|
|
||||||
tz = gxt-gyt;
|
tz = gxt-gyt;
|
||||||
|
|
||||||
// thing is behind view plane?
|
// thing is behind view plane?
|
||||||
if (tz < MINZ)
|
if (tz < MINZ)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
xscale = FixedDiv(projection, tz);
|
xscale = FixedDiv(projection, tz);
|
||||||
|
|
||||||
gxt = -FixedMul(tr_x,viewsin);
|
gxt = -FixedMul(tr_x,viewsin);
|
||||||
gyt = FixedMul(tr_y,viewcos);
|
gyt = FixedMul(tr_y,viewcos);
|
||||||
tx = -(gyt+gxt);
|
tx = -(gyt+gxt);
|
||||||
|
|
||||||
// too far off the side?
|
// too far off the side?
|
||||||
if (abs(tx)>(tz<<2))
|
if (abs(tx)>(tz<<2))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// decide which patch to use for sprite relative to player
|
// decide which patch to use for sprite relative to player
|
||||||
#ifdef RANGECHECK
|
#ifdef RANGECHECK
|
||||||
if ((unsigned int) thing->sprite >= (unsigned int) numsprites)
|
if ((unsigned int) thing->sprite >= (unsigned int) numsprites)
|
||||||
@@ -522,22 +522,22 @@ void R_ProjectSprite (mobj_t* thing)
|
|||||||
lump = sprframe->lump[0];
|
lump = sprframe->lump[0];
|
||||||
flip = (boolean)sprframe->flip[0];
|
flip = (boolean)sprframe->flip[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
// calculate edges of the shape
|
// calculate edges of the shape
|
||||||
tx -= spriteoffset[lump];
|
tx -= spriteoffset[lump];
|
||||||
x1 = (centerxfrac + FixedMul (tx,xscale) ) >>FRACBITS;
|
x1 = (centerxfrac + FixedMul (tx,xscale) ) >>FRACBITS;
|
||||||
|
|
||||||
// off the right side?
|
// off the right side?
|
||||||
if (x1 > viewwidth)
|
if (x1 > viewwidth)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
tx += spritewidth[lump];
|
tx += spritewidth[lump];
|
||||||
x2 = ((centerxfrac + FixedMul (tx,xscale) ) >>FRACBITS) - 1;
|
x2 = ((centerxfrac + FixedMul (tx,xscale) ) >>FRACBITS) - 1;
|
||||||
|
|
||||||
// off the left side
|
// off the left side
|
||||||
if (x2 < 0)
|
if (x2 < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// store information in a vissprite
|
// store information in a vissprite
|
||||||
vis = R_NewVisSprite ();
|
vis = R_NewVisSprite ();
|
||||||
vis->mobjflags = thing->flags;
|
vis->mobjflags = thing->flags;
|
||||||
@@ -548,7 +548,7 @@ void R_ProjectSprite (mobj_t* thing)
|
|||||||
vis->gzt = thing->z + spritetopoffset[lump];
|
vis->gzt = thing->z + spritetopoffset[lump];
|
||||||
vis->texturemid = vis->gzt - viewz;
|
vis->texturemid = vis->gzt - viewz;
|
||||||
vis->x1 = x1 < 0 ? 0 : x1;
|
vis->x1 = x1 < 0 ? 0 : x1;
|
||||||
vis->x2 = x2 >= viewwidth ? viewwidth-1 : x2;
|
vis->x2 = x2 >= viewwidth ? viewwidth-1 : x2;
|
||||||
iscale = FixedDiv (FRACUNIT, xscale);
|
iscale = FixedDiv (FRACUNIT, xscale);
|
||||||
|
|
||||||
if (flip)
|
if (flip)
|
||||||
@@ -565,7 +565,7 @@ void R_ProjectSprite (mobj_t* thing)
|
|||||||
if (vis->x1 > x1)
|
if (vis->x1 > x1)
|
||||||
vis->startfrac += vis->xiscale*(vis->x1-x1);
|
vis->startfrac += vis->xiscale*(vis->x1-x1);
|
||||||
vis->patch = lump;
|
vis->patch = lump;
|
||||||
|
|
||||||
// get light level
|
// get light level
|
||||||
if (thing->flags & MF_SHADOW)
|
if (thing->flags & MF_SHADOW)
|
||||||
{
|
{
|
||||||
@@ -582,17 +582,17 @@ void R_ProjectSprite (mobj_t* thing)
|
|||||||
// full bright
|
// full bright
|
||||||
vis->colormap = colormaps;
|
vis->colormap = colormaps;
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// diminished light
|
// diminished light
|
||||||
index = xscale>>(LIGHTSCALESHIFT-detailshift);
|
index = xscale>>(LIGHTSCALESHIFT-detailshift);
|
||||||
|
|
||||||
if (index >= MAXLIGHTSCALE)
|
if (index >= MAXLIGHTSCALE)
|
||||||
index = MAXLIGHTSCALE-1;
|
index = MAXLIGHTSCALE-1;
|
||||||
|
|
||||||
vis->colormap = spritelights[index];
|
vis->colormap = spritelights[index];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -612,14 +612,14 @@ void R_AddSprites (sector_t* sec)
|
|||||||
// subsectors during BSP building.
|
// subsectors during BSP building.
|
||||||
// Thus we check whether its already added.
|
// Thus we check whether its already added.
|
||||||
if (sec->validcount == validcount)
|
if (sec->validcount == validcount)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Well, now it will be done.
|
// Well, now it will be done.
|
||||||
sec->validcount = validcount;
|
sec->validcount = validcount;
|
||||||
|
|
||||||
lightnum = (sec->lightlevel >> LIGHTSEGSHIFT)+extralight;
|
lightnum = (sec->lightlevel >> LIGHTSEGSHIFT)+extralight;
|
||||||
|
|
||||||
if (lightnum < 0)
|
if (lightnum < 0)
|
||||||
spritelights = scalelight[0];
|
spritelights = scalelight[0];
|
||||||
else if (lightnum >= LIGHTLEVELS)
|
else if (lightnum >= LIGHTLEVELS)
|
||||||
spritelights = scalelight[LIGHTLEVELS-1];
|
spritelights = scalelight[LIGHTLEVELS-1];
|
||||||
@@ -646,7 +646,7 @@ void R_DrawPSprite (pspdef_t* psp)
|
|||||||
boolean flip;
|
boolean flip;
|
||||||
vissprite_t* vis;
|
vissprite_t* vis;
|
||||||
vissprite_t avis;
|
vissprite_t avis;
|
||||||
|
|
||||||
// decide which patch to use
|
// decide which patch to use
|
||||||
#ifdef RANGECHECK
|
#ifdef RANGECHECK
|
||||||
if ( (unsigned)psp->state->sprite >= (unsigned int) numsprites)
|
if ( (unsigned)psp->state->sprite >= (unsigned int) numsprites)
|
||||||
@@ -663,16 +663,16 @@ void R_DrawPSprite (pspdef_t* psp)
|
|||||||
|
|
||||||
lump = sprframe->lump[0];
|
lump = sprframe->lump[0];
|
||||||
flip = (boolean)sprframe->flip[0];
|
flip = (boolean)sprframe->flip[0];
|
||||||
|
|
||||||
// calculate edges of the shape
|
// calculate edges of the shape
|
||||||
tx = psp->sx-160*FRACUNIT;
|
tx = psp->sx-160*FRACUNIT;
|
||||||
|
|
||||||
tx -= spriteoffset[lump];
|
tx -= spriteoffset[lump];
|
||||||
x1 = (centerxfrac + FixedMul (tx,pspritescale) ) >>FRACBITS;
|
x1 = (centerxfrac + FixedMul (tx,pspritescale) ) >>FRACBITS;
|
||||||
|
|
||||||
// off the right side
|
// off the right side
|
||||||
if (x1 > viewwidth)
|
if (x1 > viewwidth)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
tx += spritewidth[lump];
|
tx += spritewidth[lump];
|
||||||
x2 = ((centerxfrac + FixedMul (tx, pspritescale) ) >>FRACBITS) - 1;
|
x2 = ((centerxfrac + FixedMul (tx, pspritescale) ) >>FRACBITS) - 1;
|
||||||
@@ -680,15 +680,15 @@ void R_DrawPSprite (pspdef_t* psp)
|
|||||||
// off the left side
|
// off the left side
|
||||||
if (x2 < 0)
|
if (x2 < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// store information in a vissprite
|
// store information in a vissprite
|
||||||
vis = &avis;
|
vis = &avis;
|
||||||
vis->mobjflags = 0;
|
vis->mobjflags = 0;
|
||||||
vis->texturemid = (BASEYCENTER<<FRACBITS)+FRACUNIT/2-(psp->sy-spritetopoffset[lump]);
|
vis->texturemid = (BASEYCENTER<<FRACBITS)+FRACUNIT/2-(psp->sy-spritetopoffset[lump]);
|
||||||
vis->x1 = x1 < 0 ? 0 : x1;
|
vis->x1 = x1 < 0 ? 0 : x1;
|
||||||
vis->x2 = x2 >= viewwidth ? viewwidth-1 : x2;
|
vis->x2 = x2 >= viewwidth ? viewwidth-1 : x2;
|
||||||
vis->scale = pspritescale<<detailshift;
|
vis->scale = pspritescale<<detailshift;
|
||||||
|
|
||||||
if (flip)
|
if (flip)
|
||||||
{
|
{
|
||||||
vis->xiscale = -pspriteiscale;
|
vis->xiscale = -pspriteiscale;
|
||||||
@@ -699,7 +699,7 @@ void R_DrawPSprite (pspdef_t* psp)
|
|||||||
vis->xiscale = pspriteiscale;
|
vis->xiscale = pspriteiscale;
|
||||||
vis->startfrac = 0;
|
vis->startfrac = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vis->x1 > x1)
|
if (vis->x1 > x1)
|
||||||
vis->startfrac += vis->xiscale*(vis->x1-x1);
|
vis->startfrac += vis->xiscale*(vis->x1-x1);
|
||||||
|
|
||||||
@@ -726,7 +726,7 @@ void R_DrawPSprite (pspdef_t* psp)
|
|||||||
// local light
|
// local light
|
||||||
vis->colormap = spritelights[MAXLIGHTSCALE-1];
|
vis->colormap = spritelights[MAXLIGHTSCALE-1];
|
||||||
}
|
}
|
||||||
|
|
||||||
R_DrawVisSprite (vis, vis->x1, vis->x2);
|
R_DrawVisSprite (vis, vis->x1, vis->x2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -740,23 +740,23 @@ void R_DrawPlayerSprites (void)
|
|||||||
int i;
|
int i;
|
||||||
int lightnum;
|
int lightnum;
|
||||||
pspdef_t* psp;
|
pspdef_t* psp;
|
||||||
|
|
||||||
// get light level
|
// get light level
|
||||||
lightnum =
|
lightnum =
|
||||||
(viewplayer->mo->subsector->sector->lightlevel >> LIGHTSEGSHIFT)
|
(viewplayer->mo->subsector->sector->lightlevel >> LIGHTSEGSHIFT)
|
||||||
+extralight;
|
+extralight;
|
||||||
|
|
||||||
if (lightnum < 0)
|
if (lightnum < 0)
|
||||||
spritelights = scalelight[0];
|
spritelights = scalelight[0];
|
||||||
else if (lightnum >= LIGHTLEVELS)
|
else if (lightnum >= LIGHTLEVELS)
|
||||||
spritelights = scalelight[LIGHTLEVELS-1];
|
spritelights = scalelight[LIGHTLEVELS-1];
|
||||||
else
|
else
|
||||||
spritelights = scalelight[lightnum];
|
spritelights = scalelight[lightnum];
|
||||||
|
|
||||||
// clip to screen bounds
|
// clip to screen bounds
|
||||||
mfloorclip = screenheightarray;
|
mfloorclip = screenheightarray;
|
||||||
mceilingclip = negonearray;
|
mceilingclip = negonearray;
|
||||||
|
|
||||||
// add all active psprites
|
// add all active psprites
|
||||||
for (i=0, psp=viewplayer->psprites;
|
for (i=0, psp=viewplayer->psprites;
|
||||||
i<NUMPSPRITES;
|
i<NUMPSPRITES;
|
||||||
@@ -786,23 +786,23 @@ void R_SortVisSprites (void)
|
|||||||
fixed_t bestscale;
|
fixed_t bestscale;
|
||||||
|
|
||||||
count = vissprite_p - vissprites;
|
count = vissprite_p - vissprites;
|
||||||
|
|
||||||
unsorted.next = unsorted.prev = &unsorted;
|
unsorted.next = unsorted.prev = &unsorted;
|
||||||
|
|
||||||
if (!count)
|
if (!count)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (ds=vissprites ; ds<vissprite_p ; ds++)
|
for (ds=vissprites ; ds<vissprite_p ; ds++)
|
||||||
{
|
{
|
||||||
ds->next = ds+1;
|
ds->next = ds+1;
|
||||||
ds->prev = ds-1;
|
ds->prev = ds-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
vissprites[0].prev = &unsorted;
|
vissprites[0].prev = &unsorted;
|
||||||
unsorted.next = &vissprites[0];
|
unsorted.next = &vissprites[0];
|
||||||
(vissprite_p-1)->next = &unsorted;
|
(vissprite_p-1)->next = &unsorted;
|
||||||
unsorted.prev = vissprite_p-1;
|
unsorted.prev = vissprite_p-1;
|
||||||
|
|
||||||
// pull the vissprites out by scale
|
// pull the vissprites out by scale
|
||||||
|
|
||||||
vsprsortedhead.next = vsprsortedhead.prev = &vsprsortedhead;
|
vsprsortedhead.next = vsprsortedhead.prev = &vsprsortedhead;
|
||||||
@@ -843,10 +843,10 @@ void R_DrawSprite (vissprite_t* spr)
|
|||||||
fixed_t scale;
|
fixed_t scale;
|
||||||
fixed_t lowscale;
|
fixed_t lowscale;
|
||||||
int silhouette;
|
int silhouette;
|
||||||
|
|
||||||
for (x = spr->x1 ; x<=spr->x2 ; x++)
|
for (x = spr->x1 ; x<=spr->x2 ; x++)
|
||||||
clipbot[x] = cliptop[x] = -2;
|
clipbot[x] = cliptop[x] = -2;
|
||||||
|
|
||||||
// Scan drawsegs from end to start for obscuring segs.
|
// Scan drawsegs from end to start for obscuring segs.
|
||||||
// The first drawseg that has a greater scale
|
// The first drawseg that has a greater scale
|
||||||
// is the clip seg.
|
// is the clip seg.
|
||||||
@@ -861,7 +861,7 @@ void R_DrawSprite (vissprite_t* spr)
|
|||||||
// does not cover sprite
|
// does not cover sprite
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
r1 = ds->x1 < spr->x1 ? spr->x1 : ds->x1;
|
r1 = ds->x1 < spr->x1 ? spr->x1 : ds->x1;
|
||||||
r2 = ds->x2 > spr->x2 ? spr->x2 : ds->x2;
|
r2 = ds->x2 > spr->x2 ? spr->x2 : ds->x2;
|
||||||
|
|
||||||
@@ -875,28 +875,28 @@ void R_DrawSprite (vissprite_t* spr)
|
|||||||
lowscale = ds->scale1;
|
lowscale = ds->scale1;
|
||||||
scale = ds->scale2;
|
scale = ds->scale2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scale < spr->scale
|
if (scale < spr->scale
|
||||||
|| ( lowscale < spr->scale
|
|| ( lowscale < spr->scale
|
||||||
&& !R_PointOnSegSide (spr->gx, spr->gy, ds->curline) ) )
|
&& !R_PointOnSegSide (spr->gx, spr->gy, ds->curline) ) )
|
||||||
{
|
{
|
||||||
// masked mid texture?
|
// masked mid texture?
|
||||||
if (ds->maskedtexturecol)
|
if (ds->maskedtexturecol)
|
||||||
R_RenderMaskedSegRange (ds, r1, r2);
|
R_RenderMaskedSegRange (ds, r1, r2);
|
||||||
// seg is behind sprite
|
// seg is behind sprite
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// clip this piece of the sprite
|
// clip this piece of the sprite
|
||||||
silhouette = ds->silhouette;
|
silhouette = ds->silhouette;
|
||||||
|
|
||||||
if (spr->gz >= ds->bsilheight)
|
if (spr->gz >= ds->bsilheight)
|
||||||
silhouette &= ~SIL_BOTTOM;
|
silhouette &= ~SIL_BOTTOM;
|
||||||
|
|
||||||
if (spr->gzt <= ds->tsilheight)
|
if (spr->gzt <= ds->tsilheight)
|
||||||
silhouette &= ~SIL_TOP;
|
silhouette &= ~SIL_TOP;
|
||||||
|
|
||||||
if (silhouette == 1)
|
if (silhouette == 1)
|
||||||
{
|
{
|
||||||
// bottom sil
|
// bottom sil
|
||||||
@@ -922,21 +922,21 @@ void R_DrawSprite (vissprite_t* spr)
|
|||||||
cliptop[x] = ds->sprtopclip[x];
|
cliptop[x] = ds->sprtopclip[x];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// all clipping has been performed, so draw the sprite
|
// all clipping has been performed, so draw the sprite
|
||||||
|
|
||||||
// check for unclipped columns
|
// check for unclipped columns
|
||||||
for (x = spr->x1 ; x<=spr->x2 ; x++)
|
for (x = spr->x1 ; x<=spr->x2 ; x++)
|
||||||
{
|
{
|
||||||
if (clipbot[x] == -2)
|
if (clipbot[x] == -2)
|
||||||
clipbot[x] = viewheight;
|
clipbot[x] = viewheight;
|
||||||
|
|
||||||
if (cliptop[x] == -2)
|
if (cliptop[x] == -2)
|
||||||
cliptop[x] = -1;
|
cliptop[x] = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
mfloorclip = clipbot;
|
mfloorclip = clipbot;
|
||||||
mceilingclip = cliptop;
|
mceilingclip = cliptop;
|
||||||
R_DrawVisSprite (spr, spr->x1, spr->x2);
|
R_DrawVisSprite (spr, spr->x1, spr->x2);
|
||||||
@@ -952,7 +952,7 @@ void R_DrawMasked (void)
|
|||||||
{
|
{
|
||||||
vissprite_t* spr;
|
vissprite_t* spr;
|
||||||
drawseg_t* ds;
|
drawseg_t* ds;
|
||||||
|
|
||||||
R_SortVisSprites ();
|
R_SortVisSprites ();
|
||||||
|
|
||||||
if (vissprite_p > vissprites)
|
if (vissprite_p > vissprites)
|
||||||
@@ -962,19 +962,19 @@ void R_DrawMasked (void)
|
|||||||
spr != &vsprsortedhead ;
|
spr != &vsprsortedhead ;
|
||||||
spr=spr->next)
|
spr=spr->next)
|
||||||
{
|
{
|
||||||
|
|
||||||
R_DrawSprite (spr);
|
R_DrawSprite (spr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// render any remaining masked mid textures
|
// render any remaining masked mid textures
|
||||||
for (ds=ds_p-1 ; ds >= drawsegs ; ds--)
|
for (ds=ds_p-1 ; ds >= drawsegs ; ds--)
|
||||||
if (ds->maskedtexturecol)
|
if (ds->maskedtexturecol)
|
||||||
R_RenderMaskedSegRange (ds, ds->x1, ds->x2);
|
R_RenderMaskedSegRange (ds, ds->x1, ds->x2);
|
||||||
|
|
||||||
// draw the psprites on top of everything
|
// draw the psprites on top of everything
|
||||||
// but does not draw on side views
|
// but does not draw on side views
|
||||||
if (!viewangleoffset)
|
if (!viewangleoffset)
|
||||||
R_DrawPlayerSprites ();
|
R_DrawPlayerSprites ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+58
-58
@@ -63,11 +63,11 @@
|
|||||||
|
|
||||||
|
|
||||||
// in tics
|
// in tics
|
||||||
//U #define PAUSELEN (TICRATE*2)
|
//U #define PAUSELEN (TICRATE*2)
|
||||||
//U #define SCORESTEP 100
|
//U #define SCORESTEP 100
|
||||||
//U #define ANIMPERIOD 32
|
//U #define ANIMPERIOD 32
|
||||||
// pixel distance from "(YOU)" to "PLAYER N"
|
// pixel distance from "(YOU)" to "PLAYER N"
|
||||||
//U #define STARDIST 10
|
//U #define STARDIST 10
|
||||||
//U #define WK 1
|
//U #define WK 1
|
||||||
|
|
||||||
|
|
||||||
@@ -118,7 +118,7 @@ typedef struct
|
|||||||
{
|
{
|
||||||
int x;
|
int x;
|
||||||
int y;
|
int y;
|
||||||
|
|
||||||
} point_t;
|
} point_t;
|
||||||
|
|
||||||
|
|
||||||
@@ -147,10 +147,10 @@ typedef struct
|
|||||||
// ALWAYS: n/a,
|
// ALWAYS: n/a,
|
||||||
// RANDOM: random base period,
|
// RANDOM: random base period,
|
||||||
// LEVEL: n/a
|
// LEVEL: n/a
|
||||||
int data2;
|
int data2;
|
||||||
|
|
||||||
// actual graphics for frames of animations
|
// actual graphics for frames of animations
|
||||||
patch_t* p[3];
|
patch_t* p[3];
|
||||||
|
|
||||||
// following must be initialized to zero before use!
|
// following must be initialized to zero before use!
|
||||||
|
|
||||||
@@ -162,9 +162,9 @@ typedef struct
|
|||||||
|
|
||||||
// next frame number to animate
|
// next frame number to animate
|
||||||
int ctr;
|
int ctr;
|
||||||
|
|
||||||
// used by RANDOM and LEVEL when animating
|
// used by RANDOM and LEVEL when animating
|
||||||
int state;
|
int state;
|
||||||
|
|
||||||
} anim_t;
|
} anim_t;
|
||||||
|
|
||||||
@@ -288,8 +288,8 @@ static anim_t *anims[NUMEPISODES] =
|
|||||||
#define SP_KILLS 0
|
#define SP_KILLS 0
|
||||||
#define SP_ITEMS 2
|
#define SP_ITEMS 2
|
||||||
#define SP_SECRET 4
|
#define SP_SECRET 4
|
||||||
#define SP_FRAGS 6
|
#define SP_FRAGS 6
|
||||||
#define SP_TIME 8
|
#define SP_TIME 8
|
||||||
#define SP_PAR ST_TIME
|
#define SP_PAR ST_TIME
|
||||||
|
|
||||||
#define SP_PAUSE 1
|
#define SP_PAUSE 1
|
||||||
@@ -314,13 +314,13 @@ static wbstartstruct_t* wbs;
|
|||||||
static wbplayerstruct_t* plrs; // wbs->plyr[]
|
static wbplayerstruct_t* plrs; // wbs->plyr[]
|
||||||
|
|
||||||
// used for general timing
|
// used for general timing
|
||||||
static int cnt;
|
static int cnt;
|
||||||
|
|
||||||
// used for timing of background animation
|
// used for timing of background animation
|
||||||
static int bcnt;
|
static int bcnt;
|
||||||
|
|
||||||
// signals to refresh everything for one frame
|
// signals to refresh everything for one frame
|
||||||
static int firstrefresh;
|
static int firstrefresh;
|
||||||
|
|
||||||
static int cnt_kills[MAXPLAYERS];
|
static int cnt_kills[MAXPLAYERS];
|
||||||
static int cnt_items[MAXPLAYERS];
|
static int cnt_items[MAXPLAYERS];
|
||||||
@@ -330,7 +330,7 @@ static int cnt_par;
|
|||||||
static int cnt_pause;
|
static int cnt_pause;
|
||||||
|
|
||||||
// # of commercial levels
|
// # of commercial levels
|
||||||
static int NUMCMAPS;
|
static int NUMCMAPS;
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -338,7 +338,7 @@ static int NUMCMAPS;
|
|||||||
//
|
//
|
||||||
|
|
||||||
// You Are Here graphic
|
// You Are Here graphic
|
||||||
static patch_t* yah[3] = { NULL, NULL, NULL };
|
static patch_t* yah[3] = { NULL, NULL, NULL };
|
||||||
|
|
||||||
// splat
|
// splat
|
||||||
static patch_t* splat[2] = { NULL, NULL };
|
static patch_t* splat[2] = { NULL, NULL };
|
||||||
@@ -357,7 +357,7 @@ static patch_t* wiminus;
|
|||||||
static patch_t* finished;
|
static patch_t* finished;
|
||||||
|
|
||||||
// "Entering" graphic
|
// "Entering" graphic
|
||||||
static patch_t* entering;
|
static patch_t* entering;
|
||||||
|
|
||||||
// "secret"
|
// "secret"
|
||||||
static patch_t* sp_secret;
|
static patch_t* sp_secret;
|
||||||
@@ -375,7 +375,7 @@ static patch_t* sucks;
|
|||||||
|
|
||||||
// "killers", "victims"
|
// "killers", "victims"
|
||||||
static patch_t* killers;
|
static patch_t* killers;
|
||||||
static patch_t* victims;
|
static patch_t* victims;
|
||||||
|
|
||||||
// "Total", your face, your dead face
|
// "Total", your face, your dead face
|
||||||
static patch_t* total;
|
static patch_t* total;
|
||||||
@@ -419,7 +419,7 @@ void WI_drawLF(void)
|
|||||||
|
|
||||||
if (gamemode != commercial || wbs->last < NUMCMAPS)
|
if (gamemode != commercial || wbs->last < NUMCMAPS)
|
||||||
{
|
{
|
||||||
// draw <LevelName>
|
// draw <LevelName>
|
||||||
V_DrawPatch((SCREENWIDTH - SHORT(lnames[wbs->last]->width))/2,
|
V_DrawPatch((SCREENWIDTH - SHORT(lnames[wbs->last]->width))/2,
|
||||||
y, lnames[wbs->last]);
|
y, lnames[wbs->last]);
|
||||||
|
|
||||||
@@ -439,7 +439,7 @@ void WI_drawLF(void)
|
|||||||
// bits of memory at this point, but let's try to be accurate
|
// bits of memory at this point, but let's try to be accurate
|
||||||
// anyway. This deliberately triggers a V_DrawPatch error.
|
// anyway. This deliberately triggers a V_DrawPatch error.
|
||||||
|
|
||||||
patch_t tmp = { SCREENWIDTH, SCREENHEIGHT, 1, 1,
|
patch_t tmp = { SCREENWIDTH, SCREENHEIGHT, 1, 1,
|
||||||
{ 0, 0, 0, 0, 0, 0, 0, 0 } };
|
{ 0, 0, 0, 0, 0, 0, 0, 0 } };
|
||||||
|
|
||||||
V_DrawPatch(0, y, &tmp);
|
V_DrawPatch(0, y, &tmp);
|
||||||
@@ -462,7 +462,7 @@ void WI_drawEL(void)
|
|||||||
y += (5*SHORT(lnames[wbs->next]->height))/4;
|
y += (5*SHORT(lnames[wbs->next]->height))/4;
|
||||||
|
|
||||||
V_DrawPatch((SCREENWIDTH - SHORT(lnames[wbs->next]->width))/2,
|
V_DrawPatch((SCREENWIDTH - SHORT(lnames[wbs->next]->width))/2,
|
||||||
y,
|
y,
|
||||||
lnames[wbs->next]);
|
lnames[wbs->next]);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -510,7 +510,7 @@ WI_drawOnLnode
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// DEBUG
|
// DEBUG
|
||||||
printf("Could not place patch on level %d", n+1);
|
printf("Could not place patch on level %d", n+1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -578,7 +578,7 @@ void WI_updateAnimatedBack(void)
|
|||||||
}
|
}
|
||||||
else a->nexttic = bcnt + a->period;
|
else a->nexttic = bcnt + a->period;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ANIM_LEVEL:
|
case ANIM_LEVEL:
|
||||||
// gawd-awful hack for level anims
|
// gawd-awful hack for level anims
|
||||||
if (!(state == StatCount && i == 7)
|
if (!(state == StatCount && i == 7)
|
||||||
@@ -726,13 +726,13 @@ WI_drawTime
|
|||||||
// draw
|
// draw
|
||||||
if (div==60 || t / div)
|
if (div==60 || t / div)
|
||||||
V_DrawPatch(x, y, colon);
|
V_DrawPatch(x, y, colon);
|
||||||
|
|
||||||
} while (t / div);
|
} while (t / div);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// "sucks"
|
// "sucks"
|
||||||
V_DrawPatch(x - SHORT(sucks->width), y, sucks);
|
V_DrawPatch(x - SHORT(sucks->width), y, sucks);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -756,7 +756,7 @@ void WI_updateNoState(void) {
|
|||||||
|
|
||||||
if (!--cnt)
|
if (!--cnt)
|
||||||
{
|
{
|
||||||
// Don't call WI_End yet. G_WorldDone doesnt immediately
|
// Don't call WI_End yet. G_WorldDone doesnt immediately
|
||||||
// change gamestate, so WI_Drawer is still going to get
|
// change gamestate, so WI_Drawer is still going to get
|
||||||
// run until that happens. If we do that after WI_End
|
// run until that happens. If we do that after WI_End
|
||||||
// (which unloads all the graphics), we're in trouble.
|
// (which unloads all the graphics), we're in trouble.
|
||||||
@@ -797,7 +797,7 @@ void WI_drawShowNextLoc(void)
|
|||||||
WI_slamBackground();
|
WI_slamBackground();
|
||||||
|
|
||||||
// draw animated background
|
// draw animated background
|
||||||
WI_drawAnimatedBack();
|
WI_drawAnimatedBack();
|
||||||
|
|
||||||
if ( gamemode != commercial)
|
if ( gamemode != commercial)
|
||||||
{
|
{
|
||||||
@@ -806,7 +806,7 @@ void WI_drawShowNextLoc(void)
|
|||||||
WI_drawEL();
|
WI_drawEL();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
last = (wbs->last == 8) ? wbs->next - 1 : wbs->last;
|
last = (wbs->last == 8) ? wbs->next - 1 : wbs->last;
|
||||||
|
|
||||||
// draw a splat on taken cities.
|
// draw a splat on taken cities.
|
||||||
@@ -819,13 +819,13 @@ void WI_drawShowNextLoc(void)
|
|||||||
|
|
||||||
// draw flashing ptr
|
// draw flashing ptr
|
||||||
if (snl_pointeron)
|
if (snl_pointeron)
|
||||||
WI_drawOnLnode(wbs->next, yah);
|
WI_drawOnLnode(wbs->next, yah);
|
||||||
}
|
}
|
||||||
|
|
||||||
// draws which level you are entering..
|
// draws which level you are entering..
|
||||||
if ( (gamemode != commercial)
|
if ( (gamemode != commercial)
|
||||||
|| wbs->next != 30)
|
|| wbs->next != 30)
|
||||||
WI_drawEL();
|
WI_drawEL();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -839,7 +839,7 @@ int WI_fragSum(int playernum)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int frags = 0;
|
int frags = 0;
|
||||||
|
|
||||||
for (i=0 ; i<MAXPLAYERS ; i++)
|
for (i=0 ; i<MAXPLAYERS ; i++)
|
||||||
{
|
{
|
||||||
if (playeringame[i]
|
if (playeringame[i]
|
||||||
@@ -849,7 +849,7 @@ int WI_fragSum(int playernum)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// JDC hack - negative frags.
|
// JDC hack - negative frags.
|
||||||
frags -= plrs[playernum].frags[playernum];
|
frags -= plrs[playernum].frags[playernum];
|
||||||
// UNUSED if (frags < 0)
|
// UNUSED if (frags < 0)
|
||||||
@@ -889,7 +889,7 @@ void WI_initDeathmatchStats(void)
|
|||||||
dm_totals[i] = 0;
|
dm_totals[i] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
WI_initAnimatedBack();
|
WI_initAnimatedBack();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -900,7 +900,7 @@ void WI_updateDeathmatchStats(void)
|
|||||||
|
|
||||||
int i;
|
int i;
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
boolean stillticking;
|
boolean stillticking;
|
||||||
|
|
||||||
WI_updateAnimatedBack();
|
WI_updateAnimatedBack();
|
||||||
@@ -920,18 +920,18 @@ void WI_updateDeathmatchStats(void)
|
|||||||
dm_totals[i] = WI_fragSum(i);
|
dm_totals[i] = WI_fragSum(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
S_StartSound(0, sfx_barexp);
|
S_StartSound(0, sfx_barexp);
|
||||||
dm_state = 4;
|
dm_state = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (dm_state == 2)
|
if (dm_state == 2)
|
||||||
{
|
{
|
||||||
if (!(bcnt&3))
|
if (!(bcnt&3))
|
||||||
S_StartSound(0, sfx_pistol);
|
S_StartSound(0, sfx_pistol);
|
||||||
|
|
||||||
stillticking = false;
|
stillticking = false;
|
||||||
|
|
||||||
for (i=0 ; i<MAXPLAYERS ; i++)
|
for (i=0 ; i<MAXPLAYERS ; i++)
|
||||||
@@ -953,7 +953,7 @@ void WI_updateDeathmatchStats(void)
|
|||||||
|
|
||||||
if (dm_frags[i][j] < -99)
|
if (dm_frags[i][j] < -99)
|
||||||
dm_frags[i][j] = -99;
|
dm_frags[i][j] = -99;
|
||||||
|
|
||||||
stillticking = true;
|
stillticking = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -961,11 +961,11 @@ void WI_updateDeathmatchStats(void)
|
|||||||
|
|
||||||
if (dm_totals[i] > 99)
|
if (dm_totals[i] > 99)
|
||||||
dm_totals[i] = 99;
|
dm_totals[i] = 99;
|
||||||
|
|
||||||
if (dm_totals[i] < -99)
|
if (dm_totals[i] < -99)
|
||||||
dm_totals[i] = -99;
|
dm_totals[i] = -99;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if (!stillticking)
|
if (!stillticking)
|
||||||
{
|
{
|
||||||
@@ -1008,16 +1008,16 @@ void WI_drawDeathmatchStats(void)
|
|||||||
int w;
|
int w;
|
||||||
|
|
||||||
WI_slamBackground();
|
WI_slamBackground();
|
||||||
|
|
||||||
// draw animated background
|
// draw animated background
|
||||||
WI_drawAnimatedBack();
|
WI_drawAnimatedBack();
|
||||||
WI_drawLF();
|
WI_drawLF();
|
||||||
|
|
||||||
// draw stat titles (top line)
|
// draw stat titles (top line)
|
||||||
V_DrawPatch(DM_TOTALSX-SHORT(total->width)/2,
|
V_DrawPatch(DM_TOTALSX-SHORT(total->width)/2,
|
||||||
DM_MATRIXY-WI_SPACINGY+10,
|
DM_MATRIXY-WI_SPACINGY+10,
|
||||||
total);
|
total);
|
||||||
|
|
||||||
V_DrawPatch(DM_KILLERSX, DM_KILLERSY, killers);
|
V_DrawPatch(DM_KILLERSX, DM_KILLERSY, killers);
|
||||||
V_DrawPatch(DM_VICTIMSX, DM_VICTIMSY, victims);
|
V_DrawPatch(DM_VICTIMSX, DM_VICTIMSY, victims);
|
||||||
|
|
||||||
@@ -1032,7 +1032,7 @@ void WI_drawDeathmatchStats(void)
|
|||||||
V_DrawPatch(x-SHORT(p[i]->width)/2,
|
V_DrawPatch(x-SHORT(p[i]->width)/2,
|
||||||
DM_MATRIXY - WI_SPACINGY,
|
DM_MATRIXY - WI_SPACINGY,
|
||||||
p[i]);
|
p[i]);
|
||||||
|
|
||||||
V_DrawPatch(DM_MATRIXX-SHORT(p[i]->width)/2,
|
V_DrawPatch(DM_MATRIXX-SHORT(p[i]->width)/2,
|
||||||
y,
|
y,
|
||||||
p[i]);
|
p[i]);
|
||||||
@@ -1119,7 +1119,7 @@ void WI_updateNetgameStats(void)
|
|||||||
|
|
||||||
int i;
|
int i;
|
||||||
int fsum;
|
int fsum;
|
||||||
|
|
||||||
boolean stillticking;
|
boolean stillticking;
|
||||||
|
|
||||||
WI_updateAnimatedBack();
|
WI_updateAnimatedBack();
|
||||||
@@ -1163,7 +1163,7 @@ void WI_updateNetgameStats(void)
|
|||||||
else
|
else
|
||||||
stillticking = true;
|
stillticking = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!stillticking)
|
if (!stillticking)
|
||||||
{
|
{
|
||||||
S_StartSound(0, sfx_barexp);
|
S_StartSound(0, sfx_barexp);
|
||||||
@@ -1213,7 +1213,7 @@ void WI_updateNetgameStats(void)
|
|||||||
else
|
else
|
||||||
stillticking = true;
|
stillticking = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!stillticking)
|
if (!stillticking)
|
||||||
{
|
{
|
||||||
S_StartSound(0, sfx_barexp);
|
S_StartSound(0, sfx_barexp);
|
||||||
@@ -1239,7 +1239,7 @@ void WI_updateNetgameStats(void)
|
|||||||
else
|
else
|
||||||
stillticking = true;
|
stillticking = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!stillticking)
|
if (!stillticking)
|
||||||
{
|
{
|
||||||
S_StartSound(0, sfx_pldeth);
|
S_StartSound(0, sfx_pldeth);
|
||||||
@@ -1277,9 +1277,9 @@ void WI_drawNetgameStats(void)
|
|||||||
int pwidth = SHORT(percent->width);
|
int pwidth = SHORT(percent->width);
|
||||||
|
|
||||||
WI_slamBackground();
|
WI_slamBackground();
|
||||||
|
|
||||||
// draw animated background
|
// draw animated background
|
||||||
WI_drawAnimatedBack();
|
WI_drawAnimatedBack();
|
||||||
|
|
||||||
WI_drawLF();
|
WI_drawLF();
|
||||||
|
|
||||||
@@ -1292,7 +1292,7 @@ void WI_drawNetgameStats(void)
|
|||||||
|
|
||||||
V_DrawPatch(NG_STATSX+3*NG_SPACINGX-SHORT(secret->width),
|
V_DrawPatch(NG_STATSX+3*NG_SPACINGX-SHORT(secret->width),
|
||||||
NG_STATSY, secret);
|
NG_STATSY, secret);
|
||||||
|
|
||||||
if (dofrags)
|
if (dofrags)
|
||||||
V_DrawPatch(NG_STATSX+4*NG_SPACINGX-SHORT(frags->width),
|
V_DrawPatch(NG_STATSX+4*NG_SPACINGX-SHORT(frags->width),
|
||||||
NG_STATSY, frags);
|
NG_STATSY, frags);
|
||||||
@@ -1447,7 +1447,7 @@ void WI_updateStats(void)
|
|||||||
void WI_drawStats(void)
|
void WI_drawStats(void)
|
||||||
{
|
{
|
||||||
// line height
|
// line height
|
||||||
int lh;
|
int lh;
|
||||||
|
|
||||||
lh = (3*SHORT(num[0]->height))/2;
|
lh = (3*SHORT(num[0]->height))/2;
|
||||||
|
|
||||||
@@ -1455,7 +1455,7 @@ void WI_drawStats(void)
|
|||||||
|
|
||||||
// draw animated background
|
// draw animated background
|
||||||
WI_drawAnimatedBack();
|
WI_drawAnimatedBack();
|
||||||
|
|
||||||
WI_drawLF();
|
WI_drawLF();
|
||||||
|
|
||||||
V_DrawPatch(SP_STATSX, SP_STATSY, kills);
|
V_DrawPatch(SP_STATSX, SP_STATSY, kills);
|
||||||
@@ -1514,7 +1514,7 @@ void WI_checkForAccelerate(void)
|
|||||||
void WI_Ticker(void)
|
void WI_Ticker(void)
|
||||||
{
|
{
|
||||||
// counter for general background animation
|
// counter for general background animation
|
||||||
bcnt++;
|
bcnt++;
|
||||||
|
|
||||||
if (bcnt == 1)
|
if (bcnt == 1)
|
||||||
{
|
{
|
||||||
@@ -1522,7 +1522,7 @@ void WI_Ticker(void)
|
|||||||
if ( gamemode == commercial )
|
if ( gamemode == commercial )
|
||||||
S_ChangeMusic(mus_dm2int, true);
|
S_ChangeMusic(mus_dm2int, true);
|
||||||
else
|
else
|
||||||
S_ChangeMusic(mus_inter, true);
|
S_ChangeMusic(mus_inter, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
WI_checkForAccelerate();
|
WI_checkForAccelerate();
|
||||||
@@ -1534,11 +1534,11 @@ void WI_Ticker(void)
|
|||||||
else if (netgame) WI_updateNetgameStats();
|
else if (netgame) WI_updateNetgameStats();
|
||||||
else WI_updateStats();
|
else WI_updateStats();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ShowNextLoc:
|
case ShowNextLoc:
|
||||||
WI_updateShowNextLoc();
|
WI_updateShowNextLoc();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NoState:
|
case NoState:
|
||||||
WI_updateNoState();
|
WI_updateNoState();
|
||||||
break;
|
break;
|
||||||
@@ -1593,7 +1593,7 @@ static void WI_loadUnloadData(load_callback_t callback)
|
|||||||
if (wbs->epsd != 1 || j != 8)
|
if (wbs->epsd != 1 || j != 8)
|
||||||
{
|
{
|
||||||
// animations
|
// animations
|
||||||
DEH_snprintf(name, 9, "WIA%d%.2d%.2d", wbs->epsd, j, i);
|
DEH_snprintf(name, 9, "WIA%d%02d%02d", wbs->epsd, j, i);
|
||||||
callback(name, &a->p[i]);
|
callback(name, &a->p[i]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1744,7 +1744,7 @@ void WI_unloadData(void)
|
|||||||
|
|
||||||
// We do not free these lumps as they are shared with the status
|
// We do not free these lumps as they are shared with the status
|
||||||
// bar code.
|
// bar code.
|
||||||
|
|
||||||
// W_ReleaseLumpName("STFST01");
|
// W_ReleaseLumpName("STFST01");
|
||||||
// W_ReleaseLumpName("STFDEAD0");
|
// W_ReleaseLumpName("STFDEAD0");
|
||||||
}
|
}
|
||||||
@@ -1761,11 +1761,11 @@ void WI_Drawer (void)
|
|||||||
else
|
else
|
||||||
WI_drawStats();
|
WI_drawStats();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ShowNextLoc:
|
case ShowNextLoc:
|
||||||
WI_drawShowNextLoc();
|
WI_drawShowNextLoc();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NoState:
|
case NoState:
|
||||||
WI_drawNoState();
|
WI_drawNoState();
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user