Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1a0e9b5650 | ||
|
|
5c325b2b40 | ||
|
|
27317cccd3 |
No files matched your search
@@ -1,21 +0,0 @@
|
||||
---
|
||||
- name: Sending artifacts to the server
|
||||
hosts: all
|
||||
gather_facts: no
|
||||
|
||||
tasks:
|
||||
- name: Creating version artefacts root folder
|
||||
file:
|
||||
path: "{{ storage_path }}/{{ version }}"
|
||||
state: directory
|
||||
owner: "{{ storage_user }}"
|
||||
group: "{{ storage_user }}"
|
||||
mode: '0755'
|
||||
|
||||
- name: Sending artifacts
|
||||
ansible.builtin.copy:
|
||||
src: "{{ artifact_path }}/"
|
||||
dest: "{{ storage_path }}/{{ version }}/"
|
||||
owner: "{{ storage_user }}"
|
||||
group: "{{ storage_user }}"
|
||||
mode: preserve
|
||||
@@ -1,119 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
# SPDX-FileCopyrightText: 2026 KolibriOS team
|
||||
|
||||
# Kernel codestyle checker (port of the former checker.pl).
|
||||
# Reads an assembly source file and validates the KolibriOS kernel style rules.
|
||||
# Usage: check-kernel-codestyle.py <file> (falls back to stdin if none given)
|
||||
# Exits 0 when clean; on the first violation prints "Style error ..." to stderr
|
||||
# and exits 1.
|
||||
|
||||
import re
|
||||
import sys
|
||||
|
||||
# Full FASM mnemonic set, taken verbatim from the original checker.pl. Only these
|
||||
# tokens are treated as instructions for the indent/spacing rules below.
|
||||
_MNEMONICS = r"""stdcall|ccall|invoke|cinvoke|bt|in|ja|jb|jc|je|jg|jl|jo|jp|js|jz|or|aaa|aad|aam|aas|adc|add|and|bsf|bsr|btc|btr|bts|cbw|cdq|clc|cld|cli|cmc|cmp|cqo|cwd|daa|das|dec|div|fld|fst|hlt|inc|ins|int|jae|jbe|jge|jle|jmp|jna|jnb|jnc|jne|jng|jnl|jno|jnp|jns|jnz|jpe|jpo|lar|lds|lea|les|lfs|lgs|lsl|lss|ltr|mov|mul|neg|nop|not|out|pop|por|rcl|rcr|rep|ret|rol|ror|rsm|sal|sar|sbb|shl|shr|stc|std|sti|str|sub|ud2|xor|arpl|call|cdqe|clgi|clts|cmps|cwde|dppd|dpps|emms|fabs|fadd|fbld|fchs|fcom|fcos|fdiv|feni|fild|fist|fld1|fldz|fmul|fnop|fsin|fstp|fsub|ftst|fxam|fxch|idiv|imul|insb|insd|insw|int1|int3|into|invd|iret|jcxz|jnae|jnbe|jnge|jnle|lahf|lgdt|lidt|lldt|lmsw|lock|lods|loop|movd|movq|movs|orpd|orps|outs|pand|popa|popd|popf|popq|popw|push|pxor|repe|repz|retd|retf|retn|retq|retw|sahf|salc|scas|seta|setb|setc|sete|setg|setl|seto|setp|sets|setz|sgdt|shld|shrd|sidt|sldt|smsw|stgi|stos|test|verr|verw|vpor|wait|xadd|xchg|xlat|addpd|addps|addsd|addss|andpd|andps|bound|bswap|cmova|cmovb|cmovc|cmove|cmovg|cmovl|cmovo|cmovp|cmovs|cmovz|cmppd|cmpps|cmpsb|cmpsd|cmpsq|cmpss|cmpsw|cpuid|crc32|divpd|divps|divsd|divss|enter|extrq|f2xm1|faddp|fbstp|fclex|fcomi|fcomp|fdisi|fdivp|fdivr|femms|ffree|fiadd|ficom|fidiv|fimul|finit|fistp|fisub|fldcw|fldpi|fmulp|fneni|fprem|fptan|fsave|fsqrt|fstcw|fstsw|fsubp|fsubr|fucom|fwait|fyl2x|icebp|iretd|iretq|iretw|jecxz|jrcxz|lddqu|leave|lodsb|lodsd|lodsq|lodsw|loopd|loope|loopq|loopw|loopz|lzcnt|maxpd|maxps|maxsd|maxss|minpd|minps|minsd|minss|movbe|movsb|movsd|movsq|movss|movsw|movsx|movzx|mulpd|mulps|mulsd|mulss|mwait|outsb|outsd|outsw|pabsb|pabsd|pabsw|paddb|paddd|paddq|paddw|pandn|pause|pavgb|pavgw|pf2id|pf2iw|pfacc|pfadd|pfmax|pfmin|pfmul|pfrcp|pfsub|pi2fd|pi2fw|popad|popaw|popfd|popfq|popfw|pslld|psllq|psllw|psrad|psraw|psrld|psrlq|psrlw|psubb|psubd|psubq|psubw|ptest|pusha|pushd|pushf|pushq|pushw|rcpps|rcpss|rdmsr|rdpmc|rdtsc|repne|repnz|retfd|retfq|retfw|retnd|retnq|retnw|scasb|scasd|scasq|scasw|setae|setbe|setge|setle|setna|setnb|setnc|setne|setng|setnl|setno|setnp|setns|setnz|setpe|setpo|stosb|stosd|stosq|stosw|subpd|subps|subsd|subss|vdppd|vdpps|vmovd|vmovq|vmrun|vmxon|vorpd|vorps|vpand|vpxor|wrmsr|xlatb|xorpd|xorps|xsave|aesdec|aesenc|aesimc|andnpd|andnps|cmovae|cmovbe|cmovge|cmovle|cmovna|cmovnb|cmovnc|cmovne|cmovng|cmovnl|cmovno|cmovnp|cmovns|cmovnz|cmovpe|cmovpo|comisd|comiss|fcmovb|fcmove|fcmovu|fcomip|fcompp|fdivrp|ffreep|ficomp|fidivr|fisttp|fisubr|fldenv|fldl2e|fldl2t|fldlg2|fldln2|fnclex|fndisi|fninit|fnsave|fnstcw|fnstsw|fpatan|fprem1|frstor|frstpm|fsaved|fsavew|fscale|fsetpm|fstenv|fsubrp|fucomi|fucomp|fxsave|getsec|haddpd|haddps|hsubpd|hsubps|invept|invlpg|lfence|looped|loopeq|loopew|loopne|loopnz|loopzd|loopzq|loopzw|mfence|movapd|movaps|movdqa|movdqu|movhpd|movhps|movlpd|movlps|movnti|movntq|movsxd|movupd|movups|paddsb|paddsw|pextrb|pextrd|pextrq|pextrw|pfnacc|pfsubr|phaddd|phaddw|phsubd|phsubw|pinsrb|pinsrd|pinsrq|pinsrw|pmaxsb|pmaxsd|pmaxsw|pmaxub|pmaxud|pmaxuw|pminsb|pminsd|pminsw|pminub|pminud|pminuw|pmuldq|pmulhw|pmulld|pmullw|popcnt|psadbw|pshufb|pshufd|pshufw|psignb|psignd|psignw|pslldq|psrldq|psubsb|psubsw|pswapd|pushad|pushaw|pushfd|pushfq|pushfw|rdmsrq|rdrand|rdtscp|setalc|setnae|setnbe|setnge|setnle|sfence|shufpd|shufps|skinit|sqrtpd|sqrtps|sqrtsd|sqrtss|swapgs|sysret|vaddpd|vaddps|vaddsd|vaddss|vandpd|vandps|vcmppd|vcmpps|vcmpsd|vcmpss|vdivpd|vdivps|vdivsd|vdivss|vlddqu|vmaxpd|vmaxps|vmaxsd|vmaxss|vmcall|vminpd|vminps|vminsd|vminss|vmload|vmovsd|vmovss|vmread|vmsave|vmulpd|vmulps|vmulsd|vmulss|vmxoff|vpabsb|vpabsd|vpabsw|vpaddb|vpaddd|vpaddq|vpaddw|vpandn|vpavgb|vpavgw|vpcmov|vpcomb|vpcomd|vpcomq|vpcomw|vpperm|vprotb|vprotd|vprotq|vprotw|vpshab|vpshad|vpshaq|vpshaw|vpshlb|vpshld|vpshlq|vpshlw|vpslld|vpsllq|vpsllw|vpsrad|vpsraw|vpsrld|vpsrlq|vpsrlw|vpsubb|vpsubd|vpsubq|vpsubw|vptest|vrcpps|vrcpss|vsubpd|vsubps|vsubsd|vsubss|vxorpd|vxorps|wbinvd|wrmsrq|xgetbv|xrstor|xsetbv|blendpd|blendps|clflush|cmovnae|cmovnbe|cmovnge|cmovnle|cmpeqpd|cmpeqps|cmpeqsd|cmpeqss|cmplepd|cmpleps|cmplesd|cmpless|cmpltpd|cmpltps|cmpltsd|cmpltss|cmpxchg|fcmovbe|fcmovnb|fcmovne|fcmovnu|fdecstp|fincstp|fldenvd|fldenvw|fnsaved|fnsavew|fnstenv|frndint|frstord|frstorw|fsincos|fstenvd|fstenvw|fucomip|fucompp|fxrstor|fxtract|fyl2xp1|insertq|invlpga|invvpid|ldmxcsr|loopned|loopneq|loopnew|loopnzd|loopnzq|loopnzw|monitor|movddup|movdq2q|movhlps|movlhps|movntdq|movntpd|movntps|movntsd|movntss|movq2dq|mpsadbw|paddusb|paddusw|palignr|pavgusb|pblendw|pcmpeqb|pcmpeqd|pcmpeqq|pcmpeqw|pcmpgtb|pcmpgtd|pcmpgtq|pcmpgtw|pfcmpeq|pfcmpge|pfcmpgt|pfpnacc|pfrsqrt|phaddsw|phsubsw|pmaddwd|pmulhrw|pmulhuw|pmuludq|pshufhw|pshuflw|psubusb|psubusw|roundpd|roundps|roundsd|roundss|rsqrtps|rsqrtss|stmxcsr|syscall|sysexit|sysretq|ucomisd|ucomiss|vaesdec|vaesenc|vaesimc|vandnpd|vandnps|vcomisd|vcomiss|vfrczpd|vfrczps|vfrczsd|vfrczss|vhaddpd|vhaddps|vhsubpd|vhsubps|vmclear|vmmcall|vmovapd|vmovaps|vmovdqa|vmovdqu|vmovhpd|vmovhps|vmovlpd|vmovlps|vmovupd|vmovups|vmptrld|vmptrst|vmwrite|vpaddsb|vpaddsw|vpcomub|vpcomLine truncated
|
||||
|
||||
# label? indent mnemonic spaces args comment?
|
||||
_LINE_RE = re.compile(
|
||||
r'^(\s*[^;"\'\s$][^;"\'\s]*:)?(\s*)(' + _MNEMONICS + r')(\s+)([^;]*)(;.*)?$'
|
||||
)
|
||||
|
||||
# Mnemonics that always take exactly one space before their arguments, like the
|
||||
# 8-char-or-longer ones, regardless of their short length.
|
||||
_LONG_MNEMONICS = {"rep", "repz", "repe", "repnz", "repne", "lock"}
|
||||
|
||||
|
||||
def fail(name, lineno, msg):
|
||||
sys.stderr.write(f"Style error in {name}:{lineno}: {msg}\n")
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
def main():
|
||||
if len(sys.argv) > 1:
|
||||
name = sys.argv[1]
|
||||
with open(name, "rb") as f:
|
||||
raw_lines = f.readlines()
|
||||
else:
|
||||
name = ""
|
||||
raw_lines = sys.stdin.buffer.readlines()
|
||||
|
||||
# None -> not inside a line continuation
|
||||
# -1 -> continuation active, but the starting column is unknown
|
||||
# >= 0 -> continuation active; following lines must indent by this column
|
||||
continued = None
|
||||
|
||||
for lineno, raw in enumerate(raw_lines, start=1):
|
||||
# Rule 6. All code and text files should be in UTF-8 without BOM.
|
||||
if lineno == 1 and raw[:3] == b"\xef\xbb\xbf":
|
||||
fail(name, lineno, "BOM is not allowed.")
|
||||
try:
|
||||
line = raw.decode("utf-8")
|
||||
except UnicodeDecodeError:
|
||||
fail(name, lineno, "the file must be in UTF-8.")
|
||||
|
||||
# Rule 1. No tab characters allowed.
|
||||
if "\t" in line:
|
||||
fail(name, lineno, "no tab characters allowed.")
|
||||
|
||||
if continued is not None:
|
||||
m = re.match(r'^(\s*)[^;]', line)
|
||||
if continued != -1 and m and len(m.group(1)) != continued:
|
||||
fail(name, lineno,
|
||||
"arguments continued in the next line must start from the "
|
||||
"same position as in the first line")
|
||||
if not re.search(r'\\\s*(;.*)?$', line):
|
||||
continued = None
|
||||
continue
|
||||
|
||||
m = _LINE_RE.match(line)
|
||||
if m:
|
||||
label = m.group(1) or ""
|
||||
indent, mnem, spaces, args = m.group(2), m.group(3), m.group(4), m.group(5)
|
||||
|
||||
# Rule 2. Any label must be on a separate line. It is not allowed to
|
||||
# have a label and anything except a comment on the same line.
|
||||
if label:
|
||||
fail(name, lineno, "any label must be on a separate line.")
|
||||
|
||||
# Rule 3. Lines with commands must start with 8 spaces.
|
||||
# A mnemonic is short if its length is less than 8.
|
||||
# Arguments for short mnemonics must start in column 16.
|
||||
# Arguments for long mnemonics must be separated from the mnemonic by
|
||||
# exactly one space.
|
||||
if indent != " ":
|
||||
fail(name, lineno, "indent for commands must be 8 spaces.")
|
||||
if len(mnem) >= 8 or mnem in _LONG_MNEMONICS:
|
||||
if args != "" and spaces != " ":
|
||||
fail(name, lineno,
|
||||
"arguments for long mnemonics must be separated from the "
|
||||
"mnemonic by exactly one space.")
|
||||
else:
|
||||
if args != "" and spaces != " " * (8 - len(mnem)):
|
||||
fail(name, lineno,
|
||||
"arguments for short mnemonics must start in the column 16.")
|
||||
|
||||
args = re.sub(r'\s*$', "", args)
|
||||
# Arguments must be separated with a comma and exactly one space after
|
||||
# a comma. Split off quoted substrings (indices 1, 2 mod 3) so commas
|
||||
# inside string literals are not checked.
|
||||
parts = re.split(r'(["\'])(.*?\1)', args)
|
||||
for i, segment in enumerate(parts):
|
||||
if i % 3 == 0 and segment is not None and \
|
||||
re.search(r',(\s{2,})?([^\\\s]|$)', segment):
|
||||
fail(name, lineno,
|
||||
"arguments must be separated with a comma and exactly one "
|
||||
"space after a comma.")
|
||||
|
||||
if re.search(r'\\$', args):
|
||||
continued = len(indent) + len(mnem) + len(spaces)
|
||||
else:
|
||||
if re.search(r'\\\s*(;.*)?$', line):
|
||||
continued = -1
|
||||
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -1,101 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# Sync tup's mtime/mtime_ns in .tup/db with the actual filesystem ctime.
|
||||
#
|
||||
# On Linux, tup uses st_ctim (ctime) for change detection, not st_mtim.
|
||||
# After restoring a build cache with cp -a, files get new ctimes while the
|
||||
# database still has old values. This script updates the database to match.
|
||||
#
|
||||
# Files in changed-files-list (changed since the cache's commit) are forced
|
||||
# dirty instead, so tup still rebuilds them and their dependents.
|
||||
#
|
||||
# Usage: python3 sync-tup-ctime.py [path/to/.tup/db] [changed-files-list]
|
||||
|
||||
import os
|
||||
import sqlite3
|
||||
import sys
|
||||
|
||||
db_path = sys.argv[1] if len(sys.argv) > 1 else ".tup/db"
|
||||
if not os.path.isfile(db_path):
|
||||
sys.exit(f"Database not found: {db_path}")
|
||||
|
||||
# Paths changed since the cache's commit: keep dirty so tup rebuilds them.
|
||||
dirty = set()
|
||||
if len(sys.argv) > 2 and sys.argv[2]:
|
||||
if os.path.isfile(sys.argv[2]):
|
||||
with open(sys.argv[2], encoding="utf-8") as f:
|
||||
dirty = {line.strip() for line in f if line.strip()}
|
||||
else:
|
||||
print(f"Warning: changed-files list not found: {sys.argv[2]}")
|
||||
|
||||
db = sqlite3.connect(db_path)
|
||||
# Map every node id -> (parent dir id, name). Any node type can be a parent
|
||||
# directory in the chain (generated/variant dirs are not type 0/2), so the map
|
||||
# must cover all of them or path resolution yields a bare filename and stat fails.
|
||||
nodes = {
|
||||
node_id: (parent_id, name)
|
||||
for node_id, parent_id, name in db.execute(
|
||||
"select id, dir, name from node"
|
||||
)
|
||||
}
|
||||
paths, updated, forced, skipped = {}, 0, 0, []
|
||||
matched = set() # dirty paths that actually resolved to a tup node
|
||||
|
||||
for node_id, dir_id, name, ntype, old_sec, old_ns in db.execute(
|
||||
"select id, dir, name, type, mtime, mtime_ns from node where type in (0, 2, 4)"
|
||||
):
|
||||
if dir_id not in paths:
|
||||
parts, cur, seen = [], dir_id, set()
|
||||
while cur in nodes and cur not in seen:
|
||||
seen.add(cur)
|
||||
cur, part = nodes[cur]
|
||||
parts.append(part)
|
||||
paths[dir_id] = "/".join(reversed(parts))
|
||||
# Build the path with forward slashes (tup stores them that way and git
|
||||
# emits them that way), independent of the host os.sep. tup's root dir
|
||||
# node is named ".", so paths come out as "./foo/bar"; strip that prefix
|
||||
# so they match git's plain "foo/bar" entries in the dirty set.
|
||||
path = paths[dir_id] + "/" + name if paths[dir_id] else name
|
||||
if path.startswith("./"):
|
||||
path = path[2:]
|
||||
|
||||
# Changed since the cache base: force a rebuild instead of aligning.
|
||||
if path in dirty:
|
||||
matched.add(path)
|
||||
if old_sec != 0 or old_ns != 0:
|
||||
db.execute(
|
||||
"update node set mtime=0, mtime_ns=0 where id=?", (node_id,))
|
||||
forced += 1
|
||||
continue
|
||||
|
||||
try:
|
||||
stat = os.stat(path)
|
||||
except OSError:
|
||||
skipped.append((path, ntype))
|
||||
continue
|
||||
sec = int(stat.st_ctime)
|
||||
ns = stat.st_ctime_ns - sec * 1_000_000_000
|
||||
if sec == old_sec and ns == old_ns:
|
||||
continue
|
||||
db.execute("update node set mtime=?, mtime_ns=? where id=?", (sec, ns, node_id))
|
||||
updated += 1
|
||||
|
||||
db.commit()
|
||||
db.close()
|
||||
|
||||
print(f"Aligned {updated} nodes, forced {forced} changed nodes dirty "
|
||||
f"({len(matched)}/{len(dirty)} changed paths matched a tup node), "
|
||||
f"skipped {len(skipped)} missing files")
|
||||
|
||||
# A changed path that matches no tup node is normal (docs, CI files, etc.),
|
||||
# but if NONE of them match while the list is non-empty, the path format from
|
||||
# git almost certainly disagrees with tup's node paths -- which means changed
|
||||
# files would silently NOT be rebuilt. Make that loud instead of silent.
|
||||
if dirty and not matched:
|
||||
print("WARNING: no changed path matched a tup node -- path format "
|
||||
"mismatch likely; changed files may NOT be rebuilt.")
|
||||
|
||||
if skipped:
|
||||
from collections import Counter
|
||||
by_type = Counter(ntype for _, ntype in skipped)
|
||||
print("Skipped by node type: "
|
||||
+ ", ".join(f"type {t}: {c}" for t, c in sorted(by_type.items())))
|
||||
+101
-175
@@ -1,40 +1,41 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
# SPDX-FileCopyrightText: 2026 KolibriOS team
|
||||
|
||||
# This workflow is for commits in main branch
|
||||
# to get OS night build images and deploy them to the server
|
||||
|
||||
# SPDX-FileCopyrightText: 2025 KolibriOS team
|
||||
|
||||
name: 'Build system'
|
||||
|
||||
# Official build of the main branch
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
branches:
|
||||
- 'main'
|
||||
|
||||
jobs:
|
||||
codestyle:
|
||||
name: "Check kernel codestyle"
|
||||
runs-on: kolibri-toolchain
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Check codestyle
|
||||
run: |
|
||||
find kernel/trunk -iname '*.asm' -or -iname '*.inc' -exec bash -c "echo {}; cat {} | perl .gitea/workflows/checker.pl" \;
|
||||
|
||||
build:
|
||||
name: 'Build (${{ matrix.lang }})'
|
||||
name: 'Build'
|
||||
runs-on: kolibri-toolchain
|
||||
# one parallel job per language variant
|
||||
strategy:
|
||||
matrix:
|
||||
lang: [en_US, ru_RU, es_ES]
|
||||
|
||||
steps:
|
||||
# full history is needed for the revision id (commit count)
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
fetch-depth: 0
|
||||
filter: blob:none
|
||||
|
||||
- name: Get describe
|
||||
id: vars
|
||||
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITEA_OUTPUT
|
||||
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ TOOLCHAIN ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
# cache the toolchain sources by hash to not rebuild them every time
|
||||
- name: Get toolchain hash
|
||||
id: toolchain-hash
|
||||
run: |
|
||||
@@ -46,15 +47,13 @@ jobs:
|
||||
f=$(find ${{ gitea.workspace }}/programs/develop/clink/ -type f -print0 | sort -z | xargs -0 sha1sum)
|
||||
echo hash=$(echo $a $b $c $d $e $f | sha1sum | awk '{print $1}') >> $GITEA_OUTPUT
|
||||
|
||||
# restore previously cached toolchain by hash
|
||||
- name: Restore toolchain
|
||||
id: cache-toolchain
|
||||
uses: actions/cache@v4
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: /home/autobuild
|
||||
key: kolibri-toolchain-${{ steps.toolchain-hash.outputs.hash }}
|
||||
|
||||
# build toolchain if cache miss or obsolote
|
||||
- name: Build and install C--
|
||||
if: steps.cache-toolchain.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
@@ -97,192 +96,119 @@ jobs:
|
||||
chmod a+x clink
|
||||
mv clink /home/autobuild/tools/win32/bin/clink
|
||||
|
||||
# move freshly built toolchain into the path that gets cached
|
||||
- name: Prepare cache folder
|
||||
run: |
|
||||
rm /home/autobuild
|
||||
mv /root/autobuild /home/autobuild
|
||||
if: steps.cache-toolchain.outputs.cache-hit != 'true'
|
||||
|
||||
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ TUP ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
# cache tup DB and this language's build dir, keyed by commit;
|
||||
- name: Cache Tup
|
||||
id: cache-tup
|
||||
uses: actions/cache@v4
|
||||
- name: Save toolchain
|
||||
if: steps.cache-toolchain.outputs.cache-hit != 'true'
|
||||
uses: actions/cache/save@v4
|
||||
with:
|
||||
path: |
|
||||
.tup
|
||||
build-${{ matrix.lang }}
|
||||
key: tup-${{ gitea.sha }}
|
||||
restore-keys: |
|
||||
tup-
|
||||
path: /home/autobuild
|
||||
key: kolibri-toolchain-${{ steps.toolchain-hash.outputs.hash }}
|
||||
|
||||
# check if a cache was restored or if we need to start fresh build
|
||||
- name: Check if cache was restored
|
||||
id: check-tup-cache
|
||||
run: |
|
||||
if [ -d ${{ gitea.workspace}}/.tup ] ; then
|
||||
echo "cache_restored=true" >> $GITEA_OUTPUT
|
||||
fi
|
||||
|
||||
# cache restore resets ctimes; realign tup DB to skip a full rebuild,
|
||||
# but keep files changed since the cache's commit dirty so tup rebuilds them
|
||||
- name: Sync tup DB with filesystem ctime
|
||||
if: steps.check-tup-cache.outputs.cache_restored == 'true'
|
||||
run: |
|
||||
DIRTY=$(mktemp)
|
||||
BASE=$(cat .tup/build-commit 2>/dev/null || true)
|
||||
if [ -n "$BASE" ] && git cat-file -e "${BASE}^{commit}" 2>/dev/null; then
|
||||
git -c core.quotePath=false diff --name-only "$BASE" HEAD > "$DIRTY"
|
||||
echo "Cache built at $BASE; $(wc -l < "$DIRTY") changed files kept dirty"
|
||||
python3 .gitea/utils/sync-tup-ctime.py .tup/db "$DIRTY"
|
||||
else
|
||||
echo "No usable cache base commit; skipping sync (tup rebuilds all)"
|
||||
fi
|
||||
|
||||
# write the variant config
|
||||
- name: Configure tup
|
||||
run: |
|
||||
export ROOT=${{ gitea.workspace }}
|
||||
echo "CONFIG_KPACK_CMD= && kpack --nologo %o" > ${{ matrix.lang }}.config
|
||||
echo "CONFIG_KERPACK_CMD= && kerpack %o" >> ${{ matrix.lang }}.config
|
||||
echo "CONFIG_PESTRIP_CMD= && EXENAME=%o fasm $ROOT/data/common/pestrip.asm %o" >> ${{ matrix.lang }}.config
|
||||
echo "CONFIG_NO_MSVC=full" >> ${{ matrix.lang }}.config
|
||||
echo "CONFIG_INSERT_REVISION_ID=1" >> ${{ matrix.lang }}.config
|
||||
echo "CONFIG_LANG=${{ matrix.lang }}" >> ${{ matrix.lang }}.config
|
||||
echo "CONFIG_BUILD_TYPE=${{ matrix.lang }}" >> ${{ matrix.lang }}.config
|
||||
cd ${{ gitea.workspace }}
|
||||
|
||||
# initialize the tup DB and register the variant
|
||||
- name: Init tup
|
||||
if: steps.check-tup-cache.outputs.cache_restored != 'true'
|
||||
run: |
|
||||
export ROOT=${{ gitea.workspace }}
|
||||
echo "CONFIG_KPACK_CMD= && kpack --nologo %o" | tee en_US.config ru_RU.config es_ES.config
|
||||
echo "CONFIG_KERPACK_CMD= && kerpack %o" | tee -a en_US.config ru_RU.config es_ES.config
|
||||
echo "CONFIG_PESTRIP_CMD= && EXENAME=%o fasm $ROOT/data/common/pestrip.asm %o" | tee -a en_US.config ru_RU.config es_ES.config
|
||||
echo "CONFIG_NO_MSVC=full" | tee -a en_US.config ru_RU.config es_ES.config
|
||||
echo "CONFIG_INSERT_REVISION_ID=1" | tee -a en_US.config ru_RU.config es_ES.config
|
||||
|
||||
tup -v
|
||||
tup init
|
||||
tup variant ${{ matrix.lang }}.config
|
||||
|
||||
# build the image for language variant
|
||||
- name: Build KolibriOS
|
||||
# Configure en_US
|
||||
echo "CONFIG_LANG=en_US" >> en_US.config
|
||||
echo "CONFIG_BUILD_TYPE=en_US" >> en_US.config
|
||||
tup variant en_US.config
|
||||
|
||||
# Configure ru_RU
|
||||
echo "CONFIG_LANG=ru_RU" >> ru_RU.config
|
||||
echo "CONFIG_BUILD_TYPE=ru_RU" >> ru_RU.config
|
||||
tup variant ru_RU.config
|
||||
|
||||
# Configure es_ES
|
||||
echo "CONFIG_LANG=es_ES" >> es_ES.config
|
||||
echo "CONFIG_BUILD_TYPE=es_ES" >> es_ES.config
|
||||
tup variant es_ES.config
|
||||
|
||||
# -------------------------- Build en_US ------------------------- #
|
||||
- name: (en_US) Build KolibriOS
|
||||
run: |
|
||||
export PATH=/home/autobuild/tools/win32/bin:$PATH
|
||||
source kos32-export-env-vars ${{ gitea.workspace }}
|
||||
tup build-${{ matrix.lang }}
|
||||
tup build-en_US
|
||||
|
||||
# stamp the cache with its commit so later builds diff against it
|
||||
- name: Record cache base commit
|
||||
run: echo "${{ gitea.sha }}" > .tup/build-commit
|
||||
|
||||
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ARTIFACTS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
# version string (tag + commit count + sha) for the artifact names
|
||||
- name: Get describe
|
||||
id: vars
|
||||
run: echo "descr=$(git describe --tags)" >> $GITEA_OUTPUT
|
||||
|
||||
# rename build outputs to their final names so artifacts are bare files
|
||||
- name: Rename images
|
||||
run: |
|
||||
for ext in img iso raw; do
|
||||
cp "build-${{ matrix.lang }}/data/kolibri.$ext" \
|
||||
"kolibrios-${{ steps.vars.outputs.descr }}-${{ matrix.lang }}.$ext"
|
||||
done
|
||||
|
||||
#publish the three images; longer retention for the floppy image.
|
||||
- name: Upload floppy image
|
||||
- name: (en_US) Upload floppy image
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: kolibrios-${{ steps.vars.outputs.descr }}-${{ matrix.lang }}.img
|
||||
path: kolibrios-${{ steps.vars.outputs.descr }}-${{ matrix.lang }}.img
|
||||
retention-days: 90
|
||||
name: kolibrios-en_US-${{ steps.vars.outputs.sha_short }}.img
|
||||
path: build-en_US/data/kolibri.img
|
||||
|
||||
- name: Upload CD image
|
||||
- name: (en_US) Upload CD image
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: kolibrios-${{ steps.vars.outputs.descr }}-${{ matrix.lang }}.iso
|
||||
path: kolibrios-${{ steps.vars.outputs.descr }}-${{ matrix.lang }}.iso
|
||||
retention-days: 30
|
||||
name: kolibrios-en_US-${{ steps.vars.outputs.sha_short }}.iso
|
||||
path: build-en_US/data/kolibri.iso
|
||||
|
||||
- name: Upload raw image
|
||||
- name: (en_US) Upload raw image
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: kolibrios-${{ steps.vars.outputs.descr }}-${{ matrix.lang }}.raw
|
||||
path: kolibrios-${{ steps.vars.outputs.descr }}-${{ matrix.lang }}.raw
|
||||
retention-days: 15
|
||||
name: kolibrios-en_US-${{ steps.vars.outputs.sha_short }}.raw
|
||||
path: build-en_US/data/kolibri.raw
|
||||
|
||||
deploy:
|
||||
name: "Publish Images"
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: ghcr.io/vicchi/gitea-actions:3.10-slim-bullseye
|
||||
needs: build
|
||||
# -------------------------- Build ru_RU ------------------------- #
|
||||
- name: (ru_RU) Build KolibriOS
|
||||
run: |
|
||||
export PATH=/home/autobuild/tools/win32/bin:$PATH
|
||||
source kos32-export-env-vars ${{ gitea.workspace }}
|
||||
tup build-ru_RU
|
||||
|
||||
steps:
|
||||
# checkout@v4 needs Node 20; the deploy container ships an older Node, so use v3 here
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Download artifacts
|
||||
uses: actions/download-artifact@v3
|
||||
- name: (ru_RU) Upload floppy image
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
pattern: "*"
|
||||
path: ./artifacts
|
||||
merge-multiple: true
|
||||
name: kolibrios-ru_RU-${{ steps.vars.outputs.sha_short }}.img
|
||||
path: build-ru_RU/data/kolibri.img
|
||||
|
||||
- name: Normalize artifacts layout
|
||||
id: normalize
|
||||
- name: (ru_RU) Upload CD image
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: kolibrios-ru_RU-${{ steps.vars.outputs.sha_short }}.iso
|
||||
path: build-ru_RU/data/kolibri.iso
|
||||
|
||||
- name: (ru_RU) Upload raw image
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: kolibrios-ru_RU-${{ steps.vars.outputs.sha_short }}.raw
|
||||
path: build-ru_RU/data/kolibri.raw
|
||||
|
||||
# -------------------------- Build es_ES ------------------------- #
|
||||
- name: (es_ES) Build KolibriOS
|
||||
run: |
|
||||
set -eu
|
||||
export PATH=/home/autobuild/tools/win32/bin:$PATH
|
||||
source kos32-export-env-vars ${{ gitea.workspace }}
|
||||
tup build-es_ES
|
||||
|
||||
rm -rf ./norm-artifacts
|
||||
mkdir -p ./norm-artifacts
|
||||
- name: (es_ES) Upload floppy image
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: kolibrios-es_ES-${{ steps.vars.outputs.sha_short }}.img
|
||||
path: build-es_ES/data/kolibri.img
|
||||
|
||||
find ./artifacts -type f \( \
|
||||
-name 'kolibrios-*.img' -o \
|
||||
-name 'kolibrios-*.iso' -o \
|
||||
-name 'kolibrios-*.raw' \
|
||||
\) | while read -r file; do
|
||||
fname="$(basename "$file")" # kolibrios-<descr>-<lang>.<ext>
|
||||
name_without_ext="${fname%.*}"
|
||||
lang="${name_without_ext##*-}"
|
||||
- name: (es_ES) Upload CD image
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: kolibrios-es_ES-${{ steps.vars.outputs.sha_short }}.iso
|
||||
path: build-es_ES/data/kolibri.iso
|
||||
|
||||
mkdir -p "./norm-artifacts/$lang"
|
||||
cp "$file" "./norm-artifacts/$lang/$fname"
|
||||
done
|
||||
|
||||
# derive the version (git describe) from an artifact name:
|
||||
# kolibrios-<descr>-<lang>.<ext> -> <descr>
|
||||
sample="$(find ./norm-artifacts -type f -name 'kolibrios-*' | head -n1)"
|
||||
base="$(basename "${sample%.*}")" # kolibrios-<descr>-<lang>
|
||||
version="${base%-*}" # kolibrios-<descr>
|
||||
version="${version#kolibrios-}" # <descr>
|
||||
echo "version=$version" >> $GITEA_OUTPUT
|
||||
|
||||
find ./norm-artifacts -type f -print
|
||||
|
||||
- name: Setup SSH
|
||||
run: |
|
||||
mkdir -p ~/.ssh
|
||||
chmod 700 ~/.ssh
|
||||
echo "${{ secrets.SSH_KEY }}" > ~/.ssh/id_rsa
|
||||
chmod 600 ~/.ssh/id_rsa
|
||||
ssh-keyscan -H ${{ secrets.STORAGE_SERVER }} >> ~/.ssh/known_hosts
|
||||
|
||||
- name: Install fresh Ansible
|
||||
run: |
|
||||
python3 -m pip install --user --upgrade pip
|
||||
python3 -m pip install --user 'ansible-core>=2.17,<2.18'
|
||||
echo "$HOME/.local/bin" >> $GITHUB_PATH
|
||||
~/.local/bin/ansible --version
|
||||
|
||||
- name: Run Ansible playbook
|
||||
run: |
|
||||
ansible-playbook .gitea/ansible/playbooks/deploy.yml \
|
||||
-i "${{ secrets.STORAGE_SERVER }}," \
|
||||
-u "${{ secrets.STORAGE_USER }}" \
|
||||
-e "storage_user=${{ secrets.STORAGE_USER }}" \
|
||||
-e "storage_path=${{ secrets.STORAGE_PATH }}" \
|
||||
-e "version=${{ steps.normalize.outputs.version }}" \
|
||||
-e "artifact_path=${{ gitea.workspace }}/norm-artifacts" \
|
||||
-v
|
||||
- name: (es_ES) Upload raw image
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: kolibrios-es_ES-${{ steps.vars.outputs.sha_short }}.raw
|
||||
path: build-es_ES/data/kolibri.raw
|
||||
@@ -0,0 +1,54 @@
|
||||
use Encode;
|
||||
while (<STDIN>)
|
||||
{
|
||||
$str = $_;
|
||||
# Rule 6. All code and text files should be in UTF-8 without BOM.
|
||||
if ($. == 1) {
|
||||
die "Style error in @ARGV[0]:$.: BOM is not allowed.\n" if substr($_,0,3) eq "\xEF\xBB\xBF";
|
||||
}
|
||||
unless(defined(eval{decode_utf8($_,Encode::FB_CROAK)})) {
|
||||
die "Style error in @ARGV[0]:$.: the file must be in UTF-8.\n";
|
||||
}
|
||||
# Rule 1. No tab characters allowed.
|
||||
$_ = $str;
|
||||
die "Style error in @ARGV[0]:$.: no tab characters allowed.\n" if m/\t/;
|
||||
if ($continued) {
|
||||
die "Style error in @ARGV[0]:$.: arguments continued in the next line must start from the same position as in the first line\n" if ($continued != -1 && m/^(\s*)[^;]/ && length($1) != $continued);
|
||||
undef $continued unless m/\\\s*(;.*)?$/;
|
||||
} else {
|
||||
# Rule 2. Any label must be on a separate line. It is not allowed to have a label and anything except a comment on the same line.
|
||||
if (m/^(\s*[^;"\x27\s\$][^;"\x27\s]*:)?(\s*)(stdcall|ccall|invoke|cinvoke|bt|in|ja|jb|jc|je|jg|jl|jo|jp|js|jz|or|aaa|aad|aam|aas|adc|add|and|bsf|bsr|btc|btr|bts|cbw|cdq|clc|cld|cli|cmc|cmp|cqo|cwd|daa|das|dec|div|fld|fst|hlt|inc|ins|int|jae|jbe|jge|jle|jmp|jna|jnb|jnc|jne|jng|jnl|jno|jnp|jns|jnz|jpe|jpo|lar|lds|lea|les|lfs|lgs|lsl|lss|ltr|mov|mul|neg|nop|not|out|pop|por|rcl|rcr|rep|ret|rol|ror|rsm|sal|sar|sbb|shl|shr|stc|std|sti|str|sub|ud2|xor|arpl|call|cdqe|clgi|clts|cmps|cwde|dppd|dpps|emms|fabs|fadd|fbld|fchs|fcom|fcos|fdiv|feni|fild|fist|fld1|fldz|fmul|fnop|fsin|fstp|fsub|ftst|fxam|fxch|idiv|imul|insb|insd|insw|int1|int3|into|invd|iret|jcxz|jnae|jnbe|jnge|jnle|lahf|lgdt|lidt|lldt|lmsw|lock|lods|loop|movd|movq|movs|orpd|orps|outs|pand|popa|popd|popf|popq|popw|push|pxor|repe|repz|retd|retf|retn|retq|retw|sahf|salc|scas|seta|setb|setc|sete|setg|setl|seto|setp|sets|setz|sgdt|shld|shrd|sidt|sldt|smsw|stgi|stos|test|verr|verw|vpor|wait|xadd|xchg|xlat|addpd|addps|addsd|addss|andpd|andps|bound|bswap|cmova|cmovb|cmovc|cmove|cmovg|cmovl|cmovo|cmovp|cmovs|cmovz|cmppd|cmpps|cmpsb|cmpsd|cmpsq|cmpss|cmpsw|cpuid|crc32|divpd|divps|divsd|divss|enter|extrq|f2xm1|faddp|fbstp|fclex|fcomi|fcomp|fdisi|fdivp|fdivr|femms|ffree|fiadd|ficom|fidiv|fimul|finit|fistp|fisub|fldcw|fldpi|fmulp|fneni|fprem|fptan|fsave|fsqrt|fstcw|fstsw|fsubp|fsubr|fucom|fwait|fyl2x|icebp|iretd|iretq|iretw|jecxz|jrcxz|lddqu|leave|lodsb|lodsd|lodsq|lodsw|loopd|loope|loopq|loopw|loopz|lzcnt|maxpd|maxps|maxsd|maxss|minpd|minps|minsd|minss|movbe|movsb|movsd|movsq|movss|movsw|movsx|movzx|mulpd|mulps|mulsd|mulss|mwait|outsb|outsd|outsw|pabsb|pabsd|pabsw|paddb|paddd|paddq|paddw|pandn|pause|pavgb|pavgw|pf2id|pf2iw|pfacc|pfadd|pfmax|pfmin|pfmul|pfrcp|pfsub|pi2fd|pi2fw|popad|popaw|popfd|popfq|popfw|pslld|psllq|psllw|psrad|psraw|psrld|psrlq|psrlw|psubb|psubd|psubq|psubw|ptest|pusha|pushd|pushf|pushq|pushw|rcpps|rcpss|rdmsr|rdpmc|rdtsc|repne|repnz|retfd|retfq|retfw|retnd|retnq|retnw|scasb|scasd|scasq|scasw|setae|setbe|setge|setle|setna|setnb|setnc|setne|setng|setnl|setno|setnp|setns|setnz|setpe|setpo|stosb|stosd|stosq|stosw|subpd|subps|subsd|subss|vdppd|vdpps|vmovd|vmovq|vmrun|vmxon|vorpd|vorps|vpand|vpxor|wrmsr|xlatb|xorpd|xorps|xsave|aesdec|aesenc|aesimc|andnpd|andnps|cmovae|cmovbe|cmovge|cmovle|cmovna|cmovnb|cmovnc|cmovne|cmovng|cmovnl|cmovno|cmovnp|cmovns|cmovnz|cmovpe|cmovpo|comisd|comiss|fcmovb|fcmove|fcmovu|fcomip|fcompp|fdivrp|ffreep|ficomp|fidivr|fisttp|fisubr|fldenv|fldl2e|fldl2t|fldlg2|fldln2|fnclex|fndisi|fninit|fnsave|fnstcw|fnstsw|fpatan|fprem1|frstor|frstpm|fsaved|fsavew|fscale|fsetpm|fstenv|fsubrp|fucomi|fucomp|fxsave|getsec|haddpd|haddps|hsubpd|hsubps|invept|invlpg|lfence|looped|loopeq|loopew|loopne|loopnz|loopzd|loopzq|loopzw|mfence|movapd|movaps|movdqa|movdqu|movhpd|movhps|movlpd|movlps|movnti|movntq|movsxd|movupd|movups|paddsb|paddsw|pextrb|pextrd|pextrq|pextrw|pfnacc|pfsubr|phaddd|phaddw|phsubd|phsubw|pinsrb|pinsrd|pinsrq|pinsrw|pmaxsb|pmaxsd|pmaxsw|pmaxub|pmaxud|pmaxuw|pminsb|pminsd|pminsw|pminub|pminud|pminuw|pmuldq|pmulhw|pmulld|pmullw|popcnt|psadbw|pshufb|pshufd|pshufw|psignb|psignd|psignw|pslldq|psrldq|psubsb|psubsw|pswapd|pushad|pushaw|pushfd|pushfq|pushfw|rdmsrq|rdrand|rdtscp|setalc|setnae|setnbe|setnge|setnle|sfence|shufpd|shufps|skinit|sqrtpd|sqrtps|sqrtsd|sqrtss|swapgs|sysret|vaddpd|vaddps|vaddsd|vaddss|vandpd|vandps|vcmppd|vcmpps|vcmpsd|vcmpss|vdivpd|vdivps|vdivsd|vdivss|vlddqu|vmaxpd|vmaxps|vmaxsd|vmaxss|vmcall|vminpd|vminps|vminsd|vminss|vmload|vmovsd|vmovss|vmread|vmsave|vmulpd|vmulps|vmulsd|vmulss|vmxoff|vpabsb|vpabsd|vpabsw|vpaddb|vpaddd|vpaddq|vpaddw|vpandn|vpavgb|vpavgw|vpcmov|vpcomb|vpcomd|vpcomq|vpcomw|vpperm|vprotb|vprotd|vprotq|vprotw|vpshab|vpshad|vpshaq|vpshaw|vpshlb|vpshld|vpshlq|vpshlw|vpslld|vpsllq|vpsllw|vpsrad|vpsraw|vpsrld|vpsrlq|vpsrlw|vpsubb|vpsubd|vpsubq|vpsubw|vptest|vrcpps|vrcpss|vsubpd|vsubps|vsubsd|vsubss|vxorpd|vxorps|wbinvd|wrmsrq|xgetbv|xrstor|xsetbv|blendpd|blendps|clflush|cmovnae|cmovnbe|cmovnge|cmovnle|cmpeqpd|cmpeqps|cmpeqsd|cmpeqss|cmplepd|cmpleps|cmplesd|cmpless|cmpltpd|cmpltps|cmpltsd|cmpltss|cmpxchg|fcmovbe|fcmovnb|fcmovne|fcmovnu|fdecstp|fincstp|fldenvd|fldenvw|fnsaved|fnsavew|fnstenv|frndint|frstord|frstorw|fsincos|fstenvd|fstenvw|fucomip|fucompp|fxrstor|fxtract|fyl2xp1|insertq|invlpga|invvpid|ldmxcsr|loopned|loopneq|loopnew|loopnzd|loopnzq|loopnzw|monitor|movddup|movdq2q|movhlps|movlhps|movntdq|movntpd|movntps|movntsd|movntss|movq2dq|mpsadbw|paddusb|paddusw|palignr|pavgusb|pblendw|pcmpeqb|pcmpeqd|pcmpeqq|pcmpeqw|pcmpgtb|pcmpgtd|pcmpgtq|pcmpgtw|pfcmpeq|pfcmpge|pfcmpgt|pfpnacc|pfrsqrt|phaddsw|phsubsw|pmaddwd|pmulhrw|pmulhuw|pmuludq|pshufhw|pshuflw|psubusb|psubusw|roundpd|roundps|roundsd|roundss|rsqrtps|rsqrtss|stmxcsr|syscall|sysexit|sysretq|ucomisd|ucomiss|vaesdec|vaesenc|vaesimc|vandnpd|vandnps|vcomisd|vcomiss|vfrczpd|vfrczps|vfrczsd|vfrczss|vhaddpd|vhaddps|vhsubpd|vhsubps|vmclear|vmmcall|vmovapd|vmovaps|vmovdqa|vmovdqu|vmovhpd|vmovhps|vmovlpd|vmovlps|vmovupd|vmovups|vmptrld|vLine truncated
|
||||
{
|
||||
$label = $1; $indent = $2; $mnem = $3; $spaces = $4; $args = $5;
|
||||
die "Style error in @ARGV[0]:$.: any label must be on a separate line.\n" if length($label);
|
||||
# Rule 3. Lines with commands must start with 8 spaces.
|
||||
# A mnemonic is short if it's length is less than 8.
|
||||
# Arguments for short mnemonics must start in the column 16.
|
||||
# Arguments for long mnemonics must be separated from the mnemonic by exactly one space.
|
||||
# Otherwise, there must be exactly one space between the mnemonic and it's arguments.
|
||||
# Arguments must be separated with a comma and exactly one space after a comma.
|
||||
die "Style error in @ARGV[0]:$.: indent for commands must be 8 spaces.\n" if ($indent ne " ");
|
||||
if (length($mnem) >= 8 || $mnem eq "rep" || $mnem eq "repz" || $mnem eq "repe" || $mnem eq "repnz" || $mnem eq "repne" || $mnem eq "lock")
|
||||
{
|
||||
die "Style error in @ARGV[0]:$.: arguments for long mnemonics must be separated from the mnemonic by exactly one space.\n" if ($args ne "" && $spaces ne " ");
|
||||
}
|
||||
else
|
||||
{
|
||||
die "Style error in @ARGV[0]:$.: arguments for short mnemonics must start in the column 16.\n" if ($args ne "" && $spaces ne " " x (8 - length($mnem)));
|
||||
}
|
||||
$args =~ s/\s*$//;
|
||||
@a = split /([\x27"])(.*?\1)/, $args;
|
||||
$z = 0;
|
||||
foreach $s(@a)
|
||||
{
|
||||
die "Style error in @ARGV[0]:$.: arguments must be separated with a comma and exactly one space after a comma.\n" if ($z++%3==0 && $s =~ m/,(\s{2,})?([^\\\s]|$)/);
|
||||
};
|
||||
$continued = length($indent) + length($mnem) + length($spaces) if ($args =~ m/\\$/);
|
||||
}
|
||||
else
|
||||
{
|
||||
$continued = -1 if m/\\\s*(;.*)?$/;
|
||||
}
|
||||
}
|
||||
}
|
||||
exit 0;
|
||||
@@ -0,0 +1,82 @@
|
||||
#!/bin/bash
|
||||
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
# SPDX-FileCopyrightText: 2025 KolibriOS Team
|
||||
|
||||
# Written by mxlgv (Maxim Logaev)
|
||||
# Installation steps described by maxcodehack (Maxim Kuzmitsky)
|
||||
|
||||
set -e
|
||||
|
||||
print_msg(){
|
||||
echo -e "\e[34m$1\e[0m"
|
||||
}
|
||||
|
||||
print_ok(){
|
||||
echo -e "\e[32m$1\e[0m"
|
||||
}
|
||||
|
||||
print_err(){
|
||||
echo -e "\e[31m$1\e[0m"
|
||||
exit
|
||||
}
|
||||
|
||||
check_utils(){
|
||||
printf "%s: " $1
|
||||
if command -v $1 &> /dev/null
|
||||
then
|
||||
print_ok "ok\r"
|
||||
else
|
||||
print_err "no\r"
|
||||
fi
|
||||
}
|
||||
|
||||
print_msg "Checking utilities..."
|
||||
|
||||
check_utils wget
|
||||
check_utils 7z
|
||||
|
||||
print_msg "Create the /home/autobuild folder..."
|
||||
sudo rm -rf ~/autobuild /home/autobuild
|
||||
mkdir -p ~/autobuild/tools
|
||||
sudo ln -sf ~/autobuild /home/autobuild
|
||||
print_ok "Successfully!"
|
||||
|
||||
print_msg "Download the kos32-gcc toolchain..."
|
||||
wget http://ftp.kolibrios.org/users/Serge/new/Toolchain/x86_64-linux-kos32-5.4.0.7z -O ~/autobuild/tools/kos32-toolchain.7z
|
||||
print_ok "Successfully!"
|
||||
|
||||
print_msg "Extracting files ..."
|
||||
cd ~/autobuild/tools/
|
||||
7z x -y kos32-toolchain.7z
|
||||
rm -rf kos32-toolchain.7z
|
||||
print_ok "Successfully!"
|
||||
|
||||
print_msg "Downloading libisl..."
|
||||
cd /tmp
|
||||
sudo wget http://board.kolibrios.org/download/file.php?id=8301libisl.so.10.2.2.7z -O /tmp/libisl.so.10.2.2.7z
|
||||
sudo 7z x -y libisl.so.10.2.2.7z
|
||||
|
||||
if ! [ -d /usr/lib/x86_64-linux-gnu/ ]; then
|
||||
sudo mkdir -p /usr/lib/x86_64-linux-gnu/
|
||||
fi
|
||||
|
||||
print_msg "Fixing libisl..."
|
||||
sudo mv /tmp/libisl.so.10.2.2 /usr/lib/x86_64-linux-gnu/libisl.so.10.2.2
|
||||
sudo ln -sf /usr/lib/x86_64-linux-gnu/libisl.so.10.2.2 /usr/lib/x86_64-linux-gnu/libisl.so.10
|
||||
sudo ln -sf /usr/lib/x86_64-linux-gnu/libisl.so.10.2.2 /usr/lib/libisl.so.10
|
||||
sudo chmod go-w /usr/lib/x86_64-linux-gnu/libisl.so.10
|
||||
sudo chmod go-w /usr/lib/x86_64-linux-gnu/libisl.so.10.2.2
|
||||
print_ok "Successfully!"
|
||||
|
||||
print_msg "Fixing libmpfr..."
|
||||
sudo ln -sf /usr/lib/x86_64-linux-gnu/libmpfr.so.6 /usr/lib/x86_64-linux-gnu/libmpfr.so.4
|
||||
sudo ln -sf /usr/lib/libmpfr.so.6 /usr/lib/libmpfr.so.4
|
||||
print_ok "Successfully!"
|
||||
|
||||
if ! grep -q 'export PATH=$PATH:/home/autobuild/tools/win32/bin' ~/.bashrc; then
|
||||
export PATH=$PATH:/home/autobuild/tools/win32/bin
|
||||
print_msg "Adding '/home/autobuild/tools/win32/bin' to '~/.bashrc'"
|
||||
echo 'export PATH=$PATH:/home/autobuild/tools/win32/bin' >> ~/.bashrc
|
||||
fi
|
||||
print_ok "Installation was successful!"
|
||||
@@ -1,37 +0,0 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
# SPDX-FileCopyrightText: 2025 KolibriOS team
|
||||
|
||||
name: 'Check kernel codestyle'
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- 'main'
|
||||
paths:
|
||||
- 'kernel/**'
|
||||
- '.gitea/workflows/kernel-check.yaml'
|
||||
- '.gitea/utils/check-kernel-codestyle.py'
|
||||
|
||||
jobs:
|
||||
codestyle:
|
||||
name: "Check kernel codestyle"
|
||||
runs-on: kolibri-toolchain
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
sparse-checkout: |
|
||||
kernel/trunk
|
||||
.gitea/utils
|
||||
|
||||
- name: Check codestyle
|
||||
run: |
|
||||
find kernel/trunk \
|
||||
\( -iname '*.asm' -or -iname '*.inc' \) \
|
||||
-exec sh -c '
|
||||
for file do
|
||||
echo "$file"
|
||||
python3 .gitea/utils/check-kernel-codestyle.py "$file"
|
||||
done
|
||||
' sh {} +
|
||||
@@ -1,210 +0,0 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
# SPDX-FileCopyrightText: 2026 KolibriOS team
|
||||
|
||||
# This workflow is for commits in PRs to test them before merging.
|
||||
# All PRs MUST be tested before merging, and if I see Maxim turn this off again
|
||||
# I'll kick his ass.
|
||||
|
||||
# Serious things you have here, guys...
|
||||
|
||||
name: 'Test PR'
|
||||
|
||||
# Test build for every pull request
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- 'main'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: 'Build (${{ matrix.lang }})'
|
||||
runs-on: kolibri-toolchain
|
||||
# one parallel job per language variant
|
||||
strategy:
|
||||
matrix:
|
||||
lang: [en_US, ru_RU, es_ES]
|
||||
|
||||
steps:
|
||||
# shallow clone is enough: PR builds embed no revision id, and the
|
||||
# artifact name uses the short head sha (no git describe)
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
fetch-depth: 1
|
||||
|
||||
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ TOOLCHAIN ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
# cache the toolchain sources by hash to not rebuild them every time
|
||||
- name: Get toolchain hash
|
||||
id: toolchain-hash
|
||||
run: |
|
||||
a=$(find ${{ gitea.workspace }}/programs/develop/cmm/ -type f -print0 | sort -z | xargs -0 sha1sum)
|
||||
b=$(sha1sum ${{ gitea.workspace }}/programs/develop/ktcc/bin/kos32-tcc)
|
||||
c=$(find ${{ gitea.workspace }}/programs/develop/objconv/ -type f -print0 | sort -z | xargs -0 sha1sum)
|
||||
d=$(find ${{ gitea.workspace }}/programs/other/kpack/kerpack_linux/ -type f -print0 | sort -z | xargs -0 sha1sum)
|
||||
e=$(find ${{ gitea.workspace }}/programs/other/kpack/linux/ -type f -print0 | sort -z | xargs -0 sha1sum)
|
||||
f=$(find ${{ gitea.workspace }}/programs/develop/clink/ -type f -print0 | sort -z | xargs -0 sha1sum)
|
||||
echo hash=$(echo $a $b $c $d $e $f | sha1sum | awk '{print $1}') >> $GITEA_OUTPUT
|
||||
|
||||
# restore previously cached toolchain by hash (restore-only, PRs don't save)
|
||||
- name: Restore toolchain
|
||||
id: cache-toolchain
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: /home/autobuild
|
||||
key: kolibri-toolchain-${{ steps.toolchain-hash.outputs.hash }}
|
||||
|
||||
# build toolchain if cache miss or obsolote
|
||||
- name: Build and install C--
|
||||
if: steps.cache-toolchain.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
cd ${{ gitea.workspace }}/programs/develop/cmm/
|
||||
make -f Makefile.lin32
|
||||
chmod +x c--
|
||||
mv c-- /home/autobuild/tools/win32/bin/c--
|
||||
cp ${{ gitea.workspace }}/programs/cmm/c--/c--.ini /home/autobuild/tools/win32/bin/c--.ini
|
||||
make -f Makefile.lin32 clean
|
||||
|
||||
- name: Install TCC
|
||||
if: steps.cache-toolchain.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
cp ${{ gitea.workspace }}/programs/develop/ktcc/bin/kos32-tcc /home/autobuild/tools/win32/bin/kos32-tcc
|
||||
chmod +x /home/autobuild/tools/win32/bin/kos32-tcc
|
||||
|
||||
- name: Build and install objconv
|
||||
if: steps.cache-toolchain.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
cd ${{ gitea.workspace }}/programs/develop/objconv/
|
||||
g++ -o /home/autobuild/tools/win32/bin/objconv -O2 *.cpp
|
||||
chmod +x /home/autobuild/tools/win32/bin/objconv
|
||||
|
||||
- name: Build and install kerpack and kpack
|
||||
if: steps.cache-toolchain.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
export PATH=/home/autobuild/tools/win32/bin:$PATH
|
||||
cd ${{ gitea.workspace }}/programs/other/kpack/kerpack_linux/
|
||||
make
|
||||
chmod +x kerpack
|
||||
chmod +x kpack
|
||||
mv kerpack /home/autobuild/tools/win32/bin/.
|
||||
mv kpack /home/autobuild/tools/win32/bin/.
|
||||
|
||||
- name: Build and install clink
|
||||
if: steps.cache-toolchain.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
cd ${{ gitea.workspace }}/programs/develop/clink
|
||||
gcc main.c -o clink
|
||||
chmod a+x clink
|
||||
mv clink /home/autobuild/tools/win32/bin/clink
|
||||
|
||||
# move freshly built toolchain into the path that gets cached
|
||||
- name: Prepare cache folder
|
||||
run: |
|
||||
rm /home/autobuild
|
||||
mv /root/autobuild /home/autobuild
|
||||
if: steps.cache-toolchain.outputs.cache-hit != 'true'
|
||||
|
||||
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ TUP ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
# restore tup cache (this PR head, else fall back to main); PRs don't save it
|
||||
- name: Cache Tup
|
||||
id: cache-tup
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: |
|
||||
.tup
|
||||
build-${{ matrix.lang }}
|
||||
key: tup-${{ gitea.event.pull_request.head.sha }}
|
||||
restore-keys: |
|
||||
tup-
|
||||
|
||||
# check if a cache was restored or if we need to start fresh build
|
||||
- name: Check if cache was restored
|
||||
id: check-tup-cache
|
||||
run: |
|
||||
if [ -d ${{ gitea.workspace}}/.tup ] ; then
|
||||
echo "cache_restored=true" >> $GITEA_OUTPUT
|
||||
fi
|
||||
|
||||
# cache restore resets ctimes; realign tup DB to skip a full rebuild,
|
||||
# but keep files changed since the cache's commit dirty so tup rebuilds them
|
||||
- name: Sync tup DB with filesystem ctime
|
||||
if: steps.check-tup-cache.outputs.cache_restored == 'true'
|
||||
run: |
|
||||
DIRTY=$(mktemp)
|
||||
BASE=$(cat .tup/build-commit 2>/dev/null || true)
|
||||
if [ -n "$BASE" ] && (git cat-file -e "${BASE}^{commit}" 2>/dev/null || git fetch --depth=1 origin "$BASE" 2>/dev/null); then
|
||||
git -c core.quotePath=false diff --name-only "$BASE" HEAD > "$DIRTY"
|
||||
echo "Cache built at $BASE; $(wc -l < "$DIRTY") changed files kept dirty"
|
||||
python3 .gitea/utils/sync-tup-ctime.py .tup/db "$DIRTY"
|
||||
else
|
||||
echo "No usable cache base commit; skipping sync (tup rebuilds all)"
|
||||
fi
|
||||
|
||||
# write the variant config
|
||||
- name: Configure tup
|
||||
run: |
|
||||
export ROOT=${{ gitea.workspace }}
|
||||
echo "CONFIG_KPACK_CMD= && kpack --nologo %o" > ${{ matrix.lang }}.config
|
||||
echo "CONFIG_KERPACK_CMD= && kerpack %o" >> ${{ matrix.lang }}.config
|
||||
echo "CONFIG_PESTRIP_CMD= && EXENAME=%o fasm $ROOT/data/common/pestrip.asm %o" >> ${{ matrix.lang }}.config
|
||||
echo "CONFIG_NO_MSVC=full" >> ${{ matrix.lang }}.config
|
||||
echo "CONFIG_INSERT_REVISION_ID=0" >> ${{ matrix.lang }}.config
|
||||
echo "CONFIG_LANG=${{ matrix.lang }}" >> ${{ matrix.lang }}.config
|
||||
echo "CONFIG_BUILD_TYPE=${{ matrix.lang }}" >> ${{ matrix.lang }}.config
|
||||
|
||||
# initialize the tup DB and register the variant
|
||||
- name: Init tup
|
||||
if: steps.check-tup-cache.outputs.cache_restored != 'true'
|
||||
run: |
|
||||
export ROOT=${{ gitea.workspace }}
|
||||
tup init
|
||||
tup variant ${{ matrix.lang }}.config
|
||||
|
||||
# build the image for language variant
|
||||
- name: Build KolibriOS
|
||||
run: |
|
||||
export PATH=/home/autobuild/tools/win32/bin:$PATH
|
||||
source kos32-export-env-vars ${{ gitea.workspace }}
|
||||
tup build-${{ matrix.lang }}
|
||||
|
||||
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ARTIFACTS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
# short head sha to pin the PR iteration in the artifact names
|
||||
- name: Get short SHA
|
||||
id: vars
|
||||
run: echo "sha=$(git rev-parse --short HEAD)" >> $GITEA_OUTPUT
|
||||
|
||||
# rename build outputs to their final names so artifacts are bare files
|
||||
- name: Rename images
|
||||
run: |
|
||||
for ext in img iso raw; do
|
||||
cp "build-${{ matrix.lang }}/data/kolibri.$ext" \
|
||||
"kolibrios-PR${{ gitea.event.pull_request.number }}-${{ steps.vars.outputs.sha }}-${{ matrix.lang }}.$ext"
|
||||
done
|
||||
|
||||
#publish the three images, named by PR number + sha
|
||||
- name: Upload floppy image
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: kolibrios-PR${{ gitea.event.pull_request.number }}-${{ steps.vars.outputs.sha }}-${{ matrix.lang }}.img
|
||||
path: kolibrios-PR${{ gitea.event.pull_request.number }}-${{ steps.vars.outputs.sha }}-${{ matrix.lang }}.img
|
||||
retention-days: 2
|
||||
|
||||
- name: Upload CD image
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: kolibrios-PR${{ gitea.event.pull_request.number }}-${{ steps.vars.outputs.sha }}-${{ matrix.lang }}.iso
|
||||
path: kolibrios-PR${{ gitea.event.pull_request.number }}-${{ steps.vars.outputs.sha }}-${{ matrix.lang }}.iso
|
||||
retention-days: 2
|
||||
|
||||
- name: Upload raw image
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: kolibrios-PR${{ gitea.event.pull_request.number }}-${{ steps.vars.outputs.sha }}-${{ matrix.lang }}.raw
|
||||
path: kolibrios-PR${{ gitea.event.pull_request.number }}-${{ steps.vars.outputs.sha }}-${{ matrix.lang }}.raw
|
||||
retention-days: 2
|
||||
@@ -1,59 +0,0 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
# SPDX-FileCopyrightText: 2026 KolibriOS team
|
||||
|
||||
name: 'Update kterm submodule'
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 8 * * 6' # Saturdays at 08:00 (UTC)
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
bump:
|
||||
name: 'Bump kterm to upstream'
|
||||
runs-on: kolibri-toolchain
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: Bump kterm and open PR
|
||||
env:
|
||||
TOKEN: ${{ github.token }}
|
||||
API: ${{ github.api_url }}
|
||||
REPO: ${{ github.repository }}
|
||||
BRANCH: chore/update-kterm
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
git submodule update --remote programs/other/kterm
|
||||
if git diff --quiet; then
|
||||
echo "kterm is already up to date"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
git config user.name "kolibri-bot"
|
||||
git config user.email "bot@kolibrios.org"
|
||||
git checkout -B "$BRANCH"
|
||||
git commit -am "kterm: bump submodule to upstream"
|
||||
git push -f origin "$BRANCH"
|
||||
|
||||
# Open a PR via the Gitea API using the built-in token.
|
||||
# 201 = created, 409 = a PR for this branch is already open (the
|
||||
# force-push above already updated it) - both are fine.
|
||||
http=$(curl -sS -o /tmp/pr.json -w '%{http_code}' -X POST \
|
||||
-H "Authorization: token ${TOKEN}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"head\":\"${BRANCH}\",\"base\":\"main\",\"title\":\"kterm: bump submodule to upstream\"}" \
|
||||
"${API}/repos/${REPO}/pulls")
|
||||
echo "PR API HTTP status: $http"
|
||||
cat /tmp/pr.json; echo
|
||||
if [ "$http" != "201" ] && [ "$http" != "409" ]; then
|
||||
echo "Failed to create pull request"
|
||||
exit 1
|
||||
fi
|
||||
@@ -1,7 +1,3 @@
|
||||
[submodule "programs/develop/oberon07"]
|
||||
path = programs/develop/oberon07
|
||||
url = https://github.com/AntKrotov/oberon-07-compiler.git
|
||||
[submodule "programs/other/kterm"]
|
||||
path = programs/other/kterm
|
||||
url = https://git.kolibrios.org/b00bl1k/kterm.git
|
||||
branch = master
|
||||
@@ -1,3 +0,0 @@
|
||||
if tup.getconfig("NO_FASM") ~= "" then return end
|
||||
lang = (tup.getconfig("LANG") == "") and "en_US" or tup.getconfig("LANG")
|
||||
tup.rule("launcher.asm", "fasm -dlang=" .. lang .. " %f %o " .. tup.getconfig("KPACK_CMD"), "launcher")
|
||||
@@ -1,229 +0,0 @@
|
||||
; Splits command line to argv array.
|
||||
; Uses standard Windows rules:
|
||||
; * in normal mode, arguments are separated with spaces and tabs,
|
||||
; duplicate spaces and tabs are ignored
|
||||
; (two sequential spaces are the same as one);
|
||||
; * unescaped quote " in normal mode starts quoted mode,
|
||||
; it does not end the current argument, it is not included in the argument;
|
||||
; * spaces and tabs in quoted mode are included in the argument as is;
|
||||
; * unescaped quote " in quoted mode returns to normal mode,
|
||||
; it does not end the current argument, it is not included in the argument;
|
||||
; * quotes can be escaped with backslashes \ in both modes
|
||||
; (the recommended way), \" means copying " to the argument
|
||||
; without switching modes;
|
||||
; * backslashes not before a quote are just regular characters,
|
||||
; backslashes before a quote should be escaped by another backslash:
|
||||
; " means unescaped quote
|
||||
; \" means character "
|
||||
; \\" means character \ plus unescaped quote
|
||||
; \\\" means characters \"
|
||||
; and so on;
|
||||
; * quotes in quoted mode can also be escaped by doubling them, ""
|
||||
; (the confusing way); note that in normal mode "" means empty argument.
|
||||
; For example, the command line
|
||||
; begin"quoted mode"end\ \"escaped" "quotes" "1\" "" """escaped quotes 2"""
|
||||
; has 4 arguments:
|
||||
; 1) beginquoted modeend\
|
||||
; 2) "escaped quotes 1"
|
||||
; 3)
|
||||
; 4) "escaped quotes 2"
|
||||
; The recommended way to create a command line with the same arguments:
|
||||
; "beginquoted modeend"\ "\"escaped quotes 1\"" "\"escaped quotes 2\"".
|
||||
;
|
||||
; in: esi -> command line
|
||||
; in: edi -> data for arguments, maybe null
|
||||
; in: edx -> pointers to arguments, maybe null
|
||||
; out: ebx = argument count
|
||||
;
|
||||
; There are too many branches and labels here,
|
||||
; isolate some of them into macro.
|
||||
macro start_arg
|
||||
; Increments argument count;
|
||||
; if arguments are tracked, stores the current address.
|
||||
{
|
||||
local .label
|
||||
test edx, edx
|
||||
jz .label
|
||||
mov [edx], edi
|
||||
add edx, 4
|
||||
.label:
|
||||
inc ebx
|
||||
}
|
||||
; In typical cases decoded arguments and input line have large chunks in common.
|
||||
; When going through the input string, we do not copy arguments immediately,
|
||||
; but track size of last chunk that should be copied instead.
|
||||
; This macros copies the last chunk of data if arguments are tracked.
|
||||
; If arguments are tracked, ecx is reset to zero;
|
||||
; otherwise, we do not care about ecx.
|
||||
macro copy_arg_data
|
||||
{
|
||||
local .label
|
||||
test edi, edi
|
||||
jz .label
|
||||
dec esi
|
||||
sub esi, ecx
|
||||
rep movsb
|
||||
inc esi
|
||||
.label:
|
||||
}
|
||||
; Process backslash.
|
||||
macro process_slash
|
||||
{
|
||||
; 1. Count number of backslashes.
|
||||
local .label1, .label2
|
||||
xor ecx, ecx
|
||||
.label1:
|
||||
inc ecx
|
||||
mov al, byte [esi]
|
||||
inc esi
|
||||
cmp al, '\'
|
||||
jz .label1
|
||||
; 2. If the next character is not ", backslash is a regular character;
|
||||
; copy all of them.
|
||||
cmp al, '"'
|
||||
jnz .label2
|
||||
; 3. If the next character is ", then only half of backslashes
|
||||
; should be copied, other are escaping characters.
|
||||
; If number of backslashes is odd, include " to copied chunk
|
||||
; and advance to the next character.
|
||||
shr ecx, 1
|
||||
jnc .label2
|
||||
mov al, byte [esi]
|
||||
inc esi
|
||||
inc ecx
|
||||
.label2:
|
||||
copy_arg_data
|
||||
}
|
||||
|
||||
; Parser procedure.
|
||||
proc parse_cmdline
|
||||
; Registers:
|
||||
; ebx = argc = argument count
|
||||
; ecx = size of last chunk if edi is nonzero, garbage otherwise
|
||||
; al = current input character = [esi-1]
|
||||
; esi = pointer to input past the current character
|
||||
; edi = zero or pointer to the next output data
|
||||
; edx = zero or pointer to the next output pointer
|
||||
xor ebx, ebx
|
||||
xor ecx, ecx
|
||||
; There are two large blocks of code for normal and quoted modes.
|
||||
; We start in normal mode.
|
||||
; 1. Processing in normal mode.
|
||||
; 1a. Skip initial spaces and tabs.
|
||||
.skip_spaces:
|
||||
mov al, byte [esi]
|
||||
inc esi
|
||||
cmp al, ' '
|
||||
jz .skip_spaces
|
||||
cmp al, 9
|
||||
jz .skip_spaces
|
||||
; 1b. If the command line has ended, exit.
|
||||
test al, al
|
||||
jz .done
|
||||
; 1c. Any character in this state starts a new argument.
|
||||
start_arg
|
||||
; 1d. Loop over the input string, watching for one of:
|
||||
; (space), (tab), (terminator), ", \
|
||||
; All other characters should be copied as is.
|
||||
; The first character here cannot be (space), (tab) or (terminator),
|
||||
; but " and \ are possible. For these, skip 1e, because we have nothing
|
||||
; to copy yet, and go directly where 1f would direct us.
|
||||
cmp al, '"'
|
||||
jz .enter_quoted_mode
|
||||
cmp al, '\'
|
||||
jz .slash_normal
|
||||
.normal_mode:
|
||||
inc ecx
|
||||
.enter_normal_mode:
|
||||
mov al, byte [esi]
|
||||
inc esi
|
||||
.reenter_normal_mode:
|
||||
cmp al, ' '
|
||||
jz .copydata
|
||||
cmp al, 9
|
||||
jz .copydata
|
||||
test al, al
|
||||
jz .copydata
|
||||
cmp al, '\'
|
||||
jz .copydata
|
||||
cmp al, '"'
|
||||
jnz .normal_mode
|
||||
.copydata:
|
||||
; 1e. Copy the found chunk.
|
||||
copy_arg_data
|
||||
; 1f. One of (space), (tab), (terminator), ", \ is found.
|
||||
; For terminator, end the current argument and exit.
|
||||
; For \, go to 1h.
|
||||
; For ", switch to quoted mode.
|
||||
test al, al
|
||||
jz .done_termarg
|
||||
cmp al, '\'
|
||||
jz .slash_normal
|
||||
cmp al, '"'
|
||||
jz .enter_quoted_mode
|
||||
; 1g. If we are here, (space) or (tab) has occured in 1d.
|
||||
; End the current argument and restart processing from 1a.
|
||||
test edi, edi
|
||||
jz .skip_spaces
|
||||
mov byte [edi], 0
|
||||
inc edi
|
||||
jmp .skip_spaces
|
||||
.done_termarg:
|
||||
test edi, edi
|
||||
jz .done
|
||||
mov byte [edi], 0
|
||||
inc edi
|
||||
.done:
|
||||
ret
|
||||
.slash_normal:
|
||||
; 1h. Process chunk of slashes with possible ending " if escaped
|
||||
; as described in process_slash macros.
|
||||
; After that, return to loop in 1d; note that the next character can be space.
|
||||
process_slash
|
||||
jmp .reenter_normal_mode
|
||||
; 2. Processing in quoted mode.
|
||||
; This block is simpler because the current argument never ends in quoted mode,
|
||||
; except when the input ends.
|
||||
; 2a. Loop over the input string, watching for one of:
|
||||
; (terminator), ", \.
|
||||
.quoted_mode:
|
||||
inc ecx
|
||||
.enter_quoted_mode:
|
||||
mov al, byte [esi]
|
||||
inc esi
|
||||
.reenter_quoted_mode:
|
||||
test al, al
|
||||
jz .copydata2
|
||||
cmp al, '\'
|
||||
jz .copydata2
|
||||
cmp al, '"'
|
||||
jnz .quoted_mode
|
||||
.copydata2:
|
||||
; 2b. Copy the found chunk.
|
||||
copy_arg_data
|
||||
; 2c. One of (terminator), ", \ is found.
|
||||
; For terminator, end the current argument and exit.
|
||||
; For \, go to 2d.
|
||||
test al, al
|
||||
jz .done_termarg
|
||||
cmp al, '\'
|
||||
jz .slash_quoted
|
||||
; For ", check whether the next character is also ":
|
||||
; for a single quote, switch to the normal mode 1d,
|
||||
; for a double quote, skip the first quote
|
||||
; and start a new chunk from the second one.
|
||||
cmp byte [esi], '"'
|
||||
jnz .enter_normal_mode
|
||||
.double_quote:
|
||||
inc esi
|
||||
jmp .quoted_mode
|
||||
.slash_quoted:
|
||||
; 2d. Process chunk of slashes with possible ending " if escaped
|
||||
; as described in process_slash macros.
|
||||
; After that, return to loop in 2a.
|
||||
process_slash
|
||||
jmp .reenter_quoted_mode
|
||||
endp
|
||||
purge start_arg
|
||||
purge copy_arg_data
|
||||
purge process_slash
|
||||
@@ -1,55 +0,0 @@
|
||||
# Параметры запуска sdldoom (KolibriOS)
|
||||
|
||||
Этот список отражает реальные параметры, доступные в текущей сборке из этого репозитория.
|
||||
Проверено по:
|
||||
- `d_main.c`, `g_game.c`, `i_net.c`, `i_video.c`, `m_misc.c`, `p_spec.c`.
|
||||
|
||||
> Примечание: лаунчер пока запускает только Wolf3D и Quake; список Doom приведён для справки.
|
||||
|
||||
## Параметры (по блокам)
|
||||
|
||||
### Файлы и данные
|
||||
- `@<file>` - response-файл с аргументами.
|
||||
- `-file <wad1> [wad2 ...]` - добавить PWAD(ы) (до первого аргумента, что начинается с `-`).
|
||||
- `-config <file>` - путь к конфигу (вместо `.doomrc`).
|
||||
- `-cdrom` - использовать `c:\doomdata\` для сейвов/конфигов.
|
||||
|
||||
### Режимы игры / сложность
|
||||
- `-skill <1..5>` - сложность.
|
||||
- `-episode <n>` - стартовый эпизод.
|
||||
- `-warp <map>` или `-warp <episode> <map>` - старт с указанного уровня.
|
||||
- `-wart <episode> <map>` - совместимая форма `-warp`.
|
||||
- `-turbo <percent>` - скорость игрока в процентах.
|
||||
- `-nomonsters` - без монстров.
|
||||
- `-respawn` - монстры возрождаются.
|
||||
- `-fast` - режим fast-monsters.
|
||||
- `-deathmatch` - deathmatch.
|
||||
- `-altdeath` - alt-death (без выхода из игры).
|
||||
- `-timer <minutes>` - лимит времени (для deathmatch).
|
||||
- `-avg` - вывод средних значений (для deathmatch).
|
||||
|
||||
### Демо, тесты и производительность
|
||||
- `-record <name>` - запись демо.
|
||||
- `-playdemo <name>` - воспроизведение демо.
|
||||
- `-timedemo <name>` - timedemo (тест скорости).
|
||||
- `-loadgame <slot>` - загрузить сохранение (номер слота).
|
||||
- `-maxdemo <kB>` - максимальный размер демо (в KB).
|
||||
- `-statcopy <addr>` - копировать статистику во внешний буфер.
|
||||
- `-nodraw` - выключить рендер.
|
||||
- `-noblit` - выключить blit.
|
||||
- `-debugfile` - писать debug-файл `debug<player>.txt`.
|
||||
- `-devparm` - developer-режим.
|
||||
- `-shdev`, `-regdev`, `-comdev` - developer-наборы данных.
|
||||
|
||||
### Сеть
|
||||
- `-net <player> ...` - netgame-параметры.
|
||||
- `-port <p>` - сетевой порт.
|
||||
- `-dup <n>` - ticdup.
|
||||
- `-extratic` - extra tic для синхронизации.
|
||||
|
||||
### Видео и ввод
|
||||
- `-fullscreen` - полноэкранный SDL-режим.
|
||||
- `-2` - масштаб 2x от 320x200 (640x400). Значение по умолчанию.
|
||||
- `-3` - масштаб 3x от 320x200 (960x600).
|
||||
- Режим 1x (320x200) недоступен: `multiply` по умолчанию равен 2, флага `-1` нет.
|
||||
- `-grabmouse` - захват мыши.
|
||||
@@ -1,785 +0,0 @@
|
||||
; SPDX-License-Identifier: GPL-2.0-only
|
||||
;
|
||||
; Launcher - Launcher for Wolf3D, Doom, Quake
|
||||
; Copyright (C) 2025-2026 KolibriOS team
|
||||
;
|
||||
; Contributor mxlgv - Idea
|
||||
; Contributor Burer - Main code
|
||||
|
||||
; ================================================================
|
||||
|
||||
use32
|
||||
org 0
|
||||
|
||||
; ================================================================
|
||||
|
||||
db "MENUET01"
|
||||
dd 0x01
|
||||
dd START
|
||||
dd I_END
|
||||
dd MEM
|
||||
dd STACK_TOP
|
||||
dd CMD_LINE
|
||||
dd 0
|
||||
|
||||
; ================================================================
|
||||
|
||||
include "../../../programs/macros.inc"
|
||||
include "../../../programs/KOSfuncs.inc"
|
||||
include "../../../programs/encoding.inc"
|
||||
include "../../../programs/proc32.inc"
|
||||
include "../../../programs/dll.inc"
|
||||
include "../../../programs/develop/libraries/box_lib/box_lib.mac"
|
||||
include "cmdline.inc"
|
||||
|
||||
; ================================================================
|
||||
|
||||
LIBS:
|
||||
library gui, "box_lib.obj"
|
||||
import gui, optionbox.draw, "option_box_draw", \
|
||||
optionbox.mouse, "option_box_mouse"
|
||||
|
||||
; ================================================================
|
||||
|
||||
START:
|
||||
; Parse the command line FIRST: heap init and dll.Load below reuse the
|
||||
; memory the OS placed it in, so reading it later loses the --game arg.
|
||||
call select_game
|
||||
|
||||
mcall SF_SET_EVENTS_MASK, EVM_REDRAW + EVM_BUTTON + EVM_MOUSE
|
||||
mcall SF_STYLE_SETTINGS, SSF_GET_COLORS, sc, sizeof.system_colors
|
||||
mcall SF_SYS_MISC, SSF_HEAP_INIT
|
||||
|
||||
; load gamepad icon from reshare (32 bpp); eax = 0 if ICONS18W absent
|
||||
mcall SF_SYS_MISC, SSF_MEM_OPEN, icon_mem, , 0
|
||||
test eax, eax
|
||||
jz @f
|
||||
lea eax, [eax + 23 * IC_PLAY.W * IC_PLAY.H * 4]
|
||||
|
||||
@@:
|
||||
mov [icon_play], eax
|
||||
|
||||
; load dynamic libraries
|
||||
stdcall dll.Load, LIBS
|
||||
test eax, eax
|
||||
jnz button.exit
|
||||
|
||||
call draw_window
|
||||
|
||||
jmp still
|
||||
|
||||
; ================================================================
|
||||
|
||||
still:
|
||||
mcall SF_WAIT_EVENT
|
||||
|
||||
cmp al, EV_REDRAW
|
||||
je redraw
|
||||
|
||||
cmp al, EV_BUTTON
|
||||
je button
|
||||
|
||||
call options_mouse
|
||||
jmp still
|
||||
|
||||
; ================================================================
|
||||
|
||||
redraw:
|
||||
call draw_window
|
||||
jmp still
|
||||
|
||||
; ================================================================
|
||||
|
||||
button:
|
||||
mcall SF_GET_BUTTON
|
||||
|
||||
cmp ah, 1
|
||||
je .exit
|
||||
|
||||
cmp ah, BTN_PLAY
|
||||
je run_game
|
||||
|
||||
jmp still
|
||||
|
||||
.exit:
|
||||
mcall SF_TERMINATE_PROCESS
|
||||
|
||||
; ================================================================
|
||||
|
||||
draw_window:
|
||||
|
||||
mcall SF_REDRAW, SSF_BEGIN_DRAW
|
||||
|
||||
mov edx, [sc.work]
|
||||
add edx, 0x34000000
|
||||
mcall SF_CREATE_WINDOW, <WN_RECT.X, WN_RECT.W>, <WN_RECT.Y, WN_RECT.H>, , , [title_ptr]
|
||||
|
||||
; mode, resolutions and scale headers
|
||||
mov ecx, FONT_BIG
|
||||
add ecx, [sc.work_text]
|
||||
|
||||
mcall SF_DRAW_TEXT, <LB_MODE.X, LB_MODE.Y> , , label_mode
|
||||
mcall , <LB_MODE.X + 1, LB_MODE.Y> , ,
|
||||
mcall , <LB_RES.X, LB_RES.Y> , , label_res
|
||||
mcall , <LB_RES.X + 1, LB_RES.Y> , ,
|
||||
mcall , <LB_SCALE.X, LB_SCALE.Y>, , label_scale
|
||||
mcall , <LB_SCALE.X + 1, LB_SCALE.Y>, ,
|
||||
|
||||
; options groups
|
||||
call options_set_colors
|
||||
|
||||
invoke optionbox.draw, op_list_mode
|
||||
invoke optionbox.draw, op_list_res
|
||||
invoke optionbox.draw, op_list_scale
|
||||
|
||||
call draw_option_labels
|
||||
|
||||
; play button
|
||||
mcall SF_DEFINE_BUTTON, <BT_PLAY.X, BT_PLAY.W>, <BT_PLAY.Y, BT_PLAY.H>, BTN_PLAY, [sc.work_button]
|
||||
|
||||
mov ecx, [sc.work_button_text]
|
||||
add ecx, FONT_BIG
|
||||
mcall SF_DRAW_TEXT, <LB_PLAY.X, LB_PLAY.Y>, , text_play
|
||||
|
||||
call draw_icon_transparent
|
||||
|
||||
mcall SF_REDRAW, SSF_END_DRAW
|
||||
|
||||
ret
|
||||
|
||||
|
||||
draw_option_labels:
|
||||
mov ecx, [sc.work_text]
|
||||
add ecx, FONT_BIG
|
||||
mcall SF_DRAW_TEXT, <LB_MODE_WIN.X, LB_MODE_WIN.Y> , , text_win
|
||||
mcall , <LB_MODE_WINF.X, LB_MODE_WINF.Y>, , text_winf
|
||||
mcall , <LB_MODE_FULL.X, LB_MODE_FULL.Y>, , text_full
|
||||
|
||||
cmp [op_group_mode], op_mode_win
|
||||
je .windowed
|
||||
|
||||
; dimmed labels for resolution and scale in fullscreen mode
|
||||
mov ecx, [sc.work_graph]
|
||||
add ecx, FONT_BIG
|
||||
|
||||
.windowed:
|
||||
mcall SF_DRAW_TEXT, <LB_RES_320_200.X, LB_RES_320_200.Y>, , text_320_200
|
||||
mcall , <LB_RES_320_240.X, LB_RES_320_240.Y>, , text_320_240
|
||||
mcall , <LB_SCALE_1.X, LB_SCALE_1.Y> , , text_x1
|
||||
mcall , <LB_SCALE_2.X, LB_SCALE_2.Y> , , text_x2
|
||||
mcall , <LB_SCALE_3.X, LB_SCALE_3.Y> , , text_x3
|
||||
mcall , <LB_SCALE_4.X, LB_SCALE_4.Y> , , text_x4
|
||||
|
||||
ret
|
||||
|
||||
|
||||
draw_icon_transparent:
|
||||
|
||||
mov esi, [icon_play]
|
||||
test esi, esi ; ICONS18W unavailable -> skip icon
|
||||
jz .ret
|
||||
mov edi, [sc.work]
|
||||
and edi, 0x00FFFFFF
|
||||
mov ecx, IC_PLAY.Y
|
||||
mov ebp, IC_PLAY.H
|
||||
|
||||
.row:
|
||||
mov ebx, IC_PLAY.X
|
||||
mov eax, IC_PLAY.W
|
||||
|
||||
.col:
|
||||
mov edx, [esi]
|
||||
and edx, 0x00FFFFFF
|
||||
cmp edx, edi
|
||||
je .skip
|
||||
cmp edx, 0x00C5BDB9
|
||||
je .skip
|
||||
push eax
|
||||
mcall SF_PUT_PIXEL
|
||||
pop eax
|
||||
|
||||
.skip:
|
||||
add esi, 4
|
||||
inc ebx
|
||||
dec eax
|
||||
jnz .col
|
||||
inc ecx
|
||||
dec ebp
|
||||
jnz .row
|
||||
|
||||
.ret:
|
||||
ret
|
||||
|
||||
; ================================================================
|
||||
|
||||
options_mouse:
|
||||
|
||||
invoke optionbox.mouse, op_list_mode
|
||||
|
||||
cmp [op_group_mode], op_mode_win
|
||||
jne .fullscreen
|
||||
|
||||
invoke optionbox.mouse, op_list_res
|
||||
invoke optionbox.mouse, op_list_scale
|
||||
|
||||
.fullscreen:
|
||||
call options_sync
|
||||
test al, al
|
||||
jnz draw_window
|
||||
|
||||
ret
|
||||
|
||||
|
||||
options_sync:
|
||||
|
||||
xor eax, eax
|
||||
|
||||
mov ebx, MODE_WIN
|
||||
cmp [op_group_mode], op_mode_win
|
||||
je .mode_set
|
||||
mov ebx, MODE_WINF
|
||||
cmp [op_group_mode], op_mode_winf
|
||||
je .mode_set
|
||||
mov ebx, MODE_FULL
|
||||
.mode_set:
|
||||
cmp [mode], ebx
|
||||
je .mode_done
|
||||
mov [mode], ebx
|
||||
or al, 1
|
||||
.mode_done:
|
||||
|
||||
xor ebx, ebx
|
||||
cmp [op_group_res], op_res_320_200
|
||||
setne bl
|
||||
cmp [base_res_index], ebx
|
||||
je .res_done
|
||||
mov [base_res_index], ebx
|
||||
or al, 1
|
||||
.res_done:
|
||||
|
||||
xor ebx, ebx
|
||||
cmp [op_group_scale], op_scale_1
|
||||
je .scale_set
|
||||
inc ebx
|
||||
cmp [op_group_scale], op_scale_2
|
||||
je .scale_set
|
||||
inc ebx
|
||||
cmp [op_group_scale], op_scale_3
|
||||
je .scale_set
|
||||
inc ebx
|
||||
.scale_set:
|
||||
cmp [scale_index], ebx
|
||||
je .scale_done
|
||||
mov [scale_index], ebx
|
||||
or al, 1
|
||||
.scale_done:
|
||||
|
||||
ret
|
||||
|
||||
|
||||
options_set_colors:
|
||||
|
||||
mov eax, [sc.work_button]
|
||||
mov ebx, [sc.work_light]
|
||||
mov ecx, [sc.work]
|
||||
add ecx, FONT_BIG
|
||||
|
||||
mov esi, op_list_mode
|
||||
call options_set_group_colors
|
||||
|
||||
cmp [mode], dword MODE_WIN
|
||||
jne .disabled
|
||||
|
||||
mov esi, op_list_res
|
||||
call options_set_group_colors
|
||||
|
||||
mov esi, op_list_scale
|
||||
call options_set_group_colors
|
||||
|
||||
ret
|
||||
|
||||
.disabled:
|
||||
mov eax, [sc.work_graph]
|
||||
mov ebx, [sc.work]
|
||||
mov ecx, [sc.work]
|
||||
add ecx, FONT_BIG
|
||||
|
||||
mov esi, op_list_res
|
||||
call options_set_group_colors
|
||||
|
||||
mov esi, op_list_scale
|
||||
call options_set_group_colors
|
||||
|
||||
ret
|
||||
|
||||
|
||||
options_set_group_colors:
|
||||
|
||||
.loop:
|
||||
mov edi, [esi]
|
||||
test edi, edi
|
||||
jz .end
|
||||
mov op_border_color, eax
|
||||
mov op_color, ebx
|
||||
mov op_text_color, ecx
|
||||
add esi, 4
|
||||
jmp .loop
|
||||
.end:
|
||||
|
||||
ret
|
||||
|
||||
; ================================================================
|
||||
|
||||
select_game:
|
||||
mov dword [title_ptr], title_wolf
|
||||
mov dword [args_res_ptr], args_res_wolf
|
||||
mov dword [run_info.file], run_name_wolf
|
||||
|
||||
cld
|
||||
mov esi, CMD_LINE
|
||||
mov edi, argv_buf
|
||||
mov edx, argv_ptrs
|
||||
call parse_cmdline
|
||||
|
||||
mov ecx, ebx
|
||||
mov esi, argv_ptrs
|
||||
|
||||
.loop:
|
||||
test ecx, ecx
|
||||
jz .done
|
||||
mov eax, [esi]
|
||||
add esi, 4
|
||||
dec ecx
|
||||
mov edi, token_game
|
||||
call streq
|
||||
jnz .loop
|
||||
|
||||
test ecx, ecx
|
||||
jz .done
|
||||
mov eax, [esi]
|
||||
add esi, 4
|
||||
dec ecx
|
||||
|
||||
mov edi, arg_wolf
|
||||
call streq
|
||||
jz .set_wolf
|
||||
mov edi, arg_quake
|
||||
call streq
|
||||
jz .set_quake
|
||||
mov edi, arg_doom
|
||||
call streq
|
||||
jz .set_doom
|
||||
jmp .loop
|
||||
|
||||
.set_wolf:
|
||||
mov dword [title_ptr], title_wolf
|
||||
mov dword [args_res_ptr], args_res_wolf
|
||||
mov dword [args_fs_ptr], arg_fullscreen_wolf
|
||||
mov dword [run_info.file], run_name_wolf
|
||||
jmp .loop
|
||||
|
||||
.set_doom:
|
||||
mov dword [title_ptr], title_doom
|
||||
mov dword [args_res_ptr], args_res_doom
|
||||
mov dword [args_fs_ptr], arg_fullscreen
|
||||
mov dword [run_info.file], run_name_doom
|
||||
jmp .loop
|
||||
|
||||
.set_quake:
|
||||
mov dword [title_ptr], title_quake
|
||||
mov dword [args_res_ptr], args_res_quake
|
||||
mov dword [args_fs_ptr], arg_fullscreen
|
||||
mov dword [run_info.file], run_name_quake
|
||||
jmp .loop
|
||||
|
||||
.done:
|
||||
ret
|
||||
|
||||
streq:
|
||||
push esi
|
||||
push edi
|
||||
mov esi, eax
|
||||
.cmp:
|
||||
mov bl, [esi]
|
||||
mov bh, [edi]
|
||||
cmp bl, bh
|
||||
jne .no
|
||||
test bl, bl
|
||||
jz .yes
|
||||
inc esi
|
||||
inc edi
|
||||
jmp .cmp
|
||||
.yes:
|
||||
pop edi
|
||||
pop esi
|
||||
xor eax, eax
|
||||
ret
|
||||
.no:
|
||||
pop edi
|
||||
pop esi
|
||||
or eax, 1
|
||||
ret
|
||||
|
||||
; ================================================================
|
||||
|
||||
args_build:
|
||||
mov edi, args_buffer
|
||||
mov ecx, ARGS_BUF_SIZE
|
||||
xor eax, eax
|
||||
rep stosb
|
||||
mov edi, args_buffer
|
||||
|
||||
mov esi, [args_res_ptr]
|
||||
call args_append_str
|
||||
|
||||
cmp [mode], dword MODE_WIN
|
||||
je .windowed
|
||||
cmp [mode], dword MODE_FULL
|
||||
je .exclusive
|
||||
|
||||
; windowed fullscreen mode, screen_size - consts
|
||||
call get_screen_size
|
||||
call get_skin_height
|
||||
mov eax, [screen_w]
|
||||
sub eax, UI_PADDING * 2
|
||||
mov edx, [screen_h]
|
||||
sub edx, [skin_h]
|
||||
sub edx, UI_PADDING
|
||||
jmp .emit
|
||||
|
||||
; exclusive fullscreen, full screen size (borderless via -fullscreen)
|
||||
.exclusive:
|
||||
call get_screen_size
|
||||
mov eax, [screen_w]
|
||||
mov edx, [screen_h]
|
||||
jmp .emit
|
||||
|
||||
; windowed mode, res * scale
|
||||
.windowed:
|
||||
mov eax, [base_res_index]
|
||||
mov ebx, [base_w + eax * 4]
|
||||
mov edx, [base_h + eax * 4]
|
||||
mov eax, [scale_index]
|
||||
mov ecx, [scale_vals + eax * 4]
|
||||
imul ebx, ecx
|
||||
imul edx, ecx
|
||||
mov eax, ebx
|
||||
|
||||
.emit:
|
||||
push edx
|
||||
call args_append_uint
|
||||
mov al, ' '
|
||||
stosb
|
||||
pop edx
|
||||
mov eax, edx
|
||||
call args_append_uint
|
||||
|
||||
cmp [mode], dword MODE_FULL
|
||||
jne .no_fs
|
||||
mov esi, [args_fs_ptr]
|
||||
test esi, esi
|
||||
jz .no_fs
|
||||
call args_append_str
|
||||
.no_fs:
|
||||
|
||||
ret
|
||||
|
||||
|
||||
args_append_str:
|
||||
|
||||
lodsb
|
||||
test al, al
|
||||
jz .done
|
||||
stosb
|
||||
jmp args_append_str
|
||||
|
||||
.done:
|
||||
ret
|
||||
|
||||
|
||||
args_append_uint:
|
||||
|
||||
mov esi, num_buf + 15
|
||||
mov byte [esi], 0
|
||||
mov ebx, 10
|
||||
|
||||
cmp eax, 0
|
||||
jne .loop
|
||||
|
||||
dec esi
|
||||
mov byte [esi], '0'
|
||||
jmp .copy
|
||||
|
||||
.loop:
|
||||
xor edx, edx
|
||||
div ebx
|
||||
add dl, '0'
|
||||
dec esi
|
||||
mov [esi], dl
|
||||
test eax, eax
|
||||
jne .loop
|
||||
|
||||
.copy:
|
||||
mov al, [esi]
|
||||
test al, al
|
||||
jz .done
|
||||
|
||||
stosb
|
||||
inc esi
|
||||
jmp .copy
|
||||
|
||||
.done:
|
||||
ret
|
||||
|
||||
; ================================================================
|
||||
|
||||
run_game:
|
||||
|
||||
call args_build
|
||||
mov dword [run_info.args], args_buffer
|
||||
mcall SF_FILE, run_info
|
||||
|
||||
jmp still
|
||||
|
||||
; ================================================================
|
||||
|
||||
get_screen_size:
|
||||
|
||||
mcall SF_GET_SCREEN_SIZE
|
||||
movzx ecx, ax
|
||||
inc ecx
|
||||
mov [screen_h], ecx
|
||||
shr eax, 16
|
||||
inc eax
|
||||
mov [screen_w], eax
|
||||
|
||||
ret
|
||||
|
||||
|
||||
get_skin_height:
|
||||
|
||||
mcall SF_STYLE_SETTINGS, SSF_GET_SKIN_HEIGHT
|
||||
mov [skin_h], eax
|
||||
|
||||
ret
|
||||
|
||||
; ================================================================
|
||||
|
||||
WN_RECT RECT 128, 128, 220, 293
|
||||
|
||||
LB_MODE RECT 7, 10, 0, 0
|
||||
|
||||
LB_MODE_WIN RECT 30, 35, 0, 0
|
||||
LB_MODE_WINF RECT 30, 58, 0, 0
|
||||
LB_MODE_FULL RECT 30, 81, 0, 0
|
||||
|
||||
BT_MODE_WIN RECT 8, 34, 15, 15
|
||||
BT_MODE_WINF RECT 8, 57, 15, 15
|
||||
BT_MODE_FULL RECT 8, 80, 15, 15
|
||||
|
||||
LB_RES RECT 7, 109, 0, 0
|
||||
|
||||
LB_RES_320_200 RECT 30, 134, 0, 0
|
||||
LB_RES_320_240 RECT 30, 158, 0, 0
|
||||
|
||||
BT_RES_320_200 RECT 8, 133, 15, 15
|
||||
BT_RES_320_240 RECT 8, 157, 15, 15
|
||||
|
||||
LB_SCALE RECT 134, 109, 0, 0
|
||||
|
||||
LB_SCALE_1 RECT 157, 134, 0, 0
|
||||
LB_SCALE_2 RECT 157, 157, 0, 0
|
||||
LB_SCALE_3 RECT 157, 180, 0, 0
|
||||
LB_SCALE_4 RECT 157, 203, 0, 0
|
||||
|
||||
BT_SCALE_1 RECT 135, 133, 15, 15
|
||||
BT_SCALE_2 RECT 135, 156, 15, 15
|
||||
BT_SCALE_3 RECT 135, 179, 15, 15
|
||||
BT_SCALE_4 RECT 135, 202, 15, 15
|
||||
|
||||
BT_PLAY RECT 8, 233, 196, 23
|
||||
LB_PLAY RECT 100, 237, 0, 0
|
||||
|
||||
IC_PLAY RECT 76, 235, 18, 18
|
||||
|
||||
FONT_BIG = 0x90000000
|
||||
UI_MARGIN = 9
|
||||
UI_PADDING = 5
|
||||
|
||||
; ================================================================
|
||||
|
||||
if lang eq ru_RU
|
||||
|
||||
title_wolf cp866 "Лаунчер Wolf3D", 0
|
||||
title_doom cp866 "Лаунчер Doom", 0
|
||||
title_quake cp866 "Лаунчер Quake", 0
|
||||
|
||||
label_mode cp866 "Режим отображения:", 0
|
||||
label_res cp866 "Разрешение:", 0
|
||||
label_scale cp866 "Масштаб:", 0
|
||||
text_win cp866 "Оконный", 0
|
||||
text_win_len = $ - text_win - 1
|
||||
text_winf cp866 "Полноэкр. в окне", 0
|
||||
text_winf_len = $ - text_winf - 1
|
||||
text_full cp866 "Весь экран", 0
|
||||
text_full_len = $ - text_full - 1
|
||||
text_play cp866 "Играть", 0
|
||||
|
||||
else if lang eq es_ES
|
||||
|
||||
title_wolf cp850 "Wolf3D Launcher", 0
|
||||
title_doom cp850 "Doom Launcher", 0
|
||||
title_quake cp850 "Quake Launcher", 0
|
||||
|
||||
label_mode cp850 "Modo de pantalla:", 0
|
||||
label_res cp850 "Resolucion:", 0
|
||||
label_scale cp850 "Escala:", 0
|
||||
text_win cp850 "En ventana", 0
|
||||
text_win_len = $ - text_win - 1
|
||||
text_winf cp850 "Ventana completa", 0
|
||||
text_winf_len = $ - text_winf - 1
|
||||
text_full cp850 "Pantalla completa", 0
|
||||
text_full_len = $ - text_full - 1
|
||||
text_play cp850 "Jugar", 0
|
||||
|
||||
else
|
||||
|
||||
title_wolf db "Wolf3D Launcher", 0
|
||||
title_doom db "Doom Launcher", 0
|
||||
title_quake db "Quake Launcher", 0
|
||||
|
||||
label_mode db "Display mode:", 0
|
||||
label_res db "Resolution:", 0
|
||||
label_scale db "Scale:", 0
|
||||
text_win db "Windowed", 0
|
||||
text_win_len = $ - text_win - 1
|
||||
text_winf db "Windowed fullscreen", 0
|
||||
text_winf_len = $ - text_winf - 1
|
||||
text_full db "Exclusive fullscreen", 0
|
||||
text_full_len = $ - text_full - 1
|
||||
text_play db "Play", 0
|
||||
|
||||
endf
|
||||
|
||||
text_320_200 db "320x200", 0
|
||||
text_320_200_len = $ - text_320_200 - 1
|
||||
text_320_240 db "320x240", 0
|
||||
text_320_240_len = $ - text_320_240 - 1
|
||||
text_x1 db "x1", 0
|
||||
text_x1_len = $ - text_x1 - 1
|
||||
text_x2 db "x2", 0
|
||||
text_x2_len = $ - text_x2 - 1
|
||||
text_x3 db "x3", 0
|
||||
text_x3_len = $ - text_x3 - 1
|
||||
text_x4 db "x4", 0
|
||||
text_x4_len = $ - text_x4 - 1
|
||||
|
||||
; ================================================================
|
||||
|
||||
op_mode_win option_box op_group_mode, BT_MODE_WIN.X, BT_MODE_WIN.Y, UI_MARGIN, BT_MODE_WIN.W, 0, 0, 0, text_win, text_win_len, 0
|
||||
op_mode_winf option_box op_group_mode, BT_MODE_WINF.X, BT_MODE_WINF.Y, UI_MARGIN, BT_MODE_WINF.W, 0, 0, 0, text_winf, text_winf_len, 0
|
||||
op_mode_full option_box op_group_mode, BT_MODE_FULL.X, BT_MODE_FULL.Y, UI_MARGIN, BT_MODE_FULL.W, 0, 0, 0, text_full, text_full_len, 0
|
||||
|
||||
op_res_320_200 option_box op_group_res, BT_RES_320_200.X, BT_RES_320_200.Y, UI_MARGIN, BT_RES_320_200.W, 0, 0, 0, text_320_200, text_320_200_len, 0
|
||||
op_res_320_240 option_box op_group_res, BT_RES_320_240.X, BT_RES_320_240.Y, UI_MARGIN, BT_RES_320_240.W, 0, 0, 0, text_320_240, text_320_240_len, 0
|
||||
|
||||
op_scale_1 option_box op_group_scale, BT_SCALE_1.X, BT_SCALE_1.Y, UI_MARGIN, BT_SCALE_1.W, 0, 0, 0, text_x1, text_x1_len, 0
|
||||
op_scale_2 option_box op_group_scale, BT_SCALE_2.X, BT_SCALE_2.Y, UI_MARGIN, BT_SCALE_2.W, 0, 0, 0, text_x2, text_x2_len, 0
|
||||
op_scale_3 option_box op_group_scale, BT_SCALE_3.X, BT_SCALE_3.Y, UI_MARGIN, BT_SCALE_3.W, 0, 0, 0, text_x3, text_x3_len, 0
|
||||
op_scale_4 option_box op_group_scale, BT_SCALE_4.X, BT_SCALE_4.Y, UI_MARGIN, BT_SCALE_4.W, 0, 0, 0, text_x4, text_x4_len, 0
|
||||
|
||||
op_list_mode dd op_mode_win, op_mode_winf, op_mode_full, 0
|
||||
op_list_res dd op_res_320_200, op_res_320_240, 0
|
||||
op_list_scale dd op_scale_1, op_scale_2, op_scale_3, op_scale_4, 0
|
||||
|
||||
op_group_mode dd op_mode_win
|
||||
op_group_res dd op_res_320_200
|
||||
op_group_scale dd op_scale_3
|
||||
|
||||
; ================================================================
|
||||
|
||||
MODE_WIN = 0 ; windowed
|
||||
MODE_WINF = 1 ; windowed fullsceen
|
||||
MODE_FULL = 2 ; exclusive (borderless) fullscreen
|
||||
|
||||
RES_320_200 = 0 ; 320x200
|
||||
RES_320_240 = 1 ; 320x240
|
||||
|
||||
SCALE_X1 = 0 ; x1
|
||||
SCALE_X2 = 1 ; x2
|
||||
SCALE_X3 = 2 ; x3
|
||||
SCALE_X4 = 3 ; x4
|
||||
|
||||
mode dd MODE_WIN
|
||||
base_res_index dd RES_320_200
|
||||
scale_index dd SCALE_X3
|
||||
|
||||
|
||||
base_w dd 320, 320
|
||||
base_h dd 200, 240
|
||||
scale_vals dd 1, 2, 3, 4
|
||||
|
||||
screen_w dd 0
|
||||
screen_h dd 0
|
||||
skin_h dd 0
|
||||
|
||||
BTN_PLAY = 0x40
|
||||
|
||||
icon_play dd 0x00000000
|
||||
icon_mem db "ICONS18W", 0
|
||||
|
||||
token_game db "--game", 0
|
||||
arg_wolf db "wolf3d", 0
|
||||
arg_doom db "doom", 0
|
||||
arg_quake db "quake", 0
|
||||
|
||||
; game-specific data
|
||||
title_ptr dd title_wolf
|
||||
args_res_ptr dd args_res_wolf
|
||||
args_fs_ptr dd arg_fullscreen_wolf
|
||||
|
||||
args_res_wolf db "--resf ", 0
|
||||
args_res_doom db "-winsize ", 0
|
||||
args_res_quake db "-winsize ", 0
|
||||
arg_fullscreen db " -fullscreen", 0
|
||||
arg_fullscreen_wolf db " --fullscreen", 0
|
||||
|
||||
run_info:
|
||||
.func dd SSF_START_APP
|
||||
.flags dd 0
|
||||
.args dd 0
|
||||
.res0 dd 0
|
||||
.res1 dd 0
|
||||
.zero db 0
|
||||
.file dd run_name_wolf
|
||||
|
||||
run_name_wolf db "/kolibrios/games/wolf3d/wolf3d", 0
|
||||
run_name_doom db "/kolibrios/games/doom1/doom", 0
|
||||
run_name_quake db "/kolibrios/games/quake/sdlquake", 0
|
||||
|
||||
; ================================================================
|
||||
|
||||
I_END:
|
||||
|
||||
; The kernel zeroes an app's BSS only from the first page boundary past I_END
|
||||
; (map_process_image rounds file_size UP to a page before clearing), so the tail
|
||||
; of the last loaded page holds garbage. Page-align these reserved buffers into
|
||||
; the zeroed region. The padding and buffers are reserved (not stored in the
|
||||
; binary), so this keeps the file small while guaranteeing zeroed buffers.
|
||||
align 4096
|
||||
|
||||
sc system_colors
|
||||
|
||||
ARGS_BUF_SIZE = 64
|
||||
args_buffer rb ARGS_BUF_SIZE
|
||||
num_buf rb 16
|
||||
|
||||
CMD_LINE rb 256
|
||||
argv_ptrs rd 16
|
||||
argv_buf rb 256
|
||||
|
||||
rb 1024 ; stack
|
||||
align 512
|
||||
|
||||
STACK_TOP:
|
||||
MEM:
|
||||
@@ -1,41 +0,0 @@
|
||||
# Параметры запуска sdlquake (KolibriOS)
|
||||
|
||||
Этот список отражает реальные параметры, доступные в текущей сборке из этого репозитория.
|
||||
Проверено по `Makefile.kos` и файлам из `C_SRC`.
|
||||
|
||||
## Параметры (по блокам)
|
||||
|
||||
### Файлы и данные
|
||||
- `-basedir <dir>` - задать базовый каталог игры.
|
||||
- `-cachedir <dir>` - каталог кеша (если далее идёт аргумент с `-`, кеш выключается).
|
||||
- `-game <gamedir>` - добавить `basedir/gamedir` как override-данные.
|
||||
- `-path <p1> <p2> ...` - задать поисковые пути полностью.
|
||||
- `-hipnotic` - mission pack Hipnotic.
|
||||
- `-rogue` - mission pack Rogue.
|
||||
- `-proghack` - режим совместимости для `progs.dat`.
|
||||
|
||||
### Сеть и сервер
|
||||
- `-dedicated [maxclients]` - выделенный сервер.
|
||||
- `-listen [maxclients]` - слушать как сервер.
|
||||
- `-port <p>` / `-udpport <p>` / `-ipxport <p>` - сетевой порт.
|
||||
- `-record` - записать VCR (`quake.vcr`).
|
||||
- `-playback` - воспроизвести VCR (`quake.vcr`).
|
||||
|
||||
### Видео и ввод
|
||||
- `-winsize <width> <height>` - размер окна/буфера SDL в пикселях. **Используется лаунчером.**
|
||||
- `-fullscreen` - полноэкранный (безрамочный) режим. **Используется лаунчером** вместе с `-winsize` под размер экрана.
|
||||
- `-nomouse` - выключить инициализацию мыши.
|
||||
|
||||
### Звук
|
||||
- `-nosound` - выключить звук.
|
||||
- `-simsound` - эмуляция звука без реального вывода.
|
||||
|
||||
### Производительность, память и диагностика
|
||||
- `-surfcachesize <kb>` - размер surface cache в KB.
|
||||
- `-particles <n>` - число частиц.
|
||||
- `-zone <kb>` - размер zone memory в KB.
|
||||
- `-minmemory` - минимизировать расход памяти.
|
||||
- `-condebug` - писать `qconsole.log` в текущий `com_gamedir`.
|
||||
- `-safe` - безопасный режим: включает набор «-no*» флагов. На KolibriOS реально действуют `-nosound` и `-nomouse`, остальные относятся к другим платформам.
|
||||
|
||||
Размер кучи (8 МБ) автоматически увеличивается под выбранное разрешение в `sys_sdl.c`, чтобы видеобуферы (z-buffer + surface cache) не переполняли её на больших окнах/полноэкранном режиме.
|
||||
@@ -1,39 +0,0 @@
|
||||
# Параметры запуска Wolf3D (KolibriOS)
|
||||
|
||||
Этот список отражает реальные параметры, доступные в текущей сборке из этого репозитория.
|
||||
Проверено по:
|
||||
- `contrib/games/wolf3d/wl_main.cpp` (парсер аргументов).
|
||||
- `contrib/games/wolf3d/Makefile` и `contrib/games/wolf3d/Tupfile.lua` (определён `_KOLIBRI`).
|
||||
- `contrib/games/wolf3d/version.h` (не определены `SPEAR`/`SPEARDEMO`, определён `GOODTIMES`).
|
||||
|
||||
## Параметры (по блокам)
|
||||
|
||||
### Общие
|
||||
- `--help` - показать справку.
|
||||
- `--goobers` - режим отладки.
|
||||
- `--nowait` - пропустить вступительные экраны.
|
||||
- `--tedlevel <level>` - старт с указанного уровня.
|
||||
- `--baby` / `--easy` / `--normal` / `--hard` - сложность (для `--tedlevel`).
|
||||
- `--mission <0..3>` - выбор миссии. Только Spear of Destiny; в этой сборке Wolf3D аргумент принимается, но ни на что не влияет.
|
||||
|
||||
### Видео и ввод
|
||||
- `--res <width> <height>` - разрешение, кратное 320x200 или 320x240.
|
||||
- `--resf <w> <h>` - любое разрешение >= 320x200 (возможны артефакты). **Используется лаунчером.**
|
||||
- `--windowed` / `--windowed-mouse` - оконный режим (с рамкой). **По умолчанию в KolibriOS-сборке.**
|
||||
- `--fullscreen` - полноэкранный (безрамочный) режим. **Используется лаунчером для Exclusive fullscreen.**
|
||||
- `--bits <b>` - глубина цвета: 8/16/24/32.
|
||||
- `--nodblbuf` - отключить двойную буферизацию SDL.
|
||||
- `--extravbls <vbls>` - задержка после кадра (уменьшает мерцание).
|
||||
|
||||
### Звук
|
||||
- `--nosound` - отключить звук.
|
||||
- `--audiobuffer <size>` - размер аудиобуфера в байтах.
|
||||
|
||||
### Файлы и данные
|
||||
- `--configdir <dir>` - каталог конфигов и сохранений.
|
||||
- `--ignorenumchunks` - игнорировать число чанков в `VGAHEAD.*`.
|
||||
- `--goodtimes` - снять проверку защиты (только Spear of Destiny). В сборке Wolf3D принимается, но не действует (`GOODTIMES` уже определён).
|
||||
|
||||
### Недоступно в KolibriOS-сборке
|
||||
В текущей KolibriOS-сборке (с `-D_KOLIBRI`) эти опции отключены в коде:
|
||||
- `--joystick`, `--joystickhat`, `--samplerate`.
|
||||
@@ -17,7 +17,7 @@ compile_gcc{
|
||||
"wl_cloudsky.cpp", "wl_debug.cpp", "id_sd.cpp", "wl_play.cpp", "id_vl.cpp", "wl_act2.cpp", "wl_floorceiling.cpp", "wl_dir3dspr.cpp",
|
||||
"wl_state.cpp", "wl_atmos.cpp", "id_in.cpp", "signon.cpp", "wl_parallax.cpp", "wl_agent.cpp", "sdl_winmain.cpp", "wl_inter.cpp", "wl_text.cpp",
|
||||
"id_pm.cpp", "wl_draw.cpp", "wl_menu.cpp", "wl_game.cpp", "wl_act1.cpp", "wl_main.cpp", "wl_shade.cpp", "id_us_1.cpp", "id_vh.cpp", "id_ca.cpp",
|
||||
"joystick_stub.cpp", "mame/fmopl.cpp",
|
||||
"joystick_stub.cpp", "kolibri.cpp", "mame/fmopl.cpp",
|
||||
}
|
||||
|
||||
-- SDL_mixer stubs --
|
||||
|
||||
@@ -1009,9 +1009,6 @@ void CA_CacheScreen (int chunk)
|
||||
CHECKMALLOCRESULT(pic);
|
||||
CAL_HuffExpand((byte *) source, pic, expanded, grhuffman);
|
||||
|
||||
if(screenXoffset || screenYoffset)
|
||||
VL_ClearScreen(0); // clear letterbox margins
|
||||
|
||||
vbuf = VL_LockSurface(curSurface);
|
||||
if(vbuf != NULL)
|
||||
{
|
||||
@@ -1022,7 +1019,7 @@ void CA_CacheScreen (int chunk)
|
||||
byte col = pic[(y * 80 + (x >> 2)) + (x & 3) * 80 * 200];
|
||||
for(i = 0; i < scaleFactor; i++)
|
||||
for(j = 0; j < scaleFactor; j++)
|
||||
vbuf[(scy + i + screenYoffset) * curPitch + scx + j + screenXoffset] = col;
|
||||
vbuf[(scy + i) * curPitch + scx + j] = col;
|
||||
}
|
||||
}
|
||||
VL_UnlockSurface(curSurface);
|
||||
|
||||
@@ -24,8 +24,7 @@ void VWB_DrawPropString(const char* string)
|
||||
|
||||
font = (fontstruct *) grsegs[STARTFONT+fontnumber];
|
||||
height = font->height;
|
||||
dest = vbuf + (scaleFactor * py + screenYoffset) * curPitch
|
||||
+ scaleFactor * px + screenXoffset;
|
||||
dest = vbuf + scaleFactor * (py * curPitch + px);
|
||||
|
||||
while ((ch = (byte)*string++)!=0)
|
||||
{
|
||||
|
||||
@@ -16,14 +16,7 @@
|
||||
#define assert_ret(x) assert(x)
|
||||
#endif
|
||||
|
||||
boolean fullscreen = false;
|
||||
|
||||
// Centering of the logical 320x200 layer (menus, title/intro, fonts, fullscreen
|
||||
// pics) when the resolution isn't an exact multiple of 320x200. The 3D view and
|
||||
// in-game HUD use physical coordinates and stay full-screen.
|
||||
int screenXoffset = 0;
|
||||
int screenYoffset = 0;
|
||||
|
||||
boolean fullscreen = true;
|
||||
#if defined(_arch_dreamcast)
|
||||
boolean usedoublebuffering = false;
|
||||
unsigned screenWidth = 320;
|
||||
@@ -150,9 +143,6 @@ void VL_SetVGAPlaneMode (void)
|
||||
scaleFactor = screenWidth/320;
|
||||
if(screenHeight/200 < scaleFactor) scaleFactor = screenHeight/200;
|
||||
|
||||
screenXoffset = (screenWidth - scaleFactor * 320) / 2;
|
||||
screenYoffset = (screenHeight - scaleFactor * 200) / 2;
|
||||
|
||||
pixelangle = (short *) malloc(screenWidth * sizeof(short));
|
||||
CHECKMALLOCRESULT(pixelangle);
|
||||
wallheight = (int *) malloc(screenWidth * sizeof(int));
|
||||
@@ -444,7 +434,7 @@ void VL_Plot (int x, int y, int color)
|
||||
ptr = VL_LockSurface(curSurface);
|
||||
if(ptr == NULL) return;
|
||||
|
||||
ptr[(y + screenYoffset) * curPitch + x + screenXoffset] = color;
|
||||
ptr[y * curPitch + x] = color;
|
||||
|
||||
VL_UnlockSurface(curSurface);
|
||||
}
|
||||
@@ -469,7 +459,7 @@ byte VL_GetPixel (int x, int y)
|
||||
ptr = VL_LockSurface(curSurface);
|
||||
if(ptr == NULL) return 0;
|
||||
|
||||
col = ((byte *) curSurface->pixels)[(y + screenYoffset) * curPitch + x + screenXoffset];
|
||||
col = ((byte *) curSurface->pixels)[y * curPitch + x];
|
||||
|
||||
VL_UnlockSurface(curSurface);
|
||||
|
||||
@@ -496,7 +486,7 @@ void VL_Hlin (unsigned x, unsigned y, unsigned width, int color)
|
||||
ptr = VL_LockSurface(curSurface);
|
||||
if(ptr == NULL) return;
|
||||
|
||||
memset(ptr + (y + screenYoffset) * curPitch + x + screenXoffset, color, width);
|
||||
memset(ptr + y * curPitch + x, color, width);
|
||||
|
||||
VL_UnlockSurface(curSurface);
|
||||
}
|
||||
@@ -521,7 +511,7 @@ void VL_Vlin (int x, int y, int height, int color)
|
||||
ptr = VL_LockSurface(curSurface);
|
||||
if(ptr == NULL) return;
|
||||
|
||||
ptr += (y + screenYoffset) * curPitch + x + screenXoffset;
|
||||
ptr += y * curPitch + x;
|
||||
|
||||
while (height--)
|
||||
{
|
||||
|
||||
@@ -16,7 +16,6 @@ extern SDL_Surface *screen, *screenBuffer, *curSurface;
|
||||
extern boolean fullscreen, usedoublebuffering;
|
||||
extern unsigned screenWidth, screenHeight, screenBits, screenPitch, bufferPitch, curPitch;
|
||||
extern unsigned scaleFactor;
|
||||
extern int screenXoffset, screenYoffset;
|
||||
|
||||
extern boolean screenfaded;
|
||||
extern unsigned bordercolor;
|
||||
@@ -54,7 +53,7 @@ void VL_Vlin (int x, int y, int height, int color);
|
||||
void VL_BarScaledCoord (int scx, int scy, int scwidth, int scheight, int color);
|
||||
void inline VL_Bar (int x, int y, int width, int height, int color)
|
||||
{
|
||||
VL_BarScaledCoord(scaleFactor*x + screenXoffset, scaleFactor*y + screenYoffset,
|
||||
VL_BarScaledCoord(scaleFactor*x, scaleFactor*y,
|
||||
scaleFactor*width, scaleFactor*height, color);
|
||||
}
|
||||
void inline VL_ClearScreen(int color)
|
||||
@@ -74,7 +73,7 @@ void VL_MemToScreenScaledCoord (byte *source, int origwidth, int origheight, in
|
||||
void inline VL_MemToScreen (byte *source, int width, int height, int x, int y)
|
||||
{
|
||||
VL_MemToScreenScaledCoord(source, width, height,
|
||||
scaleFactor*x + screenXoffset, scaleFactor*y + screenYoffset);
|
||||
scaleFactor*x, scaleFactor*y);
|
||||
}
|
||||
|
||||
void VL_MaskedToScreen (byte *source, int width, int height, int x, int y);
|
||||
@@ -86,7 +85,7 @@ void inline VL_LatchToScreen (SDL_Surface *source, int xsrc, int ysrc,
|
||||
int width, int height, int xdest, int ydest)
|
||||
{
|
||||
VL_LatchToScreenScaledCoord(source,xsrc,ysrc,width,height,
|
||||
scaleFactor*xdest + screenXoffset,scaleFactor*ydest + screenYoffset);
|
||||
scaleFactor*xdest,scaleFactor*ydest);
|
||||
}
|
||||
void inline VL_LatchToScreenScaledCoord (SDL_Surface *source, int scx, int scy)
|
||||
{
|
||||
@@ -95,5 +94,5 @@ void inline VL_LatchToScreenScaledCoord (SDL_Surface *source, int scx, int scy)
|
||||
void inline VL_LatchToScreen (SDL_Surface *source, int x, int y)
|
||||
{
|
||||
VL_LatchToScreenScaledCoord(source,0,0,source->w,source->h,
|
||||
scaleFactor*x + screenXoffset,scaleFactor*y + screenYoffset);
|
||||
scaleFactor*x,scaleFactor*y);
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
#include <stdlib.h>
|
||||
#include <sys/ksys.h>
|
||||
#include <string.h>
|
||||
|
||||
extern unsigned screenWidth;
|
||||
extern unsigned screenHeight;
|
||||
|
||||
void kolibri_set_win_max(void){
|
||||
unsigned multip1, multip2;
|
||||
ksys_pos_t screen_size = _ksys_screen_size();
|
||||
|
||||
screen_size.y++;
|
||||
screen_size.x++;
|
||||
|
||||
multip1 = (screen_size.y)/240;
|
||||
multip2 = (screen_size.y)/200;
|
||||
|
||||
do{
|
||||
screenWidth = 320 * multip1;
|
||||
screenHeight = 240 * multip1;
|
||||
|
||||
if(screenWidth<=screen_size.x){
|
||||
break;
|
||||
}
|
||||
|
||||
screenWidth = 320 * multip2;
|
||||
screenHeight = 200 * multip2;
|
||||
|
||||
if(screenWidth<=screen_size.y){
|
||||
break;
|
||||
}
|
||||
|
||||
multip1--;
|
||||
multip2--;
|
||||
|
||||
}while(multip1>0 && multip2>0);
|
||||
}
|
||||
@@ -134,8 +134,6 @@ Victory (void)
|
||||
CA_CacheGrChunk (BJCOLLAPSE3PIC);
|
||||
CA_CacheGrChunk (BJCOLLAPSE4PIC);
|
||||
|
||||
if(screenXoffset || screenYoffset)
|
||||
VL_ClearScreen(0);
|
||||
VWB_Bar (0, 0, 320, 200, VIEWCOLOR);
|
||||
VWB_DrawPic (124, 44, BJCOLLAPSE1PIC);
|
||||
VW_UpdateScreen ();
|
||||
@@ -167,8 +165,6 @@ Victory (void)
|
||||
CA_CacheGrChunk (C_TIMECODEPIC);
|
||||
#endif
|
||||
|
||||
if(screenXoffset || screenYoffset)
|
||||
VL_ClearScreen(0);
|
||||
VWB_Bar (0, 0, 320, screenHeight / scaleFactor - STATUSLINES + 1, VIEWCOLOR);
|
||||
if (bordercol != VIEWCOLOR)
|
||||
DrawStatusBorder (VIEWCOLOR);
|
||||
@@ -316,8 +312,6 @@ void
|
||||
PG13 (void)
|
||||
{
|
||||
VW_FadeOut ();
|
||||
if(screenXoffset || screenYoffset)
|
||||
VL_ClearScreen(0);
|
||||
VWB_Bar (0, 0, 320, 200, 0x82); // background
|
||||
|
||||
CA_CacheGrChunk (PG13PIC);
|
||||
@@ -565,8 +559,6 @@ LevelCompleted (void)
|
||||
|
||||
CacheLump (LEVELEND_LUMP_START, LEVELEND_LUMP_END);
|
||||
ClearSplitVWB (); // set up for double buffering in split screen
|
||||
if(screenXoffset || screenYoffset)
|
||||
VL_ClearScreen(0);
|
||||
VWB_Bar (0, 0, 320, screenHeight / scaleFactor - STATUSLINES + 1, VIEWCOLOR);
|
||||
|
||||
if (bordercol != VIEWCOLOR)
|
||||
|
||||
@@ -1369,7 +1369,7 @@ boolean SetViewSize (unsigned width, unsigned height)
|
||||
{
|
||||
viewscreenx = (screenWidth-viewwidth) / 2;
|
||||
viewscreeny = (screenHeight-scaleFactor*STATUSLINES-viewheight)/2;
|
||||
screenofs = viewscreeny*bufferPitch+viewscreenx;
|
||||
screenofs = viewscreeny*screenWidth+viewscreenx;
|
||||
}
|
||||
|
||||
//
|
||||
@@ -1721,6 +1721,7 @@ void CheckParameters(int argc, char *argv[])
|
||||
}
|
||||
else IFARG("--nosound")
|
||||
SD_Started=true;
|
||||
#ifndef _KOLIBRI
|
||||
else IFARG("--windowed")
|
||||
fullscreen = false;
|
||||
else IFARG("--windowed-mouse")
|
||||
@@ -1728,8 +1729,7 @@ void CheckParameters(int argc, char *argv[])
|
||||
fullscreen = false;
|
||||
forcegrabmouse = true;
|
||||
}
|
||||
else IFARG("--fullscreen")
|
||||
fullscreen = true;
|
||||
#endif
|
||||
else IFARG("--res")
|
||||
{
|
||||
if(i + 2 >= argc)
|
||||
@@ -1971,10 +1971,13 @@ void CheckParameters(int argc, char *argv[])
|
||||
==========================
|
||||
*/
|
||||
|
||||
extern void kolibri_set_win_max(void);
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
#ifdef _KOLIBRI
|
||||
_ksys_setcwd(dirname(argv[0]));
|
||||
kolibri_set_win_max();
|
||||
#endif
|
||||
|
||||
#if defined(_arch_dreamcast)
|
||||
|
||||
@@ -3066,8 +3066,6 @@ IntroScreen (void)
|
||||
void
|
||||
ClearMScreen (void)
|
||||
{
|
||||
if(screenXoffset || screenYoffset)
|
||||
VL_ClearScreen(0); // clear letterbox margins
|
||||
#ifndef SPEAR
|
||||
VWB_Bar (0, 0, 320, 200, BORDCOLOR);
|
||||
#else
|
||||
|
||||
@@ -424,8 +424,6 @@ void PageLayout (boolean shownumber)
|
||||
//
|
||||
// clear the screen
|
||||
//
|
||||
if(screenXoffset || screenYoffset)
|
||||
VL_ClearScreen(0);
|
||||
VWB_Bar (0,0,320,200,BACKCOLOR);
|
||||
VWB_DrawPic (0,0,H_TOPWINDOWPIC);
|
||||
VWB_DrawPic (0,8,H_LEFTWINDOWPIC);
|
||||
@@ -644,8 +642,6 @@ void ShowArticle (char *article)
|
||||
oldfontnumber = fontnumber;
|
||||
fontnumber = 0;
|
||||
CA_CacheGrChunk(STARTFONT);
|
||||
if(screenXoffset || screenYoffset)
|
||||
VL_ClearScreen(0);
|
||||
VWB_Bar (0,0,320,200,BACKCOLOR);
|
||||
CacheLayoutGraphics ();
|
||||
#endif
|
||||
|
||||
+479
-478
@@ -1,478 +1,479 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "7z.h"
|
||||
#include "7zAlloc.h"
|
||||
#include "7zBuf.h"
|
||||
#include "7zCrc.h"
|
||||
#include "7zFile.h"
|
||||
#include "7zVersion.h"
|
||||
#include "http.h"
|
||||
#include "package.h"
|
||||
|
||||
#define PERIOD_4 (4 * 365 + 1)
|
||||
#define PERIOD_100 (PERIOD_4 * 25 - 1)
|
||||
#define PERIOD_400 (PERIOD_100 * 4 + 1)
|
||||
|
||||
#define _UTF8_START(n) (0x100 - (1 << (7 - (n))))
|
||||
|
||||
#define _UTF8_RANGE(n) (((UInt32)1) << ((n) * 5 + 6))
|
||||
|
||||
#define _UTF8_HEAD(n, val) ((Byte)(_UTF8_START(n) + (val >> (6 * (n)))))
|
||||
#define _UTF8_CHAR(n, val) ((Byte)(0x80 + (((val) >> (6 * (n))) & 0x3F)))
|
||||
|
||||
#define MY_FILE_CODE_PAGE_PARAM
|
||||
|
||||
static ISzAlloc g_Alloc = { SzAlloc, SzFree };
|
||||
|
||||
static int Buf_EnsureSize(CBuf *dest, size_t size)
|
||||
{
|
||||
if (dest->size >= size)
|
||||
return 1;
|
||||
Buf_Free(dest, &g_Alloc);
|
||||
return Buf_Create(dest, size, &g_Alloc);
|
||||
}
|
||||
|
||||
|
||||
int test_archive(const char *path)
|
||||
{
|
||||
CFileInStream archiveStream;
|
||||
CLookToRead lookStream;
|
||||
CSzArEx db;
|
||||
SRes res;
|
||||
ISzAlloc allocImp;
|
||||
ISzAlloc allocTempImp;
|
||||
UInt16 *temp = NULL;
|
||||
|
||||
allocImp.Alloc = SzAlloc;
|
||||
allocImp.Free = SzFree;
|
||||
|
||||
allocTempImp.Alloc = SzAllocTemp;
|
||||
allocTempImp.Free = SzFreeTemp;
|
||||
|
||||
if (InFile_Open(&archiveStream.file, path))
|
||||
{
|
||||
printf("cannot open input file");
|
||||
return -1;
|
||||
}
|
||||
|
||||
FileInStream_CreateVTable(&archiveStream);
|
||||
LookToRead_CreateVTable(&lookStream, False);
|
||||
|
||||
lookStream.realStream = &archiveStream.s;
|
||||
LookToRead_Init(&lookStream);
|
||||
|
||||
CrcGenerateTable();
|
||||
|
||||
SzArEx_Init(&db);
|
||||
|
||||
res = SzArEx_Open(&db, &lookStream.s, &allocImp, &allocTempImp);
|
||||
|
||||
SzArEx_Free(&db, &allocImp);
|
||||
SzFree(NULL, temp);
|
||||
|
||||
File_Close(&archiveStream.file);
|
||||
|
||||
if (res == SZ_OK)
|
||||
return 0;
|
||||
else return -1;
|
||||
};
|
||||
|
||||
static size_t Utf16_To_Utf8_Calc(const UInt16 *src, const UInt16 *srcLim)
|
||||
{
|
||||
size_t size = 0;
|
||||
for (;;)
|
||||
{
|
||||
UInt32 val;
|
||||
if (src == srcLim)
|
||||
return size;
|
||||
|
||||
size++;
|
||||
val = *src++;
|
||||
|
||||
if (val < 0x80)
|
||||
continue;
|
||||
|
||||
if (val < _UTF8_RANGE(1))
|
||||
{
|
||||
size++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (val >= 0xD800 && val < 0xDC00 && src != srcLim)
|
||||
{
|
||||
UInt32 c2 = *src;
|
||||
if (c2 >= 0xDC00 && c2 < 0xE000)
|
||||
{
|
||||
src++;
|
||||
size += 3;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
size += 2;
|
||||
}
|
||||
}
|
||||
|
||||
static Byte *Utf16_To_Utf8(Byte *dest, const UInt16 *src, const UInt16 *srcLim)
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
UInt32 val;
|
||||
if (src == srcLim)
|
||||
return dest;
|
||||
|
||||
val = *src++;
|
||||
|
||||
if (val < 0x80)
|
||||
{
|
||||
*dest++ = (char)val;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (val < _UTF8_RANGE(1))
|
||||
{
|
||||
dest[0] = _UTF8_HEAD(1, val);
|
||||
dest[1] = _UTF8_CHAR(0, val);
|
||||
dest += 2;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (val >= 0xD800 && val < 0xDC00 && src != srcLim)
|
||||
{
|
||||
UInt32 c2 = *src;
|
||||
if (c2 >= 0xDC00 && c2 < 0xE000)
|
||||
{
|
||||
src++;
|
||||
val = (((val - 0xD800) << 10) | (c2 - 0xDC00)) + 0x10000;
|
||||
dest[0] = _UTF8_HEAD(3, val);
|
||||
dest[1] = _UTF8_CHAR(2, val);
|
||||
dest[2] = _UTF8_CHAR(1, val);
|
||||
dest[3] = _UTF8_CHAR(0, val);
|
||||
dest += 4;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
dest[0] = _UTF8_HEAD(2, val);
|
||||
dest[1] = _UTF8_CHAR(1, val);
|
||||
dest[2] = _UTF8_CHAR(0, val);
|
||||
dest += 3;
|
||||
}
|
||||
}
|
||||
|
||||
static SRes Utf16_To_Utf8Buf(CBuf *dest, const UInt16 *src, size_t srcLen)
|
||||
{
|
||||
size_t destLen = Utf16_To_Utf8_Calc(src, src + srcLen);
|
||||
destLen += 1;
|
||||
if (!Buf_EnsureSize(dest, destLen))
|
||||
return SZ_ERROR_MEM;
|
||||
*Utf16_To_Utf8(dest->data, src, src + srcLen) = 0;
|
||||
return SZ_OK;
|
||||
}
|
||||
|
||||
static void GetAttribString(UInt32 wa, Bool isDir, char *s)
|
||||
{
|
||||
s[0] = (char)(((wa & (1 << 4)) != 0 || isDir) ? 'D' : '.');
|
||||
s[1] = 0;
|
||||
}
|
||||
|
||||
static void UInt64ToStr(UInt64 value, char *s)
|
||||
{
|
||||
char temp[32];
|
||||
int pos = 0;
|
||||
do
|
||||
{
|
||||
temp[pos++] = (char)('0' + (unsigned)(value % 10));
|
||||
value /= 10;
|
||||
}
|
||||
while (value != 0);
|
||||
do
|
||||
*s++ = temp[--pos];
|
||||
while (pos);
|
||||
*s = '\0';
|
||||
}
|
||||
|
||||
static SRes Utf16_To_Char(CBuf *buf, const UInt16 *s)
|
||||
{
|
||||
unsigned len = 0;
|
||||
for (len = 0; s[len] != 0; len++);
|
||||
|
||||
return Utf16_To_Utf8Buf(buf, s, len);
|
||||
}
|
||||
|
||||
static char *UIntToStr(char *s, unsigned value, int numDigits)
|
||||
{
|
||||
char temp[16];
|
||||
int pos = 0;
|
||||
do
|
||||
temp[pos++] = (char)('0' + (value % 10));
|
||||
while (value /= 10);
|
||||
for (numDigits -= pos; numDigits > 0; numDigits--)
|
||||
*s++ = '0';
|
||||
do
|
||||
*s++ = temp[--pos];
|
||||
while (pos);
|
||||
*s = '\0';
|
||||
return s;
|
||||
}
|
||||
|
||||
static void UIntToStr_2(char *s, unsigned value)
|
||||
{
|
||||
s[0] = (char)('0' + (value / 10));
|
||||
s[1] = (char)('0' + (value % 10));
|
||||
}
|
||||
|
||||
static WRes OutFile_OpenUtf16(CSzFile *p, const UInt16 *name)
|
||||
{
|
||||
CBuf buf;
|
||||
WRes res;
|
||||
Buf_Init(&buf);
|
||||
RINOK(Utf16_To_Char(&buf, name MY_FILE_CODE_PAGE_PARAM));
|
||||
printf("open file %s\n", (const char *)buf.data);
|
||||
res = OutFile_Open(p, (const char *)buf.data);
|
||||
Buf_Free(&buf, &g_Alloc);
|
||||
return res;
|
||||
}
|
||||
|
||||
int create_dir(const char *path)
|
||||
{
|
||||
int retval;
|
||||
__asm__ __volatile__ (
|
||||
"pushl $0 \n\t"
|
||||
"pushl $0 \n\t"
|
||||
"movl %1, 1(%%esp) \n\t"
|
||||
"pushl $0 \n\t"
|
||||
"pushl $0 \n\t"
|
||||
"pushl $0 \n\t"
|
||||
"pushl $0 \n\t"
|
||||
"pushl $9 \n\t"
|
||||
"movl %%esp, %%ebx \n\t"
|
||||
"movl $70, %%eax \n\t"
|
||||
"int $0x40 \n\t"
|
||||
"addl $28, %%esp \n\t"
|
||||
:"=a" (retval)
|
||||
:"r" (path)
|
||||
:"ebx");
|
||||
return retval;
|
||||
};
|
||||
|
||||
static WRes MyCreateDir(const UInt16 *name)
|
||||
{
|
||||
CBuf buf;
|
||||
WRes res;
|
||||
Buf_Init(&buf);
|
||||
RINOK(Utf16_To_Char(&buf, name MY_FILE_CODE_PAGE_PARAM));
|
||||
|
||||
res = create_dir((const char *)buf.data) == 0 ? 0 : -1;
|
||||
Buf_Free(&buf, &g_Alloc);
|
||||
return res;
|
||||
}
|
||||
|
||||
static SRes PrintString(const UInt16 *s)
|
||||
{
|
||||
CBuf buf;
|
||||
SRes res;
|
||||
Buf_Init(&buf);
|
||||
res = Utf16_To_Char(&buf, s);
|
||||
if (res == SZ_OK)
|
||||
fputs((const char *)buf.data, stdout);
|
||||
Buf_Free(&buf, &g_Alloc);
|
||||
return res;
|
||||
}
|
||||
|
||||
void PrintError(char *sz)
|
||||
{
|
||||
printf("\nERROR: %s\n", sz);
|
||||
}
|
||||
|
||||
static void ConvertFileTimeToString(const CNtfsFileTime *nt, char *s)
|
||||
{
|
||||
unsigned year, mon, hour, min, sec;
|
||||
Byte ms[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
|
||||
unsigned t;
|
||||
UInt32 v;
|
||||
UInt64 v64 = nt->Low | ((UInt64)nt->High << 32);
|
||||
v64 /= 10000000;
|
||||
sec = (unsigned)(v64 % 60); v64 /= 60;
|
||||
min = (unsigned)(v64 % 60); v64 /= 60;
|
||||
hour = (unsigned)(v64 % 24); v64 /= 24;
|
||||
|
||||
v = (UInt32)v64;
|
||||
|
||||
year = (unsigned)(1601 + v / PERIOD_400 * 400);
|
||||
v %= PERIOD_400;
|
||||
|
||||
t = v / PERIOD_100; if (t == 4) t = 3; year += t * 100; v -= t * PERIOD_100;
|
||||
t = v / PERIOD_4; if (t == 25) t = 24; year += t * 4; v -= t * PERIOD_4;
|
||||
t = v / 365; if (t == 4) t = 3; year += t; v -= t * 365;
|
||||
|
||||
if (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0))
|
||||
ms[1] = 29;
|
||||
for (mon = 0;; mon++)
|
||||
{
|
||||
unsigned s = ms[mon];
|
||||
if (v < s)
|
||||
break;
|
||||
v -= s;
|
||||
}
|
||||
s = UIntToStr(s, year, 4); *s++ = '-';
|
||||
UIntToStr_2(s, mon + 1); s[2] = '-'; s += 3;
|
||||
UIntToStr_2(s, (unsigned)v + 1); s[2] = ' '; s += 3;
|
||||
UIntToStr_2(s, hour); s[2] = ':'; s += 3;
|
||||
UIntToStr_2(s, min); s[2] = ':'; s += 3;
|
||||
UIntToStr_2(s, sec); s[2] = 0;
|
||||
}
|
||||
|
||||
|
||||
void do_7z_unpack(const char *srcpath)
|
||||
{
|
||||
CFileInStream archiveStream;
|
||||
CLookToRead lookStream;
|
||||
|
||||
CSzArEx db;
|
||||
SRes res;
|
||||
ISzAlloc allocImp;
|
||||
ISzAlloc allocTempImp;
|
||||
UInt16 *temp = NULL;
|
||||
size_t tempSize = 0;
|
||||
|
||||
memset(&lookStream,0,sizeof(lookStream));
|
||||
|
||||
allocImp.Alloc = SzAlloc;
|
||||
allocImp.Free = SzFree;
|
||||
|
||||
allocTempImp.Alloc = SzAllocTemp;
|
||||
allocTempImp.Free = SzFreeTemp;
|
||||
|
||||
if (InFile_Open(&archiveStream.file, srcpath))
|
||||
return;
|
||||
|
||||
FileInStream_CreateVTable(&archiveStream);
|
||||
LookToRead_CreateVTable(&lookStream, False);
|
||||
|
||||
lookStream.realStream = &archiveStream.s;
|
||||
LookToRead_Init(&lookStream);
|
||||
CrcGenerateTable();
|
||||
SzArEx_Init(&db);
|
||||
|
||||
res = SzArEx_Open(&db, &lookStream.s, &allocImp, &allocTempImp);
|
||||
|
||||
if (res == SZ_OK)
|
||||
{
|
||||
UInt32 i;
|
||||
UInt32 blockIndex = 0xFFFFFFFF; /* it can have any value before first call (if outBuffer = 0) */
|
||||
Byte *outBuffer = 0; /* it must be 0 before first call for each new archive. */
|
||||
size_t outBufferSize = 0; /* it can have any value before first call (if outBuffer = 0) */
|
||||
|
||||
for (i = 0; i < db.NumFiles; i++)
|
||||
{
|
||||
size_t offset = 0;
|
||||
size_t outSizeProcessed = 0;
|
||||
size_t len;
|
||||
unsigned isDir = SzArEx_IsDir(&db, i);
|
||||
|
||||
if ( isDir )
|
||||
continue;
|
||||
|
||||
len = SzArEx_GetFileNameUtf16(&db, i, NULL);
|
||||
|
||||
if (len > tempSize)
|
||||
{
|
||||
SzFree(NULL, temp);
|
||||
tempSize = len;
|
||||
temp = (UInt16 *)SzAlloc(NULL, tempSize * sizeof(temp[0]));
|
||||
if (!temp)
|
||||
{
|
||||
res = SZ_ERROR_MEM;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
SzArEx_GetFileNameUtf16(&db, i, temp);
|
||||
res = PrintString(temp);
|
||||
if (res != SZ_OK)
|
||||
break;
|
||||
printf("\n");
|
||||
|
||||
if (isDir)
|
||||
printf("/");
|
||||
else
|
||||
{
|
||||
res = SzArEx_Extract(&db, &lookStream.s, i,
|
||||
&blockIndex, &outBuffer, &outBufferSize,
|
||||
&offset, &outSizeProcessed,
|
||||
&allocImp, &allocTempImp);
|
||||
if (res != SZ_OK)
|
||||
break;
|
||||
}
|
||||
|
||||
if (1)
|
||||
{
|
||||
CSzFile outFile;
|
||||
size_t processedSize;
|
||||
size_t j;
|
||||
UInt16 *name = (UInt16 *)temp;
|
||||
const UInt16 *destPath = (const UInt16 *)name;
|
||||
|
||||
for (j = 0; name[j] != 0; j++)
|
||||
if (name[j] == '/')
|
||||
{
|
||||
name[j] = 0;
|
||||
MyCreateDir(name);
|
||||
name[j] = CHAR_PATH_SEPARATOR;
|
||||
}
|
||||
|
||||
if (isDir)
|
||||
{
|
||||
MyCreateDir(destPath);
|
||||
printf("\n");
|
||||
continue;
|
||||
}
|
||||
else if (OutFile_OpenUtf16(&outFile, destPath))
|
||||
{
|
||||
PrintError("cannot open output file");
|
||||
res = SZ_ERROR_FAIL;
|
||||
break;
|
||||
}
|
||||
|
||||
processedSize = outSizeProcessed;
|
||||
|
||||
if (File_Write(&outFile, outBuffer + offset, &processedSize) != 0 || processedSize != outSizeProcessed)
|
||||
{
|
||||
PrintError("cannot write output file\n");
|
||||
res = SZ_ERROR_FAIL;
|
||||
break;
|
||||
}
|
||||
|
||||
if (File_Close(&outFile))
|
||||
{
|
||||
PrintError("cannot close output file\n");
|
||||
res = SZ_ERROR_FAIL;
|
||||
break;
|
||||
}
|
||||
};
|
||||
};
|
||||
IAlloc_Free(&allocImp, outBuffer);
|
||||
};
|
||||
SzArEx_Free(&db, &allocImp);
|
||||
SzFree(NULL, temp);
|
||||
|
||||
File_Close(&archiveStream.file);
|
||||
};
|
||||
|
||||
void do_install(list_t *install)
|
||||
{
|
||||
package_t *pkg, *tmp;
|
||||
char *cache_path;
|
||||
|
||||
list_for_each_entry_safe(pkg, tmp, install, list)
|
||||
{
|
||||
cache_path = make_cache_path(pkg->filename);
|
||||
|
||||
sprintf(conbuf,"install package %s-%s\n", pkg->name, pkg->version);
|
||||
con_write_asciiz(conbuf);
|
||||
|
||||
do_7z_unpack(cache_path);
|
||||
list_del_pkg(pkg);
|
||||
};
|
||||
};
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "7z.h"
|
||||
#include "7zAlloc.h"
|
||||
#include "7zBuf.h"
|
||||
#include "7zCrc.h"
|
||||
#include "7zFile.h"
|
||||
#include "7zVersion.h"
|
||||
#include "http.h"
|
||||
#include "package.h"
|
||||
|
||||
#define PERIOD_4 (4 * 365 + 1)
|
||||
#define PERIOD_100 (PERIOD_4 * 25 - 1)
|
||||
#define PERIOD_400 (PERIOD_100 * 4 + 1)
|
||||
|
||||
#define _UTF8_START(n) (0x100 - (1 << (7 - (n))))
|
||||
|
||||
#define _UTF8_RANGE(n) (((UInt32)1) << ((n) * 5 + 6))
|
||||
|
||||
#define _UTF8_HEAD(n, val) ((Byte)(_UTF8_START(n) + (val >> (6 * (n)))))
|
||||
#define _UTF8_CHAR(n, val) ((Byte)(0x80 + (((val) >> (6 * (n))) & 0x3F)))
|
||||
|
||||
#define MY_FILE_CODE_PAGE_PARAM
|
||||
|
||||
static ISzAlloc g_Alloc = { SzAlloc, SzFree };
|
||||
|
||||
static int Buf_EnsureSize(CBuf *dest, size_t size)
|
||||
{
|
||||
if (dest->size >= size)
|
||||
return 1;
|
||||
Buf_Free(dest, &g_Alloc);
|
||||
return Buf_Create(dest, size, &g_Alloc);
|
||||
}
|
||||
|
||||
|
||||
int test_archive(const char *path)
|
||||
{
|
||||
CFileInStream archiveStream;
|
||||
CLookToRead lookStream;
|
||||
CSzArEx db;
|
||||
SRes res;
|
||||
ISzAlloc allocImp;
|
||||
ISzAlloc allocTempImp;
|
||||
UInt16 *temp = NULL;
|
||||
|
||||
allocImp.Alloc = SzAlloc;
|
||||
allocImp.Free = SzFree;
|
||||
|
||||
allocTempImp.Alloc = SzAllocTemp;
|
||||
allocTempImp.Free = SzFreeTemp;
|
||||
|
||||
if (InFile_Open(&archiveStream.file, path))
|
||||
{
|
||||
printf("can not open input file");
|
||||
return -1;
|
||||
}
|
||||
|
||||
FileInStream_CreateVTable(&archiveStream);
|
||||
LookToRead_CreateVTable(&lookStream, False);
|
||||
|
||||
lookStream.realStream = &archiveStream.s;
|
||||
LookToRead_Init(&lookStream);
|
||||
|
||||
CrcGenerateTable();
|
||||
|
||||
SzArEx_Init(&db);
|
||||
|
||||
res = SzArEx_Open(&db, &lookStream.s, &allocImp, &allocTempImp);
|
||||
|
||||
SzArEx_Free(&db, &allocImp);
|
||||
SzFree(NULL, temp);
|
||||
|
||||
File_Close(&archiveStream.file);
|
||||
|
||||
if (res == SZ_OK)
|
||||
return 0;
|
||||
else return -1;
|
||||
};
|
||||
|
||||
static size_t Utf16_To_Utf8_Calc(const UInt16 *src, const UInt16 *srcLim)
|
||||
{
|
||||
size_t size = 0;
|
||||
for (;;)
|
||||
{
|
||||
UInt32 val;
|
||||
if (src == srcLim)
|
||||
return size;
|
||||
|
||||
size++;
|
||||
val = *src++;
|
||||
|
||||
if (val < 0x80)
|
||||
continue;
|
||||
|
||||
if (val < _UTF8_RANGE(1))
|
||||
{
|
||||
size++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (val >= 0xD800 && val < 0xDC00 && src != srcLim)
|
||||
{
|
||||
UInt32 c2 = *src;
|
||||
if (c2 >= 0xDC00 && c2 < 0xE000)
|
||||
{
|
||||
src++;
|
||||
size += 3;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
size += 2;
|
||||
}
|
||||
}
|
||||
|
||||
static Byte *Utf16_To_Utf8(Byte *dest, const UInt16 *src, const UInt16 *srcLim)
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
UInt32 val;
|
||||
if (src == srcLim)
|
||||
return dest;
|
||||
|
||||
val = *src++;
|
||||
|
||||
if (val < 0x80)
|
||||
{
|
||||
*dest++ = (char)val;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (val < _UTF8_RANGE(1))
|
||||
{
|
||||
dest[0] = _UTF8_HEAD(1, val);
|
||||
dest[1] = _UTF8_CHAR(0, val);
|
||||
dest += 2;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (val >= 0xD800 && val < 0xDC00 && src != srcLim)
|
||||
{
|
||||
UInt32 c2 = *src;
|
||||
if (c2 >= 0xDC00 && c2 < 0xE000)
|
||||
{
|
||||
src++;
|
||||
val = (((val - 0xD800) << 10) | (c2 - 0xDC00)) + 0x10000;
|
||||
dest[0] = _UTF8_HEAD(3, val);
|
||||
dest[1] = _UTF8_CHAR(2, val);
|
||||
dest[2] = _UTF8_CHAR(1, val);
|
||||
dest[3] = _UTF8_CHAR(0, val);
|
||||
dest += 4;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
dest[0] = _UTF8_HEAD(2, val);
|
||||
dest[1] = _UTF8_CHAR(1, val);
|
||||
dest[2] = _UTF8_CHAR(0, val);
|
||||
dest += 3;
|
||||
}
|
||||
}
|
||||
|
||||
static SRes Utf16_To_Utf8Buf(CBuf *dest, const UInt16 *src, size_t srcLen)
|
||||
{
|
||||
size_t destLen = Utf16_To_Utf8_Calc(src, src + srcLen);
|
||||
destLen += 1;
|
||||
if (!Buf_EnsureSize(dest, destLen))
|
||||
return SZ_ERROR_MEM;
|
||||
*Utf16_To_Utf8(dest->data, src, src + srcLen) = 0;
|
||||
return SZ_OK;
|
||||
}
|
||||
|
||||
static void GetAttribString(UInt32 wa, Bool isDir, char *s)
|
||||
{
|
||||
s[0] = (char)(((wa & (1 << 4)) != 0 || isDir) ? 'D' : '.');
|
||||
s[1] = 0;
|
||||
}
|
||||
|
||||
static void UInt64ToStr(UInt64 value, char *s)
|
||||
{
|
||||
char temp[32];
|
||||
int pos = 0;
|
||||
do
|
||||
{
|
||||
temp[pos++] = (char)('0' + (unsigned)(value % 10));
|
||||
value /= 10;
|
||||
}
|
||||
while (value != 0);
|
||||
do
|
||||
*s++ = temp[--pos];
|
||||
while (pos);
|
||||
*s = '\0';
|
||||
}
|
||||
|
||||
static SRes Utf16_To_Char(CBuf *buf, const UInt16 *s)
|
||||
{
|
||||
unsigned len = 0;
|
||||
for (len = 0; s[len] != 0; len++);
|
||||
|
||||
return Utf16_To_Utf8Buf(buf, s, len);
|
||||
}
|
||||
|
||||
static char *UIntToStr(char *s, unsigned value, int numDigits)
|
||||
{
|
||||
char temp[16];
|
||||
int pos = 0;
|
||||
do
|
||||
temp[pos++] = (char)('0' + (value % 10));
|
||||
while (value /= 10);
|
||||
for (numDigits -= pos; numDigits > 0; numDigits--)
|
||||
*s++ = '0';
|
||||
do
|
||||
*s++ = temp[--pos];
|
||||
while (pos);
|
||||
*s = '\0';
|
||||
return s;
|
||||
}
|
||||
|
||||
static void UIntToStr_2(char *s, unsigned value)
|
||||
{
|
||||
s[0] = (char)('0' + (value / 10));
|
||||
s[1] = (char)('0' + (value % 10));
|
||||
}
|
||||
|
||||
static WRes OutFile_OpenUtf16(CSzFile *p, const UInt16 *name)
|
||||
{
|
||||
CBuf buf;
|
||||
WRes res;
|
||||
Buf_Init(&buf);
|
||||
RINOK(Utf16_To_Char(&buf, name MY_FILE_CODE_PAGE_PARAM));
|
||||
printf("open file %s\n", (const char *)buf.data);
|
||||
res = OutFile_Open(p, (const char *)buf.data);
|
||||
Buf_Free(&buf, &g_Alloc);
|
||||
return res;
|
||||
}
|
||||
|
||||
int create_dir(const char *path)
|
||||
{
|
||||
int retval;
|
||||
__asm__ __volatile__ (
|
||||
"pushl $0 \n\t"
|
||||
"pushl $0 \n\t"
|
||||
"movl %1, 1(%%esp) \n\t"
|
||||
"pushl $0 \n\t"
|
||||
"pushl $0 \n\t"
|
||||
"pushl $0 \n\t"
|
||||
"pushl $0 \n\t"
|
||||
"pushl $9 \n\t"
|
||||
"movl %%esp, %%ebx \n\t"
|
||||
"movl $70, %%eax \n\t"
|
||||
"int $0x40 \n\t"
|
||||
"addl $28, %%esp \n\t"
|
||||
:"=a" (retval)
|
||||
:"r" (path)
|
||||
:"ebx");
|
||||
return retval;
|
||||
};
|
||||
|
||||
static WRes MyCreateDir(const UInt16 *name)
|
||||
{
|
||||
CBuf buf;
|
||||
WRes res;
|
||||
Buf_Init(&buf);
|
||||
RINOK(Utf16_To_Char(&buf, name MY_FILE_CODE_PAGE_PARAM));
|
||||
|
||||
res = create_dir((const char *)buf.data) == 0 ? 0 : -1;
|
||||
Buf_Free(&buf, &g_Alloc);
|
||||
return res;
|
||||
}
|
||||
|
||||
static SRes PrintString(const UInt16 *s)
|
||||
{
|
||||
CBuf buf;
|
||||
SRes res;
|
||||
Buf_Init(&buf);
|
||||
res = Utf16_To_Char(&buf, s);
|
||||
if (res == SZ_OK)
|
||||
fputs((const char *)buf.data, stdout);
|
||||
Buf_Free(&buf, &g_Alloc);
|
||||
return res;
|
||||
}
|
||||
|
||||
void PrintError(char *sz)
|
||||
{
|
||||
printf("\nERROR: %s\n", sz);
|
||||
}
|
||||
|
||||
static void ConvertFileTimeToString(const CNtfsFileTime *nt, char *s)
|
||||
{
|
||||
unsigned year, mon, hour, min, sec;
|
||||
Byte ms[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
|
||||
unsigned t;
|
||||
UInt32 v;
|
||||
UInt64 v64 = nt->Low | ((UInt64)nt->High << 32);
|
||||
v64 /= 10000000;
|
||||
sec = (unsigned)(v64 % 60); v64 /= 60;
|
||||
min = (unsigned)(v64 % 60); v64 /= 60;
|
||||
hour = (unsigned)(v64 % 24); v64 /= 24;
|
||||
|
||||
v = (UInt32)v64;
|
||||
|
||||
year = (unsigned)(1601 + v / PERIOD_400 * 400);
|
||||
v %= PERIOD_400;
|
||||
|
||||
t = v / PERIOD_100; if (t == 4) t = 3; year += t * 100; v -= t * PERIOD_100;
|
||||
t = v / PERIOD_4; if (t == 25) t = 24; year += t * 4; v -= t * PERIOD_4;
|
||||
t = v / 365; if (t == 4) t = 3; year += t; v -= t * 365;
|
||||
|
||||
if (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0))
|
||||
ms[1] = 29;
|
||||
for (mon = 0;; mon++)
|
||||
{
|
||||
unsigned s = ms[mon];
|
||||
if (v < s)
|
||||
break;
|
||||
v -= s;
|
||||
}
|
||||
s = UIntToStr(s, year, 4); *s++ = '-';
|
||||
UIntToStr_2(s, mon + 1); s[2] = '-'; s += 3;
|
||||
UIntToStr_2(s, (unsigned)v + 1); s[2] = ' '; s += 3;
|
||||
UIntToStr_2(s, hour); s[2] = ':'; s += 3;
|
||||
UIntToStr_2(s, min); s[2] = ':'; s += 3;
|
||||
UIntToStr_2(s, sec); s[2] = 0;
|
||||
}
|
||||
|
||||
|
||||
void do_7z_unpack(const char *srcpath)
|
||||
{
|
||||
CFileInStream archiveStream;
|
||||
CLookToRead lookStream;
|
||||
|
||||
CSzArEx db;
|
||||
SRes res;
|
||||
ISzAlloc allocImp;
|
||||
ISzAlloc allocTempImp;
|
||||
UInt16 *temp = NULL;
|
||||
size_t tempSize = 0;
|
||||
|
||||
memset(&lookStream,0,sizeof(lookStream));
|
||||
|
||||
allocImp.Alloc = SzAlloc;
|
||||
allocImp.Free = SzFree;
|
||||
|
||||
allocTempImp.Alloc = SzAllocTemp;
|
||||
allocTempImp.Free = SzFreeTemp;
|
||||
|
||||
if (InFile_Open(&archiveStream.file, srcpath))
|
||||
return;
|
||||
|
||||
FileInStream_CreateVTable(&archiveStream);
|
||||
LookToRead_CreateVTable(&lookStream, False);
|
||||
|
||||
lookStream.realStream = &archiveStream.s;
|
||||
LookToRead_Init(&lookStream);
|
||||
CrcGenerateTable();
|
||||
SzArEx_Init(&db);
|
||||
|
||||
res = SzArEx_Open(&db, &lookStream.s, &allocImp, &allocTempImp);
|
||||
|
||||
if (res == SZ_OK)
|
||||
{
|
||||
UInt32 i;
|
||||
UInt32 blockIndex = 0xFFFFFFFF; /* it can have any value before first call (if outBuffer = 0) */
|
||||
Byte *outBuffer = 0; /* it must be 0 before first call for each new archive. */
|
||||
size_t outBufferSize = 0; /* it can have any value before first call (if outBuffer = 0) */
|
||||
|
||||
for (i = 0; i < db.NumFiles; i++)
|
||||
{
|
||||
size_t offset = 0;
|
||||
size_t outSizeProcessed = 0;
|
||||
size_t len;
|
||||
unsigned isDir = SzArEx_IsDir(&db, i);
|
||||
|
||||
if ( isDir )
|
||||
continue;
|
||||
|
||||
len = SzArEx_GetFileNameUtf16(&db, i, NULL);
|
||||
|
||||
if (len > tempSize)
|
||||
{
|
||||
SzFree(NULL, temp);
|
||||
tempSize = len;
|
||||
temp = (UInt16 *)SzAlloc(NULL, tempSize * sizeof(temp[0]));
|
||||
if (!temp)
|
||||
{
|
||||
res = SZ_ERROR_MEM;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
SzArEx_GetFileNameUtf16(&db, i, temp);
|
||||
res = PrintString(temp);
|
||||
if (res != SZ_OK)
|
||||
break;
|
||||
printf("\n");
|
||||
|
||||
if (isDir)
|
||||
printf("/");
|
||||
else
|
||||
{
|
||||
res = SzArEx_Extract(&db, &lookStream.s, i,
|
||||
&blockIndex, &outBuffer, &outBufferSize,
|
||||
&offset, &outSizeProcessed,
|
||||
&allocImp, &allocTempImp);
|
||||
if (res != SZ_OK)
|
||||
break;
|
||||
}
|
||||
|
||||
if (1)
|
||||
{
|
||||
CSzFile outFile;
|
||||
size_t processedSize;
|
||||
size_t j;
|
||||
UInt16 *name = (UInt16 *)temp;
|
||||
const UInt16 *destPath = (const UInt16 *)name;
|
||||
|
||||
for (j = 0; name[j] != 0; j++)
|
||||
if (name[j] == '/')
|
||||
{
|
||||
name[j] = 0;
|
||||
MyCreateDir(name);
|
||||
name[j] = CHAR_PATH_SEPARATOR;
|
||||
}
|
||||
|
||||
if (isDir)
|
||||
{
|
||||
MyCreateDir(destPath);
|
||||
printf("\n");
|
||||
continue;
|
||||
}
|
||||
else if (OutFile_OpenUtf16(&outFile, destPath))
|
||||
{
|
||||
PrintError("can not open output file");
|
||||
res = SZ_ERROR_FAIL;
|
||||
break;
|
||||
}
|
||||
|
||||
processedSize = outSizeProcessed;
|
||||
|
||||
if (File_Write(&outFile, outBuffer + offset, &processedSize) != 0 || processedSize != outSizeProcessed)
|
||||
{
|
||||
PrintError("can not write output file\n");
|
||||
res = SZ_ERROR_FAIL;
|
||||
break;
|
||||
}
|
||||
|
||||
if (File_Close(&outFile))
|
||||
{
|
||||
PrintError("can not close output file\n");
|
||||
res = SZ_ERROR_FAIL;
|
||||
break;
|
||||
}
|
||||
};
|
||||
};
|
||||
IAlloc_Free(&allocImp, outBuffer);
|
||||
};
|
||||
SzArEx_Free(&db, &allocImp);
|
||||
SzFree(NULL, temp);
|
||||
|
||||
File_Close(&archiveStream.file);
|
||||
};
|
||||
|
||||
void do_install(list_t *install)
|
||||
{
|
||||
package_t *pkg, *tmp;
|
||||
char *cache_path;
|
||||
|
||||
list_for_each_entry_safe(pkg, tmp, install, list)
|
||||
{
|
||||
cache_path = make_cache_path(pkg->filename);
|
||||
|
||||
sprintf(conbuf,"install package %s-%s\n", pkg->name, pkg->version);
|
||||
con_write_asciiz(conbuf);
|
||||
|
||||
do_7z_unpack(cache_path);
|
||||
list_del_pkg(pkg);
|
||||
};
|
||||
};
|
||||
|
||||
+146
-146
@@ -1,146 +1,146 @@
|
||||
/* Bcj2.h -- BCJ2 Converter for x86 code
|
||||
2014-11-10 : Igor Pavlov : Public domain */
|
||||
|
||||
#ifndef __BCJ2_H
|
||||
#define __BCJ2_H
|
||||
|
||||
#include "7zTypes.h"
|
||||
|
||||
EXTERN_C_BEGIN
|
||||
|
||||
#define BCJ2_NUM_STREAMS 4
|
||||
|
||||
enum
|
||||
{
|
||||
BCJ2_STREAM_MAIN,
|
||||
BCJ2_STREAM_CALL,
|
||||
BCJ2_STREAM_JUMP,
|
||||
BCJ2_STREAM_RC
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
BCJ2_DEC_STATE_ORIG_0 = BCJ2_NUM_STREAMS,
|
||||
BCJ2_DEC_STATE_ORIG_1,
|
||||
BCJ2_DEC_STATE_ORIG_2,
|
||||
BCJ2_DEC_STATE_ORIG_3,
|
||||
|
||||
BCJ2_DEC_STATE_ORIG,
|
||||
BCJ2_DEC_STATE_OK
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
BCJ2_ENC_STATE_ORIG = BCJ2_NUM_STREAMS,
|
||||
BCJ2_ENC_STATE_OK
|
||||
};
|
||||
|
||||
|
||||
#define BCJ2_IS_32BIT_STREAM(s) ((s) == BCJ2_STREAM_CALL || (s) == BCJ2_STREAM_JUMP)
|
||||
|
||||
/*
|
||||
CBcj2Dec / CBcj2Enc
|
||||
bufs sizes:
|
||||
BUF_SIZE(n) = lims[n] - bufs[n]
|
||||
bufs sizes for BCJ2_STREAM_CALL and BCJ2_STREAM_JUMP must be a multiple of 4:
|
||||
(BUF_SIZE(BCJ2_STREAM_CALL) & 3) == 0
|
||||
(BUF_SIZE(BCJ2_STREAM_JUMP) & 3) == 0
|
||||
*/
|
||||
|
||||
/*
|
||||
CBcj2Dec:
|
||||
dest is allowed to overlap with bufs[BCJ2_STREAM_MAIN], with the following conditions:
|
||||
bufs[BCJ2_STREAM_MAIN] >= dest &&
|
||||
bufs[BCJ2_STREAM_MAIN] - dest >= tempReserv +
|
||||
BUF_SIZE(BCJ2_STREAM_CALL) +
|
||||
BUF_SIZE(BCJ2_STREAM_JUMP)
|
||||
tempReserv = 0 : for first call of Bcj2Dec_Decode
|
||||
tempReserv = 4 : for any other calls of Bcj2Dec_Decode
|
||||
overlap with offset = 1 is not allowed
|
||||
*/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const Byte *bufs[BCJ2_NUM_STREAMS];
|
||||
const Byte *lims[BCJ2_NUM_STREAMS];
|
||||
Byte *dest;
|
||||
const Byte *destLim;
|
||||
|
||||
unsigned state; /* BCJ2_STREAM_MAIN has more priority than BCJ2_STATE_ORIG */
|
||||
|
||||
UInt32 ip;
|
||||
Byte temp[4];
|
||||
UInt32 range;
|
||||
UInt32 code;
|
||||
UInt16 probs[2 + 256];
|
||||
} CBcj2Dec;
|
||||
|
||||
void Bcj2Dec_Init(CBcj2Dec *p);
|
||||
|
||||
/* Returns: SZ_OK or SZ_ERROR_DATA */
|
||||
SRes Bcj2Dec_Decode(CBcj2Dec *p);
|
||||
|
||||
#define Bcj2Dec_IsFinished(_p_) ((_p_)->code == 0)
|
||||
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
BCJ2_ENC_FINISH_MODE_CONTINUE,
|
||||
BCJ2_ENC_FINISH_MODE_END_BLOCK,
|
||||
BCJ2_ENC_FINISH_MODE_END_STREAM
|
||||
} EBcj2Enc_FinishMode;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Byte *bufs[BCJ2_NUM_STREAMS];
|
||||
const Byte *lims[BCJ2_NUM_STREAMS];
|
||||
const Byte *src;
|
||||
const Byte *srcLim;
|
||||
|
||||
unsigned state;
|
||||
EBcj2Enc_FinishMode finishMode;
|
||||
|
||||
Byte prevByte;
|
||||
|
||||
Byte cache;
|
||||
UInt32 range;
|
||||
UInt64 low;
|
||||
UInt64 cacheSize;
|
||||
|
||||
UInt32 ip;
|
||||
|
||||
/* 32-bit relative offset in JUMP/CALL commands is
|
||||
- (mod 4 GB) in 32-bit mode
|
||||
- signed Int32 in 64-bit mode
|
||||
We use (mod 4 GB) check for fileSize.
|
||||
Use fileSize up to 2 GB, if you want to support 32-bit and 64-bit code conversion. */
|
||||
UInt32 fileIp;
|
||||
UInt32 fileSize; /* (fileSize <= ((UInt32)1 << 31)), 0 means no_limit */
|
||||
UInt32 relatLimit; /* (relatLimit <= ((UInt32)1 << 31)), 0 means desable_conversion */
|
||||
|
||||
UInt32 tempTarget;
|
||||
unsigned tempPos;
|
||||
Byte temp[4 * 2];
|
||||
|
||||
unsigned flushPos;
|
||||
|
||||
UInt16 probs[2 + 256];
|
||||
} CBcj2Enc;
|
||||
|
||||
void Bcj2Enc_Init(CBcj2Enc *p);
|
||||
void Bcj2Enc_Encode(CBcj2Enc *p);
|
||||
|
||||
#define Bcj2Enc_Get_InputData_Size(p) ((SizeT)((p)->srcLim - (p)->src) + (p)->tempPos)
|
||||
#define Bcj2Enc_IsFinished(p) ((p)->flushPos == 5)
|
||||
|
||||
|
||||
#define BCJ2_RELAT_LIMIT_NUM_BITS 26
|
||||
#define BCJ2_RELAT_LIMIT ((UInt32)1 << BCJ2_RELAT_LIMIT_NUM_BITS)
|
||||
|
||||
/* limit for CBcj2Enc::fileSize variable */
|
||||
#define BCJ2_FileSize_MAX ((UInt32)1 << 31)
|
||||
|
||||
EXTERN_C_END
|
||||
|
||||
#endif
|
||||
/* Bcj2.h -- BCJ2 Converter for x86 code
|
||||
2014-11-10 : Igor Pavlov : Public domain */
|
||||
|
||||
#ifndef __BCJ2_H
|
||||
#define __BCJ2_H
|
||||
|
||||
#include "7zTypes.h"
|
||||
|
||||
EXTERN_C_BEGIN
|
||||
|
||||
#define BCJ2_NUM_STREAMS 4
|
||||
|
||||
enum
|
||||
{
|
||||
BCJ2_STREAM_MAIN,
|
||||
BCJ2_STREAM_CALL,
|
||||
BCJ2_STREAM_JUMP,
|
||||
BCJ2_STREAM_RC
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
BCJ2_DEC_STATE_ORIG_0 = BCJ2_NUM_STREAMS,
|
||||
BCJ2_DEC_STATE_ORIG_1,
|
||||
BCJ2_DEC_STATE_ORIG_2,
|
||||
BCJ2_DEC_STATE_ORIG_3,
|
||||
|
||||
BCJ2_DEC_STATE_ORIG,
|
||||
BCJ2_DEC_STATE_OK
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
BCJ2_ENC_STATE_ORIG = BCJ2_NUM_STREAMS,
|
||||
BCJ2_ENC_STATE_OK
|
||||
};
|
||||
|
||||
|
||||
#define BCJ2_IS_32BIT_STREAM(s) ((s) == BCJ2_STREAM_CALL || (s) == BCJ2_STREAM_JUMP)
|
||||
|
||||
/*
|
||||
CBcj2Dec / CBcj2Enc
|
||||
bufs sizes:
|
||||
BUF_SIZE(n) = lims[n] - bufs[n]
|
||||
bufs sizes for BCJ2_STREAM_CALL and BCJ2_STREAM_JUMP must be mutliply of 4:
|
||||
(BUF_SIZE(BCJ2_STREAM_CALL) & 3) == 0
|
||||
(BUF_SIZE(BCJ2_STREAM_JUMP) & 3) == 0
|
||||
*/
|
||||
|
||||
/*
|
||||
CBcj2Dec:
|
||||
dest is allowed to overlap with bufs[BCJ2_STREAM_MAIN], with the following conditions:
|
||||
bufs[BCJ2_STREAM_MAIN] >= dest &&
|
||||
bufs[BCJ2_STREAM_MAIN] - dest >= tempReserv +
|
||||
BUF_SIZE(BCJ2_STREAM_CALL) +
|
||||
BUF_SIZE(BCJ2_STREAM_JUMP)
|
||||
tempReserv = 0 : for first call of Bcj2Dec_Decode
|
||||
tempReserv = 4 : for any other calls of Bcj2Dec_Decode
|
||||
overlap with offset = 1 is not allowed
|
||||
*/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const Byte *bufs[BCJ2_NUM_STREAMS];
|
||||
const Byte *lims[BCJ2_NUM_STREAMS];
|
||||
Byte *dest;
|
||||
const Byte *destLim;
|
||||
|
||||
unsigned state; /* BCJ2_STREAM_MAIN has more priority than BCJ2_STATE_ORIG */
|
||||
|
||||
UInt32 ip;
|
||||
Byte temp[4];
|
||||
UInt32 range;
|
||||
UInt32 code;
|
||||
UInt16 probs[2 + 256];
|
||||
} CBcj2Dec;
|
||||
|
||||
void Bcj2Dec_Init(CBcj2Dec *p);
|
||||
|
||||
/* Returns: SZ_OK or SZ_ERROR_DATA */
|
||||
SRes Bcj2Dec_Decode(CBcj2Dec *p);
|
||||
|
||||
#define Bcj2Dec_IsFinished(_p_) ((_p_)->code == 0)
|
||||
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
BCJ2_ENC_FINISH_MODE_CONTINUE,
|
||||
BCJ2_ENC_FINISH_MODE_END_BLOCK,
|
||||
BCJ2_ENC_FINISH_MODE_END_STREAM
|
||||
} EBcj2Enc_FinishMode;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Byte *bufs[BCJ2_NUM_STREAMS];
|
||||
const Byte *lims[BCJ2_NUM_STREAMS];
|
||||
const Byte *src;
|
||||
const Byte *srcLim;
|
||||
|
||||
unsigned state;
|
||||
EBcj2Enc_FinishMode finishMode;
|
||||
|
||||
Byte prevByte;
|
||||
|
||||
Byte cache;
|
||||
UInt32 range;
|
||||
UInt64 low;
|
||||
UInt64 cacheSize;
|
||||
|
||||
UInt32 ip;
|
||||
|
||||
/* 32-bit ralative offset in JUMP/CALL commands is
|
||||
- (mod 4 GB) in 32-bit mode
|
||||
- signed Int32 in 64-bit mode
|
||||
We use (mod 4 GB) check for fileSize.
|
||||
Use fileSize up to 2 GB, if you want to support 32-bit and 64-bit code conversion. */
|
||||
UInt32 fileIp;
|
||||
UInt32 fileSize; /* (fileSize <= ((UInt32)1 << 31)), 0 means no_limit */
|
||||
UInt32 relatLimit; /* (relatLimit <= ((UInt32)1 << 31)), 0 means desable_conversion */
|
||||
|
||||
UInt32 tempTarget;
|
||||
unsigned tempPos;
|
||||
Byte temp[4 * 2];
|
||||
|
||||
unsigned flushPos;
|
||||
|
||||
UInt16 probs[2 + 256];
|
||||
} CBcj2Enc;
|
||||
|
||||
void Bcj2Enc_Init(CBcj2Enc *p);
|
||||
void Bcj2Enc_Encode(CBcj2Enc *p);
|
||||
|
||||
#define Bcj2Enc_Get_InputData_Size(p) ((SizeT)((p)->srcLim - (p)->src) + (p)->tempPos)
|
||||
#define Bcj2Enc_IsFinished(p) ((p)->flushPos == 5)
|
||||
|
||||
|
||||
#define BCJ2_RELAT_LIMIT_NUM_BITS 26
|
||||
#define BCJ2_RELAT_LIMIT ((UInt32)1 << BCJ2_RELAT_LIMIT_NUM_BITS)
|
||||
|
||||
/* limit for CBcj2Enc::fileSize variable */
|
||||
#define BCJ2_FileSize_MAX ((UInt32)1 << 31)
|
||||
|
||||
EXTERN_C_END
|
||||
|
||||
#endif
|
||||
+64
-64
@@ -1,64 +1,64 @@
|
||||
/* Bra.h -- Branch converters for executables
|
||||
2013-01-18 : Igor Pavlov : Public domain */
|
||||
|
||||
#ifndef __BRA_H
|
||||
#define __BRA_H
|
||||
|
||||
#include "7zTypes.h"
|
||||
|
||||
EXTERN_C_BEGIN
|
||||
|
||||
/*
|
||||
These functions convert relative addresses to absolute addresses
|
||||
in CALL instructions to increase the compression ratio.
|
||||
|
||||
In:
|
||||
data - data buffer
|
||||
size - size of data
|
||||
ip - current virtual Instruction Pointer (IP) value
|
||||
state - state variable for x86 converter
|
||||
encoding - 0 (for decoding), 1 (for encoding)
|
||||
|
||||
Out:
|
||||
state - state variable for x86 converter
|
||||
|
||||
Returns:
|
||||
The number of processed bytes. If you call these functions with multiple calls,
|
||||
you must start next call with first byte after block of processed bytes.
|
||||
|
||||
Type Endian Alignment LookAhead
|
||||
|
||||
x86 little 1 4
|
||||
ARMT little 2 2
|
||||
ARM little 4 0
|
||||
PPC big 4 0
|
||||
SPARC big 4 0
|
||||
IA64 little 16 0
|
||||
|
||||
size must be >= Alignment + LookAhead, if it's not last block.
|
||||
If (size < Alignment + LookAhead), converter returns 0.
|
||||
|
||||
Example:
|
||||
|
||||
UInt32 ip = 0;
|
||||
for ()
|
||||
{
|
||||
; size must be >= Alignment + LookAhead, if it's not last block
|
||||
SizeT processed = Convert(data, size, ip, 1);
|
||||
data += processed;
|
||||
size -= processed;
|
||||
ip += processed;
|
||||
}
|
||||
*/
|
||||
|
||||
#define x86_Convert_Init(state) { state = 0; }
|
||||
SizeT x86_Convert(Byte *data, SizeT size, UInt32 ip, UInt32 *state, int encoding);
|
||||
SizeT ARM_Convert(Byte *data, SizeT size, UInt32 ip, int encoding);
|
||||
SizeT ARMT_Convert(Byte *data, SizeT size, UInt32 ip, int encoding);
|
||||
SizeT PPC_Convert(Byte *data, SizeT size, UInt32 ip, int encoding);
|
||||
SizeT SPARC_Convert(Byte *data, SizeT size, UInt32 ip, int encoding);
|
||||
SizeT IA64_Convert(Byte *data, SizeT size, UInt32 ip, int encoding);
|
||||
|
||||
EXTERN_C_END
|
||||
|
||||
#endif
|
||||
/* Bra.h -- Branch converters for executables
|
||||
2013-01-18 : Igor Pavlov : Public domain */
|
||||
|
||||
#ifndef __BRA_H
|
||||
#define __BRA_H
|
||||
|
||||
#include "7zTypes.h"
|
||||
|
||||
EXTERN_C_BEGIN
|
||||
|
||||
/*
|
||||
These functions convert relative addresses to absolute addresses
|
||||
in CALL instructions to increase the compression ratio.
|
||||
|
||||
In:
|
||||
data - data buffer
|
||||
size - size of data
|
||||
ip - current virtual Instruction Pinter (IP) value
|
||||
state - state variable for x86 converter
|
||||
encoding - 0 (for decoding), 1 (for encoding)
|
||||
|
||||
Out:
|
||||
state - state variable for x86 converter
|
||||
|
||||
Returns:
|
||||
The number of processed bytes. If you call these functions with multiple calls,
|
||||
you must start next call with first byte after block of processed bytes.
|
||||
|
||||
Type Endian Alignment LookAhead
|
||||
|
||||
x86 little 1 4
|
||||
ARMT little 2 2
|
||||
ARM little 4 0
|
||||
PPC big 4 0
|
||||
SPARC big 4 0
|
||||
IA64 little 16 0
|
||||
|
||||
size must be >= Alignment + LookAhead, if it's not last block.
|
||||
If (size < Alignment + LookAhead), converter returns 0.
|
||||
|
||||
Example:
|
||||
|
||||
UInt32 ip = 0;
|
||||
for ()
|
||||
{
|
||||
; size must be >= Alignment + LookAhead, if it's not last block
|
||||
SizeT processed = Convert(data, size, ip, 1);
|
||||
data += processed;
|
||||
size -= processed;
|
||||
ip += processed;
|
||||
}
|
||||
*/
|
||||
|
||||
#define x86_Convert_Init(state) { state = 0; }
|
||||
SizeT x86_Convert(Byte *data, SizeT size, UInt32 ip, UInt32 *state, int encoding);
|
||||
SizeT ARM_Convert(Byte *data, SizeT size, UInt32 ip, int encoding);
|
||||
SizeT ARMT_Convert(Byte *data, SizeT size, UInt32 ip, int encoding);
|
||||
SizeT PPC_Convert(Byte *data, SizeT size, UInt32 ip, int encoding);
|
||||
SizeT SPARC_Convert(Byte *data, SizeT size, UInt32 ip, int encoding);
|
||||
SizeT IA64_Convert(Byte *data, SizeT size, UInt32 ip, int encoding);
|
||||
|
||||
EXTERN_C_END
|
||||
|
||||
#endif
|
||||
@@ -1,27 +0,0 @@
|
||||
if tup.getconfig("NO_GCC") ~= "" then return end
|
||||
if tup.getconfig("HELPERDIR") == ""
|
||||
then
|
||||
if tup.getconfig("NO_NASM") == "full" then return end -- required for SDL compilation
|
||||
HELPERDIR = "../../../programs"
|
||||
end
|
||||
tup.include(HELPERDIR .. "/use_gcc.lua")
|
||||
tup.include(HELPERDIR .. "/use_newlib.lua")
|
||||
tup.include(HELPERDIR .. "/use_sdl_newlib.lua")
|
||||
CFLAGS = CFLAGS .. " -UWIN32 -U_WIN32 -U__WIN32__ -U__MINGW32__ -D_KOLIBRI"
|
||||
|
||||
LDFLAGS = LDFLAGS .. " --subsystem native"
|
||||
|
||||
-- DOOM source files (all *.c, as in the Makefile)
|
||||
compile_gcc{
|
||||
"am_map.c", "d_items.c", "d_main.c", "d_net.c", "doomdef.c", "doomstat.c", "dstrings.c",
|
||||
"f_finale.c", "f_wipe.c", "g_game.c", "hu_lib.c", "hu_stuff.c", "i_main.c", "i_net.c",
|
||||
"i_sound.c", "i_system.c", "i_video.c", "info.c", "m_argv.c", "m_bbox.c", "m_cheat.c",
|
||||
"m_fixed.c", "m_menu.c", "m_misc.c", "m_random.c", "m_swap.c", "p_ceilng.c", "p_doors.c",
|
||||
"p_enemy.c", "p_floor.c", "p_inter.c", "p_lights.c", "p_map.c", "p_maputl.c", "p_mobj.c",
|
||||
"p_plats.c", "p_pspr.c", "p_saveg.c", "p_setup.c", "p_sight.c", "p_spec.c", "p_switch.c",
|
||||
"p_telept.c", "p_tick.c", "p_user.c", "r_bsp.c", "r_data.c", "r_draw.c", "r_main.c",
|
||||
"r_plane.c", "r_segs.c", "r_sky.c", "r_things.c", "s_sound.c", "sounds.c", "st_lib.c",
|
||||
"st_stuff.c", "tables.c", "v_video.c", "w_wad.c", "wi_stuff.c", "z_zone.c",
|
||||
}
|
||||
|
||||
link_gcc("doom")
|
||||
@@ -1,4 +1,4 @@
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $Id:$
|
||||
@@ -33,11 +33,11 @@ rcsid[] = "$Id:$";
|
||||
|
||||
|
||||
//
|
||||
// PSPRITE ACTIONS for weapons.
|
||||
// PSPRITE ACTIONS for waepons.
|
||||
// This struct controls the weapon animations.
|
||||
//
|
||||
// Each entry is:
|
||||
// ammo/ammunition type
|
||||
// ammo/amunition type
|
||||
// upstate
|
||||
// downstate
|
||||
// readystate
|
||||
@@ -54,7 +54,7 @@ weaponinfo_t weaponinfo[NUMWEAPONS] =
|
||||
S_PUNCH,
|
||||
S_PUNCH1,
|
||||
S_NULL
|
||||
},
|
||||
},
|
||||
{
|
||||
// pistol
|
||||
am_clip,
|
||||
@@ -63,7 +63,7 @@ weaponinfo_t weaponinfo[NUMWEAPONS] =
|
||||
S_PISTOL,
|
||||
S_PISTOL1,
|
||||
S_PISTOLFLASH
|
||||
},
|
||||
},
|
||||
{
|
||||
// shotgun
|
||||
am_shell,
|
||||
@@ -126,5 +126,13 @@ weaponinfo_t weaponinfo[NUMWEAPONS] =
|
||||
S_DSGUN,
|
||||
S_DSGUN1,
|
||||
S_DSGUNFLASH1
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $Id:$
|
||||
@@ -172,12 +172,12 @@ void D_PostEvent (event_t* ev)
|
||||
void D_ProcessEvents (void)
|
||||
{
|
||||
event_t* ev;
|
||||
|
||||
|
||||
// IF STORE DEMO, DO NOT ACCEPT INPUT
|
||||
if ( ( gamemode == commercial )
|
||||
&& (W_CheckNumForName("map01")<0) )
|
||||
return;
|
||||
|
||||
|
||||
for ( ; eventtail != eventhead ; eventtail = (++eventtail)&(MAXEVENTS-1) )
|
||||
{
|
||||
ev = &events[eventtail];
|
||||
@@ -219,9 +219,9 @@ void D_Display (void)
|
||||
|
||||
if (nodrawers)
|
||||
return; // for comparative timing / profiling
|
||||
|
||||
|
||||
redrawsbar = false;
|
||||
|
||||
|
||||
// change the view size if needed
|
||||
if (setsizeneeded)
|
||||
{
|
||||
@@ -241,7 +241,7 @@ void D_Display (void)
|
||||
|
||||
if (gamestate == GS_LEVEL && gametic)
|
||||
HU_Erase();
|
||||
|
||||
|
||||
// do buffered drawing
|
||||
switch (gamestate)
|
||||
{
|
||||
@@ -270,17 +270,17 @@ void D_Display (void)
|
||||
D_PageDrawer ();
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// draw buffered stuff to screen
|
||||
I_UpdateNoBlit ();
|
||||
|
||||
|
||||
// draw the view directly
|
||||
if (gamestate == GS_LEVEL && !automapactive && gametic)
|
||||
R_RenderPlayerView (&players[displayplayer]);
|
||||
|
||||
if (gamestate == GS_LEVEL && gametic)
|
||||
HU_Drawer ();
|
||||
|
||||
|
||||
// clean up border stuff
|
||||
if (gamestate != oldgamestate && gamestate != GS_LEVEL)
|
||||
I_SetPalette (W_CacheLumpName ("PLAYPAL",PU_CACHE));
|
||||
@@ -309,7 +309,7 @@ void D_Display (void)
|
||||
viewactivestate = viewactive;
|
||||
inhelpscreensstate = inhelpscreens;
|
||||
oldgamestate = wipegamestate = gamestate;
|
||||
|
||||
|
||||
// draw pause pic
|
||||
if (paused)
|
||||
{
|
||||
@@ -333,7 +333,7 @@ void D_Display (void)
|
||||
I_FinishUpdate (); // page flip or blit buffer
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// wipe update
|
||||
wipe_EndScreen(0, 0, SCREENWIDTH, SCREENHEIGHT);
|
||||
|
||||
@@ -366,7 +366,7 @@ void D_DoomLoop (void)
|
||||
{
|
||||
if (demorecording)
|
||||
G_BeginRecording ();
|
||||
|
||||
|
||||
if (M_CheckParm ("-debugfile"))
|
||||
{
|
||||
char filename[20];
|
||||
@@ -374,14 +374,14 @@ void D_DoomLoop (void)
|
||||
printf ("debug output to: %s\n",filename);
|
||||
debugfile = fopen (filename,"w");
|
||||
}
|
||||
|
||||
|
||||
I_InitGraphics ();
|
||||
|
||||
while (1)
|
||||
{
|
||||
// frame synchronous IO operations
|
||||
I_StartFrame ();
|
||||
|
||||
// frame syncronous IO operations
|
||||
I_StartFrame ();
|
||||
|
||||
// process one or more tics
|
||||
if (singletics)
|
||||
{
|
||||
@@ -450,7 +450,7 @@ void D_AdvanceDemo (void)
|
||||
|
||||
//
|
||||
// This cycles through the demo sequences.
|
||||
// FIXME - version dependent demo numbers?
|
||||
// FIXME - version dependend demo numbers?
|
||||
//
|
||||
void D_DoAdvanceDemo (void)
|
||||
{
|
||||
@@ -464,7 +464,7 @@ void D_AdvanceDemo (void)
|
||||
demosequence = (demosequence+1)%7;
|
||||
else
|
||||
demosequence = (demosequence+1)%6;
|
||||
|
||||
|
||||
switch (demosequence)
|
||||
{
|
||||
case 0:
|
||||
@@ -545,13 +545,13 @@ void D_AddFile (char *file)
|
||||
{
|
||||
int numwadfiles;
|
||||
char *newfile;
|
||||
|
||||
|
||||
for (numwadfiles = 0 ; wadfiles[numwadfiles] ; numwadfiles++)
|
||||
;
|
||||
|
||||
newfile = malloc (strlen(file)+1);
|
||||
strcpy (newfile, file);
|
||||
|
||||
|
||||
wadfiles[numwadfiles] = newfile;
|
||||
}
|
||||
|
||||
@@ -586,11 +586,11 @@ void IdentifyVersion (void)
|
||||
// Retail.
|
||||
doomuwad = malloc(strlen(doomwaddir)+1+8+1);
|
||||
sprintf(doomuwad, "%s/doomu.wad", doomwaddir);
|
||||
|
||||
|
||||
// Registered.
|
||||
doomwad = malloc(strlen(doomwaddir)+1+8+1);
|
||||
sprintf(doomwad, "%s/doom.wad", doomwaddir);
|
||||
|
||||
|
||||
// Shareware.
|
||||
doom1wad = malloc(strlen(doomwaddir)+1+9+1);
|
||||
sprintf(doom1wad, "%s/doom1.wad", doomwaddir);
|
||||
@@ -613,11 +613,6 @@ void IdentifyVersion (void)
|
||||
home = ".";
|
||||
sprintf(basedefault, "%s/.doomrc", home);
|
||||
|
||||
#ifdef _KOLIBRI
|
||||
// the config ships as DOOMRC.TXT next to the WAD (our CWD after setcwd)
|
||||
strcpy(basedefault, "DOOMRC.TXT");
|
||||
#endif
|
||||
|
||||
if (M_CheckParm ("-shdev"))
|
||||
{
|
||||
gamemode = shareware;
|
||||
@@ -652,7 +647,7 @@ void IdentifyVersion (void)
|
||||
D_AddFile (DEVDATA"tnt.wad");
|
||||
else*/
|
||||
D_AddFile (DEVDATA"doom2.wad");
|
||||
|
||||
|
||||
D_AddFile (DEVMAPS"cdata/texture1.lmp");
|
||||
D_AddFile (DEVMAPS"cdata/pnames.lmp");
|
||||
strcpy (basedefault,DEVDATA"default.cfg");
|
||||
@@ -727,7 +722,7 @@ void FindResponseFile (void)
|
||||
{
|
||||
int i;
|
||||
#define MAXARGVS 100
|
||||
|
||||
|
||||
for (i = 1;i < myargc;i++)
|
||||
if (myargv[i][0] == '@')
|
||||
{
|
||||
@@ -740,7 +735,7 @@ void FindResponseFile (void)
|
||||
char *file;
|
||||
char *moreargs[20];
|
||||
char *firstargv;
|
||||
|
||||
|
||||
// READ THE RESPONSE FILE INTO MEMORY
|
||||
handle = fopen (&myargv[i][1],"rb");
|
||||
if (!handle)
|
||||
@@ -755,16 +750,16 @@ void FindResponseFile (void)
|
||||
file = malloc (size);
|
||||
fread (file,size,1,handle);
|
||||
fclose (handle);
|
||||
|
||||
|
||||
// KEEP ALL CMDLINE ARGS FOLLOWING @RESPONSEFILE ARG
|
||||
for (index = 0,k = i+1; k < myargc; k++)
|
||||
moreargs[index++] = myargv[k];
|
||||
|
||||
|
||||
firstargv = myargv[0];
|
||||
myargv = malloc(sizeof(char *)*MAXARGVS);
|
||||
memset(myargv,0,sizeof(char *)*MAXARGVS);
|
||||
myargv[0] = firstargv;
|
||||
|
||||
|
||||
infile = file;
|
||||
indexinfile = k = 0;
|
||||
indexinfile++; // SKIP PAST ARGV[0] (KEEP IT)
|
||||
@@ -779,11 +774,11 @@ void FindResponseFile (void)
|
||||
((*(infile+k)<= ' ') || (*(infile+k)>'z')))
|
||||
k++;
|
||||
} while(k < size);
|
||||
|
||||
|
||||
for (k = 0;k < index;k++)
|
||||
myargv[indexinfile++] = moreargs[k];
|
||||
myargc = indexinfile;
|
||||
|
||||
|
||||
// DISPLAY ARGS
|
||||
printf("%d command-line args:\n",myargc);
|
||||
for (k=1;k<myargc;k++)
|
||||
@@ -803,12 +798,12 @@ void D_DoomMain (void)
|
||||
char file[256];
|
||||
|
||||
FindResponseFile ();
|
||||
|
||||
|
||||
IdentifyVersion ();
|
||||
|
||||
|
||||
setbuf (stdout, NULL);
|
||||
modifiedgame = false;
|
||||
|
||||
|
||||
nomonsters = M_CheckParm ("-nomonsters");
|
||||
respawnparm = M_CheckParm ("-respawn");
|
||||
fastparm = M_CheckParm ("-fast");
|
||||
@@ -872,19 +867,19 @@ void D_DoomMain (void)
|
||||
VERSION_NUM/100,VERSION_NUM%100);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
printf ("%s\n",title);
|
||||
|
||||
if (devparm)
|
||||
printf(D_DEVSTR);
|
||||
|
||||
|
||||
// turbo option
|
||||
if ( (p=M_CheckParm ("-turbo")) )
|
||||
{
|
||||
int scale = 200;
|
||||
extern int forwardmove[2];
|
||||
extern int sidemove[2];
|
||||
|
||||
|
||||
if (p<myargc-1)
|
||||
scale = atoi (myargv[p+1]);
|
||||
if (scale < 10)
|
||||
@@ -897,7 +892,7 @@ void D_DoomMain (void)
|
||||
sidemove[0] = sidemove[0]*scale/100;
|
||||
sidemove[1] = sidemove[1]*scale/100;
|
||||
}
|
||||
|
||||
|
||||
// add any files specified on the command line with -file wadfile
|
||||
// to the wad list
|
||||
//
|
||||
@@ -919,7 +914,7 @@ void D_DoomMain (void)
|
||||
printf("Warping to Episode %s, Map %s.\n",
|
||||
myargv[p+1],myargv[p+2]);
|
||||
break;
|
||||
|
||||
|
||||
case commercial:
|
||||
default:
|
||||
p = atoi (myargv[p+1]);
|
||||
@@ -931,7 +926,7 @@ void D_DoomMain (void)
|
||||
}
|
||||
D_AddFile (file);
|
||||
}
|
||||
|
||||
|
||||
p = M_CheckParm ("-file");
|
||||
if (p)
|
||||
{
|
||||
@@ -953,14 +948,14 @@ void D_DoomMain (void)
|
||||
D_AddFile (file);
|
||||
printf("Playing demo %s.lmp.\n",myargv[p+1]);
|
||||
}
|
||||
|
||||
|
||||
// get skill / episode / map from parms
|
||||
startskill = sk_medium;
|
||||
startepisode = 1;
|
||||
startmap = 1;
|
||||
autostart = false;
|
||||
|
||||
|
||||
|
||||
p = M_CheckParm ("-skill");
|
||||
if (p && p < myargc-1)
|
||||
{
|
||||
@@ -975,7 +970,7 @@ void D_DoomMain (void)
|
||||
startmap = 1;
|
||||
autostart = true;
|
||||
}
|
||||
|
||||
|
||||
p = M_CheckParm ("-timer");
|
||||
if (p && p < myargc-1 && deathmatch)
|
||||
{
|
||||
@@ -1003,7 +998,7 @@ void D_DoomMain (void)
|
||||
}
|
||||
autostart = true;
|
||||
}
|
||||
|
||||
|
||||
// init subsystems
|
||||
printf ("V_Init: allocate screens.\n");
|
||||
V_Init ();
|
||||
@@ -1017,7 +1012,7 @@ void D_DoomMain (void)
|
||||
printf ("W_Init: Init WADfiles.\n");
|
||||
W_InitMultipleFiles (wadfiles);
|
||||
printf("added\n");
|
||||
|
||||
|
||||
|
||||
// Check for -file in shareware
|
||||
if (modifiedgame)
|
||||
@@ -1031,20 +1026,20 @@ printf("added\n");
|
||||
"dphoof","bfgga0","heada1","cybra1","spida1d1"
|
||||
};
|
||||
int i;
|
||||
|
||||
|
||||
if ( gamemode == shareware)
|
||||
I_Error("\nYou cannot -file with the shareware "
|
||||
"version. Register!");
|
||||
|
||||
// Check for fake IWAD with right name,
|
||||
// but w/o all the lumps of the registered version.
|
||||
// but w/o all the lumps of the registered version.
|
||||
if (gamemode == registered)
|
||||
for (i = 0;i < 23; i++)
|
||||
if (W_CheckNumForName(name[i])<0)
|
||||
I_Error("\nThis is not the registered version.");
|
||||
}
|
||||
|
||||
// Iff additional PWAD files are used, print modified banner
|
||||
|
||||
// Iff additonal PWAD files are used, print modified banner
|
||||
if (modifiedgame)
|
||||
{
|
||||
/*m*/printf (
|
||||
@@ -1057,7 +1052,7 @@ printf("added\n");
|
||||
);
|
||||
getchar ();
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Check and print which version is executed.
|
||||
switch ( gamemode )
|
||||
@@ -1080,7 +1075,7 @@ printf("added\n");
|
||||
"===========================================================================\n"
|
||||
);
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
// Ouch.
|
||||
break;
|
||||
@@ -1115,13 +1110,13 @@ printf("added\n");
|
||||
if (p && p<myargc-1)
|
||||
{
|
||||
// for statistics driver
|
||||
extern void* statcopy;
|
||||
extern void* statcopy;
|
||||
|
||||
statcopy = (void*)atoi(myargv[p+1]);
|
||||
printf ("External statistics registered.\n");
|
||||
}
|
||||
|
||||
// start the appropriate game based on parms
|
||||
|
||||
// start the apropriate game based on parms
|
||||
p = M_CheckParm ("-record");
|
||||
|
||||
if (p && p < myargc-1)
|
||||
@@ -1129,7 +1124,7 @@ printf("added\n");
|
||||
G_RecordDemo (myargv[p+1]);
|
||||
autostart = true;
|
||||
}
|
||||
|
||||
|
||||
p = M_CheckParm ("-playdemo");
|
||||
if (p && p < myargc-1)
|
||||
{
|
||||
@@ -1137,14 +1132,14 @@ printf("added\n");
|
||||
G_DeferedPlayDemo (myargv[p+1]);
|
||||
D_DoomLoop (); // never returns
|
||||
}
|
||||
|
||||
|
||||
p = M_CheckParm ("-timedemo");
|
||||
if (p && p < myargc-1)
|
||||
{
|
||||
G_TimeDemo (myargv[p+1]);
|
||||
D_DoomLoop (); // never returns
|
||||
}
|
||||
|
||||
|
||||
p = M_CheckParm ("-loadgame");
|
||||
if (p && p < myargc-1)
|
||||
{
|
||||
@@ -1154,7 +1149,7 @@ printf("added\n");
|
||||
sprintf(file, SAVEGAMENAME"%c.dsg",myargv[p+1][0]);
|
||||
G_LoadGame (file);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ( gameaction != ga_loadgame )
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $Id:$
|
||||
@@ -44,14 +44,14 @@ void D_AddFile (char *file);
|
||||
// D_DoomMain()
|
||||
// Not a globally visible function, just included for source reference,
|
||||
// calls all startup code, parses command line options.
|
||||
// If not overridden by user input, calls N_AdvanceDemo.
|
||||
// If not overrided by user input, calls N_AdvanceDemo.
|
||||
//
|
||||
void D_DoomMain (void);
|
||||
|
||||
// Called by IO functions when input is detected.
|
||||
void D_PostEvent (event_t* ev);
|
||||
|
||||
|
||||
|
||||
|
||||
//
|
||||
// BASE LEVEL
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $Id:$
|
||||
@@ -18,7 +18,7 @@
|
||||
//
|
||||
// DESCRIPTION:
|
||||
// DOOM Network game communication and protocol,
|
||||
// all OS independent parts.
|
||||
// all OS independend parts.
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
@@ -40,8 +40,8 @@ static const char rcsid[] = "$Id: d_net.c,v 1.3 1997/02/03 22:01:47 b1 Exp $";
|
||||
#define NCMD_KILL 0x10000000 // kill game
|
||||
#define NCMD_CHECKSUM 0x0fffffff
|
||||
|
||||
|
||||
doomcom_t* doomcom;
|
||||
|
||||
doomcom_t* doomcom;
|
||||
doomdata_t* netbuffer; // points inside doomcom
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ doomdata_t* netbuffer; // points inside doomcom
|
||||
//
|
||||
// gametic is the tic about to (or currently being) run
|
||||
// maketic is the tick that hasn't had control made for it yet
|
||||
// nettics[] has the maketics for all players
|
||||
// nettics[] has the maketics for all players
|
||||
//
|
||||
// a gametic cannot be run until nettics[] > gametic for all players
|
||||
//
|
||||
@@ -71,14 +71,14 @@ int nodeforplayer[MAXPLAYERS];
|
||||
int maketic;
|
||||
int lastnettic;
|
||||
int skiptics;
|
||||
int ticdup;
|
||||
int ticdup;
|
||||
int maxsend; // BACKUPTICS/(2*ticdup)-1
|
||||
|
||||
|
||||
void D_ProcessEvents (void);
|
||||
void G_BuildTiccmd (ticcmd_t *cmd);
|
||||
void D_ProcessEvents (void);
|
||||
void G_BuildTiccmd (ticcmd_t *cmd);
|
||||
void D_DoAdvanceDemo (void);
|
||||
|
||||
|
||||
boolean reboundpacket;
|
||||
doomdata_t reboundstore;
|
||||
|
||||
@@ -89,11 +89,11 @@ doomdata_t reboundstore;
|
||||
//
|
||||
int NetbufferSize (void)
|
||||
{
|
||||
return (int)&(((doomdata_t *)0)->cmds[netbuffer->numtics]);
|
||||
return (int)&(((doomdata_t *)0)->cmds[netbuffer->numtics]);
|
||||
}
|
||||
|
||||
//
|
||||
// Checksum
|
||||
// Checksum
|
||||
//
|
||||
unsigned NetbufferChecksum (void)
|
||||
{
|
||||
@@ -102,7 +102,7 @@ unsigned NetbufferChecksum (void)
|
||||
|
||||
c = 0x1234567;
|
||||
|
||||
// FIXME -endianness?
|
||||
// FIXME -endianess?
|
||||
#ifdef NORMALUNIX
|
||||
return 0; // byte order problems
|
||||
#endif
|
||||
@@ -120,16 +120,16 @@ unsigned NetbufferChecksum (void)
|
||||
int ExpandTics (int low)
|
||||
{
|
||||
int delta;
|
||||
|
||||
|
||||
delta = low - (maketic&0xff);
|
||||
|
||||
|
||||
if (delta >= -64 && delta <= 64)
|
||||
return (maketic&~0xff) + low;
|
||||
if (delta > 64)
|
||||
return (maketic&~0xff) - 256 + low;
|
||||
if (delta < -64)
|
||||
return (maketic&~0xff) + 256 + low;
|
||||
|
||||
|
||||
I_Error ("ExpandTics: strange value %i at maketic %i",low,maketic);
|
||||
return 0;
|
||||
}
|
||||
@@ -158,11 +158,11 @@ HSendPacket
|
||||
|
||||
if (!netgame)
|
||||
I_Error ("Tried to transmit to another node");
|
||||
|
||||
|
||||
doomcom->command = CMD_SEND;
|
||||
doomcom->remotenode = node;
|
||||
doomcom->datalength = NetbufferSize ();
|
||||
|
||||
|
||||
if (debugfile)
|
||||
{
|
||||
int i;
|
||||
@@ -175,7 +175,7 @@ HSendPacket
|
||||
fprintf (debugfile,"send (%i + %i, R %i) [%i] ",
|
||||
ExpandTics(netbuffer->starttic),
|
||||
netbuffer->numtics, realretrans, doomcom->datalength);
|
||||
|
||||
|
||||
for (i=0 ; i<doomcom->datalength ; i++)
|
||||
fprintf (debugfile,"%i ",((byte *)netbuffer)[i]);
|
||||
|
||||
@@ -190,7 +190,7 @@ HSendPacket
|
||||
// Returns false if no packet is waiting
|
||||
//
|
||||
boolean HGetPacket (void)
|
||||
{
|
||||
{
|
||||
if (reboundpacket)
|
||||
{
|
||||
*netbuffer = reboundstore;
|
||||
@@ -204,10 +204,10 @@ boolean HGetPacket (void)
|
||||
|
||||
if (demoplayback)
|
||||
return false;
|
||||
|
||||
|
||||
doomcom->command = CMD_GET;
|
||||
I_NetCmd ();
|
||||
|
||||
|
||||
if (doomcom->remotenode == -1)
|
||||
return false;
|
||||
|
||||
@@ -217,7 +217,7 @@ boolean HGetPacket (void)
|
||||
fprintf (debugfile,"bad packet length %i\n",doomcom->datalength);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (NetbufferChecksum () != (netbuffer->checksum&NCMD_CHECKSUM) )
|
||||
{
|
||||
if (debugfile)
|
||||
@@ -229,7 +229,7 @@ boolean HGetPacket (void)
|
||||
{
|
||||
int realretrans;
|
||||
int i;
|
||||
|
||||
|
||||
if (netbuffer->checksum & NCMD_SETUP)
|
||||
fprintf (debugfile,"setup packet\n");
|
||||
else
|
||||
@@ -238,7 +238,7 @@ boolean HGetPacket (void)
|
||||
realretrans = ExpandTics (netbuffer->retransmitfrom);
|
||||
else
|
||||
realretrans = -1;
|
||||
|
||||
|
||||
fprintf (debugfile,"get %i = (%i + %i, R %i)[%i] ",
|
||||
doomcom->remotenode,
|
||||
ExpandTics(netbuffer->starttic),
|
||||
@@ -249,7 +249,7 @@ boolean HGetPacket (void)
|
||||
fprintf (debugfile,"\n");
|
||||
}
|
||||
}
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -265,20 +265,20 @@ void GetPackets (void)
|
||||
ticcmd_t *src, *dest;
|
||||
int realend;
|
||||
int realstart;
|
||||
|
||||
|
||||
while ( HGetPacket() )
|
||||
{
|
||||
if (netbuffer->checksum & NCMD_SETUP)
|
||||
continue; // extra setup packet
|
||||
|
||||
|
||||
netconsole = netbuffer->player & ~PL_DRONE;
|
||||
netnode = doomcom->remotenode;
|
||||
|
||||
|
||||
// to save bytes, only the low byte of tic numbers are sent
|
||||
// Figure out what the rest of the bytes are
|
||||
realstart = ExpandTics (netbuffer->starttic);
|
||||
realstart = ExpandTics (netbuffer->starttic);
|
||||
realend = (realstart+netbuffer->numtics);
|
||||
|
||||
|
||||
// check for exiting the game
|
||||
if (netbuffer->checksum & NCMD_EXIT)
|
||||
{
|
||||
@@ -293,15 +293,15 @@ void GetPackets (void)
|
||||
G_CheckDemoStatus ();
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
// check for a remote game kill
|
||||
if (netbuffer->checksum & NCMD_KILL)
|
||||
I_Error ("Killed by network driver");
|
||||
|
||||
nodeforplayer[netconsole] = netnode;
|
||||
|
||||
|
||||
// check for retransmit request
|
||||
if ( resendcount[netnode] <= 0
|
||||
if ( resendcount[netnode] <= 0
|
||||
&& (netbuffer->checksum & NCMD_RETRANSMIT) )
|
||||
{
|
||||
resendto[netnode] = ExpandTics(netbuffer->retransmitfrom);
|
||||
@@ -311,11 +311,11 @@ void GetPackets (void)
|
||||
}
|
||||
else
|
||||
resendcount[netnode]--;
|
||||
|
||||
// check for out of order / duplicated packet
|
||||
|
||||
// check for out of order / duplicated packet
|
||||
if (realend == nettics[netnode])
|
||||
continue;
|
||||
|
||||
|
||||
if (realend < nettics[netnode])
|
||||
{
|
||||
if (debugfile)
|
||||
@@ -324,7 +324,7 @@ void GetPackets (void)
|
||||
realstart,netbuffer->numtics);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
// check for a missed packet
|
||||
if (realstart > nettics[netnode])
|
||||
{
|
||||
@@ -342,8 +342,8 @@ void GetPackets (void)
|
||||
int start;
|
||||
|
||||
remoteresend[netnode] = false;
|
||||
|
||||
start = nettics[netnode] - realstart;
|
||||
|
||||
start = nettics[netnode] - realstart;
|
||||
src = &netbuffer->cmds[start];
|
||||
|
||||
while (nettics[netnode] < realend)
|
||||
@@ -372,14 +372,14 @@ void NetUpdate (void)
|
||||
int i,j;
|
||||
int realstart;
|
||||
int gameticdiv;
|
||||
|
||||
|
||||
// check time
|
||||
nowtime = I_GetTime ()/ticdup;
|
||||
newtics = nowtime - gametime;
|
||||
gametime = nowtime;
|
||||
|
||||
|
||||
if (newtics <= 0) // nothing new to update
|
||||
goto listen;
|
||||
goto listen;
|
||||
|
||||
if (skiptics <= newtics)
|
||||
{
|
||||
@@ -391,10 +391,10 @@ void NetUpdate (void)
|
||||
skiptics -= newtics;
|
||||
newtics = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
netbuffer->player = consoleplayer;
|
||||
|
||||
|
||||
// build new ticcmds for console player
|
||||
gameticdiv = gametic/ticdup;
|
||||
for (i=0 ; i<newtics ; i++)
|
||||
@@ -403,7 +403,7 @@ void NetUpdate (void)
|
||||
D_ProcessEvents ();
|
||||
if (maketic - gameticdiv >= BACKUPTICS/2-1)
|
||||
break; // can't hold any more
|
||||
|
||||
|
||||
//printf ("mk:%i ",maketic);
|
||||
G_BuildTiccmd (&localcmds[maketic%BACKUPTICS]);
|
||||
maketic++;
|
||||
@@ -411,8 +411,8 @@ void NetUpdate (void)
|
||||
|
||||
|
||||
if (singletics)
|
||||
return; // singletic update is synchronous
|
||||
|
||||
return; // singletic update is syncronous
|
||||
|
||||
// send the packet to the other nodes
|
||||
for (i=0 ; i<doomcom->numnodes ; i++)
|
||||
if (nodeingame[i])
|
||||
@@ -425,9 +425,9 @@ void NetUpdate (void)
|
||||
resendto[i] = maketic - doomcom->extratics;
|
||||
|
||||
for (j=0 ; j< netbuffer->numtics ; j++)
|
||||
netbuffer->cmds[j] =
|
||||
netbuffer->cmds[j] =
|
||||
localcmds[(realstart+j)%BACKUPTICS];
|
||||
|
||||
|
||||
if (remoteresend[i])
|
||||
{
|
||||
netbuffer->retransmitfrom = nettics[i];
|
||||
@@ -439,7 +439,7 @@ void NetUpdate (void)
|
||||
HSendPacket (i, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// listen for other packets
|
||||
listen:
|
||||
GetPackets ();
|
||||
@@ -454,19 +454,19 @@ void CheckAbort (void)
|
||||
{
|
||||
event_t *ev;
|
||||
int stoptic;
|
||||
|
||||
stoptic = I_GetTime () + 2;
|
||||
while (I_GetTime() < stoptic)
|
||||
I_StartTic ();
|
||||
|
||||
|
||||
stoptic = I_GetTime () + 2;
|
||||
while (I_GetTime() < stoptic)
|
||||
I_StartTic ();
|
||||
|
||||
I_StartTic ();
|
||||
for ( ; eventtail != eventhead
|
||||
; eventtail = (++eventtail)&(MAXEVENTS-1) )
|
||||
{
|
||||
ev = &events[eventtail];
|
||||
for ( ; eventtail != eventhead
|
||||
; eventtail = (++eventtail)&(MAXEVENTS-1) )
|
||||
{
|
||||
ev = &events[eventtail];
|
||||
if (ev->type == ev_keydown && ev->data1 == KEY_ESCAPE)
|
||||
I_Error ("Network game synchronization aborted.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -477,10 +477,10 @@ void D_ArbitrateNetStart (void)
|
||||
{
|
||||
int i;
|
||||
boolean gotinfo[MAXNETNODES];
|
||||
|
||||
|
||||
autostart = true;
|
||||
memset (gotinfo,0,sizeof(gotinfo));
|
||||
|
||||
|
||||
if (doomcom->consoleplayer)
|
||||
{
|
||||
// listen for setup info from key player
|
||||
@@ -555,7 +555,7 @@ extern int viewangleoffset;
|
||||
void D_CheckNetGame (void)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
for (i=0 ; i<MAXNETNODES ; i++)
|
||||
{
|
||||
nodeingame[i] = false;
|
||||
@@ -563,12 +563,12 @@ void D_CheckNetGame (void)
|
||||
remoteresend[i] = false; // set when local needs tics
|
||||
resendto[i] = 0; // which tic to start sending
|
||||
}
|
||||
|
||||
|
||||
// I_InitNetwork sets doomcom and netgame
|
||||
I_InitNetwork ();
|
||||
if (doomcom->id != DOOMCOM_ID)
|
||||
I_Error ("Doomcom buffer invalid!");
|
||||
|
||||
|
||||
netbuffer = &doomcom->data;
|
||||
consoleplayer = displayplayer = doomcom->consoleplayer;
|
||||
if (netgame)
|
||||
@@ -576,18 +576,18 @@ void D_CheckNetGame (void)
|
||||
|
||||
printf ("startskill %i deathmatch: %i startmap: %i startepisode: %i\n",
|
||||
startskill, deathmatch, startmap, startepisode);
|
||||
|
||||
|
||||
// read values out of doomcom
|
||||
ticdup = doomcom->ticdup;
|
||||
maxsend = BACKUPTICS/(2*ticdup)-1;
|
||||
if (maxsend<1)
|
||||
maxsend = 1;
|
||||
|
||||
|
||||
for (i=0 ; i<doomcom->numplayers ; i++)
|
||||
playeringame[i] = true;
|
||||
for (i=0 ; i<doomcom->numnodes ; i++)
|
||||
nodeingame[i] = true;
|
||||
|
||||
|
||||
printf ("player %i of %i (%i nodes)\n",
|
||||
consoleplayer+1, doomcom->numplayers, doomcom->numnodes);
|
||||
|
||||
@@ -602,13 +602,13 @@ void D_CheckNetGame (void)
|
||||
void D_QuitNetGame (void)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
|
||||
if (debugfile)
|
||||
fclose (debugfile);
|
||||
|
||||
|
||||
if (!netgame || !usergame || consoleplayer == -1 || demoplayback)
|
||||
return;
|
||||
|
||||
|
||||
// send a bunch of packets for security
|
||||
netbuffer->player = consoleplayer;
|
||||
netbuffer->numtics = 0;
|
||||
@@ -643,15 +643,15 @@ void TryRunTics (void)
|
||||
int availabletics;
|
||||
int counts;
|
||||
int numplaying;
|
||||
|
||||
// get real tics
|
||||
|
||||
// get real tics
|
||||
entertic = I_GetTime ()/ticdup;
|
||||
realtics = entertic - oldentertics;
|
||||
oldentertics = entertic;
|
||||
|
||||
|
||||
// get available tics
|
||||
NetUpdate ();
|
||||
|
||||
|
||||
lowtic = MAXINT;
|
||||
numplaying = 0;
|
||||
for (i=0 ; i<doomcom->numnodes ; i++)
|
||||
@@ -664,7 +664,7 @@ void TryRunTics (void)
|
||||
}
|
||||
}
|
||||
availabletics = lowtic - gametic/ticdup;
|
||||
|
||||
|
||||
// decide how many tics to run
|
||||
if (realtics < availabletics-1)
|
||||
counts = realtics+1;
|
||||
@@ -672,10 +672,10 @@ void TryRunTics (void)
|
||||
counts = realtics;
|
||||
else
|
||||
counts = availabletics;
|
||||
|
||||
|
||||
if (counts < 1)
|
||||
counts = 1;
|
||||
|
||||
|
||||
frameon++;
|
||||
|
||||
if (debugfile)
|
||||
@@ -684,9 +684,9 @@ void TryRunTics (void)
|
||||
realtics, availabletics,counts);
|
||||
|
||||
if (!demoplayback)
|
||||
{
|
||||
{
|
||||
// ideally nettics[0] should be 1 - 3 tics above lowtic
|
||||
// if we are consistently slower, speed up time
|
||||
// if we are consistantly slower, speed up time
|
||||
for (i=0 ; i<MAXPLAYERS ; i++)
|
||||
if (playeringame[i])
|
||||
break;
|
||||
@@ -710,28 +710,28 @@ void TryRunTics (void)
|
||||
}
|
||||
}
|
||||
}// demoplayback
|
||||
|
||||
|
||||
// wait for new tics if needed
|
||||
while (lowtic < gametic/ticdup + counts)
|
||||
while (lowtic < gametic/ticdup + counts)
|
||||
{
|
||||
NetUpdate ();
|
||||
NetUpdate ();
|
||||
lowtic = MAXINT;
|
||||
|
||||
|
||||
for (i=0 ; i<doomcom->numnodes ; i++)
|
||||
if (nodeingame[i] && nettics[i] < lowtic)
|
||||
lowtic = nettics[i];
|
||||
|
||||
|
||||
if (lowtic < gametic/ticdup)
|
||||
I_Error ("TryRunTics: lowtic < gametic");
|
||||
|
||||
|
||||
// don't stay in here forever -- give the menu a chance to work
|
||||
if (I_GetTime ()/ticdup - entertic >= 20)
|
||||
{
|
||||
M_Ticker ();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// run the count * ticdup dics
|
||||
while (counts--)
|
||||
{
|
||||
@@ -744,15 +744,15 @@ void TryRunTics (void)
|
||||
M_Ticker ();
|
||||
G_Ticker ();
|
||||
gametic++;
|
||||
|
||||
|
||||
// modify command for duplicated tics
|
||||
if (i != ticdup-1)
|
||||
{
|
||||
ticcmd_t *cmd;
|
||||
int buf;
|
||||
int j;
|
||||
|
||||
buf = (gametic/ticdup)%BACKUPTICS;
|
||||
|
||||
buf = (gametic/ticdup)%BACKUPTICS;
|
||||
for (j=0 ; j<MAXPLAYERS ; j++)
|
||||
{
|
||||
cmd = &netcmds[j][buf];
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $Id:$
|
||||
@@ -65,7 +65,7 @@ typedef struct
|
||||
unsigned checksum;
|
||||
// Only valid if NCMD_RETRANSMIT.
|
||||
byte retransmitfrom;
|
||||
|
||||
|
||||
byte starttic;
|
||||
byte player;
|
||||
byte numtics;
|
||||
@@ -80,20 +80,20 @@ typedef struct
|
||||
{
|
||||
// Supposed to be DOOMCOM_ID?
|
||||
long id;
|
||||
|
||||
|
||||
// DOOM executes an int to execute commands.
|
||||
short intnum;
|
||||
short intnum;
|
||||
// Communication between DOOM and the driver.
|
||||
// Is CMD_SEND or CMD_GET.
|
||||
short command;
|
||||
// Is dest for send, set by get (-1 = no packet).
|
||||
short remotenode;
|
||||
|
||||
|
||||
// Number of bytes in doomdata to be sent
|
||||
short datalength;
|
||||
|
||||
// Info common to all nodes.
|
||||
// Console is always node 0.
|
||||
// Console is allways node 0.
|
||||
short numnodes;
|
||||
// Flag: 1 = no duplication, 2-5 = dup for slow nets.
|
||||
short ticdup;
|
||||
@@ -110,7 +110,7 @@ typedef struct
|
||||
// Info specific to this node.
|
||||
short consoleplayer;
|
||||
short numplayers;
|
||||
|
||||
|
||||
// These are related to the 3-display mode,
|
||||
// in which two drones looking left and right
|
||||
// were used to render two additional views
|
||||
@@ -119,11 +119,11 @@ typedef struct
|
||||
// 1 = left, 0 = center, -1 = right
|
||||
short angleoffset;
|
||||
// 1 = drone
|
||||
short drone;
|
||||
short drone;
|
||||
|
||||
// The packet data to be sent.
|
||||
doomdata_t data;
|
||||
|
||||
|
||||
} doomcom_t;
|
||||
|
||||
|
||||
@@ -146,3 +146,4 @@ void TryRunTics (void);
|
||||
// $Log:$
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $Id:$
|
||||
@@ -38,7 +38,7 @@ typedef struct
|
||||
char forwardmove; // *2048 for move
|
||||
char sidemove; // *2048 for move
|
||||
short angleturn; // <<16 for angle delta
|
||||
short consistency; // checks for net game
|
||||
short consistancy; // checks for net game
|
||||
byte chatchar;
|
||||
byte buttons;
|
||||
} ticcmd_t;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $Id:$
|
||||
@@ -51,7 +51,7 @@ enum
|
||||
ML_SSECTORS, // SubSectors, list of LineSegs
|
||||
ML_NODES, // BSP nodes
|
||||
ML_SECTORS, // Sectors, from editing
|
||||
ML_REJECT, // LUT, sector-sector visibility
|
||||
ML_REJECT, // LUT, sector-sector visibility
|
||||
ML_BLOCKMAP // LUT, motion clipping, walls/grid element
|
||||
};
|
||||
|
||||
@@ -89,7 +89,7 @@ typedef struct
|
||||
short special;
|
||||
short tag;
|
||||
// sidenum[1] will be -1 if one sided
|
||||
short sidenum[2];
|
||||
short sidenum[2];
|
||||
} maplinedef_t;
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ typedef struct
|
||||
// top or bottom of the texture (stairs or pulled
|
||||
// down things) and will move with a height change
|
||||
// of one of the neighbor sectors.
|
||||
// Unpegged textures always have the first row of
|
||||
// Unpegged textures allways have the first row of
|
||||
// the texture at the top pixel of the line for both
|
||||
// top and bottom textures (use next to windows).
|
||||
|
||||
@@ -120,7 +120,7 @@ typedef struct
|
||||
#define ML_DONTPEGTOP 8
|
||||
|
||||
// lower texture unpegged
|
||||
#define ML_DONTPEGBOTTOM 16
|
||||
#define ML_DONTPEGBOTTOM 16
|
||||
|
||||
// In AutoMap: don't map as two sided: IT'S A SECRET!
|
||||
#define ML_SECRET 32
|
||||
@@ -154,7 +154,7 @@ typedef struct
|
||||
{
|
||||
short numsegs;
|
||||
// Index of first one, segs are stored sequentially.
|
||||
short firstseg;
|
||||
short firstseg;
|
||||
} mapsubsector_t;
|
||||
|
||||
|
||||
@@ -164,7 +164,7 @@ typedef struct
|
||||
{
|
||||
short v1;
|
||||
short v2;
|
||||
short angle;
|
||||
short angle;
|
||||
short linedef;
|
||||
short side;
|
||||
short offset;
|
||||
@@ -219,3 +219,4 @@ typedef struct
|
||||
// $Log:$
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $Id:$
|
||||
@@ -34,7 +34,7 @@ enum { VERSION_NUM = 110 };
|
||||
|
||||
|
||||
// Game mode handling - identify IWAD version
|
||||
// to handle IWAD dependent animations etc.
|
||||
// to handle IWAD dependend animations etc.
|
||||
typedef enum
|
||||
{
|
||||
shareware, // DOOM 1 shareware, E1, M9
|
||||
@@ -43,7 +43,7 @@ typedef enum
|
||||
// DOOM 2 german edition not handled
|
||||
retail, // DOOM 1 retail, E4, M36
|
||||
indetermined // Well, no IWAD found.
|
||||
|
||||
|
||||
} GameMode_t;
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ typedef enum
|
||||
// The integrated sound support is experimental,
|
||||
// and unfinished. Default is synchronous.
|
||||
// Experimental asynchronous timer based is
|
||||
// handled by SNDINTR.
|
||||
// handled by SNDINTR.
|
||||
#define SNDSERV 1
|
||||
//#define SNDINTR 1
|
||||
|
||||
@@ -99,7 +99,7 @@ typedef enum
|
||||
|
||||
// It is educational but futile to change this
|
||||
// scaling e.g. to 2. Drawing of status bar,
|
||||
// menus etc. is tied to the scale implied
|
||||
// menues etc. is tied to the scale implied
|
||||
// by the graphics.
|
||||
#define SCREEN_MUL 1
|
||||
#define INV_ASPECT_RATIO 0.625 // 0.75, ideally
|
||||
@@ -123,7 +123,7 @@ typedef enum
|
||||
|
||||
// The current state of the game: whether we are
|
||||
// playing, gazing at the intermission screen,
|
||||
// the game final animation, or a demo.
|
||||
// the game final animation, or a demo.
|
||||
typedef enum
|
||||
{
|
||||
GS_LEVEL,
|
||||
@@ -167,9 +167,9 @@ typedef enum
|
||||
it_blueskull,
|
||||
it_yellowskull,
|
||||
it_redskull,
|
||||
|
||||
|
||||
NUMCARDS
|
||||
|
||||
|
||||
} card_t;
|
||||
|
||||
|
||||
@@ -190,7 +190,7 @@ typedef enum
|
||||
wp_supershotgun,
|
||||
|
||||
NUMWEAPONS,
|
||||
|
||||
|
||||
// No pending weapon change.
|
||||
wp_nochange
|
||||
|
||||
@@ -205,7 +205,7 @@ typedef enum
|
||||
am_cell, // Plasma rifle, BFG.
|
||||
am_misl, // Missile launcher.
|
||||
NUMAMMO,
|
||||
am_noammo // Unlimited for chainsaw / fist.
|
||||
am_noammo // Unlimited for chainsaw / fist.
|
||||
|
||||
} ammotype_t;
|
||||
|
||||
@@ -220,7 +220,7 @@ typedef enum
|
||||
pw_allmap,
|
||||
pw_infrared,
|
||||
NUMPOWERS
|
||||
|
||||
|
||||
} powertype_t;
|
||||
|
||||
|
||||
@@ -236,7 +236,7 @@ typedef enum
|
||||
INVISTICS = (60*TICRATE),
|
||||
INFRATICS = (120*TICRATE),
|
||||
IRONTICS = (60*TICRATE)
|
||||
|
||||
|
||||
} powerduration_t;
|
||||
|
||||
|
||||
@@ -288,7 +288,7 @@ typedef enum
|
||||
// Fixed point.
|
||||
//#include "m_fixed.h"
|
||||
|
||||
// Endianness handling.
|
||||
// Endianess handling.
|
||||
//#include "m_swap.h"
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $Id:$
|
||||
@@ -80,7 +80,7 @@ extern int startmap;
|
||||
|
||||
extern boolean autostart;
|
||||
|
||||
// Selected by user.
|
||||
// Selected by user.
|
||||
extern skill_t gameskill;
|
||||
extern int gameepisode;
|
||||
extern int gamemap;
|
||||
@@ -93,8 +93,8 @@ extern boolean netgame;
|
||||
|
||||
// Flag: true only if started as net deathmatch.
|
||||
// An enum might handle altdeath/cooperative better.
|
||||
extern boolean deathmatch;
|
||||
|
||||
extern boolean deathmatch;
|
||||
|
||||
// -------------------------
|
||||
// Internal parameters for sound rendering.
|
||||
// These have been taken from the DOS version,
|
||||
@@ -126,11 +126,11 @@ extern int snd_DesiredSfxDevice;
|
||||
|
||||
// Depending on view size - no status bar?
|
||||
// Note that there is no way to disable the
|
||||
// status bar explicitly.
|
||||
// status bar explicitely.
|
||||
extern boolean statusbaractive;
|
||||
|
||||
extern boolean automapactive; // In AutoMap mode?
|
||||
extern boolean menuactive; // Menu overlaid?
|
||||
extern boolean menuactive; // Menu overlayed?
|
||||
extern boolean paused; // Game Pause?
|
||||
|
||||
|
||||
@@ -155,7 +155,7 @@ extern int scaledviewwidth;
|
||||
extern int viewangleoffset;
|
||||
|
||||
// Player taking events, and displaying.
|
||||
extern int consoleplayer;
|
||||
extern int consoleplayer;
|
||||
extern int displayplayer;
|
||||
|
||||
|
||||
@@ -184,7 +184,7 @@ extern boolean demoplayback;
|
||||
extern boolean demorecording;
|
||||
|
||||
// Quit after playing a demo from cmdline.
|
||||
extern boolean singledemo;
|
||||
extern boolean singledemo;
|
||||
|
||||
|
||||
|
||||
@@ -225,7 +225,7 @@ extern mapthing_t playerstarts[MAXPLAYERS];
|
||||
|
||||
// Intermission stats.
|
||||
// Parameters for world map / intermission.
|
||||
extern wbstartstruct_t wminfo;
|
||||
extern wbstartstruct_t wminfo;
|
||||
|
||||
|
||||
// LUT of ammunition limits for each kind.
|
||||
@@ -255,7 +255,7 @@ extern gamestate_t wipegamestate;
|
||||
extern int mouseSensitivity;
|
||||
//?
|
||||
// debug flag to cancel adaptiveness
|
||||
extern boolean singletics;
|
||||
extern boolean singletics;
|
||||
|
||||
extern int bodyqueslot;
|
||||
|
||||
@@ -274,7 +274,7 @@ extern int skyflatnum;
|
||||
extern doomcom_t* doomcom;
|
||||
|
||||
// This points inside doomcom.
|
||||
extern doomdata_t* netbuffer;
|
||||
extern doomdata_t* netbuffer;
|
||||
|
||||
|
||||
extern ticcmd_t localcmds[BACKUPTICS];
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $Id:$
|
||||
@@ -100,8 +100,8 @@ void F_StartFinale (void)
|
||||
viewactive = false;
|
||||
automapactive = false;
|
||||
|
||||
// Okay - IWAD dependent stuff.
|
||||
// This has been changed severely, and
|
||||
// Okay - IWAD dependend stuff.
|
||||
// This has been changed severly, and
|
||||
// some stuff might have changed in the process.
|
||||
switch ( gamemode )
|
||||
{
|
||||
@@ -112,7 +112,7 @@ void F_StartFinale (void)
|
||||
case retail:
|
||||
{
|
||||
S_ChangeMusic(mus_victor, true);
|
||||
|
||||
|
||||
switch (gameepisode)
|
||||
{
|
||||
case 1:
|
||||
@@ -137,7 +137,7 @@ void F_StartFinale (void)
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// DOOM II and missions packs with E1, M34
|
||||
case commercial:
|
||||
{
|
||||
@@ -174,9 +174,9 @@ void F_StartFinale (void)
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Indeterminate.
|
||||
default:
|
||||
S_ChangeMusic(mus_read_m, true);
|
||||
@@ -184,10 +184,10 @@ void F_StartFinale (void)
|
||||
finaletext = c1text; // FIXME - other text, music?
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
finalestage = 0;
|
||||
finalecount = 0;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -196,7 +196,7 @@ boolean F_Responder (event_t *event)
|
||||
{
|
||||
if (finalestage == 2)
|
||||
return F_CastResponder (event);
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -207,7 +207,7 @@ boolean F_Responder (event_t *event)
|
||||
void F_Ticker (void)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
// check for skipping
|
||||
if ( (gamemode == commercial)
|
||||
&& ( finalecount > 50) )
|
||||
@@ -216,28 +216,28 @@ void F_Ticker (void)
|
||||
for (i=0 ; i<MAXPLAYERS ; i++)
|
||||
if (players[i].cmd.buttons)
|
||||
break;
|
||||
|
||||
|
||||
if (i < MAXPLAYERS)
|
||||
{
|
||||
{
|
||||
if (gamemap == 30)
|
||||
F_StartCast ();
|
||||
else
|
||||
gameaction = ga_worlddone;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// advance animation
|
||||
finalecount++;
|
||||
|
||||
|
||||
if (finalestage == 2)
|
||||
{
|
||||
F_CastTicker ();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if ( gamemode == commercial)
|
||||
return;
|
||||
|
||||
|
||||
if (!finalestage && finalecount>strlen (finaletext)*TEXTSPEED + TEXTWAIT)
|
||||
{
|
||||
finalecount = 0;
|
||||
@@ -262,18 +262,18 @@ void F_TextWrite (void)
|
||||
{
|
||||
byte* src;
|
||||
byte* dest;
|
||||
|
||||
|
||||
int x,y,w;
|
||||
int count;
|
||||
char* ch;
|
||||
int c;
|
||||
int cx;
|
||||
int cy;
|
||||
|
||||
|
||||
// erase the entire screen to a tiled background
|
||||
src = W_CacheLumpName ( finaleflat , PU_CACHE);
|
||||
dest = screens[0];
|
||||
|
||||
|
||||
for (y=0 ; y<SCREENHEIGHT ; y++)
|
||||
{
|
||||
for (x=0 ; x<SCREENWIDTH/64 ; x++)
|
||||
@@ -289,12 +289,12 @@ void F_TextWrite (void)
|
||||
}
|
||||
|
||||
V_MarkRect (0, 0, SCREENWIDTH, SCREENHEIGHT);
|
||||
|
||||
|
||||
// draw some of the text onto the screen
|
||||
cx = 10;
|
||||
cy = 10;
|
||||
ch = finaletext;
|
||||
|
||||
|
||||
count = (finalecount - 10)/TEXTSPEED;
|
||||
if (count < 0)
|
||||
count = 0;
|
||||
@@ -309,21 +309,21 @@ void F_TextWrite (void)
|
||||
cy += 11;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
c = toupper(c) - HU_FONTSTART;
|
||||
if (c < 0 || c> HU_FONTSIZE)
|
||||
{
|
||||
cx += 4;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
w = SHORT (hu_font[c]->width);
|
||||
if (cx+w > SCREENWIDTH)
|
||||
break;
|
||||
V_DrawPatch(cx, cy, 0, hu_font[c]);
|
||||
cx+=w;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
@@ -381,7 +381,7 @@ void F_StartCast (void)
|
||||
caststate = &states[mobjinfo[castorder[castnum].type].seestate];
|
||||
casttics = caststate->tics;
|
||||
castdeath = false;
|
||||
finalestage = 2;
|
||||
finalestage = 2;
|
||||
castframes = 0;
|
||||
castonmelee = 0;
|
||||
castattacking = false;
|
||||
@@ -396,10 +396,10 @@ void F_CastTicker (void)
|
||||
{
|
||||
int st;
|
||||
int sfx;
|
||||
|
||||
|
||||
if (--casttics > 0)
|
||||
return; // not time to change state yet
|
||||
|
||||
|
||||
if (caststate->tics == -1 || caststate->nextstate == S_NULL)
|
||||
{
|
||||
// switch from deathstate to next monster
|
||||
@@ -420,7 +420,7 @@ void F_CastTicker (void)
|
||||
st = caststate->nextstate;
|
||||
caststate = &states[st];
|
||||
castframes++;
|
||||
|
||||
|
||||
// sound hacks....
|
||||
switch (st)
|
||||
{
|
||||
@@ -452,11 +452,11 @@ void F_CastTicker (void)
|
||||
case S_PAIN_ATK3: sfx = sfx_sklatk; break;
|
||||
default: sfx = 0; break;
|
||||
}
|
||||
|
||||
|
||||
if (sfx)
|
||||
S_StartSound (NULL, sfx);
|
||||
}
|
||||
|
||||
|
||||
if (castframes == 12)
|
||||
{
|
||||
// go into attack frame
|
||||
@@ -476,7 +476,7 @@ void F_CastTicker (void)
|
||||
&states[mobjinfo[castorder[castnum].type].missilestate];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (castattacking)
|
||||
{
|
||||
if (castframes == 24
|
||||
@@ -488,7 +488,7 @@ void F_CastTicker (void)
|
||||
caststate = &states[mobjinfo[castorder[castnum].type].seestate];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
casttics = caststate->tics;
|
||||
if (casttics == -1)
|
||||
casttics = 15;
|
||||
@@ -503,10 +503,10 @@ boolean F_CastResponder (event_t* ev)
|
||||
{
|
||||
if (ev->type != ev_keydown)
|
||||
return false;
|
||||
|
||||
|
||||
if (castdeath)
|
||||
return true; // already in dying frames
|
||||
|
||||
|
||||
// go into death frame
|
||||
castdeath = true;
|
||||
caststate = &states[mobjinfo[castorder[castnum].type].deathstate];
|
||||
@@ -515,7 +515,7 @@ boolean F_CastResponder (event_t* ev)
|
||||
castattacking = false;
|
||||
if (mobjinfo[castorder[castnum].type].deathsound)
|
||||
S_StartSound (NULL, mobjinfo[castorder[castnum].type].deathsound);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -527,11 +527,11 @@ void F_CastPrint (char* text)
|
||||
int cx;
|
||||
int w;
|
||||
int width;
|
||||
|
||||
|
||||
// find width
|
||||
ch = text;
|
||||
width = 0;
|
||||
|
||||
|
||||
while (ch)
|
||||
{
|
||||
c = *ch++;
|
||||
@@ -543,11 +543,11 @@ void F_CastPrint (char* text)
|
||||
width += 4;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
w = SHORT (hu_font[c]->width);
|
||||
width += w;
|
||||
}
|
||||
|
||||
|
||||
// draw it
|
||||
cx = 160-width/2;
|
||||
ch = text;
|
||||
@@ -562,12 +562,12 @@ void F_CastPrint (char* text)
|
||||
cx += 4;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
w = SHORT (hu_font[c]->width);
|
||||
V_DrawPatch(cx, 180, 0, hu_font[c]);
|
||||
cx+=w;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -583,18 +583,18 @@ void F_CastDrawer (void)
|
||||
int lump;
|
||||
boolean flip;
|
||||
patch_t* patch;
|
||||
|
||||
|
||||
// erase the entire screen to a background
|
||||
V_DrawPatch (0,0,0, W_CacheLumpName ("BOSSBACK", PU_CACHE));
|
||||
|
||||
F_CastPrint (castorder[castnum].name);
|
||||
|
||||
|
||||
// draw the current frame in the middle of the screen
|
||||
sprdef = &sprites[caststate->sprite];
|
||||
sprframe = &sprdef->spriteframes[ caststate->frame & FF_FRAMEMASK];
|
||||
lump = sprframe->lump[0];
|
||||
flip = (boolean)sprframe->flip[0];
|
||||
|
||||
|
||||
patch = W_CacheLumpNum (lump+firstspritelump, PU_CACHE);
|
||||
if (flip)
|
||||
V_DrawPatchFlipped (160,170,0,patch);
|
||||
@@ -617,7 +617,7 @@ F_DrawPatchCol
|
||||
byte* dest;
|
||||
byte* desttop;
|
||||
int count;
|
||||
|
||||
|
||||
column = (column_t *)((byte *)patch + LONG(patch->columnofs[col]));
|
||||
desttop = screens[0]+x;
|
||||
|
||||
@@ -627,7 +627,7 @@ F_DrawPatchCol
|
||||
source = (byte *)column + 3;
|
||||
dest = desttop + column->topdelta*SCREENWIDTH;
|
||||
count = column->length;
|
||||
|
||||
|
||||
while (count--)
|
||||
{
|
||||
*dest = *source++;
|
||||
@@ -650,26 +650,26 @@ void F_BunnyScroll (void)
|
||||
char name[10];
|
||||
int stage;
|
||||
static int laststage;
|
||||
|
||||
|
||||
p1 = W_CacheLumpName ("PFUB2", PU_LEVEL);
|
||||
p2 = W_CacheLumpName ("PFUB1", PU_LEVEL);
|
||||
|
||||
V_MarkRect (0, 0, SCREENWIDTH, SCREENHEIGHT);
|
||||
|
||||
|
||||
scrolled = 320 - (finalecount-230)/2;
|
||||
if (scrolled > 320)
|
||||
scrolled = 320;
|
||||
if (scrolled < 0)
|
||||
scrolled = 0;
|
||||
|
||||
|
||||
for ( x=0 ; x<SCREENWIDTH ; x++)
|
||||
{
|
||||
if (x+scrolled < 320)
|
||||
F_DrawPatchCol (x, p1, x+scrolled);
|
||||
else
|
||||
F_DrawPatchCol (x, p2, x+scrolled - 320);
|
||||
F_DrawPatchCol (x, p2, x+scrolled - 320);
|
||||
}
|
||||
|
||||
|
||||
if (finalecount < 1130)
|
||||
return;
|
||||
if (finalecount < 1180)
|
||||
@@ -679,7 +679,7 @@ void F_BunnyScroll (void)
|
||||
laststage = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
stage = (finalecount-1180) / 5;
|
||||
if (stage > 6)
|
||||
stage = 6;
|
||||
@@ -688,7 +688,7 @@ void F_BunnyScroll (void)
|
||||
S_StartSound (NULL, sfx_pistol);
|
||||
laststage = stage;
|
||||
}
|
||||
|
||||
|
||||
sprintf (name,"END%i",stage);
|
||||
V_DrawPatch ((SCREENWIDTH-13*8)/2, (SCREENHEIGHT-8*8)/2,0, W_CacheLumpName (name,PU_CACHE));
|
||||
}
|
||||
@@ -732,5 +732,7 @@ void F_Drawer (void)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
+1166
-1163
File diff suppressed because it is too large.
Load diff
@@ -1,4 +1,4 @@
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $Id:$
|
||||
@@ -47,14 +47,14 @@ typedef struct
|
||||
// left-justified position of scrolling text window
|
||||
int x;
|
||||
int y;
|
||||
|
||||
|
||||
patch_t** f; // font
|
||||
int sc; // start character
|
||||
char l[HU_MAXLINELENGTH+1]; // line of text
|
||||
int len; // current line length
|
||||
|
||||
// whether this line needs to be updated
|
||||
int needsupdate;
|
||||
// whether this line needs to be udpated
|
||||
int needsupdate;
|
||||
|
||||
} hu_textline_t;
|
||||
|
||||
@@ -86,7 +86,7 @@ typedef struct
|
||||
int lm;
|
||||
|
||||
// pointer to boolean stating whether to update window
|
||||
boolean* on;
|
||||
boolean* on;
|
||||
boolean laston; // last value of *->on;
|
||||
|
||||
} hu_itext_t;
|
||||
@@ -118,7 +118,7 @@ boolean HUlib_delCharFromTextLine(hu_textline_t *t);
|
||||
void HUlib_drawTextLine(hu_textline_t *l, boolean drawcursor);
|
||||
|
||||
// erases text line
|
||||
void HUlib_eraseTextLine(hu_textline_t *l);
|
||||
void HUlib_eraseTextLine(hu_textline_t *l);
|
||||
|
||||
|
||||
//
|
||||
@@ -137,7 +137,7 @@ HUlib_initSText
|
||||
boolean* on );
|
||||
|
||||
// add a new line
|
||||
void HUlib_addLineToSText(hu_stext_t* s);
|
||||
void HUlib_addLineToSText(hu_stext_t* s);
|
||||
|
||||
// ?
|
||||
void
|
||||
@@ -150,7 +150,7 @@ HUlib_addMessageToSText
|
||||
void HUlib_drawSText(hu_stext_t* s);
|
||||
|
||||
// erases all stext lines
|
||||
void HUlib_eraseSText(hu_stext_t* s);
|
||||
void HUlib_eraseSText(hu_stext_t* s);
|
||||
|
||||
// Input Text Line widget routines
|
||||
void
|
||||
@@ -186,7 +186,7 @@ HUlib_keyInIText
|
||||
void HUlib_drawIText(hu_itext_t* it);
|
||||
|
||||
// erases all itext lines
|
||||
void HUlib_eraseIText(hu_itext_t* it);
|
||||
void HUlib_eraseIText(hu_itext_t* it);
|
||||
|
||||
#endif
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
@@ -32,23 +32,13 @@ rcsid[] = "$Id: i_main.c,v 1.4 1997/02/03 22:45:10 b1 Exp $";
|
||||
#include "m_argv.h"
|
||||
#include "d_main.h"
|
||||
|
||||
#ifdef _KOLIBRI
|
||||
#include <sys/ksys.h>
|
||||
#include <libgen.h>
|
||||
#endif
|
||||
|
||||
int
|
||||
main
|
||||
( int argc,
|
||||
char** argv )
|
||||
{
|
||||
myargc = argc;
|
||||
myargv = argv;
|
||||
|
||||
#ifdef _KOLIBRI
|
||||
// run from our own dir so DOOM1.WAD is found regardless of launcher CWD
|
||||
_ksys_setcwd(dirname(argv[0]));
|
||||
#endif
|
||||
myargv = argv;
|
||||
|
||||
D_DoomMain ();
|
||||
|
||||
|
||||
+266
-266
@@ -1,266 +1,266 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include "i_system.h"
|
||||
#include "d_event.h"
|
||||
#include "d_net.h"
|
||||
#include "m_argv.h"
|
||||
#include "doomstat.h"
|
||||
#include "i_net.h"
|
||||
|
||||
#ifdef DLHEAP
|
||||
|
||||
void* _cdecl dlmalloc(size_t);
|
||||
void _cdecl dlfree(void*);
|
||||
void _cdecl mf_init();
|
||||
|
||||
#define malloc dlmalloc
|
||||
#define free dlfree
|
||||
#define realloc dlrealloc
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef B_HOST_IS_LENDIAN
|
||||
#define B_HOST_IS_LENDIAN 1
|
||||
#endif
|
||||
#if !defined(sparc) && B_HOST_IS_LENDIAN
|
||||
#ifndef ntohl
|
||||
#define ntohl(x) \
|
||||
((unsigned long int)((((unsigned long int)(x) & 0x000000ffU) << 24) | \
|
||||
(((unsigned long int)(x) & 0x0000ff00U) << 8) | \
|
||||
(((unsigned long int)(x) & 0x00ff0000U) >> 8) | \
|
||||
(((unsigned long int)(x) & 0xff000000U) >> 24)))
|
||||
#endif
|
||||
|
||||
#ifndef ntohs
|
||||
#define ntohs(x) \
|
||||
((unsigned short int)((((unsigned short int)(x) & 0x00ff) << 8) | \
|
||||
(((unsigned short int)(x) & 0xff00) >> 8)))
|
||||
#endif
|
||||
|
||||
#ifndef htonl
|
||||
#define htonl(x) ntohl(x)
|
||||
#endif
|
||||
#ifndef htons
|
||||
#define htons(x) ntohs(x)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void NetSend (void);
|
||||
int NetListen (void);
|
||||
|
||||
|
||||
//
|
||||
// NETWORKING
|
||||
//
|
||||
|
||||
#ifndef IPPORT_USERRESERVED
|
||||
#define IPPORT_USERRESERVED 5000
|
||||
#endif
|
||||
|
||||
int DOOMPORT = (IPPORT_USERRESERVED+0x1d);
|
||||
int sendsocket[MAXNETNODES];
|
||||
int insocket;
|
||||
|
||||
void (*netget) (void);
|
||||
void (*netsend) (void);
|
||||
|
||||
static int first_user_port=IPPORT_USERRESERVED+0x1D+0x10;
|
||||
|
||||
/**********
|
||||
int GetAvailPort(void)
|
||||
{
|
||||
int i,d0;
|
||||
//for(i=0;i<1024;i++)
|
||||
//{
|
||||
// __asm__ __volatile__(
|
||||
// "int $0x40"
|
||||
// :"=a"(d0)
|
||||
// :"0"(53),"b"(9),"c"(first_user_port+i));
|
||||
// if(d0==1) return i+first_user_port;
|
||||
//}
|
||||
I_Error("Unable to get new port\n");
|
||||
return -1;
|
||||
}
|
||||
**********/
|
||||
|
||||
int CreateInputUDPsocket(void)
|
||||
{
|
||||
int d0=0;
|
||||
//__asm__ __volatile__(
|
||||
// "int $0x40"
|
||||
// :"=a"(d0)
|
||||
// :"0"(53),"b"(1),"c"(DOOMPORT),"d"(0),"S"(0));
|
||||
//if(d0==0xffffffff)
|
||||
//{
|
||||
I_Error("Unable to create socket\n");
|
||||
//}
|
||||
return d0;
|
||||
}
|
||||
|
||||
int CreateOutputUDPSocket(int remote_ip)
|
||||
{
|
||||
int d0;
|
||||
int p;
|
||||
// p=GetAvailPort();
|
||||
// __asm__ __volatile__(
|
||||
// "int $0x40"
|
||||
// :"=a"(d0)
|
||||
// :"0"(53),"b"(0),"c"(p),"d"(DOOMPORT),"S"(remote_ip));
|
||||
// if(d0==0xffffffff)
|
||||
// {
|
||||
I_Error("Unable to create output socket\n");
|
||||
// }
|
||||
return d0;
|
||||
}
|
||||
|
||||
//
|
||||
// PacketSend
|
||||
//
|
||||
void PacketSend (void)
|
||||
{
|
||||
int c;
|
||||
doomdata_t sw;
|
||||
|
||||
|
||||
//printf("ERROR Packet Send\n\r");
|
||||
|
||||
|
||||
// byte swap
|
||||
sw.checksum = htonl(netbuffer->checksum);
|
||||
sw.player = netbuffer->player;
|
||||
sw.retransmitfrom = netbuffer->retransmitfrom;
|
||||
sw.starttic = netbuffer->starttic;
|
||||
sw.numtics = netbuffer->numtics;
|
||||
for (c=0 ; c< netbuffer->numtics ; c++)
|
||||
{
|
||||
sw.cmds[c].forwardmove = netbuffer->cmds[c].forwardmove;
|
||||
sw.cmds[c].sidemove = netbuffer->cmds[c].sidemove;
|
||||
sw.cmds[c].angleturn = htons(netbuffer->cmds[c].angleturn);
|
||||
sw.cmds[c].consistency = htons(netbuffer->cmds[c].consistency);
|
||||
sw.cmds[c].chatchar = netbuffer->cmds[c].chatchar;
|
||||
sw.cmds[c].buttons = netbuffer->cmds[c].buttons;
|
||||
}
|
||||
// __libclog_printf("Sending packet %u to node %u\n",gametic,
|
||||
// doomcom->remotenode);
|
||||
// __asm__ __volatile__(
|
||||
// "int $0x40"
|
||||
// :"=a"(c)
|
||||
// :"0"(53),"b"(4),"c"(sendsocket[doomcom->remotenode]),
|
||||
// "d"(doomcom->datalength),"S"((long)&sw));
|
||||
// if(c==-1)
|
||||
// {
|
||||
// __libclog_printf("Unable to send packet to remote node\n");
|
||||
// }
|
||||
}
|
||||
|
||||
//
|
||||
// PacketGet
|
||||
//
|
||||
void PacketGet (void)
|
||||
{
|
||||
}
|
||||
|
||||
int GetLocalAddress (void)
|
||||
{
|
||||
int d0;
|
||||
// __asm__ __volatile__(
|
||||
// "int $0x40"
|
||||
// :"=a"(d0)
|
||||
// :"0"(52),"b"(1));
|
||||
return d0;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// I_InitNetwork
|
||||
//
|
||||
|
||||
void I_InitNetwork (void)
|
||||
{
|
||||
boolean trueval = true;
|
||||
int i;
|
||||
int p;
|
||||
|
||||
doomcom = malloc (sizeof (*doomcom) );
|
||||
memset (doomcom, 0, sizeof(*doomcom) );
|
||||
|
||||
// set up for network
|
||||
i = M_CheckParm ("-dup");
|
||||
if (i && i< myargc-1)
|
||||
{
|
||||
doomcom->ticdup = myargv[i+1][0]-'0';
|
||||
if (doomcom->ticdup < 1)
|
||||
doomcom->ticdup = 1;
|
||||
if (doomcom->ticdup > 9)
|
||||
doomcom->ticdup = 9;
|
||||
}
|
||||
else
|
||||
doomcom-> ticdup = 1;
|
||||
|
||||
if (M_CheckParm ("-extratic"))
|
||||
doomcom-> extratics = 1;
|
||||
else
|
||||
doomcom-> extratics = 0;
|
||||
|
||||
p = M_CheckParm ("-port");
|
||||
if (p && p<myargc-1)
|
||||
{
|
||||
DOOMPORT = atoi (myargv[p+1]);
|
||||
// __libclog_printf ("using alternate port %i\n",DOOMPORT);
|
||||
}
|
||||
|
||||
// parse network game options,
|
||||
// -net <consoleplayer> <host> <host> ...
|
||||
i = M_CheckParm ("-net");
|
||||
|
||||
if (!i)
|
||||
{
|
||||
// single player game
|
||||
netgame = false;
|
||||
doomcom->id = DOOMCOM_ID;
|
||||
doomcom->numplayers = doomcom->numnodes = 1;
|
||||
doomcom->deathmatch = false;
|
||||
doomcom->consoleplayer = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
netsend = PacketSend;
|
||||
netget = PacketGet;
|
||||
netgame = true;
|
||||
|
||||
// parse player number and host list
|
||||
doomcom->consoleplayer = myargv[i+1][0]-'1';
|
||||
|
||||
doomcom->numnodes = 1; // this node for sure
|
||||
doomcom->id = DOOMCOM_ID;
|
||||
doomcom->numplayers = doomcom->numnodes;
|
||||
sendsocket[0]=0;
|
||||
for(i=1;i<MAXNETNODES;i++)
|
||||
{
|
||||
sendsocket[i]=-1;
|
||||
}
|
||||
insocket=CreateInputUDPsocket();
|
||||
// __libclog_printf("DOOM: Input UDP socket is %d\n",insocket);
|
||||
}
|
||||
|
||||
void I_NetCmd (void)
|
||||
{
|
||||
|
||||
|
||||
//printf("ERROR NetCmd");
|
||||
|
||||
|
||||
if (doomcom->command == CMD_SEND)
|
||||
{
|
||||
// netsend ();
|
||||
}
|
||||
else if (doomcom->command == CMD_GET)
|
||||
{
|
||||
// netget ();
|
||||
}
|
||||
else
|
||||
I_Error ("Bad net cmd: %i\n",doomcom->command);
|
||||
}
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include "i_system.h"
|
||||
#include "d_event.h"
|
||||
#include "d_net.h"
|
||||
#include "m_argv.h"
|
||||
#include "doomstat.h"
|
||||
#include "i_net.h"
|
||||
|
||||
#ifdef DLHEAP
|
||||
|
||||
void* _cdecl dlmalloc(size_t);
|
||||
void _cdecl dlfree(void*);
|
||||
void _cdecl mf_init();
|
||||
|
||||
#define malloc dlmalloc
|
||||
#define free dlfree
|
||||
#define realloc dlrealloc
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef B_HOST_IS_LENDIAN
|
||||
#define B_HOST_IS_LENDIAN 1
|
||||
#endif
|
||||
#if !defined(sparc) && B_HOST_IS_LENDIAN
|
||||
#ifndef ntohl
|
||||
#define ntohl(x) \
|
||||
((unsigned long int)((((unsigned long int)(x) & 0x000000ffU) << 24) | \
|
||||
(((unsigned long int)(x) & 0x0000ff00U) << 8) | \
|
||||
(((unsigned long int)(x) & 0x00ff0000U) >> 8) | \
|
||||
(((unsigned long int)(x) & 0xff000000U) >> 24)))
|
||||
#endif
|
||||
|
||||
#ifndef ntohs
|
||||
#define ntohs(x) \
|
||||
((unsigned short int)((((unsigned short int)(x) & 0x00ff) << 8) | \
|
||||
(((unsigned short int)(x) & 0xff00) >> 8)))
|
||||
#endif
|
||||
|
||||
#ifndef htonl
|
||||
#define htonl(x) ntohl(x)
|
||||
#endif
|
||||
#ifndef htons
|
||||
#define htons(x) ntohs(x)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void NetSend (void);
|
||||
int NetListen (void);
|
||||
|
||||
|
||||
//
|
||||
// NETWORKING
|
||||
//
|
||||
|
||||
#ifndef IPPORT_USERRESERVED
|
||||
#define IPPORT_USERRESERVED 5000
|
||||
#endif
|
||||
|
||||
int DOOMPORT = (IPPORT_USERRESERVED+0x1d);
|
||||
int sendsocket[MAXNETNODES];
|
||||
int insocket;
|
||||
|
||||
void (*netget) (void);
|
||||
void (*netsend) (void);
|
||||
|
||||
static int first_user_port=IPPORT_USERRESERVED+0x1D+0x10;
|
||||
|
||||
/**********
|
||||
int GetAvailPort(void)
|
||||
{
|
||||
int i,d0;
|
||||
//for(i=0;i<1024;i++)
|
||||
//{
|
||||
// __asm__ __volatile__(
|
||||
// "int $0x40"
|
||||
// :"=a"(d0)
|
||||
// :"0"(53),"b"(9),"c"(first_user_port+i));
|
||||
// if(d0==1) return i+first_user_port;
|
||||
//}
|
||||
I_Error("Unable to get new port\n");
|
||||
return -1;
|
||||
}
|
||||
**********/
|
||||
|
||||
int CreateInputUDPsocket(void)
|
||||
{
|
||||
int d0=0;
|
||||
//__asm__ __volatile__(
|
||||
// "int $0x40"
|
||||
// :"=a"(d0)
|
||||
// :"0"(53),"b"(1),"c"(DOOMPORT),"d"(0),"S"(0));
|
||||
//if(d0==0xffffffff)
|
||||
//{
|
||||
I_Error("Unable to create socket\n");
|
||||
//}
|
||||
return d0;
|
||||
}
|
||||
|
||||
int CreateOutputUDPSocket(int remote_ip)
|
||||
{
|
||||
int d0;
|
||||
int p;
|
||||
// p=GetAvailPort();
|
||||
// __asm__ __volatile__(
|
||||
// "int $0x40"
|
||||
// :"=a"(d0)
|
||||
// :"0"(53),"b"(0),"c"(p),"d"(DOOMPORT),"S"(remote_ip));
|
||||
// if(d0==0xffffffff)
|
||||
// {
|
||||
I_Error("Unable to create output socket\n");
|
||||
// }
|
||||
return d0;
|
||||
}
|
||||
|
||||
//
|
||||
// PacketSend
|
||||
//
|
||||
void PacketSend (void)
|
||||
{
|
||||
int c;
|
||||
doomdata_t sw;
|
||||
|
||||
|
||||
//printf("ERROR Packet Send\n\r");
|
||||
|
||||
|
||||
// byte swap
|
||||
sw.checksum = htonl(netbuffer->checksum);
|
||||
sw.player = netbuffer->player;
|
||||
sw.retransmitfrom = netbuffer->retransmitfrom;
|
||||
sw.starttic = netbuffer->starttic;
|
||||
sw.numtics = netbuffer->numtics;
|
||||
for (c=0 ; c< netbuffer->numtics ; c++)
|
||||
{
|
||||
sw.cmds[c].forwardmove = netbuffer->cmds[c].forwardmove;
|
||||
sw.cmds[c].sidemove = netbuffer->cmds[c].sidemove;
|
||||
sw.cmds[c].angleturn = htons(netbuffer->cmds[c].angleturn);
|
||||
sw.cmds[c].consistancy = htons(netbuffer->cmds[c].consistancy);
|
||||
sw.cmds[c].chatchar = netbuffer->cmds[c].chatchar;
|
||||
sw.cmds[c].buttons = netbuffer->cmds[c].buttons;
|
||||
}
|
||||
// __libclog_printf("Sending packet %u to node %u\n",gametic,
|
||||
// doomcom->remotenode);
|
||||
// __asm__ __volatile__(
|
||||
// "int $0x40"
|
||||
// :"=a"(c)
|
||||
// :"0"(53),"b"(4),"c"(sendsocket[doomcom->remotenode]),
|
||||
// "d"(doomcom->datalength),"S"((long)&sw));
|
||||
// if(c==-1)
|
||||
// {
|
||||
// __libclog_printf("Unable to send packet to remote node\n");
|
||||
// }
|
||||
}
|
||||
|
||||
//
|
||||
// PacketGet
|
||||
//
|
||||
void PacketGet (void)
|
||||
{
|
||||
}
|
||||
|
||||
int GetLocalAddress (void)
|
||||
{
|
||||
int d0;
|
||||
// __asm__ __volatile__(
|
||||
// "int $0x40"
|
||||
// :"=a"(d0)
|
||||
// :"0"(52),"b"(1));
|
||||
return d0;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// I_InitNetwork
|
||||
//
|
||||
|
||||
void I_InitNetwork (void)
|
||||
{
|
||||
boolean trueval = true;
|
||||
int i;
|
||||
int p;
|
||||
|
||||
doomcom = malloc (sizeof (*doomcom) );
|
||||
memset (doomcom, 0, sizeof(*doomcom) );
|
||||
|
||||
// set up for network
|
||||
i = M_CheckParm ("-dup");
|
||||
if (i && i< myargc-1)
|
||||
{
|
||||
doomcom->ticdup = myargv[i+1][0]-'0';
|
||||
if (doomcom->ticdup < 1)
|
||||
doomcom->ticdup = 1;
|
||||
if (doomcom->ticdup > 9)
|
||||
doomcom->ticdup = 9;
|
||||
}
|
||||
else
|
||||
doomcom-> ticdup = 1;
|
||||
|
||||
if (M_CheckParm ("-extratic"))
|
||||
doomcom-> extratics = 1;
|
||||
else
|
||||
doomcom-> extratics = 0;
|
||||
|
||||
p = M_CheckParm ("-port");
|
||||
if (p && p<myargc-1)
|
||||
{
|
||||
DOOMPORT = atoi (myargv[p+1]);
|
||||
// __libclog_printf ("using alternate port %i\n",DOOMPORT);
|
||||
}
|
||||
|
||||
// parse network game options,
|
||||
// -net <consoleplayer> <host> <host> ...
|
||||
i = M_CheckParm ("-net");
|
||||
|
||||
if (!i)
|
||||
{
|
||||
// single player game
|
||||
netgame = false;
|
||||
doomcom->id = DOOMCOM_ID;
|
||||
doomcom->numplayers = doomcom->numnodes = 1;
|
||||
doomcom->deathmatch = false;
|
||||
doomcom->consoleplayer = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
netsend = PacketSend;
|
||||
netget = PacketGet;
|
||||
netgame = true;
|
||||
|
||||
// parse player number and host list
|
||||
doomcom->consoleplayer = myargv[i+1][0]-'1';
|
||||
|
||||
doomcom->numnodes = 1; // this node for sure
|
||||
doomcom->id = DOOMCOM_ID;
|
||||
doomcom->numplayers = doomcom->numnodes;
|
||||
sendsocket[0]=0;
|
||||
for(i=1;i<MAXNETNODES;i++)
|
||||
{
|
||||
sendsocket[i]=-1;
|
||||
}
|
||||
insocket=CreateInputUDPsocket();
|
||||
// __libclog_printf("DOOM: Input UDP socket is %d\n",insocket);
|
||||
}
|
||||
|
||||
void I_NetCmd (void)
|
||||
{
|
||||
|
||||
|
||||
//printf("ERROR NetCmd");
|
||||
|
||||
|
||||
if (doomcom->command == CMD_SEND)
|
||||
{
|
||||
// netsend ();
|
||||
}
|
||||
else if (doomcom->command == CMD_GET)
|
||||
{
|
||||
// netget ();
|
||||
}
|
||||
else
|
||||
I_Error ("Bad net cmd: %i\n",doomcom->command);
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $Id:$
|
||||
@@ -88,7 +88,7 @@ int channelhandles[NUM_CHANNELS];
|
||||
|
||||
// SFX id of the playing sound effect.
|
||||
// Used to catch duplicates (like chainsaw).
|
||||
int channelids[NUM_CHANNELS];
|
||||
int channelids[NUM_CHANNELS];
|
||||
|
||||
// Pitch to stepping lookup, unused.
|
||||
int steptable[256];
|
||||
@@ -119,7 +119,7 @@ getsfx
|
||||
char name[20];
|
||||
int sfxlump;
|
||||
|
||||
|
||||
|
||||
// Get the sound data from the WAD, allocate lump
|
||||
// in zone memory.
|
||||
sprintf(name, "ds%s", sfxname);
|
||||
@@ -138,7 +138,7 @@ getsfx
|
||||
sfxlump = W_GetNumForName("dspistol");
|
||||
else
|
||||
sfxlump = W_GetNumForName(name);
|
||||
|
||||
|
||||
size = W_LumpLength( sfxlump );
|
||||
|
||||
// Debug.
|
||||
@@ -146,7 +146,7 @@ getsfx
|
||||
//fprintf( stderr, " -loading %s (lump %d, %d bytes)\n",
|
||||
// sfxname, sfxlump, size );
|
||||
//fflush( stderr );
|
||||
|
||||
|
||||
sfx = (unsigned char*)W_CacheLumpNum( sfxlump, PU_STATIC );
|
||||
|
||||
// Pads the sound effect out to the mixing buffer size.
|
||||
@@ -166,7 +166,7 @@ getsfx
|
||||
|
||||
// Remove the cached lump.
|
||||
Z_Free( sfx );
|
||||
|
||||
|
||||
// Preserve padded length.
|
||||
*len = paddedsize;
|
||||
|
||||
@@ -190,13 +190,13 @@ addsfx
|
||||
( int sfxid,
|
||||
int volume,
|
||||
int step,
|
||||
int separation )
|
||||
int seperation )
|
||||
{
|
||||
static unsigned short handlenums = 0;
|
||||
|
||||
|
||||
int i;
|
||||
int rc = -1;
|
||||
|
||||
|
||||
int oldest = gametic;
|
||||
int oldestnum = 0;
|
||||
int slot;
|
||||
@@ -273,25 +273,25 @@ addsfx
|
||||
|
||||
// Separation, that is, orientation/stereo.
|
||||
// range is: 1 - 256
|
||||
separation += 1;
|
||||
seperation += 1;
|
||||
|
||||
// Per left/right channel.
|
||||
// x^2 separation,
|
||||
// x^2 seperation,
|
||||
// adjust volume properly.
|
||||
volume *= 8;
|
||||
leftvol =
|
||||
volume - ((volume*separation*separation) >> 16); ///(256*256);
|
||||
separation = separation - 257;
|
||||
volume - ((volume*seperation*seperation) >> 16); ///(256*256);
|
||||
seperation = seperation - 257;
|
||||
rightvol =
|
||||
volume - ((volume*separation*separation) >> 16);
|
||||
volume - ((volume*seperation*seperation) >> 16);
|
||||
|
||||
// Sanity check, clamp volume.
|
||||
if (rightvol < 0 || rightvol > 127)
|
||||
I_Error("rightvol out of bounds");
|
||||
|
||||
|
||||
if (leftvol < 0 || leftvol > 127)
|
||||
I_Error("leftvol out of bounds");
|
||||
|
||||
|
||||
// Get the proper lookup table piece
|
||||
// for this volume level???
|
||||
channelleftvol_lookup[slot] = &vol_lookup[leftvol*256];
|
||||
@@ -322,12 +322,12 @@ void I_SetChannels()
|
||||
{
|
||||
// Init internal lookups (raw data, mixing buffer, channels).
|
||||
// This function sets up internal lookups used during
|
||||
// the mixing process.
|
||||
// the mixing process.
|
||||
int i;
|
||||
int j;
|
||||
|
||||
|
||||
int* steptablemid = steptable + 128;
|
||||
|
||||
|
||||
// Okay, reset internal mixing channels to zero.
|
||||
/*for (i=0; i<NUM_CHANNELS; i++)
|
||||
{
|
||||
@@ -338,8 +338,8 @@ void I_SetChannels()
|
||||
// I fail to see that this is currently used.
|
||||
for (i=-128 ; i<128 ; i++)
|
||||
steptablemid[i] = (int)(pow(2.0, (i/64.0))*65536.0);
|
||||
|
||||
|
||||
|
||||
|
||||
// Generates volume lookup tables
|
||||
// which also turn the unsigned samples
|
||||
// into signed samples.
|
||||
@@ -348,9 +348,9 @@ void I_SetChannels()
|
||||
vol_lookup[i*256+j] = (i*(j-128)*256)/127;
|
||||
//fprintf(stderr, "vol_lookup[%d*256+%d] = %d\n", i, j, vol_lookup[i*256+j]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void I_SetSfxVolume(int volume)
|
||||
{
|
||||
// Identical to DOS.
|
||||
@@ -405,17 +405,17 @@ I_StartSound
|
||||
|
||||
// UNUSED
|
||||
priority = 0;
|
||||
|
||||
|
||||
// Debug.
|
||||
//fprintf( stderr, "starting sound %d", id );
|
||||
|
||||
|
||||
// Returns a handle (not used).
|
||||
SDL_LockAudio();
|
||||
id = addsfx( id, vol, steptable[pitch], sep );
|
||||
SDL_UnlockAudio();
|
||||
|
||||
// fprintf( stderr, "/handle is %d\n", id );
|
||||
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
@@ -427,7 +427,7 @@ void I_StopSound (int handle)
|
||||
// Would be looping all channels,
|
||||
// tracking down the handle,
|
||||
// an setting the channel to zero.
|
||||
|
||||
|
||||
// UNUSED.
|
||||
handle = 0;
|
||||
}
|
||||
@@ -458,7 +458,7 @@ void I_UpdateSound(void *unused, Uint8 *stream, int len)
|
||||
register unsigned int sample;
|
||||
register int dl;
|
||||
register int dr;
|
||||
|
||||
|
||||
// Pointers in audio stream, left, right, end.
|
||||
signed short* leftout;
|
||||
signed short* rightout;
|
||||
@@ -468,7 +468,7 @@ void I_UpdateSound(void *unused, Uint8 *stream, int len)
|
||||
|
||||
// Mixing channel index.
|
||||
int chan;
|
||||
|
||||
|
||||
// Left and right channel
|
||||
// are in audio stream, alternating.
|
||||
leftout = (signed short *)stream;
|
||||
@@ -484,11 +484,11 @@ void I_UpdateSound(void *unused, Uint8 *stream, int len)
|
||||
// that is 512 values for two channels.
|
||||
while (leftout != leftend)
|
||||
{
|
||||
// Reset left/right value.
|
||||
// Reset left/right value.
|
||||
dl = 0;
|
||||
dr = 0;
|
||||
|
||||
// Love thy L2 cache - made this a loop.
|
||||
// Love thy L2 chache - made this a loop.
|
||||
// Now more channels could be set at compile time
|
||||
// as well. Thus loop those channels.
|
||||
for ( chan = 0; chan < NUM_CHANNELS; chan++ )
|
||||
@@ -496,7 +496,7 @@ void I_UpdateSound(void *unused, Uint8 *stream, int len)
|
||||
// Check channel, if active.
|
||||
if (channels[ chan ])
|
||||
{
|
||||
// Get the raw data from the channel.
|
||||
// Get the raw data from the channel.
|
||||
sample = *channels[ chan ];
|
||||
// Add left and right part
|
||||
// for this channel (sound)
|
||||
@@ -516,7 +516,7 @@ void I_UpdateSound(void *unused, Uint8 *stream, int len)
|
||||
channels[ chan ] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Clamp to range. Left hardware channel.
|
||||
// Has been char instead of short.
|
||||
// if (dl > 127) *leftout = 127;
|
||||
@@ -562,21 +562,20 @@ I_UpdateSoundParams
|
||||
|
||||
|
||||
void I_ShutdownSound(void)
|
||||
{
|
||||
{
|
||||
SDL_CloseAudio();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
I_InitSound()
|
||||
{
|
||||
{
|
||||
SDL_AudioSpec wanted;
|
||||
SDL_AudioSpec obtained;
|
||||
int i;
|
||||
|
||||
|
||||
// Secure and configure sound device first.
|
||||
fprintf( stderr, "I_InitSound: ");
|
||||
|
||||
|
||||
// Open the audio device
|
||||
wanted.freq = SAMPLERATE;
|
||||
if ( SDL_BYTEORDER == SDL_BIG_ENDIAN ) {
|
||||
@@ -587,29 +586,25 @@ I_InitSound()
|
||||
wanted.channels = 2;
|
||||
wanted.samples = SAMPLECOUNT;
|
||||
wanted.callback = I_UpdateSound;
|
||||
if ( SDL_OpenAudio(&wanted, &obtained) < 0 ) {
|
||||
if ( SDL_OpenAudio(&wanted, NULL) < 0 ) {
|
||||
fprintf(stderr, "couldn't open audio with desired format\n");
|
||||
return;
|
||||
}
|
||||
// KolibriOS SDL fills the real device parameters into `obtained`
|
||||
// (it does not write them back into `wanted` like upstream SDL),
|
||||
// and refuses a NULL obtained. Take the actual slice size from it
|
||||
// so the mixer in I_UpdateSound fills exactly one device buffer.
|
||||
SAMPLECOUNT = obtained.samples;
|
||||
SAMPLECOUNT = wanted.samples;
|
||||
fprintf(stderr, " configured audio device with %d samples/slice\n", SAMPLECOUNT);
|
||||
|
||||
|
||||
|
||||
// Initialize external data (all sounds) at start, keep static.
|
||||
fprintf( stderr, "I_InitSound: ");
|
||||
|
||||
|
||||
for (i=1 ; i<NUMSFX ; i++)
|
||||
{
|
||||
{
|
||||
// Alias? Example is the chaingun sound linked to pistol.
|
||||
if (!S_sfx[i].link)
|
||||
{
|
||||
// Load data from WAD file.
|
||||
S_sfx[i].data = getsfx( S_sfx[i].name, &lengths[i] );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Previously loaded already?
|
||||
@@ -619,7 +614,7 @@ I_InitSound()
|
||||
}
|
||||
|
||||
fprintf( stderr, " pre-cached all sound data\n");
|
||||
|
||||
|
||||
// Finished initialization.
|
||||
fprintf(stderr, "I_InitSound: sound module ready\n");
|
||||
SDL_PauseAudio(0);
|
||||
@@ -662,7 +657,7 @@ void I_StopSong(int handle)
|
||||
{
|
||||
// UNUSED.
|
||||
handle = 0;
|
||||
|
||||
|
||||
looping = 0;
|
||||
musicdies = 0;
|
||||
}
|
||||
@@ -677,7 +672,7 @@ int I_RegisterSong(void* data)
|
||||
{
|
||||
// UNUSED.
|
||||
data = NULL;
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -688,3 +683,4 @@ int I_QrySongPlaying(int handle)
|
||||
handle = 0;
|
||||
return looping || musicdies > gametic;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $Id:$
|
||||
@@ -33,7 +33,7 @@
|
||||
// Init at program start...
|
||||
void I_InitSound();
|
||||
|
||||
// ... shut down and release at program termination.
|
||||
// ... shut down and relase at program termination.
|
||||
void I_ShutdownSound(void);
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $Id:$
|
||||
@@ -35,7 +35,7 @@
|
||||
void I_Init (void);
|
||||
|
||||
// Called by startup code
|
||||
// to get the amount of memory to malloc
|
||||
// to get the ammount of memory to malloc
|
||||
// for the zone management.
|
||||
byte* I_ZoneBase (int *size);
|
||||
|
||||
@@ -49,7 +49,7 @@ int I_GetTime (void);
|
||||
// Called by D_DoomLoop,
|
||||
// called before processing any tics in a frame
|
||||
// (just after displaying a frame).
|
||||
// Time consuming synchronous operations
|
||||
// Time consuming syncronous operations
|
||||
// are performed here (joystick reading).
|
||||
// Can call D_PostEvent.
|
||||
//
|
||||
@@ -59,7 +59,7 @@ void I_StartFrame (void);
|
||||
//
|
||||
// Called by D_DoomLoop,
|
||||
// called before processing each tic in a frame.
|
||||
// Quick synchronous operations are performed here.
|
||||
// Quick syncronous operations are performed here.
|
||||
// Can call D_PostEvent.
|
||||
void I_StartTic (void);
|
||||
|
||||
|
||||
@@ -40,18 +40,15 @@ rcsid[] = "$Id: i_x.c,v 1.6 1997/02/03 22:45:10 b1 Exp $";
|
||||
|
||||
SDL_Surface *screen;
|
||||
|
||||
// DOOM always renders to a fixed 320x200 surface; SDL_SoftStretch scales
|
||||
// it to the (arbitrary) window size each frame.
|
||||
SDL_Surface *render;
|
||||
|
||||
// 24bpp truecolor twin of render: the 8->24 palette conversion is done once
|
||||
// here at 320x200 (cheap), so the window-sized surface is truecolor - no
|
||||
// per-pixel palette pass, and the display needs no 8->24 shadow conversion.
|
||||
SDL_Surface *render24;
|
||||
|
||||
// Fake mouse handling.
|
||||
boolean grabMouse;
|
||||
|
||||
// Blocky mode,
|
||||
// replace each 320x200 pixel with multiply*multiply pixels.
|
||||
// According to Dave Taylor, it still is a bonehead thing
|
||||
// to use ....
|
||||
static int multiply=2;
|
||||
|
||||
|
||||
//
|
||||
// Translates the key
|
||||
@@ -240,21 +237,134 @@ void I_FinishUpdate (void)
|
||||
screens[0][ (SCREENHEIGHT-1)*SCREENWIDTH + i] = 0x0;
|
||||
}
|
||||
|
||||
// The 8bpp frame is converted to truecolor once here at 320x200; every blit
|
||||
// below is 24bpp, so the window-sized surface gets no per-pixel palette pass
|
||||
// and the display needs no 8->24 shadow conversion on update.
|
||||
SDL_BlitSurface(render, NULL, render24, NULL);
|
||||
|
||||
// scales the screen size before blitting it
|
||||
if ( SDL_MUSTLOCK(screen) ) {
|
||||
if ( SDL_LockSurface(screen) < 0 ) {
|
||||
return;
|
||||
if ( SDL_LockSurface(screen) < 0 ) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if ((multiply == 1) && SDL_MUSTLOCK(screen))
|
||||
{
|
||||
unsigned char *olineptr;
|
||||
unsigned char *ilineptr;
|
||||
int y;
|
||||
|
||||
ilineptr = (unsigned char *) screens[0];
|
||||
olineptr = (unsigned char *) screen->pixels;
|
||||
|
||||
y = SCREENHEIGHT;
|
||||
while (y--)
|
||||
{
|
||||
memcpy(olineptr, ilineptr, screen->w);
|
||||
ilineptr += SCREENWIDTH;
|
||||
olineptr += screen->pitch;
|
||||
}
|
||||
}
|
||||
else if (multiply == 2)
|
||||
{
|
||||
unsigned int *olineptrs[2];
|
||||
unsigned int *ilineptr;
|
||||
int x, y, i;
|
||||
unsigned int twoopixels;
|
||||
unsigned int twomoreopixels;
|
||||
unsigned int fouripixels;
|
||||
|
||||
ilineptr = (unsigned int *) (screens[0]);
|
||||
for (i=0 ; i<2 ; i++) {
|
||||
olineptrs[i] =
|
||||
(unsigned int *)&((Uint8 *)screen->pixels)[i*screen->pitch];
|
||||
}
|
||||
|
||||
y = SCREENHEIGHT;
|
||||
while (y--)
|
||||
{
|
||||
x = SCREENWIDTH;
|
||||
do
|
||||
{
|
||||
fouripixels = *ilineptr++;
|
||||
twoopixels = (fouripixels & 0xff000000)
|
||||
| ((fouripixels>>8) & 0xffff00)
|
||||
| ((fouripixels>>16) & 0xff);
|
||||
twomoreopixels = ((fouripixels<<16) & 0xff000000)
|
||||
| ((fouripixels<<8) & 0xffff00)
|
||||
| (fouripixels & 0xff);
|
||||
#ifdef __BIG_ENDIAN__
|
||||
*olineptrs[0]++ = twoopixels;
|
||||
*olineptrs[1]++ = twoopixels;
|
||||
*olineptrs[0]++ = twomoreopixels;
|
||||
*olineptrs[1]++ = twomoreopixels;
|
||||
#else
|
||||
*olineptrs[0]++ = twomoreopixels;
|
||||
*olineptrs[1]++ = twomoreopixels;
|
||||
*olineptrs[0]++ = twoopixels;
|
||||
*olineptrs[1]++ = twoopixels;
|
||||
#endif
|
||||
} while (x-=4);
|
||||
olineptrs[0] += screen->pitch/4;
|
||||
olineptrs[1] += screen->pitch/4;
|
||||
}
|
||||
|
||||
}
|
||||
else if (multiply == 3)
|
||||
{
|
||||
unsigned int *olineptrs[3];
|
||||
unsigned int *ilineptr;
|
||||
int x, y, i;
|
||||
unsigned int fouropixels[3];
|
||||
unsigned int fouripixels;
|
||||
|
||||
ilineptr = (unsigned int *) (screens[0]);
|
||||
for (i=0 ; i<3 ; i++) {
|
||||
olineptrs[i] =
|
||||
(unsigned int *)&((Uint8 *)screen->pixels)[i*screen->pitch];
|
||||
}
|
||||
|
||||
y = SCREENHEIGHT;
|
||||
while (y--)
|
||||
{
|
||||
x = SCREENWIDTH;
|
||||
do
|
||||
{
|
||||
fouripixels = *ilineptr++;
|
||||
fouropixels[0] = (fouripixels & 0xff000000)
|
||||
| ((fouripixels>>8) & 0xff0000)
|
||||
| ((fouripixels>>16) & 0xffff);
|
||||
fouropixels[1] = ((fouripixels<<8) & 0xff000000)
|
||||
| (fouripixels & 0xffff00)
|
||||
| ((fouripixels>>8) & 0xff);
|
||||
fouropixels[2] = ((fouripixels<<16) & 0xffff0000)
|
||||
| ((fouripixels<<8) & 0xff00)
|
||||
| (fouripixels & 0xff);
|
||||
#ifdef __BIG_ENDIAN__
|
||||
*olineptrs[0]++ = fouropixels[0];
|
||||
*olineptrs[1]++ = fouropixels[0];
|
||||
*olineptrs[2]++ = fouropixels[0];
|
||||
*olineptrs[0]++ = fouropixels[1];
|
||||
*olineptrs[1]++ = fouropixels[1];
|
||||
*olineptrs[2]++ = fouropixels[1];
|
||||
*olineptrs[0]++ = fouropixels[2];
|
||||
*olineptrs[1]++ = fouropixels[2];
|
||||
*olineptrs[2]++ = fouropixels[2];
|
||||
#else
|
||||
*olineptrs[0]++ = fouropixels[2];
|
||||
*olineptrs[1]++ = fouropixels[2];
|
||||
*olineptrs[2]++ = fouropixels[2];
|
||||
*olineptrs[0]++ = fouropixels[1];
|
||||
*olineptrs[1]++ = fouropixels[1];
|
||||
*olineptrs[2]++ = fouropixels[1];
|
||||
*olineptrs[0]++ = fouropixels[0];
|
||||
*olineptrs[1]++ = fouropixels[0];
|
||||
*olineptrs[2]++ = fouropixels[0];
|
||||
#endif
|
||||
} while (x-=4);
|
||||
olineptrs[0] += 2*screen->pitch/4;
|
||||
olineptrs[1] += 2*screen->pitch/4;
|
||||
olineptrs[2] += 2*screen->pitch/4;
|
||||
}
|
||||
|
||||
}
|
||||
// Stretch the whole 320x200 frame to the window. Aspect may not match the
|
||||
// window shape, but nothing is cropped and there are no seams.
|
||||
SDL_SoftStretch(render24, NULL, screen, NULL);
|
||||
if ( SDL_MUSTLOCK(screen) ) {
|
||||
SDL_UnlockSurface(screen);
|
||||
SDL_UnlockSurface(screen);
|
||||
}
|
||||
SDL_UpdateRect(screen, 0, 0, 0, 0);
|
||||
}
|
||||
@@ -283,7 +393,7 @@ void I_SetPalette (byte* palette)
|
||||
colors[i].b = gammatable[usegamma][*palette++];
|
||||
colors[i].unused = 0;
|
||||
}
|
||||
SDL_SetColors(render, colors, 0, 256);
|
||||
SDL_SetColors(screen, colors, 0, 256);
|
||||
}
|
||||
|
||||
|
||||
@@ -291,53 +401,71 @@ void I_InitGraphics(void)
|
||||
{
|
||||
|
||||
static int firsttime=1;
|
||||
Uint16 video_w, video_h;
|
||||
Uint16 video_w, video_h, w, h;
|
||||
Uint8 video_bpp;
|
||||
Uint32 video_flags;
|
||||
int i;
|
||||
|
||||
if (!firsttime)
|
||||
return;
|
||||
firsttime = 0;
|
||||
|
||||
video_flags = SDL_SWSURFACE;
|
||||
video_flags = (SDL_SWSURFACE|SDL_HWPALETTE);
|
||||
if (!!M_CheckParm("-fullscreen"))
|
||||
video_flags |= SDL_FULLSCREEN;
|
||||
|
||||
if (M_CheckParm("-2"))
|
||||
multiply = 2;
|
||||
|
||||
if (M_CheckParm("-3"))
|
||||
multiply = 3;
|
||||
|
||||
// check if the user wants to grab the mouse (quite unnice)
|
||||
grabMouse = !!M_CheckParm("-grabmouse");
|
||||
|
||||
// Window size: "-winsize <w> <h>"; defaults to 2x of 320x200.
|
||||
video_w = SCREENWIDTH * 2;
|
||||
video_h = SCREENHEIGHT * 2;
|
||||
i = M_CheckParm("-winsize");
|
||||
if (i && i < myargc-2) {
|
||||
video_w = atoi(myargv[i+1]);
|
||||
video_h = atoi(myargv[i+2]);
|
||||
}
|
||||
video_w = w = SCREENWIDTH * multiply;
|
||||
video_h = h = SCREENHEIGHT * multiply;
|
||||
video_bpp = 8;
|
||||
|
||||
// 24bpp truecolor window: the kolibri framebuffer is 24bpp, so a truecolor
|
||||
// surface avoids SDL's per-frame 8->24 shadow conversion across the whole
|
||||
// window (the 8->24 step is done once at 320x200 in I_FinishUpdate).
|
||||
screen = SDL_SetVideoMode(video_w, video_h, 24, video_flags);
|
||||
/* We need to allocate a software surface because the DOOM! code expects
|
||||
the screen surface to be valid all of the time. Properly done, the
|
||||
rendering code would allocate the video surface in video memory and
|
||||
then call SDL_LockSurface()/SDL_UnlockSurface() around frame rendering.
|
||||
Eventually SDL will support flipping, which would be really nice in
|
||||
a complete-frame rendering application like this.
|
||||
*/
|
||||
switch (video_w/w) {
|
||||
case 3:
|
||||
multiply *= 3;
|
||||
break;
|
||||
case 2:
|
||||
multiply *= 2;
|
||||
break;
|
||||
case 1:
|
||||
multiply *= 1;
|
||||
break;
|
||||
default:
|
||||
;
|
||||
}
|
||||
if ( multiply > 3 ) {
|
||||
I_Error("Smallest available mode (%dx%d) is too large!",
|
||||
video_w, video_h);
|
||||
}
|
||||
screen = SDL_SetVideoMode(video_w, video_h, 8, video_flags);
|
||||
if ( screen == NULL ) {
|
||||
I_Error("Could not set %dx%d video mode: %s", video_w, video_h,
|
||||
SDL_GetError());
|
||||
}
|
||||
SDL_ShowCursor(0);
|
||||
SDL_WM_SetCaption("SDL DOOM! v1.11", "doom");
|
||||
SDL_WM_SetCaption("SDL DOOM! v1.10", "doom");
|
||||
|
||||
/* DOOM renders to a fixed 320x200 paletted surface; each frame it is
|
||||
scaled to the window with SDL_SoftStretch (see I_FinishUpdate). */
|
||||
render = SDL_CreateRGBSurface(SDL_SWSURFACE, SCREENWIDTH, SCREENHEIGHT,
|
||||
8, 0, 0, 0, 0);
|
||||
if ( render == NULL )
|
||||
I_Error("Cannot create render surface: %s", SDL_GetError());
|
||||
// 24bpp truecolor copy of render, scaled to the window (see I_FinishUpdate)
|
||||
render24 = SDL_CreateRGBSurface(SDL_SWSURFACE, SCREENWIDTH, SCREENHEIGHT,
|
||||
screen->format->BitsPerPixel,
|
||||
screen->format->Rmask, screen->format->Gmask,
|
||||
screen->format->Bmask, screen->format->Amask);
|
||||
if ( render24 == NULL )
|
||||
I_Error("Cannot create render24 surface: %s", SDL_GetError());
|
||||
screens[0] = (unsigned char *) render->pixels;
|
||||
/* Set up the screen displays */
|
||||
w = SCREENWIDTH * multiply;
|
||||
h = SCREENHEIGHT * multiply;
|
||||
if (multiply == 1 && !SDL_MUSTLOCK(screen) ) {
|
||||
screens[0] = (unsigned char *) screen->pixels;
|
||||
} else {
|
||||
screens[0] = (unsigned char *) malloc (SCREENWIDTH * SCREENHEIGHT);
|
||||
if ( screens[0] == NULL )
|
||||
I_Error("Couldn't allocate screen memory");
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $Id:$
|
||||
@@ -18,7 +18,7 @@
|
||||
//
|
||||
// DESCRIPTION:
|
||||
// Thing frame/state LUT,
|
||||
// generated by multigen utility.
|
||||
// generated by multigen utilitiy.
|
||||
// This one is the original DOOM version, preserved.
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -4667,3 +4667,4 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = {
|
||||
S_NULL // raisestate
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $Id:$
|
||||
@@ -16,7 +16,7 @@
|
||||
//
|
||||
// DESCRIPTION:
|
||||
// Thing frame/state LUT,
|
||||
// generated by multigen utility.
|
||||
// generated by multigen utilitiy.
|
||||
// This one is the original DOOM version, preserved.
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
@@ -247,7 +247,7 @@ default_t defaults[] =
|
||||
{"joyb_use",&joybuse,3},
|
||||
{"joyb_speed",&joybspeed,2},
|
||||
|
||||
{"screenblocks",&screenblocks, 10},
|
||||
{"screenblocks",&screenblocks, 9},
|
||||
{"detaillevel",&detailLevel, 0},
|
||||
|
||||
{"snd_channels",&numChannels, 3},
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $Id:$
|
||||
@@ -17,7 +17,7 @@
|
||||
// $Log:$
|
||||
//
|
||||
// DESCRIPTION:
|
||||
// Endianness handling, swapping 16bit and 32bit.
|
||||
// Endianess handling, swapping 16bit and 32bit.
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
@@ -34,7 +34,7 @@ rcsid[] = "$Id: m_bbox.c,v 1.1 1997/02/03 22:45:10 b1 Exp $";
|
||||
// Swap 16bit, that is, MSB and LSB byte.
|
||||
unsigned short SwapSHORT(unsigned short x)
|
||||
{
|
||||
// No masking with 0xFF should be necessary.
|
||||
// No masking with 0xFF should be necessary.
|
||||
return (x>>8) | (x<<8);
|
||||
}
|
||||
|
||||
@@ -47,3 +47,5 @@ unsigned long SwapLONG( unsigned long x)
|
||||
| ((x<<8) & 0xff0000)
|
||||
| (x<<24);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $Id:$
|
||||
@@ -15,7 +15,7 @@
|
||||
// for more details.
|
||||
//
|
||||
// DESCRIPTION:
|
||||
// Endianness handling, swapping 16bit and 32bit.
|
||||
// Endianess handling, swapping 16bit and 32bit.
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#endif
|
||||
|
||||
|
||||
// Endianness handling.
|
||||
// Endianess handling.
|
||||
// WAD files are stored little endian.
|
||||
#ifdef sparc
|
||||
#define __BIG_ENDIAN__
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,4 +1,4 @@
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $Id:$
|
||||
@@ -57,7 +57,7 @@
|
||||
#define MELEERANGE (64*FRACUNIT)
|
||||
#define MISSILERANGE (32*64*FRACUNIT)
|
||||
|
||||
// follow a player exclusively for 3 seconds
|
||||
// follow a player exlusively for 3 seconds
|
||||
#define BASETHRESHOLD 100
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
//
|
||||
|
||||
// both the head and tail of the thinker list
|
||||
extern thinker_t thinkercap;
|
||||
extern thinker_t thinkercap;
|
||||
|
||||
|
||||
void P_InitThinkers (void);
|
||||
@@ -138,7 +138,7 @@ typedef struct
|
||||
fixed_t y;
|
||||
fixed_t dx;
|
||||
fixed_t dy;
|
||||
|
||||
|
||||
} divline_t;
|
||||
|
||||
typedef struct
|
||||
@@ -285,3 +285,5 @@ P_DamageMobj
|
||||
// $Log:$
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
+107
-106
@@ -1,4 +1,4 @@
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $Id:$
|
||||
@@ -74,18 +74,18 @@ P_SetMobjState
|
||||
|
||||
// Modified handling.
|
||||
// Call action functions when the state is set
|
||||
if (st->action.acp1)
|
||||
st->action.acp1(mobj);
|
||||
|
||||
if (st->action.acp1)
|
||||
st->action.acp1(mobj);
|
||||
|
||||
state = st->nextstate;
|
||||
} while (!mobj->tics);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// P_ExplodeMissile
|
||||
// P_ExplodeMissile
|
||||
//
|
||||
void P_ExplodeMissile (mobj_t* mo)
|
||||
{
|
||||
@@ -106,19 +106,19 @@ void P_ExplodeMissile (mobj_t* mo)
|
||||
|
||||
|
||||
//
|
||||
// P_XYMovement
|
||||
// P_XYMovement
|
||||
//
|
||||
#define STOPSPEED 0x1000
|
||||
#define FRICTION 0xe800
|
||||
|
||||
void P_XYMovement (mobj_t* mo)
|
||||
{
|
||||
void P_XYMovement (mobj_t* mo)
|
||||
{
|
||||
fixed_t ptryx;
|
||||
fixed_t ptryy;
|
||||
player_t* player;
|
||||
fixed_t xmove;
|
||||
fixed_t ymove;
|
||||
|
||||
|
||||
if (!mo->momx && !mo->momy)
|
||||
{
|
||||
if (mo->flags & MF_SKULLFLY)
|
||||
@@ -131,9 +131,9 @@ void P_XYMovement (mobj_t* mo)
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
player = mo->player;
|
||||
|
||||
|
||||
if (mo->momx > MAXMOVE)
|
||||
mo->momx = MAXMOVE;
|
||||
else if (mo->momx < -MAXMOVE)
|
||||
@@ -143,10 +143,10 @@ void P_XYMovement (mobj_t* mo)
|
||||
mo->momy = MAXMOVE;
|
||||
else if (mo->momy < -MAXMOVE)
|
||||
mo->momy = -MAXMOVE;
|
||||
|
||||
|
||||
xmove = mo->momx;
|
||||
ymove = mo->momy;
|
||||
|
||||
|
||||
do
|
||||
{
|
||||
if (xmove > MAXMOVE/2 || ymove > MAXMOVE/2)
|
||||
@@ -162,7 +162,7 @@ void P_XYMovement (mobj_t* mo)
|
||||
ptryy = mo->y + ymove;
|
||||
xmove = ymove = 0;
|
||||
}
|
||||
|
||||
|
||||
if (!P_TryMove (mo, ptryx, ptryy))
|
||||
{
|
||||
// blocked move
|
||||
@@ -189,7 +189,7 @@ void P_XYMovement (mobj_t* mo)
|
||||
mo->momx = mo->momy = 0;
|
||||
}
|
||||
} while (xmove || ymove);
|
||||
|
||||
|
||||
// slow down
|
||||
if (player && player->cheats & CF_NOMOMENTUM)
|
||||
{
|
||||
@@ -200,7 +200,7 @@ void P_XYMovement (mobj_t* mo)
|
||||
|
||||
if (mo->flags & (MF_MISSILE | MF_SKULLFLY) )
|
||||
return; // no friction for missiles ever
|
||||
|
||||
|
||||
if (mo->z > mo->floorz)
|
||||
return; // no friction when airborne
|
||||
|
||||
@@ -229,7 +229,7 @@ void P_XYMovement (mobj_t* mo)
|
||||
// if in a walking frame, stop moving
|
||||
if ( player&&(unsigned)((player->mo->state - states)- S_PLAY_RUN1) < 4)
|
||||
P_SetMobjState (player->mo, S_PLAY);
|
||||
|
||||
|
||||
mo->momx = 0;
|
||||
mo->momy = 0;
|
||||
}
|
||||
@@ -247,7 +247,7 @@ void P_ZMovement (mobj_t* mo)
|
||||
{
|
||||
fixed_t dist;
|
||||
fixed_t delta;
|
||||
|
||||
|
||||
// check for smooth step up
|
||||
if (mo->player && mo->z < mo->floorz)
|
||||
{
|
||||
@@ -256,10 +256,10 @@ void P_ZMovement (mobj_t* mo)
|
||||
mo->player->deltaviewheight
|
||||
= (VIEWHEIGHT - mo->player->viewheight)>>3;
|
||||
}
|
||||
|
||||
|
||||
// adjust height
|
||||
mo->z += mo->momz;
|
||||
|
||||
|
||||
if ( mo->flags & MF_FLOAT
|
||||
&& mo->target)
|
||||
{
|
||||
@@ -269,17 +269,17 @@ void P_ZMovement (mobj_t* mo)
|
||||
{
|
||||
dist = P_AproxDistance (mo->x - mo->target->x,
|
||||
mo->y - mo->target->y);
|
||||
|
||||
|
||||
delta =(mo->target->z + (mo->height>>1)) - mo->z;
|
||||
|
||||
if (delta<0 && dist < -(delta*3) )
|
||||
mo->z -= FLOATSPEED;
|
||||
else if (delta>0 && dist < (delta*3) )
|
||||
mo->z += FLOATSPEED;
|
||||
mo->z += FLOATSPEED;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
// clip movement
|
||||
if (mo->z <= mo->floorz)
|
||||
{
|
||||
@@ -293,11 +293,11 @@ void P_ZMovement (mobj_t* mo)
|
||||
// the skull slammed into something
|
||||
mo->momz = -mo->momz;
|
||||
}
|
||||
|
||||
|
||||
if (mo->momz < 0)
|
||||
{
|
||||
if (mo->player
|
||||
&& mo->momz < -GRAVITY*8)
|
||||
&& mo->momz < -GRAVITY*8)
|
||||
{
|
||||
// Squat down.
|
||||
// Decrease viewheight for a moment
|
||||
@@ -324,7 +324,7 @@ void P_ZMovement (mobj_t* mo)
|
||||
else
|
||||
mo->momz -= GRAVITY;
|
||||
}
|
||||
|
||||
|
||||
if (mo->z + mo->height > mo->ceilingz)
|
||||
{
|
||||
// hit the ceiling
|
||||
@@ -338,7 +338,7 @@ void P_ZMovement (mobj_t* mo)
|
||||
{ // the skull slammed into something
|
||||
mo->momz = -mo->momz;
|
||||
}
|
||||
|
||||
|
||||
if ( (mo->flags & MF_MISSILE)
|
||||
&& !(mo->flags & MF_NOCLIP) )
|
||||
{
|
||||
@@ -346,7 +346,7 @@ void P_ZMovement (mobj_t* mo)
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -358,36 +358,36 @@ P_NightmareRespawn (mobj_t* mobj)
|
||||
{
|
||||
fixed_t x;
|
||||
fixed_t y;
|
||||
fixed_t z;
|
||||
subsector_t* ss;
|
||||
fixed_t z;
|
||||
subsector_t* ss;
|
||||
mobj_t* mo;
|
||||
mapthing_t* mthing;
|
||||
|
||||
x = mobj->spawnpoint.x << FRACBITS;
|
||||
y = mobj->spawnpoint.y << FRACBITS;
|
||||
|
||||
x = mobj->spawnpoint.x << FRACBITS;
|
||||
y = mobj->spawnpoint.y << FRACBITS;
|
||||
|
||||
// something is occupying its position?
|
||||
if (!P_CheckPosition (mobj, x, y) )
|
||||
return; // no respawn
|
||||
// somthing is occupying it's position?
|
||||
if (!P_CheckPosition (mobj, x, y) )
|
||||
return; // no respwan
|
||||
|
||||
// spawn a teleport fog at old spot
|
||||
// because of removal of the body?
|
||||
mo = P_SpawnMobj (mobj->x,
|
||||
mobj->y,
|
||||
mobj->subsector->sector->floorheight , MT_TFOG);
|
||||
mobj->subsector->sector->floorheight , MT_TFOG);
|
||||
// initiate teleport sound
|
||||
S_StartSound (mo, sfx_telept);
|
||||
|
||||
// spawn a teleport fog at the new spot
|
||||
ss = R_PointInSubsector (x,y);
|
||||
ss = R_PointInSubsector (x,y);
|
||||
|
||||
mo = P_SpawnMobj (x, y, ss->sector->floorheight , MT_TFOG);
|
||||
mo = P_SpawnMobj (x, y, ss->sector->floorheight , MT_TFOG);
|
||||
|
||||
S_StartSound (mo, sfx_telept);
|
||||
|
||||
// spawn the new monster
|
||||
mthing = &mobj->spawnpoint;
|
||||
|
||||
|
||||
// spawn it
|
||||
if (mobj->info->flags & MF_SPAWNCEILING)
|
||||
z = ONCEILINGZ;
|
||||
@@ -396,14 +396,14 @@ P_NightmareRespawn (mobj_t* mobj)
|
||||
|
||||
// inherit attributes from deceased one
|
||||
mo = P_SpawnMobj (x,y,z, mobj->type);
|
||||
mo->spawnpoint = mobj->spawnpoint;
|
||||
mo->spawnpoint = mobj->spawnpoint;
|
||||
mo->angle = ANG45 * (mthing->angle/45);
|
||||
|
||||
if (mthing->options & MTF_AMBUSH)
|
||||
mo->flags |= MF_AMBUSH;
|
||||
|
||||
mo->reactiontime = 18;
|
||||
|
||||
|
||||
// remove the old monster,
|
||||
P_RemoveMobj (mobj);
|
||||
}
|
||||
@@ -429,19 +429,19 @@ void P_MobjThinker (mobj_t* mobj)
|
||||
|| mobj->momz )
|
||||
{
|
||||
P_ZMovement (mobj);
|
||||
|
||||
|
||||
// FIXME: decent NOP/NULL/Nil function pointer please.
|
||||
if (mobj->thinker.function.acv == (actionf_v) (-1))
|
||||
return; // mobj was removed
|
||||
}
|
||||
|
||||
|
||||
|
||||
// cycle through states,
|
||||
// calling action functions at transitions
|
||||
if (mobj->tics != -1)
|
||||
{
|
||||
mobj->tics--;
|
||||
|
||||
|
||||
// you can cycle through multiple states in a tic
|
||||
if (!mobj->tics)
|
||||
if (!P_SetMobjState (mobj, mobj->state->nextstate) )
|
||||
@@ -486,11 +486,11 @@ P_SpawnMobj
|
||||
mobj_t* mobj;
|
||||
state_t* st;
|
||||
mobjinfo_t* info;
|
||||
|
||||
|
||||
mobj = Z_Malloc (sizeof(*mobj), PU_LEVEL, NULL);
|
||||
memset (mobj, 0, sizeof (*mobj));
|
||||
info = &mobjinfo[type];
|
||||
|
||||
|
||||
mobj->type = type;
|
||||
mobj->info = info;
|
||||
mobj->x = x;
|
||||
@@ -502,10 +502,10 @@ P_SpawnMobj
|
||||
|
||||
if (gameskill != sk_nightmare)
|
||||
mobj->reactiontime = info->reactiontime;
|
||||
|
||||
|
||||
mobj->lastlook = P_Random () % MAXPLAYERS;
|
||||
// do not set the state with P_SetMobjState,
|
||||
// because action routines cannot be called yet
|
||||
// because action routines can not be called yet
|
||||
st = &states[info->spawnstate];
|
||||
|
||||
mobj->state = st;
|
||||
@@ -515,7 +515,7 @@ P_SpawnMobj
|
||||
|
||||
// set subsector and/or block links
|
||||
P_SetThingPosition (mobj);
|
||||
|
||||
|
||||
mobj->floorz = mobj->subsector->sector->floorheight;
|
||||
mobj->ceilingz = mobj->subsector->sector->ceilingheight;
|
||||
|
||||
@@ -523,11 +523,11 @@ P_SpawnMobj
|
||||
mobj->z = mobj->floorz;
|
||||
else if (z == ONCEILINGZ)
|
||||
mobj->z = mobj->ceilingz - mobj->info->height;
|
||||
else
|
||||
else
|
||||
mobj->z = z;
|
||||
|
||||
mobj->thinker.function.acp1 = (actionf_p1)P_MobjThinker;
|
||||
|
||||
|
||||
P_AddThinker (&mobj->thinker);
|
||||
|
||||
return mobj;
|
||||
@@ -558,13 +558,13 @@ void P_RemoveMobj (mobj_t* mobj)
|
||||
if (iquehead == iquetail)
|
||||
iquetail = (iquetail+1)&(ITEMQUESIZE-1);
|
||||
}
|
||||
|
||||
|
||||
// unlink from sector and block lists
|
||||
P_UnsetThingPosition (mobj);
|
||||
|
||||
|
||||
// stop any playing sound
|
||||
S_StopSound (mobj);
|
||||
|
||||
|
||||
// free block
|
||||
P_RemoveThinker ((thinker_t*)mobj);
|
||||
}
|
||||
@@ -580,33 +580,33 @@ void P_RespawnSpecials (void)
|
||||
fixed_t x;
|
||||
fixed_t y;
|
||||
fixed_t z;
|
||||
|
||||
subsector_t* ss;
|
||||
|
||||
subsector_t* ss;
|
||||
mobj_t* mo;
|
||||
mapthing_t* mthing;
|
||||
|
||||
|
||||
int i;
|
||||
|
||||
// only respawn items in deathmatch
|
||||
if (deathmatch != 2)
|
||||
return; //
|
||||
return; //
|
||||
|
||||
// nothing left to respawn?
|
||||
if (iquehead == iquetail)
|
||||
return;
|
||||
return;
|
||||
|
||||
// wait at least 30 seconds
|
||||
if (leveltime - itemrespawntime[iquetail] < 30*35)
|
||||
return;
|
||||
return;
|
||||
|
||||
mthing = &itemrespawnque[iquetail];
|
||||
|
||||
x = mthing->x << FRACBITS;
|
||||
y = mthing->y << FRACBITS;
|
||||
|
||||
|
||||
x = mthing->x << FRACBITS;
|
||||
y = mthing->y << FRACBITS;
|
||||
|
||||
// spawn a teleport fog at the new spot
|
||||
ss = R_PointInSubsector (x,y);
|
||||
mo = P_SpawnMobj (x, y, ss->sector->floorheight , MT_IFOG);
|
||||
ss = R_PointInSubsector (x,y);
|
||||
mo = P_SpawnMobj (x, y, ss->sector->floorheight , MT_IFOG);
|
||||
S_StartSound (mo, sfx_itmbk);
|
||||
|
||||
// find which type to spawn
|
||||
@@ -615,7 +615,7 @@ void P_RespawnSpecials (void)
|
||||
if (mthing->type == mobjinfo[i].doomednum)
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// spawn it
|
||||
if (mobjinfo[i].flags & MF_SPAWNCEILING)
|
||||
z = ONCEILINGZ;
|
||||
@@ -623,7 +623,7 @@ void P_RespawnSpecials (void)
|
||||
z = ONFLOORZ;
|
||||
|
||||
mo = P_SpawnMobj (x,y,z, i);
|
||||
mo->spawnpoint = *mthing;
|
||||
mo->spawnpoint = *mthing;
|
||||
mo->angle = ANG45 * (mthing->angle/45);
|
||||
|
||||
// pull it from the que
|
||||
@@ -652,8 +652,8 @@ void P_SpawnPlayer (mapthing_t* mthing)
|
||||
|
||||
// not playing?
|
||||
if (!playeringame[mthing->type-1])
|
||||
return;
|
||||
|
||||
return;
|
||||
|
||||
p = &players[mthing->type-1];
|
||||
|
||||
if (p->playerstate == PST_REBORN)
|
||||
@@ -665,15 +665,15 @@ void P_SpawnPlayer (mapthing_t* mthing)
|
||||
mobj = P_SpawnMobj (x,y,z, MT_PLAYER);
|
||||
|
||||
// set color translations for player sprites
|
||||
if (mthing->type > 1)
|
||||
if (mthing->type > 1)
|
||||
mobj->flags |= (mthing->type-1)<<MF_TRANSSHIFT;
|
||||
|
||||
|
||||
mobj->angle = ANG45 * (mthing->angle/45);
|
||||
mobj->player = p;
|
||||
mobj->health = p->health;
|
||||
|
||||
p->mo = mobj;
|
||||
p->playerstate = PST_LIVE;
|
||||
p->playerstate = PST_LIVE;
|
||||
p->refire = 0;
|
||||
p->message = NULL;
|
||||
p->damagecount = 0;
|
||||
@@ -684,18 +684,18 @@ void P_SpawnPlayer (mapthing_t* mthing)
|
||||
|
||||
// setup gun psprite
|
||||
P_SetupPsprites (p);
|
||||
|
||||
|
||||
// give all cards in death match mode
|
||||
if (deathmatch)
|
||||
for (i=0 ; i<NUMCARDS ; i++)
|
||||
p->cards[i] = true;
|
||||
|
||||
|
||||
if (mthing->type-1 == consoleplayer)
|
||||
{
|
||||
// wake up the status bar
|
||||
ST_Start ();
|
||||
// wake up the heads up text
|
||||
HU_Start ();
|
||||
HU_Start ();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -713,7 +713,7 @@ void P_SpawnMapThing (mapthing_t* mthing)
|
||||
fixed_t x;
|
||||
fixed_t y;
|
||||
fixed_t z;
|
||||
|
||||
|
||||
// count deathmatch start positions
|
||||
if (mthing->type == 11)
|
||||
{
|
||||
@@ -724,7 +724,7 @@ void P_SpawnMapThing (mapthing_t* mthing)
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// check for players specially
|
||||
if (mthing->type <= 4)
|
||||
{
|
||||
@@ -736,10 +736,10 @@ void P_SpawnMapThing (mapthing_t* mthing)
|
||||
return;
|
||||
}
|
||||
|
||||
// check for appropriate skill level
|
||||
// check for apropriate skill level
|
||||
if (!netgame && (mthing->options & 16) )
|
||||
return;
|
||||
|
||||
|
||||
if (gameskill == sk_baby)
|
||||
bit = 1;
|
||||
else if (gameskill == sk_nightmare)
|
||||
@@ -749,21 +749,21 @@ void P_SpawnMapThing (mapthing_t* mthing)
|
||||
|
||||
if (!(mthing->options & bit) )
|
||||
return;
|
||||
|
||||
|
||||
// find which type to spawn
|
||||
for (i=0 ; i< NUMMOBJTYPES ; i++)
|
||||
if (mthing->type == mobjinfo[i].doomednum)
|
||||
break;
|
||||
|
||||
|
||||
if (i==NUMMOBJTYPES)
|
||||
I_Error ("P_SpawnMapThing: Unknown type %i at (%i, %i)",
|
||||
mthing->type,
|
||||
mthing->x, mthing->y);
|
||||
|
||||
|
||||
// don't spawn keycards and players in deathmatch
|
||||
if (deathmatch && mobjinfo[i].flags & MF_NOTDMATCH)
|
||||
return;
|
||||
|
||||
|
||||
// don't spawn any monsters if -nomonsters
|
||||
if (nomonsters
|
||||
&& ( i == MT_SKULL
|
||||
@@ -771,7 +771,7 @@ void P_SpawnMapThing (mapthing_t* mthing)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// spawn it
|
||||
x = mthing->x << FRACBITS;
|
||||
y = mthing->y << FRACBITS;
|
||||
@@ -780,7 +780,7 @@ void P_SpawnMapThing (mapthing_t* mthing)
|
||||
z = ONCEILINGZ;
|
||||
else
|
||||
z = ONFLOORZ;
|
||||
|
||||
|
||||
mobj = P_SpawnMobj (x,y,z, i);
|
||||
mobj->spawnpoint = *mthing;
|
||||
|
||||
@@ -790,7 +790,7 @@ void P_SpawnMapThing (mapthing_t* mthing)
|
||||
totalkills++;
|
||||
if (mobj->flags & MF_COUNTITEM)
|
||||
totalitems++;
|
||||
|
||||
|
||||
mobj->angle = ANG45 * (mthing->angle/45);
|
||||
if (mthing->options & MTF_AMBUSH)
|
||||
mobj->flags |= MF_AMBUSH;
|
||||
@@ -815,7 +815,7 @@ P_SpawnPuff
|
||||
fixed_t z )
|
||||
{
|
||||
mobj_t* th;
|
||||
|
||||
|
||||
z += ((P_Random()-P_Random())<<10);
|
||||
|
||||
th = P_SpawnMobj (x,y,z, MT_PUFF);
|
||||
@@ -824,7 +824,7 @@ P_SpawnPuff
|
||||
|
||||
if (th->tics < 1)
|
||||
th->tics = 1;
|
||||
|
||||
|
||||
// don't make punches spark on the wall
|
||||
if (attackrange == MELEERANGE)
|
||||
P_SetMobjState (th, S_PUFF3);
|
||||
@@ -834,7 +834,7 @@ P_SpawnPuff
|
||||
|
||||
//
|
||||
// P_SpawnBlood
|
||||
//
|
||||
//
|
||||
void
|
||||
P_SpawnBlood
|
||||
( fixed_t x,
|
||||
@@ -843,7 +843,7 @@ P_SpawnBlood
|
||||
int damage )
|
||||
{
|
||||
mobj_t* th;
|
||||
|
||||
|
||||
z += ((P_Random()-P_Random())<<10);
|
||||
th = P_SpawnMobj (x,y,z, MT_BLOOD);
|
||||
th->momz = FRACUNIT*2;
|
||||
@@ -851,7 +851,7 @@ P_SpawnBlood
|
||||
|
||||
if (th->tics < 1)
|
||||
th->tics = 1;
|
||||
|
||||
|
||||
if (damage <= 12 && damage >= 9)
|
||||
P_SetMobjState (th,S_BLOOD2);
|
||||
else if (damage < 9)
|
||||
@@ -870,7 +870,7 @@ void P_CheckMissileSpawn (mobj_t* th)
|
||||
th->tics -= P_Random()&3;
|
||||
if (th->tics < 1)
|
||||
th->tics = 1;
|
||||
|
||||
|
||||
// move a little forward so an angle can
|
||||
// be computed if it immediately explodes
|
||||
th->x += (th->momx>>1);
|
||||
@@ -898,22 +898,22 @@ P_SpawnMissile
|
||||
th = P_SpawnMobj (source->x,
|
||||
source->y,
|
||||
source->z + 4*8*FRACUNIT, type);
|
||||
|
||||
|
||||
if (th->info->seesound)
|
||||
S_StartSound (th, th->info->seesound);
|
||||
|
||||
th->target = source; // where it came from
|
||||
an = R_PointToAngle2 (source->x, source->y, dest->x, dest->y);
|
||||
an = R_PointToAngle2 (source->x, source->y, dest->x, dest->y);
|
||||
|
||||
// fuzzy player
|
||||
if (dest->flags & MF_SHADOW)
|
||||
an += (P_Random()-P_Random())<<20;
|
||||
an += (P_Random()-P_Random())<<20;
|
||||
|
||||
th->angle = an;
|
||||
an >>= ANGLETOFINESHIFT;
|
||||
th->momx = FixedMul (th->info->speed, finecosine[an]);
|
||||
th->momy = FixedMul (th->info->speed, finesine[an]);
|
||||
|
||||
|
||||
dist = P_AproxDistance (dest->x - source->x, dest->y - source->y);
|
||||
dist = dist / th->info->speed;
|
||||
|
||||
@@ -922,7 +922,7 @@ P_SpawnMissile
|
||||
|
||||
th->momz = (dest->z - source->z) / dist;
|
||||
P_CheckMissileSpawn (th);
|
||||
|
||||
|
||||
return th;
|
||||
}
|
||||
|
||||
@@ -938,16 +938,16 @@ P_SpawnPlayerMissile
|
||||
{
|
||||
mobj_t* th;
|
||||
angle_t an;
|
||||
|
||||
|
||||
fixed_t x;
|
||||
fixed_t y;
|
||||
fixed_t z;
|
||||
fixed_t slope;
|
||||
|
||||
|
||||
// see which target is to be aimed at
|
||||
an = source->angle;
|
||||
slope = P_AimLineAttack (source, an, 16*64*FRACUNIT);
|
||||
|
||||
|
||||
if (!linetarget)
|
||||
{
|
||||
an += 1<<26;
|
||||
@@ -965,11 +965,11 @@ P_SpawnPlayerMissile
|
||||
slope = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
x = source->x;
|
||||
y = source->y;
|
||||
z = source->z + 4*8*FRACUNIT;
|
||||
|
||||
|
||||
th = P_SpawnMobj (x,y,z, type);
|
||||
|
||||
if (th->info->seesound)
|
||||
@@ -985,3 +985,4 @@ P_SpawnPlayerMissile
|
||||
|
||||
P_CheckMissileSpawn (th);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $Id:$
|
||||
@@ -58,7 +58,7 @@
|
||||
// lists of things in sectors as they are being drawn.
|
||||
// The sprite, frame, and angle elements determine which patch_t
|
||||
// is used to draw the sprite if it is visible.
|
||||
// The sprite and frame values are almost always set
|
||||
// The sprite and frame values are allmost allways set
|
||||
// from state_t structures.
|
||||
// The statescr.exe utility generates the states.h and states.c
|
||||
// files that contain the sprite/frame numbers from the
|
||||
@@ -96,7 +96,7 @@
|
||||
// things, but nothing can run into a missile).
|
||||
// Each block in the grid is 128*128 units, and knows about
|
||||
// every line_t that it contains a piece of, and every
|
||||
// interactable mobj_t that has its origin contained.
|
||||
// interactable mobj_t that has its origin contained.
|
||||
//
|
||||
// A valid mobj_t is a mobj_t that has the proper subsector_t
|
||||
// filled in for its xy coordinates and is linked into the
|
||||
@@ -125,7 +125,7 @@ typedef enum
|
||||
// Don't use the sector links (invisible but touchable).
|
||||
MF_NOSECTOR = 8,
|
||||
// Don't use the blocklinks (inert but displayable)
|
||||
MF_NOBLOCKMAP = 16,
|
||||
MF_NOBLOCKMAP = 16,
|
||||
|
||||
// Not to be activated by sound, deaf monster.
|
||||
MF_AMBUSH = 32,
|
||||
@@ -158,7 +158,7 @@ typedef enum
|
||||
MF_TELEPORT = 0x8000,
|
||||
// Don't hit same species, explode on block.
|
||||
// Player missiles as well as fireballs of various kinds.
|
||||
MF_MISSILE = 0x10000,
|
||||
MF_MISSILE = 0x10000,
|
||||
// Dropped by a demon, not level spawned.
|
||||
// E.g. ammo clips dropped by dying former humans.
|
||||
MF_DROPPED = 0x20000,
|
||||
@@ -179,7 +179,7 @@ typedef enum
|
||||
// towards intermission kill total.
|
||||
// Happy gathering.
|
||||
MF_COUNTKILL = 0x400000,
|
||||
|
||||
|
||||
// On picking up, count this item object
|
||||
// towards intermission item total.
|
||||
MF_COUNTITEM = 0x800000,
|
||||
@@ -227,7 +227,7 @@ typedef struct mobj_s
|
||||
// Links in blocks (if needed).
|
||||
struct mobj_s* bnext;
|
||||
struct mobj_s* bprev;
|
||||
|
||||
|
||||
struct subsector_s* subsector;
|
||||
|
||||
// The closest interval over all contacted Sectors.
|
||||
@@ -236,7 +236,7 @@ typedef struct mobj_s
|
||||
|
||||
// For movement checking.
|
||||
fixed_t radius;
|
||||
fixed_t height;
|
||||
fixed_t height;
|
||||
|
||||
// Momentums, used to update position.
|
||||
fixed_t momx;
|
||||
@@ -248,7 +248,7 @@ typedef struct mobj_s
|
||||
|
||||
mobjtype_t type;
|
||||
mobjinfo_t* info; // &mobjinfo[mobj->type]
|
||||
|
||||
|
||||
int tics; // state tic counter
|
||||
state_t* state;
|
||||
int flags;
|
||||
@@ -264,7 +264,7 @@ typedef struct mobj_s
|
||||
|
||||
// Reaction time: if non 0, don't attack yet.
|
||||
// Used by player to freeze a bit after teleporting.
|
||||
int reactiontime;
|
||||
int reactiontime;
|
||||
|
||||
// If >0, the target will be chased
|
||||
// no matter what (even if shot)
|
||||
@@ -275,14 +275,14 @@ typedef struct mobj_s
|
||||
struct player_s* player;
|
||||
|
||||
// Player number last looked for.
|
||||
int lastlook;
|
||||
int lastlook;
|
||||
|
||||
// For nightmare respawn.
|
||||
mapthing_t spawnpoint;
|
||||
mapthing_t spawnpoint;
|
||||
|
||||
// Thing being chased/attacked for tracers.
|
||||
struct mobj_s* tracer;
|
||||
|
||||
struct mobj_s* tracer;
|
||||
|
||||
} mobj_t;
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $Id:$
|
||||
@@ -49,7 +49,7 @@ rcsid[] = "$Id: p_pspr.c,v 1.5 1997/02/03 22:45:12 b1 Exp $";
|
||||
|
||||
|
||||
// plasma cells for a bfg attack
|
||||
#define BFGCELLS 40
|
||||
#define BFGCELLS 40
|
||||
|
||||
|
||||
//
|
||||
@@ -59,22 +59,22 @@ void
|
||||
P_SetPsprite
|
||||
( player_t* player,
|
||||
int position,
|
||||
statenum_t stnum )
|
||||
statenum_t stnum )
|
||||
{
|
||||
pspdef_t* psp;
|
||||
state_t* state;
|
||||
|
||||
|
||||
psp = &player->psprites[position];
|
||||
|
||||
|
||||
do
|
||||
{
|
||||
if (!stnum)
|
||||
{
|
||||
// object removed itself
|
||||
psp->state = NULL;
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
state = &states[stnum];
|
||||
psp->state = state;
|
||||
psp->tics = state->tics; // could be 0
|
||||
@@ -85,7 +85,7 @@ P_SetPsprite
|
||||
psp->sx = state->misc1 << FRACBITS;
|
||||
psp->sy = state->misc2 << FRACBITS;
|
||||
}
|
||||
|
||||
|
||||
// Call action routine.
|
||||
// Modified handling.
|
||||
if (state->action.acp2)
|
||||
@@ -94,9 +94,9 @@ P_SetPsprite
|
||||
if (!psp->state)
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
stnum = psp->state->nextstate;
|
||||
|
||||
|
||||
} while (!psp->tics);
|
||||
// an initial state of 0 could cycle through
|
||||
}
|
||||
@@ -105,7 +105,7 @@ P_SetPsprite
|
||||
|
||||
//
|
||||
// P_CalcSwing
|
||||
//
|
||||
//
|
||||
fixed_t swingx;
|
||||
fixed_t swingy;
|
||||
|
||||
@@ -113,7 +113,7 @@ void P_CalcSwing (player_t* player)
|
||||
{
|
||||
fixed_t swing;
|
||||
int angle;
|
||||
|
||||
|
||||
// OPTIMIZE: tablify this.
|
||||
// A LUT would allow for different modes,
|
||||
// and add flexibility.
|
||||
@@ -138,13 +138,13 @@ void P_CalcSwing (player_t* player)
|
||||
void P_BringUpWeapon (player_t* player)
|
||||
{
|
||||
statenum_t newstate;
|
||||
|
||||
|
||||
if (player->pendingweapon == wp_nochange)
|
||||
player->pendingweapon = player->readyweapon;
|
||||
|
||||
|
||||
if (player->pendingweapon == wp_chainsaw)
|
||||
S_StartSound (player->mo, sfx_sawup);
|
||||
|
||||
|
||||
newstate = weaponinfo[player->pendingweapon].upstate;
|
||||
|
||||
player->pendingweapon = wp_nochange;
|
||||
@@ -177,7 +177,7 @@ boolean P_CheckAmmo (player_t* player)
|
||||
// Return if current ammunition sufficient.
|
||||
if (ammo == am_noammo || player->ammo[ammo] >= count)
|
||||
return true;
|
||||
|
||||
|
||||
// Out of ammo, pick a weapon to change to.
|
||||
// Preferences are set here.
|
||||
do
|
||||
@@ -188,7 +188,7 @@ boolean P_CheckAmmo (player_t* player)
|
||||
{
|
||||
player->pendingweapon = wp_plasma;
|
||||
}
|
||||
else if (player->weaponowned[wp_supershotgun]
|
||||
else if (player->weaponowned[wp_supershotgun]
|
||||
&& player->ammo[am_shell]>2
|
||||
&& (gamemode == commercial) )
|
||||
{
|
||||
@@ -228,7 +228,7 @@ boolean P_CheckAmmo (player_t* player)
|
||||
// If everything fails.
|
||||
player->pendingweapon = wp_fist;
|
||||
}
|
||||
|
||||
|
||||
} while (player->pendingweapon == wp_nochange);
|
||||
|
||||
// Now set appropriate weapon overlay.
|
||||
@@ -236,7 +236,7 @@ boolean P_CheckAmmo (player_t* player)
|
||||
ps_weapon,
|
||||
weaponinfo[player->readyweapon].downstate);
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -246,10 +246,10 @@ boolean P_CheckAmmo (player_t* player)
|
||||
void P_FireWeapon (player_t* player)
|
||||
{
|
||||
statenum_t newstate;
|
||||
|
||||
|
||||
if (!P_CheckAmmo (player))
|
||||
return;
|
||||
|
||||
|
||||
P_SetMobjState (player->mo, S_PLAY_ATK1);
|
||||
newstate = weaponinfo[player->readyweapon].atkstate;
|
||||
P_SetPsprite (player, ps_weapon, newstate);
|
||||
@@ -282,34 +282,34 @@ void
|
||||
A_WeaponReady
|
||||
( player_t* player,
|
||||
pspdef_t* psp )
|
||||
{
|
||||
{
|
||||
statenum_t newstate;
|
||||
int angle;
|
||||
|
||||
|
||||
// get out of attack state
|
||||
if (player->mo->state == &states[S_PLAY_ATK1]
|
||||
|| player->mo->state == &states[S_PLAY_ATK2] )
|
||||
{
|
||||
P_SetMobjState (player->mo, S_PLAY);
|
||||
}
|
||||
|
||||
|
||||
if (player->readyweapon == wp_chainsaw
|
||||
&& psp->state == &states[S_SAW])
|
||||
{
|
||||
S_StartSound (player->mo, sfx_sawidl);
|
||||
}
|
||||
|
||||
|
||||
// check for change
|
||||
// if player is dead, put the weapon away
|
||||
if (player->pendingweapon != wp_nochange || !player->health)
|
||||
{
|
||||
// change weapon
|
||||
// (pending weapon should already be validated)
|
||||
// (pending weapon should allready be validated)
|
||||
newstate = weaponinfo[player->readyweapon].downstate;
|
||||
P_SetPsprite (player, ps_weapon, newstate);
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// check for fire
|
||||
// the missile launcher and bfg do not auto fire
|
||||
if (player->cmd.buttons & BT_ATTACK)
|
||||
@@ -319,13 +319,13 @@ A_WeaponReady
|
||||
&& player->readyweapon != wp_bfg) )
|
||||
{
|
||||
player->attackdown = true;
|
||||
P_FireWeapon (player);
|
||||
P_FireWeapon (player);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
player->attackdown = false;
|
||||
|
||||
|
||||
// bob the weapon based on movement speed
|
||||
angle = (128*leveltime)&FINEMASK;
|
||||
psp->sx = FRACUNIT + FixedMul (player->bob, finecosine[angle]);
|
||||
@@ -344,10 +344,10 @@ void A_ReFire
|
||||
( player_t* player,
|
||||
pspdef_t* psp )
|
||||
{
|
||||
|
||||
|
||||
// check for fire
|
||||
// (if a weaponchange is pending, let it go through instead)
|
||||
if ( (player->cmd.buttons & BT_ATTACK)
|
||||
if ( (player->cmd.buttons & BT_ATTACK)
|
||||
&& player->pendingweapon == wp_nochange
|
||||
&& player->health)
|
||||
{
|
||||
@@ -385,7 +385,7 @@ void
|
||||
A_Lower
|
||||
( player_t* player,
|
||||
pspdef_t* psp )
|
||||
{
|
||||
{
|
||||
psp->sy += LOWERSPEED;
|
||||
|
||||
// Is already down.
|
||||
@@ -398,19 +398,19 @@ A_Lower
|
||||
psp->sy = WEAPONBOTTOM;
|
||||
|
||||
// don't bring weapon back up
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// The old weapon has been lowered off the screen,
|
||||
// so change the weapon and start raising it
|
||||
if (!player->health)
|
||||
{
|
||||
// Player is dead, so keep the weapon off screen.
|
||||
P_SetPsprite (player, ps_weapon, S_NULL);
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
player->readyweapon = player->pendingweapon;
|
||||
|
||||
player->readyweapon = player->pendingweapon;
|
||||
|
||||
P_BringUpWeapon (player);
|
||||
}
|
||||
@@ -425,14 +425,14 @@ A_Raise
|
||||
pspdef_t* psp )
|
||||
{
|
||||
statenum_t newstate;
|
||||
|
||||
|
||||
psp->sy -= RAISESPEED;
|
||||
|
||||
if (psp->sy > WEAPONTOP )
|
||||
return;
|
||||
|
||||
|
||||
psp->sy = WEAPONTOP;
|
||||
|
||||
|
||||
// The weapon has been raised all the way,
|
||||
// so change to the ready state.
|
||||
newstate = weaponinfo[player->readyweapon].readystate;
|
||||
@@ -448,7 +448,7 @@ A_Raise
|
||||
void
|
||||
A_GunFlash
|
||||
( player_t* player,
|
||||
pspdef_t* psp )
|
||||
pspdef_t* psp )
|
||||
{
|
||||
P_SetMobjState (player->mo, S_PLAY_ATK2);
|
||||
P_SetPsprite (player,ps_flash,weaponinfo[player->readyweapon].flashstate);
|
||||
@@ -467,15 +467,15 @@ A_GunFlash
|
||||
void
|
||||
A_Punch
|
||||
( player_t* player,
|
||||
pspdef_t* psp )
|
||||
pspdef_t* psp )
|
||||
{
|
||||
angle_t angle;
|
||||
int damage;
|
||||
int slope;
|
||||
|
||||
|
||||
damage = (P_Random ()%10+1)<<1;
|
||||
|
||||
if (player->powers[pw_strength])
|
||||
if (player->powers[pw_strength])
|
||||
damage *= 10;
|
||||
|
||||
angle = player->mo->angle;
|
||||
@@ -501,7 +501,7 @@ A_Punch
|
||||
void
|
||||
A_Saw
|
||||
( player_t* player,
|
||||
pspdef_t* psp )
|
||||
pspdef_t* psp )
|
||||
{
|
||||
angle_t angle;
|
||||
int damage;
|
||||
@@ -510,7 +510,7 @@ A_Saw
|
||||
damage = 2*(P_Random ()%10+1);
|
||||
angle = player->mo->angle;
|
||||
angle += (P_Random()-P_Random())<<18;
|
||||
|
||||
|
||||
// use meleerange + 1 se the puff doesn't skip the flash
|
||||
slope = P_AimLineAttack (player->mo, angle, MELEERANGE+1);
|
||||
P_LineAttack (player->mo, angle, MELEERANGE+1, slope, damage);
|
||||
@@ -521,7 +521,7 @@ A_Saw
|
||||
return;
|
||||
}
|
||||
S_StartSound (player->mo, sfx_sawhit);
|
||||
|
||||
|
||||
// turn to face target
|
||||
angle = R_PointToAngle2 (player->mo->x, player->mo->y,
|
||||
linetarget->x, linetarget->y);
|
||||
@@ -550,7 +550,7 @@ A_Saw
|
||||
void
|
||||
A_FireMissile
|
||||
( player_t* player,
|
||||
pspdef_t* psp )
|
||||
pspdef_t* psp )
|
||||
{
|
||||
player->ammo[weaponinfo[player->readyweapon].ammo]--;
|
||||
P_SpawnPlayerMissile (player->mo, MT_ROCKET);
|
||||
@@ -563,7 +563,7 @@ A_FireMissile
|
||||
void
|
||||
A_FireBFG
|
||||
( player_t* player,
|
||||
pspdef_t* psp )
|
||||
pspdef_t* psp )
|
||||
{
|
||||
player->ammo[weaponinfo[player->readyweapon].ammo] -= BFGCELLS;
|
||||
P_SpawnPlayerMissile (player->mo, MT_BFG);
|
||||
@@ -577,7 +577,7 @@ A_FireBFG
|
||||
void
|
||||
A_FirePlasma
|
||||
( player_t* player,
|
||||
pspdef_t* psp )
|
||||
pspdef_t* psp )
|
||||
{
|
||||
player->ammo[weaponinfo[player->readyweapon].ammo]--;
|
||||
|
||||
@@ -592,7 +592,7 @@ A_FirePlasma
|
||||
|
||||
//
|
||||
// P_BulletSlope
|
||||
// Sets a slope so a near miss is at approximately
|
||||
// Sets a slope so a near miss is at aproximately
|
||||
// the height of the intended target
|
||||
//
|
||||
fixed_t bulletslope;
|
||||
@@ -601,7 +601,7 @@ fixed_t bulletslope;
|
||||
void P_BulletSlope (mobj_t* mo)
|
||||
{
|
||||
angle_t an;
|
||||
|
||||
|
||||
// see which target is to be aimed at
|
||||
an = mo->angle;
|
||||
bulletslope = P_AimLineAttack (mo, an, 16*64*FRACUNIT);
|
||||
@@ -629,7 +629,7 @@ P_GunShot
|
||||
{
|
||||
angle_t angle;
|
||||
int damage;
|
||||
|
||||
|
||||
damage = 5*(P_Random ()%3+1);
|
||||
angle = mo->angle;
|
||||
|
||||
@@ -646,7 +646,7 @@ P_GunShot
|
||||
void
|
||||
A_FirePistol
|
||||
( player_t* player,
|
||||
pspdef_t* psp )
|
||||
pspdef_t* psp )
|
||||
{
|
||||
S_StartSound (player->mo, sfx_pistol);
|
||||
|
||||
@@ -668,10 +668,10 @@ A_FirePistol
|
||||
void
|
||||
A_FireShotgun
|
||||
( player_t* player,
|
||||
pspdef_t* psp )
|
||||
pspdef_t* psp )
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
S_StartSound (player->mo, sfx_shotgn);
|
||||
P_SetMobjState (player->mo, S_PLAY_ATK2);
|
||||
|
||||
@@ -682,7 +682,7 @@ A_FireShotgun
|
||||
weaponinfo[player->readyweapon].flashstate);
|
||||
|
||||
P_BulletSlope (player->mo);
|
||||
|
||||
|
||||
for (i=0 ; i<7 ; i++)
|
||||
P_GunShot (player->mo, false);
|
||||
}
|
||||
@@ -695,13 +695,13 @@ A_FireShotgun
|
||||
void
|
||||
A_FireShotgun2
|
||||
( player_t* player,
|
||||
pspdef_t* psp )
|
||||
pspdef_t* psp )
|
||||
{
|
||||
int i;
|
||||
angle_t angle;
|
||||
int damage;
|
||||
|
||||
|
||||
|
||||
|
||||
S_StartSound (player->mo, sfx_dshtgn);
|
||||
P_SetMobjState (player->mo, S_PLAY_ATK2);
|
||||
|
||||
@@ -712,7 +712,7 @@ A_FireShotgun2
|
||||
weaponinfo[player->readyweapon].flashstate);
|
||||
|
||||
P_BulletSlope (player->mo);
|
||||
|
||||
|
||||
for (i=0 ; i<20 ; i++)
|
||||
{
|
||||
damage = 5*(P_Random ()%3+1);
|
||||
@@ -732,13 +732,13 @@ A_FireShotgun2
|
||||
void
|
||||
A_FireCGun
|
||||
( player_t* player,
|
||||
pspdef_t* psp )
|
||||
pspdef_t* psp )
|
||||
{
|
||||
S_StartSound (player->mo, sfx_pistol);
|
||||
|
||||
if (!player->ammo[weaponinfo[player->readyweapon].ammo])
|
||||
return;
|
||||
|
||||
|
||||
P_SetMobjState (player->mo, S_PLAY_ATK2);
|
||||
player->ammo[weaponinfo[player->readyweapon].ammo]--;
|
||||
|
||||
@@ -749,7 +749,7 @@ A_FireCGun
|
||||
- &states[S_CHAIN1] );
|
||||
|
||||
P_BulletSlope (player->mo);
|
||||
|
||||
|
||||
P_GunShot (player->mo, !player->refire);
|
||||
}
|
||||
|
||||
@@ -778,13 +778,13 @@ void A_Light2 (player_t *player, pspdef_t *psp)
|
||||
// A_BFGSpray
|
||||
// Spawn a BFG explosion on every monster in view
|
||||
//
|
||||
void A_BFGSpray (mobj_t* mo)
|
||||
void A_BFGSpray (mobj_t* mo)
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
int damage;
|
||||
angle_t an;
|
||||
|
||||
|
||||
// offset angles from its attack angle
|
||||
for (i=0 ; i<40 ; i++)
|
||||
{
|
||||
@@ -801,7 +801,7 @@ void A_BFGSpray (mobj_t* mo)
|
||||
linetarget->y,
|
||||
linetarget->z + (linetarget->height>>2),
|
||||
MT_EXTRABFG);
|
||||
|
||||
|
||||
damage = 0;
|
||||
for (j=0;j<15;j++)
|
||||
damage += (P_Random()&7) + 1;
|
||||
@@ -828,14 +828,14 @@ A_BFGsound
|
||||
// P_SetupPsprites
|
||||
// Called at start of level for each player.
|
||||
//
|
||||
void P_SetupPsprites (player_t* player)
|
||||
void P_SetupPsprites (player_t* player)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
// remove all psprites
|
||||
for (i=0 ; i<NUMPSPRITES ; i++)
|
||||
player->psprites[i].state = NULL;
|
||||
|
||||
|
||||
// spawn the gun
|
||||
player->pendingweapon = player->readyweapon;
|
||||
P_BringUpWeapon (player);
|
||||
@@ -848,30 +848,32 @@ void P_SetupPsprites (player_t* player)
|
||||
// P_MovePsprites
|
||||
// Called every tic by player thinking routine.
|
||||
//
|
||||
void P_MovePsprites (player_t* player)
|
||||
void P_MovePsprites (player_t* player)
|
||||
{
|
||||
int i;
|
||||
pspdef_t* psp;
|
||||
state_t* state;
|
||||
|
||||
|
||||
psp = &player->psprites[0];
|
||||
for (i=0 ; i<NUMPSPRITES ; i++, psp++)
|
||||
{
|
||||
// a null state means not active
|
||||
if ( (state = psp->state) )
|
||||
if ( (state = psp->state) )
|
||||
{
|
||||
// drop tic count and possibly change state
|
||||
|
||||
// a -1 tic count never changes
|
||||
if (psp->tics != -1)
|
||||
if (psp->tics != -1)
|
||||
{
|
||||
psp->tics--;
|
||||
if (!psp->tics)
|
||||
P_SetPsprite (player, i, psp->state->nextstate);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
player->psprites[ps_flash].sx = player->psprites[ps_weapon].sx;
|
||||
player->psprites[ps_flash].sy = player->psprites[ps_weapon].sy;
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
// sprite animation tables.
|
||||
// Header generated by multigen utility.
|
||||
// This includes all the data for thing animation,
|
||||
// i.e. the Thing Attributes table
|
||||
// i.e. the Thing Atrributes table
|
||||
// and the Frame Sequence table.
|
||||
#include "info.h"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $Id:$
|
||||
@@ -87,12 +87,12 @@ int bmapwidth;
|
||||
int bmapheight; // size in mapblocks
|
||||
short* blockmap; // int for larger maps
|
||||
// offsets in blockmap are from here
|
||||
short* blockmaplump;
|
||||
short* blockmaplump;
|
||||
// origin of block map
|
||||
fixed_t bmaporgx;
|
||||
fixed_t bmaporgy;
|
||||
// for thing chains
|
||||
mobj_t** blocklinks;
|
||||
mobj_t** blocklinks;
|
||||
|
||||
|
||||
// REJECT
|
||||
@@ -131,11 +131,11 @@ void P_LoadVertexes (int lump)
|
||||
numvertexes = W_LumpLength (lump) / sizeof(mapvertex_t);
|
||||
|
||||
// Allocate zone memory for buffer.
|
||||
vertexes = Z_Malloc (numvertexes*sizeof(vertex_t),PU_LEVEL,0);
|
||||
vertexes = Z_Malloc (numvertexes*sizeof(vertex_t),PU_LEVEL,0);
|
||||
|
||||
// Load data into cache.
|
||||
data = W_CacheLumpNum (lump,PU_STATIC);
|
||||
|
||||
|
||||
ml = (mapvertex_t *)data;
|
||||
li = vertexes;
|
||||
|
||||
@@ -165,19 +165,19 @@ void P_LoadSegs (int lump)
|
||||
line_t* ldef;
|
||||
int linedef;
|
||||
int side;
|
||||
|
||||
|
||||
numsegs = W_LumpLength (lump) / sizeof(mapseg_t);
|
||||
segs = Z_Malloc (numsegs*sizeof(seg_t),PU_LEVEL,0);
|
||||
segs = Z_Malloc (numsegs*sizeof(seg_t),PU_LEVEL,0);
|
||||
memset (segs, 0, numsegs*sizeof(seg_t));
|
||||
data = W_CacheLumpNum (lump,PU_STATIC);
|
||||
|
||||
|
||||
ml = (mapseg_t *)data;
|
||||
li = segs;
|
||||
for (i=0 ; i<numsegs ; i++, li++, ml++)
|
||||
{
|
||||
li->v1 = &vertexes[SHORT(ml->v1)];
|
||||
li->v2 = &vertexes[SHORT(ml->v2)];
|
||||
|
||||
|
||||
li->angle = (SHORT(ml->angle))<<16;
|
||||
li->offset = (SHORT(ml->offset))<<16;
|
||||
linedef = SHORT(ml->linedef);
|
||||
@@ -191,7 +191,7 @@ void P_LoadSegs (int lump)
|
||||
else
|
||||
li->backsector = 0;
|
||||
}
|
||||
|
||||
|
||||
Z_Free (data);
|
||||
}
|
||||
|
||||
@@ -205,21 +205,21 @@ void P_LoadSubsectors (int lump)
|
||||
int i;
|
||||
mapsubsector_t* ms;
|
||||
subsector_t* ss;
|
||||
|
||||
|
||||
numsubsectors = W_LumpLength (lump) / sizeof(mapsubsector_t);
|
||||
subsectors = Z_Malloc (numsubsectors*sizeof(subsector_t),PU_LEVEL,0);
|
||||
subsectors = Z_Malloc (numsubsectors*sizeof(subsector_t),PU_LEVEL,0);
|
||||
data = W_CacheLumpNum (lump,PU_STATIC);
|
||||
|
||||
|
||||
ms = (mapsubsector_t *)data;
|
||||
memset (subsectors,0, numsubsectors*sizeof(subsector_t));
|
||||
ss = subsectors;
|
||||
|
||||
|
||||
for (i=0 ; i<numsubsectors ; i++, ss++, ms++)
|
||||
{
|
||||
ss->numlines = SHORT(ms->numsegs);
|
||||
ss->firstline = SHORT(ms->firstseg);
|
||||
}
|
||||
|
||||
|
||||
Z_Free (data);
|
||||
}
|
||||
|
||||
@@ -234,12 +234,12 @@ void P_LoadSectors (int lump)
|
||||
int i;
|
||||
mapsector_t* ms;
|
||||
sector_t* ss;
|
||||
|
||||
|
||||
numsectors = W_LumpLength (lump) / sizeof(mapsector_t);
|
||||
sectors = Z_Malloc (numsectors*sizeof(sector_t),PU_LEVEL,0);
|
||||
sectors = Z_Malloc (numsectors*sizeof(sector_t),PU_LEVEL,0);
|
||||
memset (sectors, 0, numsectors*sizeof(sector_t));
|
||||
data = W_CacheLumpNum (lump,PU_STATIC);
|
||||
|
||||
|
||||
ms = (mapsector_t *)data;
|
||||
ss = sectors;
|
||||
for (i=0 ; i<numsectors ; i++, ss++, ms++)
|
||||
@@ -253,7 +253,7 @@ void P_LoadSectors (int lump)
|
||||
ss->tag = SHORT(ms->tag);
|
||||
ss->thinglist = NULL;
|
||||
}
|
||||
|
||||
|
||||
Z_Free (data);
|
||||
}
|
||||
|
||||
@@ -269,14 +269,14 @@ void P_LoadNodes (int lump)
|
||||
int k;
|
||||
mapnode_t* mn;
|
||||
node_t* no;
|
||||
|
||||
|
||||
numnodes = W_LumpLength (lump) / sizeof(mapnode_t);
|
||||
nodes = Z_Malloc (numnodes*sizeof(node_t),PU_LEVEL,0);
|
||||
nodes = Z_Malloc (numnodes*sizeof(node_t),PU_LEVEL,0);
|
||||
data = W_CacheLumpNum (lump,PU_STATIC);
|
||||
|
||||
|
||||
mn = (mapnode_t *)data;
|
||||
no = nodes;
|
||||
|
||||
|
||||
for (i=0 ; i<numnodes ; i++, no++, mn++)
|
||||
{
|
||||
no->x = SHORT(mn->x)<<FRACBITS;
|
||||
@@ -290,7 +290,7 @@ void P_LoadNodes (int lump)
|
||||
no->bbox[j][k] = SHORT(mn->bbox[j][k])<<FRACBITS;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Z_Free (data);
|
||||
}
|
||||
|
||||
@@ -305,10 +305,10 @@ void P_LoadThings (int lump)
|
||||
mapthing_t* mt;
|
||||
int numthings;
|
||||
boolean spawn;
|
||||
|
||||
|
||||
data = W_CacheLumpNum (lump,PU_STATIC);
|
||||
numthings = W_LumpLength (lump) / sizeof(mapthing_t);
|
||||
|
||||
|
||||
mt = (mapthing_t *)data;
|
||||
for (i=0 ; i<numthings ; i++, mt++)
|
||||
{
|
||||
@@ -336,16 +336,16 @@ void P_LoadThings (int lump)
|
||||
if (spawn == false)
|
||||
break;
|
||||
|
||||
// Do spawn all other stuff.
|
||||
// Do spawn all other stuff.
|
||||
mt->x = SHORT(mt->x);
|
||||
mt->y = SHORT(mt->y);
|
||||
mt->angle = SHORT(mt->angle);
|
||||
mt->type = SHORT(mt->type);
|
||||
mt->options = SHORT(mt->options);
|
||||
|
||||
|
||||
P_SpawnMapThing (mt);
|
||||
}
|
||||
|
||||
|
||||
Z_Free (data);
|
||||
}
|
||||
|
||||
@@ -362,12 +362,12 @@ void P_LoadLineDefs (int lump)
|
||||
line_t* ld;
|
||||
vertex_t* v1;
|
||||
vertex_t* v2;
|
||||
|
||||
|
||||
numlines = W_LumpLength (lump) / sizeof(maplinedef_t);
|
||||
lines = Z_Malloc (numlines*sizeof(line_t),PU_LEVEL,0);
|
||||
lines = Z_Malloc (numlines*sizeof(line_t),PU_LEVEL,0);
|
||||
memset (lines, 0, numlines*sizeof(line_t));
|
||||
data = W_CacheLumpNum (lump,PU_STATIC);
|
||||
|
||||
|
||||
mld = (maplinedef_t *)data;
|
||||
ld = lines;
|
||||
for (i=0 ; i<numlines ; i++, mld++, ld++)
|
||||
@@ -379,7 +379,7 @@ void P_LoadLineDefs (int lump)
|
||||
v2 = ld->v2 = &vertexes[SHORT(mld->v2)];
|
||||
ld->dx = v2->x - v1->x;
|
||||
ld->dy = v2->y - v1->y;
|
||||
|
||||
|
||||
if (!ld->dx)
|
||||
ld->slopetype = ST_VERTICAL;
|
||||
else if (!ld->dy)
|
||||
@@ -391,7 +391,7 @@ void P_LoadLineDefs (int lump)
|
||||
else
|
||||
ld->slopetype = ST_NEGATIVE;
|
||||
}
|
||||
|
||||
|
||||
if (v1->x < v2->x)
|
||||
{
|
||||
ld->bbox[BOXLEFT] = v1->x;
|
||||
@@ -427,7 +427,7 @@ void P_LoadLineDefs (int lump)
|
||||
else
|
||||
ld->backsector = 0;
|
||||
}
|
||||
|
||||
|
||||
Z_Free (data);
|
||||
}
|
||||
|
||||
@@ -441,12 +441,12 @@ void P_LoadSideDefs (int lump)
|
||||
int i;
|
||||
mapsidedef_t* msd;
|
||||
side_t* sd;
|
||||
|
||||
|
||||
numsides = W_LumpLength (lump) / sizeof(mapsidedef_t);
|
||||
sides = Z_Malloc (numsides*sizeof(side_t),PU_LEVEL,0);
|
||||
sides = Z_Malloc (numsides*sizeof(side_t),PU_LEVEL,0);
|
||||
memset (sides, 0, numsides*sizeof(side_t));
|
||||
data = W_CacheLumpNum (lump,PU_STATIC);
|
||||
|
||||
|
||||
msd = (mapsidedef_t *)data;
|
||||
sd = sides;
|
||||
for (i=0 ; i<numsides ; i++, msd++, sd++)
|
||||
@@ -458,7 +458,7 @@ void P_LoadSideDefs (int lump)
|
||||
sd->midtexture = R_TextureNumForName(msd->midtexture);
|
||||
sd->sector = §ors[SHORT(msd->sector)];
|
||||
}
|
||||
|
||||
|
||||
Z_Free (data);
|
||||
}
|
||||
|
||||
@@ -470,19 +470,19 @@ void P_LoadBlockMap (int lump)
|
||||
{
|
||||
int i;
|
||||
int count;
|
||||
|
||||
|
||||
blockmaplump = W_CacheLumpNum (lump,PU_LEVEL);
|
||||
blockmap = blockmaplump+4;
|
||||
count = W_LumpLength (lump)/2;
|
||||
|
||||
for (i=0 ; i<count ; i++)
|
||||
blockmaplump[i] = SHORT(blockmaplump[i]);
|
||||
|
||||
|
||||
bmaporgx = blockmaplump[0]<<FRACBITS;
|
||||
bmaporgy = blockmaplump[1]<<FRACBITS;
|
||||
bmapwidth = blockmaplump[2];
|
||||
bmapheight = blockmaplump[3];
|
||||
|
||||
|
||||
// clear out mobj chains
|
||||
count = sizeof(*blocklinks)* bmapwidth*bmapheight;
|
||||
blocklinks = Z_Malloc (count,PU_LEVEL, 0);
|
||||
@@ -508,7 +508,7 @@ void P_GroupLines (void)
|
||||
seg_t* seg;
|
||||
fixed_t bbox[4];
|
||||
int block;
|
||||
|
||||
|
||||
// look up sector number for each subsector
|
||||
ss = subsectors;
|
||||
for (i=0 ; i<numsubsectors ; i++, ss++)
|
||||
@@ -531,8 +531,8 @@ void P_GroupLines (void)
|
||||
total++;
|
||||
}
|
||||
}
|
||||
|
||||
// build line tables for each sector
|
||||
|
||||
// build line tables for each sector
|
||||
linebuffer = Z_Malloc (total*4, PU_LEVEL, 0);
|
||||
sector = sectors;
|
||||
for (i=0 ; i<numsectors ; i++, sector++)
|
||||
@@ -551,11 +551,11 @@ void P_GroupLines (void)
|
||||
}
|
||||
if (linebuffer - sector->lines != sector->linecount)
|
||||
I_Error ("P_GroupLines: miscounted");
|
||||
|
||||
|
||||
// set the degenmobj_t to the middle of the bounding box
|
||||
sector->soundorg.x = (bbox[BOXRIGHT]+bbox[BOXLEFT])/2;
|
||||
sector->soundorg.y = (bbox[BOXTOP]+bbox[BOXBOTTOM])/2;
|
||||
|
||||
|
||||
// adjust bounding box to map blocks
|
||||
block = (bbox[BOXTOP]-bmaporgy+MAXRADIUS)>>MAPBLOCKSHIFT;
|
||||
block = block >= bmapheight ? bmapheight-1 : block;
|
||||
@@ -573,7 +573,7 @@ void P_GroupLines (void)
|
||||
block = block < 0 ? 0 : block;
|
||||
sector->blockbox[BOXLEFT]=block;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -590,23 +590,23 @@ P_SetupLevel
|
||||
int i;
|
||||
char lumpname[9];
|
||||
int lumpnum;
|
||||
|
||||
|
||||
totalkills = totalitems = totalsecret = wminfo.maxfrags = 0;
|
||||
wminfo.partime = 180;
|
||||
for (i=0 ; i<MAXPLAYERS ; i++)
|
||||
{
|
||||
players[i].killcount = players[i].secretcount
|
||||
players[i].killcount = players[i].secretcount
|
||||
= players[i].itemcount = 0;
|
||||
}
|
||||
|
||||
// Initial height of PointOfView
|
||||
// will be set by player think.
|
||||
players[consoleplayer].viewz = 1;
|
||||
players[consoleplayer].viewz = 1;
|
||||
|
||||
// Make sure all sounds are stopped before Z_FreeTags.
|
||||
S_Start ();
|
||||
|
||||
S_Start ();
|
||||
|
||||
|
||||
#if 0 // UNUSED
|
||||
if (debugfile)
|
||||
{
|
||||
@@ -621,9 +621,9 @@ P_SetupLevel
|
||||
// UNUSED W_Profile ();
|
||||
P_InitThinkers ();
|
||||
|
||||
// if working with a development map, reload it
|
||||
W_Reload ();
|
||||
|
||||
// if working with a devlopment map, reload it
|
||||
W_Reload ();
|
||||
|
||||
// find map name
|
||||
if ( gamemode == commercial)
|
||||
{
|
||||
@@ -642,10 +642,10 @@ P_SetupLevel
|
||||
}
|
||||
|
||||
lumpnum = W_GetNumForName (lumpname);
|
||||
|
||||
|
||||
leveltime = 0;
|
||||
|
||||
// note: most of this ordering is important
|
||||
|
||||
// note: most of this ordering is important
|
||||
P_LoadBlockMap (lumpnum+ML_BLOCKMAP);
|
||||
P_LoadVertexes (lumpnum+ML_VERTEXES);
|
||||
P_LoadSectors (lumpnum+ML_SECTORS);
|
||||
@@ -655,14 +655,14 @@ P_SetupLevel
|
||||
P_LoadSubsectors (lumpnum+ML_SSECTORS);
|
||||
P_LoadNodes (lumpnum+ML_NODES);
|
||||
P_LoadSegs (lumpnum+ML_SEGS);
|
||||
|
||||
|
||||
rejectmatrix = W_CacheLumpNum (lumpnum+ML_REJECT,PU_LEVEL);
|
||||
P_GroupLines ();
|
||||
|
||||
bodyqueslot = 0;
|
||||
deathmatch_p = deathmatchstarts;
|
||||
P_LoadThings (lumpnum+ML_THINGS);
|
||||
|
||||
|
||||
// if deathmatch, randomly spawn the active players
|
||||
if (deathmatch)
|
||||
{
|
||||
@@ -672,15 +672,15 @@ P_SetupLevel
|
||||
players[i].mo = NULL;
|
||||
G_DeathMatchSpawnPlayer (i);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// clear special respawning que
|
||||
iquehead = iquetail = 0;
|
||||
|
||||
iquehead = iquetail = 0;
|
||||
|
||||
// set up world state
|
||||
P_SpawnSpecials ();
|
||||
|
||||
|
||||
// build subsector connect matrix
|
||||
// UNUSED P_ConnectSubsectors ();
|
||||
|
||||
@@ -703,3 +703,6 @@ void P_Init (void)
|
||||
P_InitPicAnims ();
|
||||
R_InitSprites (sprnames);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $Id:$
|
||||
@@ -66,13 +66,13 @@ P_DivlineSide
|
||||
{
|
||||
if (x==node->x)
|
||||
return 2;
|
||||
|
||||
|
||||
if (x <= node->x)
|
||||
return node->dy > 0;
|
||||
|
||||
return node->dy < 0;
|
||||
}
|
||||
|
||||
|
||||
if (!node->dy)
|
||||
{
|
||||
if (x==node->y)
|
||||
@@ -83,16 +83,16 @@ P_DivlineSide
|
||||
|
||||
return node->dx > 0;
|
||||
}
|
||||
|
||||
|
||||
dx = (x - node->x);
|
||||
dy = (y - node->y);
|
||||
|
||||
left = (node->dy>>FRACBITS) * (dx>>FRACBITS);
|
||||
right = (dy>>FRACBITS) * (node->dx>>FRACBITS);
|
||||
|
||||
|
||||
if (right < left)
|
||||
return 0; // front side
|
||||
|
||||
|
||||
if (left == right)
|
||||
return 2;
|
||||
return 1; // back side
|
||||
@@ -113,14 +113,14 @@ P_InterceptVector2
|
||||
fixed_t frac;
|
||||
fixed_t num;
|
||||
fixed_t den;
|
||||
|
||||
|
||||
den = FixedMul (v1->dy>>8,v2->dx) - FixedMul(v1->dx>>8,v2->dy);
|
||||
|
||||
if (den == 0)
|
||||
return 0;
|
||||
// I_Error ("P_InterceptVector: parallel");
|
||||
|
||||
num = FixedMul ( (v1->x - v2->x)>>8 ,v1->dy) +
|
||||
|
||||
num = FixedMul ( (v1->x - v2->x)>>8 ,v1->dy) +
|
||||
FixedMul ( (v2->y - v1->y)>>8 , v1->dx);
|
||||
frac = FixedDiv (num , den);
|
||||
|
||||
@@ -149,7 +149,7 @@ boolean P_CrossSubsector (int num)
|
||||
vertex_t* v2;
|
||||
fixed_t frac;
|
||||
fixed_t slope;
|
||||
|
||||
|
||||
#ifdef RANGECHECK
|
||||
if (num>=numsubsectors)
|
||||
I_Error ("P_CrossSubsector: ss %i with numss = %i",
|
||||
@@ -158,7 +158,7 @@ boolean P_CrossSubsector (int num)
|
||||
#endif
|
||||
|
||||
sub = &subsectors[num];
|
||||
|
||||
|
||||
// check lines
|
||||
count = sub->numlines;
|
||||
seg = &segs[sub->firstline];
|
||||
@@ -167,12 +167,12 @@ boolean P_CrossSubsector (int num)
|
||||
{
|
||||
line = seg->linedef;
|
||||
|
||||
// already checked other side?
|
||||
// allready checked other side?
|
||||
if (line->validcount == validcount)
|
||||
continue;
|
||||
|
||||
|
||||
line->validcount = validcount;
|
||||
|
||||
|
||||
v1 = line->v1;
|
||||
v2 = line->v2;
|
||||
s1 = P_DivlineSide (v1->x,v1->y, &strace);
|
||||
@@ -181,7 +181,7 @@ boolean P_CrossSubsector (int num)
|
||||
// line isn't crossed?
|
||||
if (s1 == s2)
|
||||
continue;
|
||||
|
||||
|
||||
divl.x = v1->x;
|
||||
divl.y = v1->y;
|
||||
divl.dx = v2->x - v1->x;
|
||||
@@ -191,13 +191,13 @@ boolean P_CrossSubsector (int num)
|
||||
|
||||
// line isn't crossed?
|
||||
if (s1 == s2)
|
||||
continue;
|
||||
continue;
|
||||
|
||||
// stop because it is not two sided anyway
|
||||
// might do this after updating validcount?
|
||||
if ( !(line->flags & ML_TWOSIDED) )
|
||||
return false;
|
||||
|
||||
|
||||
// crosses a two sided line
|
||||
front = seg->frontsector;
|
||||
back = seg->backsector;
|
||||
@@ -205,7 +205,7 @@ boolean P_CrossSubsector (int num)
|
||||
// no wall to block sight with?
|
||||
if (front->floorheight == back->floorheight
|
||||
&& front->ceilingheight == back->ceilingheight)
|
||||
continue;
|
||||
continue;
|
||||
|
||||
// possible occluder
|
||||
// because of ceiling height differences
|
||||
@@ -219,32 +219,32 @@ boolean P_CrossSubsector (int num)
|
||||
openbottom = front->floorheight;
|
||||
else
|
||||
openbottom = back->floorheight;
|
||||
|
||||
|
||||
// quick test for totally closed doors
|
||||
if (openbottom >= opentop)
|
||||
if (openbottom >= opentop)
|
||||
return false; // stop
|
||||
|
||||
|
||||
frac = P_InterceptVector2 (&strace, &divl);
|
||||
|
||||
|
||||
if (front->floorheight != back->floorheight)
|
||||
{
|
||||
slope = FixedDiv (openbottom - sightzstart , frac);
|
||||
if (slope > bottomslope)
|
||||
bottomslope = slope;
|
||||
}
|
||||
|
||||
|
||||
if (front->ceilingheight != back->ceilingheight)
|
||||
{
|
||||
slope = FixedDiv (opentop - sightzstart , frac);
|
||||
if (slope < topslope)
|
||||
topslope = slope;
|
||||
}
|
||||
|
||||
|
||||
if (topslope <= bottomslope)
|
||||
return false; // stop
|
||||
return false; // stop
|
||||
}
|
||||
// passed the subsector ok
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -266,9 +266,9 @@ boolean P_CrossBSPNode (int bspnum)
|
||||
else
|
||||
return P_CrossSubsector (bspnum&(~NF_SUBSECTOR));
|
||||
}
|
||||
|
||||
|
||||
bsp = &nodes[bspnum];
|
||||
|
||||
|
||||
// decide which side the start point is on
|
||||
side = P_DivlineSide (strace.x, strace.y, (divline_t *)bsp);
|
||||
if (side == 2)
|
||||
@@ -277,15 +277,15 @@ boolean P_CrossBSPNode (int bspnum)
|
||||
// cross the starting side
|
||||
if (!P_CrossBSPNode (bsp->children[side]) )
|
||||
return false;
|
||||
|
||||
|
||||
// the partition plane is crossed here
|
||||
if (side == P_DivlineSide (t2x, t2y,(divline_t *)bsp))
|
||||
{
|
||||
// the line doesn't touch the other side
|
||||
return true;
|
||||
}
|
||||
|
||||
// cross the ending side
|
||||
|
||||
// cross the ending side
|
||||
return P_CrossBSPNode (bsp->children[side^1]);
|
||||
}
|
||||
|
||||
@@ -306,7 +306,7 @@ P_CheckSight
|
||||
int pnum;
|
||||
int bytenum;
|
||||
int bitnum;
|
||||
|
||||
|
||||
// First check for trivial rejection.
|
||||
|
||||
// Determine subsector entries in REJECT table.
|
||||
@@ -322,7 +322,7 @@ P_CheckSight
|
||||
sightcounts[0]++;
|
||||
|
||||
// can't possibly be connected
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
// An unobstructed LOS is possible.
|
||||
@@ -330,11 +330,11 @@ P_CheckSight
|
||||
sightcounts[1]++;
|
||||
|
||||
validcount++;
|
||||
|
||||
|
||||
sightzstart = t1->z + t1->height - (t1->height>>2);
|
||||
topslope = (t2->z+t2->height) - sightzstart;
|
||||
bottomslope = (t2->z) - sightzstart;
|
||||
|
||||
|
||||
strace.x = t1->x;
|
||||
strace.y = t1->y;
|
||||
t2x = t2->x;
|
||||
@@ -343,5 +343,7 @@ P_CheckSight
|
||||
strace.dy = t2->y - t1->y;
|
||||
|
||||
// the head node is the last node output
|
||||
return P_CrossBSPNode (numnodes-1);
|
||||
return P_CrossBSPNode (numnodes-1);
|
||||
}
|
||||
|
||||
|
||||
+127
-127
@@ -1,4 +1,4 @@
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $Id:$
|
||||
@@ -64,7 +64,7 @@ typedef struct
|
||||
int basepic;
|
||||
int numpics;
|
||||
int speed;
|
||||
|
||||
|
||||
} anim_t;
|
||||
|
||||
//
|
||||
@@ -107,7 +107,7 @@ animdef_t animdefs[] =
|
||||
{false, "BLOOD3", "BLOOD1", 8},
|
||||
|
||||
// DOOM II flat animations.
|
||||
{false, "RROCK08", "RROCK05", 8},
|
||||
{false, "RROCK08", "RROCK05", 8},
|
||||
{false, "SLIME04", "SLIME01", 8},
|
||||
{false, "SLIME08", "SLIME05", 8},
|
||||
{false, "SLIME12", "SLIME09", 8},
|
||||
@@ -127,7 +127,7 @@ animdef_t animdefs[] =
|
||||
{true, "SFALL4", "SFALL1", 8},
|
||||
{true, "WFALL4", "WFALL1", 8},
|
||||
{true, "DBRAIN4", "DBRAIN1", 8},
|
||||
|
||||
|
||||
{-1}
|
||||
};
|
||||
|
||||
@@ -149,7 +149,7 @@ void P_InitPicAnims (void)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
|
||||
// Init animation
|
||||
lastanim = anims;
|
||||
for (i=0 ; animdefs[i].istexture != -1 ; i++)
|
||||
@@ -158,7 +158,7 @@ void P_InitPicAnims (void)
|
||||
{
|
||||
// different episode ?
|
||||
if (R_CheckTextureNumForName(animdefs[i].startname) == -1)
|
||||
continue;
|
||||
continue;
|
||||
|
||||
lastanim->picnum = R_TextureNumForName (animdefs[i].endname);
|
||||
lastanim->basepic = R_TextureNumForName (animdefs[i].startname);
|
||||
@@ -179,11 +179,11 @@ void P_InitPicAnims (void)
|
||||
I_Error ("P_InitPicAnims: bad cycle from %s to %s",
|
||||
animdefs[i].startname,
|
||||
animdefs[i].endname);
|
||||
|
||||
|
||||
lastanim->speed = animdefs[i].speed;
|
||||
lastanim++;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -254,10 +254,10 @@ getNextSector
|
||||
{
|
||||
if (!(line->flags & ML_TWOSIDED))
|
||||
return NULL;
|
||||
|
||||
|
||||
if (line->frontsector == sec)
|
||||
return line->backsector;
|
||||
|
||||
|
||||
return line->frontsector;
|
||||
}
|
||||
|
||||
@@ -273,7 +273,7 @@ fixed_t P_FindLowestFloorSurrounding(sector_t* sec)
|
||||
line_t* check;
|
||||
sector_t* other;
|
||||
fixed_t floor = sec->floorheight;
|
||||
|
||||
|
||||
for (i=0 ;i < sec->linecount ; i++)
|
||||
{
|
||||
check = sec->lines[i];
|
||||
@@ -281,7 +281,7 @@ fixed_t P_FindLowestFloorSurrounding(sector_t* sec)
|
||||
|
||||
if (!other)
|
||||
continue;
|
||||
|
||||
|
||||
if (other->floorheight < floor)
|
||||
floor = other->floorheight;
|
||||
}
|
||||
@@ -300,15 +300,15 @@ fixed_t P_FindHighestFloorSurrounding(sector_t *sec)
|
||||
line_t* check;
|
||||
sector_t* other;
|
||||
fixed_t floor = -500*FRACUNIT;
|
||||
|
||||
|
||||
for (i=0 ;i < sec->linecount ; i++)
|
||||
{
|
||||
check = sec->lines[i];
|
||||
other = getNextSector(check,sec);
|
||||
|
||||
|
||||
if (!other)
|
||||
continue;
|
||||
|
||||
|
||||
if (other->floorheight > floor)
|
||||
floor = other->floorheight;
|
||||
}
|
||||
@@ -337,8 +337,8 @@ P_FindNextHighestFloor
|
||||
sector_t* other;
|
||||
fixed_t height = currentheight;
|
||||
|
||||
|
||||
fixed_t heightlist[MAX_ADJOINING_SECTORS];
|
||||
|
||||
fixed_t heightlist[MAX_ADJOINING_SECTORS];
|
||||
|
||||
for (i=0, h=0 ;i < sec->linecount ; i++)
|
||||
{
|
||||
@@ -347,7 +347,7 @@ P_FindNextHighestFloor
|
||||
|
||||
if (!other)
|
||||
continue;
|
||||
|
||||
|
||||
if (other->floorheight > height)
|
||||
heightlist[h++] = other->floorheight;
|
||||
|
||||
@@ -359,18 +359,18 @@ P_FindNextHighestFloor
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Find lowest height in list
|
||||
if (!h)
|
||||
return currentheight;
|
||||
|
||||
|
||||
min = heightlist[0];
|
||||
|
||||
// Range checking?
|
||||
|
||||
// Range checking?
|
||||
for (i = 1;i < h;i++)
|
||||
if (heightlist[i] < min)
|
||||
min = heightlist[i];
|
||||
|
||||
|
||||
return min;
|
||||
}
|
||||
|
||||
@@ -385,7 +385,7 @@ P_FindLowestCeilingSurrounding(sector_t* sec)
|
||||
line_t* check;
|
||||
sector_t* other;
|
||||
fixed_t height = MAXINT;
|
||||
|
||||
|
||||
for (i=0 ;i < sec->linecount ; i++)
|
||||
{
|
||||
check = sec->lines[i];
|
||||
@@ -410,7 +410,7 @@ fixed_t P_FindHighestCeilingSurrounding(sector_t* sec)
|
||||
line_t* check;
|
||||
sector_t* other;
|
||||
fixed_t height = 0;
|
||||
|
||||
|
||||
for (i=0 ;i < sec->linecount ; i++)
|
||||
{
|
||||
check = sec->lines[i];
|
||||
@@ -436,11 +436,11 @@ P_FindSectorFromLineTag
|
||||
int start )
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
for (i=start+1;i<numsectors;i++)
|
||||
if (sectors[i].tag == line->tag)
|
||||
return i;
|
||||
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -459,7 +459,7 @@ P_FindMinSurroundingLight
|
||||
int min;
|
||||
line_t* line;
|
||||
sector_t* check;
|
||||
|
||||
|
||||
min = max;
|
||||
for (i=0 ; i < sector->linecount ; i++)
|
||||
{
|
||||
@@ -498,7 +498,7 @@ P_CrossSpecialLine
|
||||
int ok;
|
||||
|
||||
line = &lines[linenum];
|
||||
|
||||
|
||||
// Triggers that other things can activate
|
||||
if (!thing->player)
|
||||
{
|
||||
@@ -513,10 +513,10 @@ P_CrossSpecialLine
|
||||
case MT_BRUISERSHOT:
|
||||
return;
|
||||
break;
|
||||
|
||||
|
||||
default: break;
|
||||
}
|
||||
|
||||
|
||||
ok = 0;
|
||||
switch(line->special)
|
||||
{
|
||||
@@ -534,7 +534,7 @@ P_CrossSpecialLine
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Note: could use some const's here.
|
||||
switch (line->special)
|
||||
{
|
||||
@@ -557,104 +557,104 @@ P_CrossSpecialLine
|
||||
EV_DoDoor(line,normal);
|
||||
line->special = 0;
|
||||
break;
|
||||
|
||||
|
||||
case 5:
|
||||
// Raise Floor
|
||||
EV_DoFloor(line,raiseFloor);
|
||||
line->special = 0;
|
||||
break;
|
||||
|
||||
|
||||
case 6:
|
||||
// Fast Ceiling Crush & Raise
|
||||
EV_DoCeiling(line,fastCrushAndRaise);
|
||||
line->special = 0;
|
||||
break;
|
||||
|
||||
|
||||
case 8:
|
||||
// Build Stairs
|
||||
EV_BuildStairs(line,build8);
|
||||
line->special = 0;
|
||||
break;
|
||||
|
||||
|
||||
case 10:
|
||||
// PlatDownWaitUp
|
||||
EV_DoPlat(line,downWaitUpStay,0);
|
||||
line->special = 0;
|
||||
break;
|
||||
|
||||
|
||||
case 12:
|
||||
// Light Turn On - brightest near
|
||||
EV_LightTurnOn(line,0);
|
||||
line->special = 0;
|
||||
break;
|
||||
|
||||
|
||||
case 13:
|
||||
// Light Turn On 255
|
||||
EV_LightTurnOn(line,255);
|
||||
line->special = 0;
|
||||
break;
|
||||
|
||||
|
||||
case 16:
|
||||
// Close Door 30
|
||||
EV_DoDoor(line,close30ThenOpen);
|
||||
line->special = 0;
|
||||
break;
|
||||
|
||||
|
||||
case 17:
|
||||
// Start Light Strobing
|
||||
EV_StartLightStrobing(line);
|
||||
line->special = 0;
|
||||
break;
|
||||
|
||||
|
||||
case 19:
|
||||
// Lower Floor
|
||||
EV_DoFloor(line,lowerFloor);
|
||||
line->special = 0;
|
||||
break;
|
||||
|
||||
|
||||
case 22:
|
||||
// Raise floor to nearest height and change texture
|
||||
EV_DoPlat(line,raiseToNearestAndChange,0);
|
||||
line->special = 0;
|
||||
break;
|
||||
|
||||
|
||||
case 25:
|
||||
// Ceiling Crush and Raise
|
||||
EV_DoCeiling(line,crushAndRaise);
|
||||
line->special = 0;
|
||||
break;
|
||||
|
||||
|
||||
case 30:
|
||||
// Raise floor to shortest texture height
|
||||
// on either side of lines.
|
||||
EV_DoFloor(line,raiseToTexture);
|
||||
line->special = 0;
|
||||
break;
|
||||
|
||||
|
||||
case 35:
|
||||
// Lights Very Dark
|
||||
EV_LightTurnOn(line,35);
|
||||
line->special = 0;
|
||||
break;
|
||||
|
||||
|
||||
case 36:
|
||||
// Lower Floor (TURBO)
|
||||
EV_DoFloor(line,turboLower);
|
||||
line->special = 0;
|
||||
break;
|
||||
|
||||
|
||||
case 37:
|
||||
// LowerAndChange
|
||||
EV_DoFloor(line,lowerAndChange);
|
||||
line->special = 0;
|
||||
break;
|
||||
|
||||
|
||||
case 38:
|
||||
// Lower Floor To Lowest
|
||||
EV_DoFloor( line, lowerFloorToLowest );
|
||||
line->special = 0;
|
||||
break;
|
||||
|
||||
|
||||
case 39:
|
||||
// TELEPORT!
|
||||
EV_Teleport( line, side, thing );
|
||||
@@ -667,24 +667,24 @@ P_CrossSpecialLine
|
||||
EV_DoFloor( line, lowerFloorToLowest );
|
||||
line->special = 0;
|
||||
break;
|
||||
|
||||
|
||||
case 44:
|
||||
// Ceiling Crush
|
||||
EV_DoCeiling( line, lowerAndCrush );
|
||||
line->special = 0;
|
||||
break;
|
||||
|
||||
|
||||
case 52:
|
||||
// EXIT!
|
||||
G_ExitLevel ();
|
||||
break;
|
||||
|
||||
|
||||
case 53:
|
||||
// Perpetual Platform Raise
|
||||
EV_DoPlat(line,perpetualRaise,0);
|
||||
line->special = 0;
|
||||
break;
|
||||
|
||||
|
||||
case 54:
|
||||
// Platform Stop
|
||||
EV_StopPlat(line);
|
||||
@@ -702,7 +702,7 @@ P_CrossSpecialLine
|
||||
EV_CeilingCrushStop(line);
|
||||
line->special = 0;
|
||||
break;
|
||||
|
||||
|
||||
case 58:
|
||||
// Raise Floor 24
|
||||
EV_DoFloor(line,raiseFloor24);
|
||||
@@ -714,31 +714,31 @@ P_CrossSpecialLine
|
||||
EV_DoFloor(line,raiseFloor24AndChange);
|
||||
line->special = 0;
|
||||
break;
|
||||
|
||||
|
||||
case 104:
|
||||
// Turn lights off in sector(tag)
|
||||
EV_TurnTagLightsOff(line);
|
||||
line->special = 0;
|
||||
break;
|
||||
|
||||
|
||||
case 108:
|
||||
// Blazing Door Raise (faster than TURBO!)
|
||||
EV_DoDoor (line,blazeRaise);
|
||||
line->special = 0;
|
||||
break;
|
||||
|
||||
|
||||
case 109:
|
||||
// Blazing Door Open (faster than TURBO!)
|
||||
EV_DoDoor (line,blazeOpen);
|
||||
line->special = 0;
|
||||
break;
|
||||
|
||||
|
||||
case 100:
|
||||
// Build Stairs Turbo 16
|
||||
EV_BuildStairs(line,turbo16);
|
||||
line->special = 0;
|
||||
break;
|
||||
|
||||
|
||||
case 110:
|
||||
// Blazing Door Close (faster than TURBO!)
|
||||
EV_DoDoor (line,blazeClose);
|
||||
@@ -750,18 +750,18 @@ P_CrossSpecialLine
|
||||
EV_DoFloor(line,raiseFloorToNearest);
|
||||
line->special = 0;
|
||||
break;
|
||||
|
||||
|
||||
case 121:
|
||||
// Blazing PlatDownWaitUpStay
|
||||
EV_DoPlat(line,blazeDWUS,0);
|
||||
line->special = 0;
|
||||
break;
|
||||
|
||||
|
||||
case 124:
|
||||
// Secret EXIT
|
||||
G_SecretExitLevel ();
|
||||
break;
|
||||
|
||||
|
||||
case 125:
|
||||
// TELEPORT MonsterONLY
|
||||
if (!thing->player)
|
||||
@@ -770,19 +770,19 @@ P_CrossSpecialLine
|
||||
line->special = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 130:
|
||||
// Raise Floor Turbo
|
||||
EV_DoFloor(line,raiseFloorTurbo);
|
||||
line->special = 0;
|
||||
break;
|
||||
|
||||
|
||||
case 141:
|
||||
// Silent Ceiling Crush & Raise
|
||||
EV_DoCeiling(line,silentCrushAndRaise);
|
||||
line->special = 0;
|
||||
break;
|
||||
|
||||
|
||||
// RETRIGGERS. All from here till end.
|
||||
case 72:
|
||||
// Ceiling Crush
|
||||
@@ -798,42 +798,42 @@ P_CrossSpecialLine
|
||||
// Ceiling Crush Stop
|
||||
EV_CeilingCrushStop(line);
|
||||
break;
|
||||
|
||||
|
||||
case 75:
|
||||
// Close Door
|
||||
EV_DoDoor(line,close);
|
||||
break;
|
||||
|
||||
|
||||
case 76:
|
||||
// Close Door 30
|
||||
EV_DoDoor(line,close30ThenOpen);
|
||||
break;
|
||||
|
||||
|
||||
case 77:
|
||||
// Fast Ceiling Crush & Raise
|
||||
EV_DoCeiling(line,fastCrushAndRaise);
|
||||
break;
|
||||
|
||||
|
||||
case 79:
|
||||
// Lights Very Dark
|
||||
EV_LightTurnOn(line,35);
|
||||
break;
|
||||
|
||||
|
||||
case 80:
|
||||
// Light Turn On - brightest near
|
||||
EV_LightTurnOn(line,0);
|
||||
break;
|
||||
|
||||
|
||||
case 81:
|
||||
// Light Turn On 255
|
||||
EV_LightTurnOn(line,255);
|
||||
break;
|
||||
|
||||
|
||||
case 82:
|
||||
// Lower Floor To Lowest
|
||||
EV_DoFloor( line, lowerFloorToLowest );
|
||||
break;
|
||||
|
||||
|
||||
case 83:
|
||||
// Lower Floor
|
||||
EV_DoFloor(line,lowerFloor);
|
||||
@@ -848,64 +848,64 @@ P_CrossSpecialLine
|
||||
// Open Door
|
||||
EV_DoDoor(line,open);
|
||||
break;
|
||||
|
||||
|
||||
case 87:
|
||||
// Perpetual Platform Raise
|
||||
EV_DoPlat(line,perpetualRaise,0);
|
||||
break;
|
||||
|
||||
|
||||
case 88:
|
||||
// PlatDownWaitUp
|
||||
EV_DoPlat(line,downWaitUpStay,0);
|
||||
break;
|
||||
|
||||
|
||||
case 89:
|
||||
// Platform Stop
|
||||
EV_StopPlat(line);
|
||||
break;
|
||||
|
||||
|
||||
case 90:
|
||||
// Raise Door
|
||||
EV_DoDoor(line,normal);
|
||||
break;
|
||||
|
||||
|
||||
case 91:
|
||||
// Raise Floor
|
||||
EV_DoFloor(line,raiseFloor);
|
||||
break;
|
||||
|
||||
|
||||
case 92:
|
||||
// Raise Floor 24
|
||||
EV_DoFloor(line,raiseFloor24);
|
||||
break;
|
||||
|
||||
|
||||
case 93:
|
||||
// Raise Floor 24 And Change
|
||||
EV_DoFloor(line,raiseFloor24AndChange);
|
||||
break;
|
||||
|
||||
|
||||
case 94:
|
||||
// Raise Floor Crush
|
||||
EV_DoFloor(line,raiseFloorCrush);
|
||||
break;
|
||||
|
||||
|
||||
case 95:
|
||||
// Raise floor to nearest height
|
||||
// and change texture.
|
||||
EV_DoPlat(line,raiseToNearestAndChange,0);
|
||||
break;
|
||||
|
||||
|
||||
case 96:
|
||||
// Raise floor to shortest texture height
|
||||
// on either side of lines.
|
||||
EV_DoFloor(line,raiseToTexture);
|
||||
break;
|
||||
|
||||
|
||||
case 97:
|
||||
// TELEPORT!
|
||||
EV_Teleport( line, side, thing );
|
||||
break;
|
||||
|
||||
|
||||
case 98:
|
||||
// Lower Floor (TURBO)
|
||||
EV_DoFloor(line,turboLower);
|
||||
@@ -915,7 +915,7 @@ P_CrossSpecialLine
|
||||
// Blazing Door Raise (faster than TURBO!)
|
||||
EV_DoDoor (line,blazeRaise);
|
||||
break;
|
||||
|
||||
|
||||
case 106:
|
||||
// Blazing Door Open (faster than TURBO!)
|
||||
EV_DoDoor (line,blazeOpen);
|
||||
@@ -930,18 +930,18 @@ P_CrossSpecialLine
|
||||
// Blazing PlatDownWaitUpStay.
|
||||
EV_DoPlat(line,blazeDWUS,0);
|
||||
break;
|
||||
|
||||
|
||||
case 126:
|
||||
// TELEPORT MonsterONLY.
|
||||
if (!thing->player)
|
||||
EV_Teleport( line, side, thing );
|
||||
break;
|
||||
|
||||
|
||||
case 128:
|
||||
// Raise To Nearest Floor
|
||||
EV_DoFloor(line,raiseFloorToNearest);
|
||||
break;
|
||||
|
||||
|
||||
case 129:
|
||||
// Raise Floor Turbo
|
||||
EV_DoFloor(line,raiseFloorTurbo);
|
||||
@@ -961,7 +961,7 @@ P_ShootSpecialLine
|
||||
line_t* line )
|
||||
{
|
||||
int ok;
|
||||
|
||||
|
||||
// Impacts that other things can activate.
|
||||
if (!thing->player)
|
||||
{
|
||||
@@ -984,13 +984,13 @@ P_ShootSpecialLine
|
||||
EV_DoFloor(line,raiseFloor);
|
||||
P_ChangeSwitchTexture(line,0);
|
||||
break;
|
||||
|
||||
|
||||
case 46:
|
||||
// OPEN DOOR
|
||||
EV_DoDoor(line,open);
|
||||
P_ChangeSwitchTexture(line,1);
|
||||
break;
|
||||
|
||||
|
||||
case 47:
|
||||
// RAISE FLOOR NEAR AND CHANGE
|
||||
EV_DoPlat(line,raiseToNearestAndChange,0);
|
||||
@@ -1009,12 +1009,12 @@ P_ShootSpecialLine
|
||||
void P_PlayerInSpecialSector (player_t* player)
|
||||
{
|
||||
sector_t* sector;
|
||||
|
||||
|
||||
sector = player->mo->subsector->sector;
|
||||
|
||||
// Falling, not all the way down yet?
|
||||
if (player->mo->z != sector->floorheight)
|
||||
return;
|
||||
return;
|
||||
|
||||
// Has hitten ground.
|
||||
switch (sector->special)
|
||||
@@ -1025,14 +1025,14 @@ void P_PlayerInSpecialSector (player_t* player)
|
||||
if (!(leveltime&0x1f))
|
||||
P_DamageMobj (player->mo, NULL, NULL, 10);
|
||||
break;
|
||||
|
||||
|
||||
case 7:
|
||||
// NUKAGE DAMAGE
|
||||
if (!player->powers[pw_ironfeet])
|
||||
if (!(leveltime&0x1f))
|
||||
P_DamageMobj (player->mo, NULL, NULL, 5);
|
||||
break;
|
||||
|
||||
|
||||
case 16:
|
||||
// SUPER HELLSLIME DAMAGE
|
||||
case 4:
|
||||
@@ -1044,13 +1044,13 @@ void P_PlayerInSpecialSector (player_t* player)
|
||||
P_DamageMobj (player->mo, NULL, NULL, 20);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 9:
|
||||
// SECRET SECTOR
|
||||
player->secretcount++;
|
||||
sector->special = 0;
|
||||
break;
|
||||
|
||||
|
||||
case 11:
|
||||
// EXIT SUPER DAMAGE! (for E1M8 finale)
|
||||
player->cheats &= ~CF_GODMODE;
|
||||
@@ -1061,7 +1061,7 @@ void P_PlayerInSpecialSector (player_t* player)
|
||||
if (player->health <= 10)
|
||||
G_ExitLevel();
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
I_Error ("P_PlayerInSpecialSector: "
|
||||
"unknown special %i",
|
||||
@@ -1087,7 +1087,7 @@ void P_UpdateSpecials (void)
|
||||
int i;
|
||||
line_t* line;
|
||||
|
||||
|
||||
|
||||
// LEVEL TIMER
|
||||
if (levelTimer == true)
|
||||
{
|
||||
@@ -1095,7 +1095,7 @@ void P_UpdateSpecials (void)
|
||||
if (!levelTimeCount)
|
||||
G_ExitLevel();
|
||||
}
|
||||
|
||||
|
||||
// ANIMATE FLATS AND TEXTURES GLOBALLY
|
||||
for (anim = anims ; anim < lastanim ; anim++)
|
||||
{
|
||||
@@ -1109,7 +1109,7 @@ void P_UpdateSpecials (void)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ANIMATE LINE SPECIALS
|
||||
for (i = 0; i < numlinespecials; i++)
|
||||
{
|
||||
@@ -1123,7 +1123,7 @@ void P_UpdateSpecials (void)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// DO BUTTONS
|
||||
for (i = 0; i < MAXBUTTONS; i++)
|
||||
if (buttonlist[i].btimer)
|
||||
@@ -1137,12 +1137,12 @@ void P_UpdateSpecials (void)
|
||||
sides[buttonlist[i].line->sidenum[0]].toptexture =
|
||||
buttonlist[i].btexture;
|
||||
break;
|
||||
|
||||
|
||||
case middle:
|
||||
sides[buttonlist[i].line->sidenum[0]].midtexture =
|
||||
buttonlist[i].btexture;
|
||||
break;
|
||||
|
||||
|
||||
case bottom:
|
||||
sides[buttonlist[i].line->sidenum[0]].bottomtexture =
|
||||
buttonlist[i].btexture;
|
||||
@@ -1152,13 +1152,13 @@ void P_UpdateSpecials (void)
|
||||
memset(&buttonlist[i],0,sizeof(button_t));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Special Stuff that cannot be categorized
|
||||
// Special Stuff that can not be categorized
|
||||
//
|
||||
int EV_DoDonut(line_t* line)
|
||||
{
|
||||
@@ -1169,17 +1169,17 @@ int EV_DoDonut(line_t* line)
|
||||
int rtn;
|
||||
int i;
|
||||
floormove_t* floor;
|
||||
|
||||
|
||||
secnum = -1;
|
||||
rtn = 0;
|
||||
while ((secnum = P_FindSectorFromLineTag(line,secnum)) >= 0)
|
||||
{
|
||||
s1 = §ors[secnum];
|
||||
|
||||
|
||||
// ALREADY MOVING? IF SO, KEEP GOING...
|
||||
if (s1->specialdata)
|
||||
continue;
|
||||
|
||||
|
||||
rtn = 1;
|
||||
s2 = getNextSector(s1->lines[0],s1);
|
||||
for (i = 0;i < s2->linecount;i++)
|
||||
@@ -1188,7 +1188,7 @@ int EV_DoDonut(line_t* line)
|
||||
(s2->lines[i]->backsector == s1))
|
||||
continue;
|
||||
s3 = s2->lines[i]->backsector;
|
||||
|
||||
|
||||
// Spawn rising slime
|
||||
floor = Z_Malloc (sizeof(*floor), PU_LEVSPEC, 0);
|
||||
P_AddThinker (&floor->thinker);
|
||||
@@ -1202,7 +1202,7 @@ int EV_DoDonut(line_t* line)
|
||||
floor->texture = s3->floorpic;
|
||||
floor->newspecial = 0;
|
||||
floor->floordestheight = s3->floorheight;
|
||||
|
||||
|
||||
// Spawn lowering donut-hole
|
||||
floor = Z_Malloc (sizeof(*floor), PU_LEVSPEC, 0);
|
||||
P_AddThinker (&floor->thinker);
|
||||
@@ -1246,17 +1246,17 @@ void P_SpawnSpecials (void)
|
||||
if (W_CheckNumForName("texture2") >= 0)
|
||||
episode = 2;
|
||||
|
||||
|
||||
|
||||
// See if -TIMER needs to be used.
|
||||
levelTimer = false;
|
||||
|
||||
|
||||
i = M_CheckParm("-avg");
|
||||
if (i && deathmatch)
|
||||
{
|
||||
levelTimer = true;
|
||||
levelTimeCount = 20 * 60 * 35;
|
||||
}
|
||||
|
||||
|
||||
i = M_CheckParm("-timer");
|
||||
if (i && deathmatch)
|
||||
{
|
||||
@@ -1265,14 +1265,14 @@ void P_SpawnSpecials (void)
|
||||
levelTimer = true;
|
||||
levelTimeCount = time;
|
||||
}
|
||||
|
||||
|
||||
// Init special SECTORs.
|
||||
sector = sectors;
|
||||
for (i=0 ; i<numsectors ; i++, sector++)
|
||||
{
|
||||
if (!sector->special)
|
||||
continue;
|
||||
|
||||
|
||||
switch (sector->special)
|
||||
{
|
||||
case 1:
|
||||
@@ -1284,18 +1284,18 @@ void P_SpawnSpecials (void)
|
||||
// STROBE FAST
|
||||
P_SpawnStrobeFlash(sector,FASTDARK,0);
|
||||
break;
|
||||
|
||||
|
||||
case 3:
|
||||
// STROBE SLOW
|
||||
P_SpawnStrobeFlash(sector,SLOWDARK,0);
|
||||
break;
|
||||
|
||||
|
||||
case 4:
|
||||
// STROBE FAST/DEATH SLIME
|
||||
P_SpawnStrobeFlash(sector,FASTDARK,0);
|
||||
sector->special = 4;
|
||||
break;
|
||||
|
||||
|
||||
case 8:
|
||||
// GLOWING LIGHT
|
||||
P_SpawnGlowingLight(sector);
|
||||
@@ -1304,12 +1304,12 @@ void P_SpawnSpecials (void)
|
||||
// SECRET SECTOR
|
||||
totalsecret++;
|
||||
break;
|
||||
|
||||
|
||||
case 10:
|
||||
// DOOR CLOSE IN 30 SECONDS
|
||||
P_SpawnDoorCloseIn30 (sector);
|
||||
break;
|
||||
|
||||
|
||||
case 12:
|
||||
// SYNC STROBE SLOW
|
||||
P_SpawnStrobeFlash (sector, SLOWDARK, 1);
|
||||
@@ -1324,14 +1324,14 @@ void P_SpawnSpecials (void)
|
||||
// DOOR RAISE IN 5 MINUTES
|
||||
P_SpawnDoorRaiseIn5Mins (sector, i);
|
||||
break;
|
||||
|
||||
|
||||
case 17:
|
||||
P_SpawnFireFlicker(sector);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Init line EFFECTs
|
||||
numlinespecials = 0;
|
||||
for (i = 0;i < numlines; i++)
|
||||
@@ -1346,17 +1346,17 @@ void P_SpawnSpecials (void)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Init other misc stuff
|
||||
for (i = 0;i < MAXCEILINGS;i++)
|
||||
activeceilings[i] = NULL;
|
||||
|
||||
for (i = 0;i < MAXPLATS;i++)
|
||||
activeplats[i] = NULL;
|
||||
|
||||
|
||||
for (i = 0;i < MAXBUTTONS;i++)
|
||||
memset(&buttonlist[i],0,sizeof(button_t));
|
||||
|
||||
// UNUSED: no horizontal sliders.
|
||||
// UNUSED: no horizonal sliders.
|
||||
// P_InitSlidingDoorFrames();
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $Id:$
|
||||
@@ -46,7 +46,7 @@ rcsid[] = "$Id: p_user.c,v 1.3 1997/01/28 22:08:29 b1 Exp $";
|
||||
//
|
||||
|
||||
// 16 pixels of bob
|
||||
#define MAXBOB 0x100000
|
||||
#define MAXBOB 0x100000
|
||||
|
||||
boolean onground;
|
||||
|
||||
@@ -59,11 +59,11 @@ void
|
||||
P_Thrust
|
||||
( player_t* player,
|
||||
angle_t angle,
|
||||
fixed_t move )
|
||||
fixed_t move )
|
||||
{
|
||||
angle >>= ANGLETOFINESHIFT;
|
||||
|
||||
player->mo->momx += FixedMul(move,finecosine[angle]);
|
||||
|
||||
player->mo->momx += FixedMul(move,finecosine[angle]);
|
||||
player->mo->momy += FixedMul(move,finesine[angle]);
|
||||
}
|
||||
|
||||
@@ -74,11 +74,11 @@ P_Thrust
|
||||
// P_CalcHeight
|
||||
// Calculate the walking / running height adjustment
|
||||
//
|
||||
void P_CalcHeight (player_t* player)
|
||||
void P_CalcHeight (player_t* player)
|
||||
{
|
||||
int angle;
|
||||
fixed_t bob;
|
||||
|
||||
|
||||
// Regular movement bobbing
|
||||
// (needs to be calculated for gun swing
|
||||
// even if not on ground)
|
||||
@@ -88,7 +88,7 @@ void P_CalcHeight (player_t* player)
|
||||
player->bob =
|
||||
FixedMul (player->mo->momx, player->mo->momx)
|
||||
+ FixedMul (player->mo->momy,player->mo->momy);
|
||||
|
||||
|
||||
player->bob >>= 2;
|
||||
|
||||
if (player->bob>MAXBOB)
|
||||
@@ -104,11 +104,11 @@ void P_CalcHeight (player_t* player)
|
||||
player->viewz = player->mo->z + player->viewheight;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
angle = (FINEANGLES/20*leveltime)&FINEMASK;
|
||||
bob = FixedMul ( player->bob/2, finesine[angle]);
|
||||
|
||||
|
||||
|
||||
// move viewheight
|
||||
if (player->playerstate == PST_LIVE)
|
||||
{
|
||||
@@ -126,8 +126,8 @@ void P_CalcHeight (player_t* player)
|
||||
if (player->deltaviewheight <= 0)
|
||||
player->deltaviewheight = 1;
|
||||
}
|
||||
|
||||
if (player->deltaviewheight)
|
||||
|
||||
if (player->deltaviewheight)
|
||||
{
|
||||
player->deltaviewheight += FRACUNIT/4;
|
||||
if (!player->deltaviewheight)
|
||||
@@ -148,27 +148,27 @@ void P_CalcHeight (player_t* player)
|
||||
void P_MovePlayer (player_t* player)
|
||||
{
|
||||
ticcmd_t* cmd;
|
||||
|
||||
|
||||
cmd = &player->cmd;
|
||||
|
||||
|
||||
player->mo->angle += (cmd->angleturn<<16);
|
||||
|
||||
// Do not let the player control movement
|
||||
// if not onground.
|
||||
onground = (player->mo->z <= player->mo->floorz);
|
||||
|
||||
|
||||
if (cmd->forwardmove && onground)
|
||||
P_Thrust (player, player->mo->angle, cmd->forwardmove*2048);
|
||||
|
||||
|
||||
if (cmd->sidemove && onground)
|
||||
P_Thrust (player, player->mo->angle-ANG90, cmd->sidemove*2048);
|
||||
|
||||
if ( (cmd->forwardmove || cmd->sidemove)
|
||||
if ( (cmd->forwardmove || cmd->sidemove)
|
||||
&& player->mo->state == &states[S_PLAY] )
|
||||
{
|
||||
P_SetMobjState (player->mo, S_PLAY_RUN1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -185,7 +185,7 @@ void P_DeathThink (player_t* player)
|
||||
angle_t delta;
|
||||
|
||||
P_MovePsprites (player);
|
||||
|
||||
|
||||
// fall to the ground
|
||||
if (player->viewheight > 6*FRACUNIT)
|
||||
player->viewheight -= FRACUNIT;
|
||||
@@ -196,16 +196,16 @@ void P_DeathThink (player_t* player)
|
||||
player->deltaviewheight = 0;
|
||||
onground = (player->mo->z <= player->mo->floorz);
|
||||
P_CalcHeight (player);
|
||||
|
||||
|
||||
if (player->attacker && player->attacker != player->mo)
|
||||
{
|
||||
angle = R_PointToAngle2 (player->mo->x,
|
||||
player->mo->y,
|
||||
player->attacker->x,
|
||||
player->attacker->y);
|
||||
|
||||
|
||||
delta = angle - player->mo->angle;
|
||||
|
||||
|
||||
if (delta < ANG5 || delta > (unsigned)-ANG5)
|
||||
{
|
||||
// Looking at killer,
|
||||
@@ -222,7 +222,7 @@ void P_DeathThink (player_t* player)
|
||||
}
|
||||
else if (player->damagecount)
|
||||
player->damagecount--;
|
||||
|
||||
|
||||
|
||||
if (player->cmd.buttons & BT_USE)
|
||||
player->playerstate = PST_REBORN;
|
||||
@@ -237,13 +237,13 @@ void P_PlayerThink (player_t* player)
|
||||
{
|
||||
ticcmd_t* cmd;
|
||||
weapontype_t newweapon;
|
||||
|
||||
|
||||
// fixme: do this in the cheat code
|
||||
if (player->cheats & CF_NOCLIP)
|
||||
player->mo->flags |= MF_NOCLIP;
|
||||
else
|
||||
player->mo->flags &= ~MF_NOCLIP;
|
||||
|
||||
|
||||
// chain saw run forward
|
||||
cmd = &player->cmd;
|
||||
if (player->mo->flags & MF_JUSTATTACKED)
|
||||
@@ -253,14 +253,14 @@ void P_PlayerThink (player_t* player)
|
||||
cmd->sidemove = 0;
|
||||
player->mo->flags &= ~MF_JUSTATTACKED;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if (player->playerstate == PST_DEAD)
|
||||
{
|
||||
P_DeathThink (player);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Move around.
|
||||
// Reactiontime is used to prevent movement
|
||||
// for a bit after a teleport.
|
||||
@@ -268,25 +268,25 @@ void P_PlayerThink (player_t* player)
|
||||
player->mo->reactiontime--;
|
||||
else
|
||||
P_MovePlayer (player);
|
||||
|
||||
|
||||
P_CalcHeight (player);
|
||||
|
||||
if (player->mo->subsector->sector->special)
|
||||
P_PlayerInSpecialSector (player);
|
||||
|
||||
|
||||
// Check for weapon change.
|
||||
|
||||
// A special event has no other buttons.
|
||||
if (cmd->buttons & BT_SPECIAL)
|
||||
cmd->buttons = 0;
|
||||
|
||||
cmd->buttons = 0;
|
||||
|
||||
if (cmd->buttons & BT_CHANGE)
|
||||
{
|
||||
// The actual changing of the weapon is done
|
||||
// when the weapon psprite can do it
|
||||
// (read: not in the middle of an attack).
|
||||
newweapon = (cmd->buttons&BT_WEAPONMASK)>>BT_WEAPONSHIFT;
|
||||
|
||||
|
||||
if (newweapon == wp_fist
|
||||
&& player->weaponowned[wp_chainsaw]
|
||||
&& !(player->readyweapon == wp_chainsaw
|
||||
@@ -294,15 +294,15 @@ void P_PlayerThink (player_t* player)
|
||||
{
|
||||
newweapon = wp_chainsaw;
|
||||
}
|
||||
|
||||
|
||||
if ( (gamemode == commercial)
|
||||
&& newweapon == wp_shotgun
|
||||
&& newweapon == wp_shotgun
|
||||
&& player->weaponowned[wp_supershotgun]
|
||||
&& player->readyweapon != wp_supershotgun)
|
||||
{
|
||||
newweapon = wp_supershotgun;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (player->weaponowned[newweapon]
|
||||
&& newweapon != player->readyweapon)
|
||||
@@ -317,7 +317,7 @@ void P_PlayerThink (player_t* player)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// check for use
|
||||
if (cmd->buttons & BT_USE)
|
||||
{
|
||||
@@ -329,36 +329,36 @@ void P_PlayerThink (player_t* player)
|
||||
}
|
||||
else
|
||||
player->usedown = false;
|
||||
|
||||
|
||||
// cycle psprites
|
||||
P_MovePsprites (player);
|
||||
|
||||
// Counters, time dependent power ups.
|
||||
|
||||
// Counters, time dependend power ups.
|
||||
|
||||
// Strength counts up to diminish fade.
|
||||
if (player->powers[pw_strength])
|
||||
player->powers[pw_strength]++;
|
||||
|
||||
player->powers[pw_strength]++;
|
||||
|
||||
if (player->powers[pw_invulnerability])
|
||||
player->powers[pw_invulnerability]--;
|
||||
|
||||
if (player->powers[pw_invisibility])
|
||||
if (! --player->powers[pw_invisibility] )
|
||||
player->mo->flags &= ~MF_SHADOW;
|
||||
|
||||
|
||||
if (player->powers[pw_infrared])
|
||||
player->powers[pw_infrared]--;
|
||||
|
||||
|
||||
if (player->powers[pw_ironfeet])
|
||||
player->powers[pw_ironfeet]--;
|
||||
|
||||
|
||||
if (player->damagecount)
|
||||
player->damagecount--;
|
||||
|
||||
|
||||
if (player->bonuscount)
|
||||
player->bonuscount--;
|
||||
|
||||
|
||||
|
||||
// Handling colormaps.
|
||||
if (player->powers[pw_invulnerability])
|
||||
{
|
||||
@@ -368,7 +368,7 @@ void P_PlayerThink (player_t* player)
|
||||
else
|
||||
player->fixedcolormap = 0;
|
||||
}
|
||||
else if (player->powers[pw_infrared])
|
||||
else if (player->powers[pw_infrared])
|
||||
{
|
||||
if (player->powers[pw_infrared] > 4*32
|
||||
|| (player->powers[pw_infrared]&8) )
|
||||
@@ -382,3 +382,5 @@ void P_PlayerThink (player_t* player)
|
||||
else
|
||||
player->fixedcolormap = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $Id:$
|
||||
@@ -57,7 +57,7 @@ extern void *alloca(int);
|
||||
// is stored in vertical runs of opaque pixels (posts).
|
||||
// A column is composed of zero or more posts,
|
||||
// a patch or sprite is composed of zero or more columns.
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ typedef struct
|
||||
typedef struct
|
||||
{
|
||||
char name[8];
|
||||
boolean masked;
|
||||
boolean masked;
|
||||
short width;
|
||||
short height;
|
||||
void **columndirectory; // OBSOLETE
|
||||
@@ -101,10 +101,10 @@ typedef struct
|
||||
// the texture rectangle.
|
||||
typedef struct
|
||||
{
|
||||
// Block origin (always UL),
|
||||
// which has already accounted
|
||||
// Block origin (allways UL),
|
||||
// which has allready accounted
|
||||
// for the internal origin of the patch.
|
||||
int originx;
|
||||
int originx;
|
||||
int originy;
|
||||
int patch;
|
||||
} texpatch_t;
|
||||
@@ -116,15 +116,15 @@ typedef struct
|
||||
typedef struct
|
||||
{
|
||||
// Keep name for switch changing, etc.
|
||||
char name[8];
|
||||
char name[8];
|
||||
short width;
|
||||
short height;
|
||||
|
||||
|
||||
// All the patches[patchcount]
|
||||
// are drawn back to front into the cached texture.
|
||||
short patchcount;
|
||||
texpatch_t patches[1];
|
||||
|
||||
texpatch_t patches[1];
|
||||
|
||||
} texture_t;
|
||||
|
||||
|
||||
@@ -147,7 +147,7 @@ texture_t** textures;
|
||||
|
||||
int* texturewidthmask;
|
||||
// needed for texture pegging
|
||||
fixed_t* textureheight;
|
||||
fixed_t* textureheight;
|
||||
int* texturecompositesize;
|
||||
short** texturecolumnlump;
|
||||
unsigned short** texturecolumnofs;
|
||||
@@ -158,7 +158,7 @@ int* flattranslation;
|
||||
int* texturetranslation;
|
||||
|
||||
// needed for pre rendering
|
||||
fixed_t* spritewidth;
|
||||
fixed_t* spritewidth;
|
||||
fixed_t* spriteoffset;
|
||||
fixed_t* spritetopoffset;
|
||||
|
||||
@@ -195,9 +195,9 @@ R_DrawColumnInCache
|
||||
int position;
|
||||
byte* source;
|
||||
byte* dest;
|
||||
|
||||
|
||||
dest = (byte *)cache + 3;
|
||||
|
||||
|
||||
while (patch->topdelta != 0xff)
|
||||
{
|
||||
source = (byte *)patch + 3;
|
||||
@@ -215,8 +215,8 @@ R_DrawColumnInCache
|
||||
|
||||
if (count > 0)
|
||||
memcpy (cache + position, source, count);
|
||||
|
||||
patch = (column_t *)( (byte *)patch + patch->length + 4);
|
||||
|
||||
patch = (column_t *)( (byte *)patch + patch->length + 4);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -232,7 +232,7 @@ void R_GenerateComposite (int texnum)
|
||||
{
|
||||
byte* block;
|
||||
texture_t* texture;
|
||||
texpatch_t* patch;
|
||||
texpatch_t* patch;
|
||||
patch_t* realpatch;
|
||||
int x;
|
||||
int x1;
|
||||
@@ -241,19 +241,19 @@ void R_GenerateComposite (int texnum)
|
||||
column_t* patchcol;
|
||||
short* collump;
|
||||
unsigned short* colofs;
|
||||
|
||||
|
||||
texture = textures[texnum];
|
||||
|
||||
block = Z_Malloc (texturecompositesize[texnum],
|
||||
PU_STATIC,
|
||||
&texturecomposite[texnum]);
|
||||
PU_STATIC,
|
||||
&texturecomposite[texnum]);
|
||||
|
||||
collump = texturecolumnlump[texnum];
|
||||
colofs = texturecolumnofs[texnum];
|
||||
|
||||
|
||||
// Composite the columns together.
|
||||
patch = texture->patches;
|
||||
|
||||
|
||||
for (i=0 , patch = texture->patches;
|
||||
i<texture->patchcount;
|
||||
i++, patch++)
|
||||
@@ -266,7 +266,7 @@ void R_GenerateComposite (int texnum)
|
||||
x = 0;
|
||||
else
|
||||
x = x1;
|
||||
|
||||
|
||||
if (x2 > texture->width)
|
||||
x2 = texture->width;
|
||||
|
||||
@@ -275,7 +275,7 @@ void R_GenerateComposite (int texnum)
|
||||
// Column does not have multiple patches?
|
||||
if (collump[x] >= 0)
|
||||
continue;
|
||||
|
||||
|
||||
patchcol = (column_t *)((byte *)realpatch
|
||||
+ LONG(realpatch->columnofs[x-x1]));
|
||||
R_DrawColumnInCache (patchcol,
|
||||
@@ -283,11 +283,11 @@ void R_GenerateComposite (int texnum)
|
||||
patch->originy,
|
||||
texture->height);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Now that the texture has been built in column cache,
|
||||
// it is purgeable from zone memory.
|
||||
// it is purgable from zone memory.
|
||||
Z_ChangeTag (block, PU_CACHE);
|
||||
}
|
||||
|
||||
@@ -300,7 +300,7 @@ void R_GenerateLookup (int texnum)
|
||||
{
|
||||
texture_t* texture;
|
||||
byte* patchcount; // patchcount[texture->width]
|
||||
texpatch_t* patch;
|
||||
texpatch_t* patch;
|
||||
patch_t* realpatch;
|
||||
int x;
|
||||
int x1;
|
||||
@@ -308,16 +308,16 @@ void R_GenerateLookup (int texnum)
|
||||
int i;
|
||||
short* collump;
|
||||
unsigned short* colofs;
|
||||
|
||||
|
||||
texture = textures[texnum];
|
||||
|
||||
// Composited texture not created yet.
|
||||
texturecomposite[texnum] = 0;
|
||||
|
||||
|
||||
texturecompositesize[texnum] = 0;
|
||||
collump = texturecolumnlump[texnum];
|
||||
colofs = texturecolumnofs[texnum];
|
||||
|
||||
|
||||
// Now count the number of columns
|
||||
// that are covered by more than one patch.
|
||||
// Fill in the lump / offset, so columns
|
||||
@@ -325,7 +325,7 @@ void R_GenerateLookup (int texnum)
|
||||
patchcount = (byte *)alloca (texture->width);
|
||||
memset (patchcount, 0, texture->width);
|
||||
patch = texture->patches;
|
||||
|
||||
|
||||
for (i=0 , patch = texture->patches;
|
||||
i<texture->patchcount;
|
||||
i++, patch++)
|
||||
@@ -333,7 +333,7 @@ void R_GenerateLookup (int texnum)
|
||||
realpatch = W_CacheLumpNum (patch->patch, PU_CACHE);
|
||||
x1 = patch->originx;
|
||||
x2 = x1 + SHORT(realpatch->width);
|
||||
|
||||
|
||||
if (x1 < 0)
|
||||
x = 0;
|
||||
else
|
||||
@@ -348,7 +348,7 @@ void R_GenerateLookup (int texnum)
|
||||
colofs[x] = LONG(realpatch->columnofs[x-x1])+3;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (x=0 ; x<texture->width ; x++)
|
||||
{
|
||||
if (!patchcount[x])
|
||||
@@ -358,22 +358,22 @@ void R_GenerateLookup (int texnum)
|
||||
return;
|
||||
}
|
||||
// I_Error ("R_GenerateLookup: column without a patch");
|
||||
|
||||
|
||||
if (patchcount[x] > 1)
|
||||
{
|
||||
// Use the cached block.
|
||||
collump[x] = -1;
|
||||
collump[x] = -1;
|
||||
colofs[x] = texturecompositesize[texnum];
|
||||
|
||||
|
||||
if (texturecompositesize[texnum] > 0x10000-texture->height)
|
||||
{
|
||||
I_Error ("R_GenerateLookup: texture %i is >64k",
|
||||
texnum);
|
||||
}
|
||||
|
||||
|
||||
texturecompositesize[texnum] += texture->height;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -389,11 +389,11 @@ R_GetColumn
|
||||
{
|
||||
int lump;
|
||||
int ofs;
|
||||
|
||||
|
||||
col &= texturewidthmask[tex];
|
||||
lump = texturecolumnlump[tex][col];
|
||||
ofs = texturecolumnofs[tex][col];
|
||||
|
||||
|
||||
if (lump > 0)
|
||||
return (byte *)W_CacheLumpNum(lump,PU_CACHE)+ofs;
|
||||
|
||||
@@ -424,13 +424,13 @@ void R_InitTextures (void)
|
||||
int* maptex;
|
||||
int* maptex2;
|
||||
int* maptex1;
|
||||
|
||||
|
||||
char name[9];
|
||||
char* names;
|
||||
char* name_p;
|
||||
|
||||
|
||||
int* patchlookup;
|
||||
|
||||
|
||||
int totalwidth;
|
||||
int nummappatches;
|
||||
int offset;
|
||||
@@ -440,26 +440,26 @@ void R_InitTextures (void)
|
||||
int numtextures2;
|
||||
|
||||
int* directory;
|
||||
|
||||
|
||||
int temp1;
|
||||
int temp2;
|
||||
int temp3;
|
||||
|
||||
|
||||
|
||||
// Load the patch names from pnames.lmp.
|
||||
name[8] = 0;
|
||||
name[8] = 0;
|
||||
names = W_CacheLumpName ("PNAMES", PU_STATIC);
|
||||
nummappatches = LONG ( *((int *)names) );
|
||||
name_p = names+4;
|
||||
patchlookup = alloca (nummappatches*sizeof(*patchlookup));
|
||||
|
||||
|
||||
for (i=0 ; i<nummappatches ; i++)
|
||||
{
|
||||
strncpy (name,name_p+i*8, 8);
|
||||
patchlookup[i] = W_CheckNumForName (name);
|
||||
}
|
||||
Z_Free (names);
|
||||
|
||||
|
||||
// Load the map texture definitions from textures.lmp.
|
||||
// The data is contained in one or two lumps,
|
||||
// TEXTURE1 for shareware, plus TEXTURE2 for commercial.
|
||||
@@ -467,7 +467,7 @@ void R_InitTextures (void)
|
||||
numtextures1 = LONG(*maptex);
|
||||
maxoff = W_LumpLength (W_GetNumForName ("TEXTURE1"));
|
||||
directory = maptex+1;
|
||||
|
||||
|
||||
if (W_CheckNumForName ("TEXTURE2") != -1)
|
||||
{
|
||||
maptex2 = W_CacheLumpName ("TEXTURE2", PU_STATIC);
|
||||
@@ -481,7 +481,7 @@ void R_InitTextures (void)
|
||||
maxoff2 = 0;
|
||||
}
|
||||
numtextures = numtextures1 + numtextures2;
|
||||
|
||||
|
||||
textures = Z_Malloc (numtextures*4, PU_STATIC, 0);
|
||||
texturecolumnlump = Z_Malloc (numtextures*4, PU_STATIC, 0);
|
||||
texturecolumnofs = Z_Malloc (numtextures*4, PU_STATIC, 0);
|
||||
@@ -491,7 +491,7 @@ void R_InitTextures (void)
|
||||
textureheight = Z_Malloc (numtextures*4, PU_STATIC, 0);
|
||||
|
||||
totalwidth = 0;
|
||||
|
||||
|
||||
// Really complex printing shit...
|
||||
temp1 = W_GetNumForName ("S_START"); // P_???????
|
||||
temp2 = W_GetNumForName ("S_END") - 1;
|
||||
@@ -502,8 +502,8 @@ void R_InitTextures (void)
|
||||
printf(" ]");
|
||||
for (i = 0; i < temp3; i++)
|
||||
printf("\x8");
|
||||
printf("\x8\x8\x8\x8\x8\x8\x8\x8\x8\x8");
|
||||
|
||||
printf("\x8\x8\x8\x8\x8\x8\x8\x8\x8\x8");
|
||||
|
||||
for (i=0 ; i<numtextures ; i++, directory++)
|
||||
{
|
||||
if (!(i&63))
|
||||
@@ -521,14 +521,14 @@ void R_InitTextures (void)
|
||||
|
||||
if (offset > maxoff)
|
||||
I_Error ("R_InitTextures: bad texture directory");
|
||||
|
||||
|
||||
mtexture = (maptexture_t *) ( (byte *)maptex + offset);
|
||||
|
||||
texture = textures[i] =
|
||||
Z_Malloc (sizeof(texture_t)
|
||||
+ sizeof(texpatch_t)*(SHORT(mtexture->patchcount)-1),
|
||||
PU_STATIC, 0);
|
||||
|
||||
|
||||
texture->width = SHORT(mtexture->width);
|
||||
texture->height = SHORT(mtexture->height);
|
||||
texture->patchcount = SHORT(mtexture->patchcount);
|
||||
@@ -557,7 +557,7 @@ void R_InitTextures (void)
|
||||
I_Error ("R_InitTextures: Missing patch in texture %s",
|
||||
texture->name);
|
||||
}
|
||||
}
|
||||
}
|
||||
texturecolumnlump[i] = Z_Malloc (texture->width*2, PU_STATIC,0);
|
||||
texturecolumnofs[i] = Z_Malloc (texture->width*2, PU_STATIC,0);
|
||||
|
||||
@@ -567,21 +567,21 @@ void R_InitTextures (void)
|
||||
|
||||
texturewidthmask[i] = j-1;
|
||||
textureheight[i] = texture->height<<FRACBITS;
|
||||
|
||||
|
||||
totalwidth += texture->width;
|
||||
}
|
||||
|
||||
Z_Free (maptex1);
|
||||
if (maptex2)
|
||||
Z_Free (maptex2);
|
||||
|
||||
// Precalculate whatever possible.
|
||||
|
||||
// Precalculate whatever possible.
|
||||
for (i=0 ; i<numtextures ; i++)
|
||||
R_GenerateLookup (i);
|
||||
|
||||
|
||||
// Create translation table for global animation.
|
||||
texturetranslation = Z_Malloc ((numtextures+1)*4, PU_STATIC, 0);
|
||||
|
||||
|
||||
for (i=0 ; i<numtextures ; i++)
|
||||
texturetranslation[i] = i;
|
||||
}
|
||||
@@ -594,14 +594,14 @@ void R_InitTextures (void)
|
||||
void R_InitFlats (void)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
firstflat = W_GetNumForName ("F_START") + 1;
|
||||
lastflat = W_GetNumForName ("F_END") - 1;
|
||||
numflats = lastflat - firstflat + 1;
|
||||
|
||||
|
||||
// Create translation table for global animation.
|
||||
flattranslation = Z_Malloc ((numflats+1)*4, PU_STATIC, 0);
|
||||
|
||||
|
||||
for (i=0 ; i<numflats ; i++)
|
||||
flattranslation[i] = i;
|
||||
}
|
||||
@@ -617,15 +617,15 @@ void R_InitSpriteLumps (void)
|
||||
{
|
||||
int i;
|
||||
patch_t *patch;
|
||||
|
||||
|
||||
firstspritelump = W_GetNumForName ("S_START") + 1;
|
||||
lastspritelump = W_GetNumForName ("S_END") - 1;
|
||||
|
||||
|
||||
numspritelumps = lastspritelump - firstspritelump + 1;
|
||||
spritewidth = Z_Malloc (numspritelumps*4, PU_STATIC, 0);
|
||||
spriteoffset = Z_Malloc (numspritelumps*4, PU_STATIC, 0);
|
||||
spritetopoffset = Z_Malloc (numspritelumps*4, PU_STATIC, 0);
|
||||
|
||||
|
||||
for (i=0 ; i< numspritelumps ; i++)
|
||||
{
|
||||
if (!(i&63))
|
||||
@@ -646,14 +646,14 @@ void R_InitSpriteLumps (void)
|
||||
void R_InitColormaps (void)
|
||||
{
|
||||
int lump, length;
|
||||
|
||||
// Load in the light tables,
|
||||
|
||||
// Load in the light tables,
|
||||
// 256 byte align tables.
|
||||
lump = W_GetNumForName("COLORMAP");
|
||||
length = W_LumpLength (lump) + 255;
|
||||
colormaps = Z_Malloc (length, PU_STATIC, 0);
|
||||
colormaps = (byte *)( ((int)colormaps + 255)&~0xff);
|
||||
W_ReadLump (lump,colormaps);
|
||||
lump = W_GetNumForName("COLORMAP");
|
||||
length = W_LumpLength (lump) + 255;
|
||||
colormaps = Z_Malloc (length, PU_STATIC, 0);
|
||||
colormaps = (byte *)( ((int)colormaps + 255)&~0xff);
|
||||
W_ReadLump (lump,colormaps);
|
||||
}
|
||||
|
||||
|
||||
@@ -711,13 +711,13 @@ int R_CheckTextureNumForName (char *name)
|
||||
int i;
|
||||
|
||||
// "NoTexture" marker.
|
||||
if (name[0] == '-')
|
||||
if (name[0] == '-')
|
||||
return 0;
|
||||
|
||||
|
||||
for (i=0 ; i<numtextures ; i++)
|
||||
if (!I_strncasecmp (textures[i]->name, name, 8) )
|
||||
return i;
|
||||
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -731,7 +731,7 @@ int R_CheckTextureNumForName (char *name)
|
||||
int R_TextureNumForName (char* name)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
i = R_CheckTextureNumForName (name);
|
||||
|
||||
if (i==-1)
|
||||
@@ -763,24 +763,24 @@ void R_PrecacheLevel (void)
|
||||
int j;
|
||||
int k;
|
||||
int lump;
|
||||
|
||||
|
||||
texture_t* texture;
|
||||
thinker_t* th;
|
||||
spriteframe_t* sf;
|
||||
|
||||
if (demoplayback)
|
||||
return;
|
||||
|
||||
|
||||
// Precache flats.
|
||||
flatpresent = alloca(numflats);
|
||||
memset (flatpresent,0,numflats);
|
||||
memset (flatpresent,0,numflats);
|
||||
|
||||
for (i=0 ; i<numsectors ; i++)
|
||||
{
|
||||
flatpresent[sectors[i].floorpic] = 1;
|
||||
flatpresent[sectors[i].ceilingpic] = 1;
|
||||
}
|
||||
|
||||
|
||||
flatmemory = 0;
|
||||
|
||||
for (i=0 ; i<numflats ; i++)
|
||||
@@ -792,11 +792,11 @@ void R_PrecacheLevel (void)
|
||||
W_CacheLumpNum(lump, PU_CACHE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Precache textures.
|
||||
texturepresent = alloca(numtextures);
|
||||
memset (texturepresent,0, numtextures);
|
||||
|
||||
|
||||
for (i=0 ; i<numsides ; i++)
|
||||
{
|
||||
texturepresent[sides[i].toptexture] = 1;
|
||||
@@ -808,10 +808,10 @@ void R_PrecacheLevel (void)
|
||||
// Note that F_SKY1 is the name used to
|
||||
// indicate a sky floor/ceiling as a flat,
|
||||
// while the sky texture is stored like
|
||||
// a wall texture, with an episode dependent
|
||||
// a wall texture, with an episode dependend
|
||||
// name.
|
||||
texturepresent[skytexture] = 1;
|
||||
|
||||
|
||||
texturememory = 0;
|
||||
for (i=0 ; i<numtextures ; i++)
|
||||
{
|
||||
@@ -819,7 +819,7 @@ void R_PrecacheLevel (void)
|
||||
continue;
|
||||
|
||||
texture = textures[i];
|
||||
|
||||
|
||||
for (j=0 ; j<texture->patchcount ; j++)
|
||||
{
|
||||
lump = texture->patches[j].patch;
|
||||
@@ -827,17 +827,17 @@ void R_PrecacheLevel (void)
|
||||
W_CacheLumpNum(lump , PU_CACHE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Precache sprites.
|
||||
spritepresent = alloca(numsprites);
|
||||
memset (spritepresent,0, numsprites);
|
||||
|
||||
|
||||
for (th = thinkercap.next ; th != &thinkercap ; th=th->next)
|
||||
{
|
||||
if (th->function.acp1 == (actionf_p1)P_MobjThinker)
|
||||
spritepresent[((mobj_t *)th)->sprite] = 1;
|
||||
}
|
||||
|
||||
|
||||
spritememory = 0;
|
||||
for (i=0 ; i<numsprites ; i++)
|
||||
{
|
||||
@@ -856,3 +856,7 @@ void R_PrecacheLevel (void)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $Id:$
|
||||
@@ -72,7 +72,7 @@ typedef struct
|
||||
{
|
||||
fixed_t x;
|
||||
fixed_t y;
|
||||
|
||||
|
||||
} vertex_t;
|
||||
|
||||
|
||||
@@ -126,12 +126,12 @@ typedef struct
|
||||
// list of mobjs in sector
|
||||
mobj_t* thinglist;
|
||||
|
||||
// thinker_t for reversible actions
|
||||
// thinker_t for reversable actions
|
||||
void* specialdata;
|
||||
|
||||
int linecount;
|
||||
struct line_s** lines; // [linecount] size
|
||||
|
||||
|
||||
} sector_t;
|
||||
|
||||
|
||||
@@ -145,19 +145,19 @@ typedef struct
|
||||
{
|
||||
// add this to the calculated texture column
|
||||
fixed_t textureoffset;
|
||||
|
||||
|
||||
// add this to the calculated texture top
|
||||
fixed_t rowoffset;
|
||||
|
||||
// Texture indices.
|
||||
// We do not maintain names here.
|
||||
// We do not maintain names here.
|
||||
short toptexture;
|
||||
short bottomtexture;
|
||||
short midtexture;
|
||||
|
||||
// Sector the SideDef is facing.
|
||||
sector_t* sector;
|
||||
|
||||
|
||||
} side_t;
|
||||
|
||||
|
||||
@@ -193,7 +193,7 @@ typedef struct line_s
|
||||
|
||||
// Visual appearance: SideDefs.
|
||||
// sidenum[1] will be -1 if one sided
|
||||
short sidenum[2];
|
||||
short sidenum[2];
|
||||
|
||||
// Neat. Another bounding box, for the extent
|
||||
// of the LineDef.
|
||||
@@ -210,8 +210,8 @@ typedef struct line_s
|
||||
// if == validcount, already checked
|
||||
int validcount;
|
||||
|
||||
// thinker_t for reversible actions
|
||||
void* specialdata;
|
||||
// thinker_t for reversable actions
|
||||
void* specialdata;
|
||||
} line_t;
|
||||
|
||||
|
||||
@@ -229,7 +229,7 @@ typedef struct subsector_s
|
||||
sector_t* sector;
|
||||
short numlines;
|
||||
short firstline;
|
||||
|
||||
|
||||
} subsector_t;
|
||||
|
||||
|
||||
@@ -241,7 +241,7 @@ typedef struct
|
||||
{
|
||||
vertex_t* v1;
|
||||
vertex_t* v2;
|
||||
|
||||
|
||||
fixed_t offset;
|
||||
|
||||
angle_t angle;
|
||||
@@ -254,7 +254,7 @@ typedef struct
|
||||
// backsector is NULL for one sided lines
|
||||
sector_t* frontsector;
|
||||
sector_t* backsector;
|
||||
|
||||
|
||||
} seg_t;
|
||||
|
||||
|
||||
@@ -275,7 +275,7 @@ typedef struct
|
||||
|
||||
// If NF_SUBSECTOR its a subsector.
|
||||
unsigned short children[2];
|
||||
|
||||
|
||||
} node_t;
|
||||
|
||||
|
||||
@@ -307,11 +307,11 @@ typedef post_t column_t;
|
||||
//
|
||||
|
||||
// This could be wider for >8 bit display.
|
||||
// Indeed, true color support is possible
|
||||
// Indeed, true color support is posibble
|
||||
// precalculating 24bpp lightmap/colormap LUT.
|
||||
// from darkening PLAYPAL to all black.
|
||||
// Could even us emore than 32 levels.
|
||||
typedef byte lighttable_t;
|
||||
typedef byte lighttable_t;
|
||||
|
||||
|
||||
|
||||
@@ -337,13 +337,13 @@ typedef struct drawseg_s
|
||||
|
||||
// do not clip sprites below this
|
||||
fixed_t tsilheight;
|
||||
|
||||
|
||||
// Pointers to lists for sprite clipping,
|
||||
// all three adjusted so [x1] is first value.
|
||||
short* sprtopclip;
|
||||
short* sprbottomclip;
|
||||
short* sprtopclip;
|
||||
short* sprbottomclip;
|
||||
short* maskedtexturecol;
|
||||
|
||||
|
||||
} drawseg_t;
|
||||
|
||||
|
||||
@@ -353,14 +353,14 @@ typedef struct drawseg_s
|
||||
// Patches are used for sprites and all masked pictures,
|
||||
// and we compose textures from the TEXTURE1/2 lists
|
||||
// of patches.
|
||||
typedef struct
|
||||
{
|
||||
short width; // bounding box size
|
||||
short height;
|
||||
short leftoffset; // pixels to the left of origin
|
||||
short topoffset; // pixels below the origin
|
||||
typedef struct
|
||||
{
|
||||
short width; // bounding box size
|
||||
short height;
|
||||
short leftoffset; // pixels to the left of origin
|
||||
short topoffset; // pixels below the origin
|
||||
int columnofs[8]; // only [width] used
|
||||
// the [0] is &columnofs[width]
|
||||
// the [0] is &columnofs[width]
|
||||
} patch_t;
|
||||
|
||||
|
||||
@@ -377,13 +377,13 @@ typedef struct vissprite_s
|
||||
// Doubly linked list.
|
||||
struct vissprite_s* prev;
|
||||
struct vissprite_s* next;
|
||||
|
||||
|
||||
int x1;
|
||||
int x2;
|
||||
|
||||
// for line side calculation
|
||||
fixed_t gx;
|
||||
fixed_t gy;
|
||||
fixed_t gy;
|
||||
|
||||
// global bottom / top for silhouette clipping
|
||||
fixed_t gz;
|
||||
@@ -391,11 +391,11 @@ typedef struct vissprite_s
|
||||
|
||||
// horizontal position of x1
|
||||
fixed_t startfrac;
|
||||
|
||||
|
||||
fixed_t scale;
|
||||
|
||||
|
||||
// negative if flipped
|
||||
fixed_t xiscale;
|
||||
fixed_t xiscale;
|
||||
|
||||
fixed_t texturemid;
|
||||
int patch;
|
||||
@@ -403,13 +403,13 @@ typedef struct vissprite_s
|
||||
// for color translation and shadow draw,
|
||||
// maxbright frames as well
|
||||
lighttable_t* colormap;
|
||||
|
||||
|
||||
int mobjflags;
|
||||
|
||||
|
||||
} vissprite_t;
|
||||
|
||||
|
||||
//
|
||||
//
|
||||
// Sprites are patches with a special naming convention
|
||||
// so they can be recognized by R_InitSprites.
|
||||
// The base name is NNNNFx or NNNNFxFx, with
|
||||
@@ -436,7 +436,7 @@ typedef struct
|
||||
|
||||
// Flip bit (1 = flip) to use for view angles 0-7.
|
||||
byte flip[8];
|
||||
|
||||
|
||||
} spriteframe_t;
|
||||
|
||||
|
||||
@@ -456,7 +456,7 @@ typedef struct
|
||||
|
||||
//
|
||||
// Now what is a visplane, anyway?
|
||||
//
|
||||
//
|
||||
typedef struct
|
||||
{
|
||||
fixed_t height;
|
||||
@@ -464,9 +464,9 @@ typedef struct
|
||||
int lightlevel;
|
||||
int minx;
|
||||
int maxx;
|
||||
|
||||
|
||||
// leave pads for [minx-1]/[maxx+1]
|
||||
|
||||
|
||||
byte pad1;
|
||||
// Here lies the rub for all
|
||||
// dynamic resize/change of resolution.
|
||||
|
||||
+327
-325
File diff suppressed because it is too large.
Load diff
@@ -1,4 +1,4 @@
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $Id:$
|
||||
@@ -45,14 +45,14 @@ static const char rcsid[] = "$Id: r_main.c,v 1.5 1997/02/03 22:45:12 b1 Exp $";
|
||||
|
||||
|
||||
// Fineangles in the SCREENWIDTH wide window.
|
||||
#define FIELDOFVIEW 2048
|
||||
#define FIELDOFVIEW 2048
|
||||
|
||||
|
||||
|
||||
int viewangleoffset;
|
||||
|
||||
// increment every time a check is made
|
||||
int validcount = 1;
|
||||
int validcount = 1;
|
||||
|
||||
|
||||
lighttable_t* fixedcolormap;
|
||||
@@ -66,7 +66,7 @@ fixed_t centeryfrac;
|
||||
fixed_t projection;
|
||||
|
||||
// just for profiling purposes
|
||||
int framecount;
|
||||
int framecount;
|
||||
|
||||
int sscount;
|
||||
int linecount;
|
||||
@@ -84,7 +84,7 @@ fixed_t viewsin;
|
||||
player_t* viewplayer;
|
||||
|
||||
// 0 = high, 1 = low
|
||||
int detailshift;
|
||||
int detailshift;
|
||||
|
||||
//
|
||||
// precalculated math tables
|
||||
@@ -94,7 +94,7 @@ angle_t clipangle;
|
||||
// The viewangletox[viewangle + FINEANGLES/4] lookup
|
||||
// maps the visible view angles to screen X coordinates,
|
||||
// flattening the arc to a flat projection plane.
|
||||
// There will be many angles mapped to the same X.
|
||||
// There will be many angles mapped to the same X.
|
||||
int viewangletox[FINEANGLES/2];
|
||||
|
||||
// The xtoviewangleangle[] table maps a screen pixel
|
||||
@@ -118,7 +118,7 @@ lighttable_t* scalelightfixed[MAXLIGHTSCALE];
|
||||
lighttable_t* zlight[LIGHTLEVELS][MAXLIGHTZ];
|
||||
|
||||
// bumped light from gun blasts
|
||||
int extralight;
|
||||
int extralight;
|
||||
|
||||
|
||||
|
||||
@@ -168,25 +168,25 @@ R_PointOnSide
|
||||
fixed_t dy;
|
||||
fixed_t left;
|
||||
fixed_t right;
|
||||
|
||||
|
||||
if (!node->dx)
|
||||
{
|
||||
if (x <= node->x)
|
||||
return node->dy > 0;
|
||||
|
||||
|
||||
return node->dy < 0;
|
||||
}
|
||||
if (!node->dy)
|
||||
{
|
||||
if (y <= node->y)
|
||||
return node->dx < 0;
|
||||
|
||||
|
||||
return node->dx > 0;
|
||||
}
|
||||
|
||||
|
||||
dx = (x - node->x);
|
||||
dy = (y - node->y);
|
||||
|
||||
|
||||
// Try to quickly decide by looking at sign bits.
|
||||
if ( (node->dy ^ node->dx ^ dx ^ dy)&0x80000000 )
|
||||
{
|
||||
@@ -200,14 +200,14 @@ R_PointOnSide
|
||||
|
||||
left = FixedMul ( node->dy>>FRACBITS , dx );
|
||||
right = FixedMul ( dy , node->dx>>FRACBITS );
|
||||
|
||||
|
||||
if (right < left)
|
||||
{
|
||||
// front side
|
||||
return 0;
|
||||
}
|
||||
// back side
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -225,31 +225,31 @@ R_PointOnSegSide
|
||||
fixed_t dy;
|
||||
fixed_t left;
|
||||
fixed_t right;
|
||||
|
||||
|
||||
lx = line->v1->x;
|
||||
ly = line->v1->y;
|
||||
|
||||
|
||||
ldx = line->v2->x - lx;
|
||||
ldy = line->v2->y - ly;
|
||||
|
||||
|
||||
if (!ldx)
|
||||
{
|
||||
if (x <= lx)
|
||||
return ldy > 0;
|
||||
|
||||
|
||||
return ldy < 0;
|
||||
}
|
||||
if (!ldy)
|
||||
{
|
||||
if (y <= ly)
|
||||
return ldx < 0;
|
||||
|
||||
|
||||
return ldx > 0;
|
||||
}
|
||||
|
||||
|
||||
dx = (x - lx);
|
||||
dy = (y - ly);
|
||||
|
||||
|
||||
// Try to quickly decide by looking at sign bits.
|
||||
if ( (ldy ^ ldx ^ dx ^ dy)&0x80000000 )
|
||||
{
|
||||
@@ -263,14 +263,14 @@ R_PointOnSegSide
|
||||
|
||||
left = FixedMul ( ldy>>FRACBITS , dx );
|
||||
right = FixedMul ( dy , ldx>>FRACBITS );
|
||||
|
||||
|
||||
if (right < left)
|
||||
{
|
||||
// front side
|
||||
return 0;
|
||||
}
|
||||
// back side
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -292,10 +292,10 @@ angle_t
|
||||
R_PointToAngle
|
||||
( fixed_t x,
|
||||
fixed_t y )
|
||||
{
|
||||
{
|
||||
x -= viewx;
|
||||
y -= viewy;
|
||||
|
||||
|
||||
if ( (!x) && (!y) )
|
||||
return 0;
|
||||
|
||||
@@ -380,10 +380,10 @@ R_PointToAngle2
|
||||
fixed_t y1,
|
||||
fixed_t x2,
|
||||
fixed_t y2 )
|
||||
{
|
||||
{
|
||||
viewx = x1;
|
||||
viewy = y1;
|
||||
|
||||
|
||||
return R_PointToAngle (x2, y2);
|
||||
}
|
||||
|
||||
@@ -398,22 +398,22 @@ R_PointToDist
|
||||
fixed_t dy;
|
||||
fixed_t temp;
|
||||
fixed_t dist;
|
||||
|
||||
|
||||
dx = abs(x - viewx);
|
||||
dy = abs(y - viewy);
|
||||
|
||||
|
||||
if (dy>dx)
|
||||
{
|
||||
temp = dx;
|
||||
dx = dy;
|
||||
dy = temp;
|
||||
}
|
||||
|
||||
|
||||
angle = (tantoangle[ FixedDiv(dy,dx)>>DBITS ]+ANG90) >> ANGLETOFINESHIFT;
|
||||
|
||||
// use as cosine
|
||||
dist = FixedDiv (dx, finesine[angle] );
|
||||
|
||||
dist = FixedDiv (dx, finesine[angle] );
|
||||
|
||||
return dist;
|
||||
}
|
||||
|
||||
@@ -467,8 +467,8 @@ fixed_t R_ScaleFromGlobalAngle (angle_t visangle)
|
||||
fixed_t z;
|
||||
fixed_t sinv;
|
||||
fixed_t cosv;
|
||||
|
||||
sinv = finesine[(visangle-rw_normalangle)>>ANGLETOFINESHIFT];
|
||||
|
||||
sinv = finesine[(visangle-rw_normalangle)>>ANGLETOFINESHIFT];
|
||||
dist = FixedDiv (rw_distance, sinv);
|
||||
cosv = finecosine[(viewangle-visangle)>>ANGLETOFINESHIFT];
|
||||
z = abs(FixedMul (dist, cosv));
|
||||
@@ -480,8 +480,8 @@ fixed_t R_ScaleFromGlobalAngle (angle_t visangle)
|
||||
anglea = ANG90 + (visangle-viewangle);
|
||||
angleb = ANG90 + (visangle-rw_normalangle);
|
||||
|
||||
// both sines are always positive
|
||||
sinea = finesine[anglea>>ANGLETOFINESHIFT];
|
||||
// both sines are allways positive
|
||||
sinea = finesine[anglea>>ANGLETOFINESHIFT];
|
||||
sineb = finesine[angleb>>ANGLETOFINESHIFT];
|
||||
num = FixedMul(projection,sineb)<<detailshift;
|
||||
den = FixedMul(rw_distance,sinea);
|
||||
@@ -497,7 +497,7 @@ fixed_t R_ScaleFromGlobalAngle (angle_t visangle)
|
||||
}
|
||||
else
|
||||
scale = 64*FRACUNIT;
|
||||
|
||||
|
||||
return scale;
|
||||
}
|
||||
|
||||
@@ -514,7 +514,7 @@ void R_InitTables (void)
|
||||
float a;
|
||||
float fv;
|
||||
int t;
|
||||
|
||||
|
||||
// viewangle tangent table
|
||||
for (i=0 ; i<FINEANGLES/2 ; i++)
|
||||
{
|
||||
@@ -523,7 +523,7 @@ void R_InitTables (void)
|
||||
t = fv;
|
||||
finetangent[i] = t;
|
||||
}
|
||||
|
||||
|
||||
// finesine table
|
||||
for (i=0 ; i<5*FINEANGLES/4 ; i++)
|
||||
{
|
||||
@@ -547,7 +547,7 @@ void R_InitTextureMapping (void)
|
||||
int x;
|
||||
int t;
|
||||
fixed_t focallength;
|
||||
|
||||
|
||||
// Use tangent table to generate viewangletox:
|
||||
// viewangletox will give the next greatest x
|
||||
// after the view angle.
|
||||
@@ -556,7 +556,7 @@ void R_InitTextureMapping (void)
|
||||
// so FIELDOFVIEW angles covers SCREENWIDTH.
|
||||
focallength = FixedDiv (centerxfrac,
|
||||
finetangent[FINEANGLES/4+FIELDOFVIEW/2] );
|
||||
|
||||
|
||||
for (i=0 ; i<FINEANGLES/2 ; i++)
|
||||
{
|
||||
if (finetangent[i] > FRACUNIT*2)
|
||||
@@ -575,10 +575,10 @@ void R_InitTextureMapping (void)
|
||||
}
|
||||
viewangletox[i] = t;
|
||||
}
|
||||
|
||||
|
||||
// Scan viewangletox[] to generate xtoviewangle[]:
|
||||
// xtoviewangle will give the smallest view angle
|
||||
// that maps to x.
|
||||
// that maps to x.
|
||||
for (x=0;x<=viewwidth;x++)
|
||||
{
|
||||
i = 0;
|
||||
@@ -586,19 +586,19 @@ void R_InitTextureMapping (void)
|
||||
i++;
|
||||
xtoviewangle[x] = (i<<ANGLETOFINESHIFT)-ANG90;
|
||||
}
|
||||
|
||||
|
||||
// Take out the fencepost cases from viewangletox.
|
||||
for (i=0 ; i<FINEANGLES/2 ; i++)
|
||||
{
|
||||
t = FixedMul (finetangent[i], focallength);
|
||||
t = centerx - t;
|
||||
|
||||
|
||||
if (viewangletox[i] == -1)
|
||||
viewangletox[i] = 0;
|
||||
else if (viewangletox[i] == viewwidth+1)
|
||||
viewangletox[i] = viewwidth;
|
||||
}
|
||||
|
||||
|
||||
clipangle = xtoviewangle[0];
|
||||
}
|
||||
|
||||
@@ -616,9 +616,9 @@ void R_InitLightTables (void)
|
||||
int i;
|
||||
int j;
|
||||
int level;
|
||||
int startmap;
|
||||
int startmap;
|
||||
int scale;
|
||||
|
||||
|
||||
// Calculate the light levels to use
|
||||
// for each level / distance combination.
|
||||
for (i=0 ; i< LIGHTLEVELS ; i++)
|
||||
@@ -629,7 +629,7 @@ void R_InitLightTables (void)
|
||||
scale = FixedDiv ((SCREENWIDTH/2*FRACUNIT), (j+1)<<LIGHTZSHIFT);
|
||||
scale >>= LIGHTSCALESHIFT;
|
||||
level = startmap - scale/DISTMAP;
|
||||
|
||||
|
||||
if (level < 0)
|
||||
level = 0;
|
||||
|
||||
@@ -675,7 +675,7 @@ void R_ExecuteSetViewSize (void)
|
||||
int i;
|
||||
int j;
|
||||
int level;
|
||||
int startmap;
|
||||
int startmap;
|
||||
|
||||
setsizeneeded = false;
|
||||
|
||||
@@ -689,10 +689,10 @@ void R_ExecuteSetViewSize (void)
|
||||
scaledviewwidth = setblocks*32;
|
||||
viewheight = (setblocks*168/10)&~7;
|
||||
}
|
||||
|
||||
|
||||
detailshift = setdetail;
|
||||
viewwidth = scaledviewwidth>>detailshift;
|
||||
|
||||
|
||||
centery = viewheight/2;
|
||||
centerx = viewwidth/2;
|
||||
centerxfrac = centerx<<FRACBITS;
|
||||
@@ -715,17 +715,17 @@ void R_ExecuteSetViewSize (void)
|
||||
}
|
||||
|
||||
R_InitBuffer (scaledviewwidth, viewheight);
|
||||
|
||||
|
||||
R_InitTextureMapping ();
|
||||
|
||||
|
||||
// psprite scales
|
||||
pspritescale = FRACUNIT*viewwidth/SCREENWIDTH;
|
||||
pspriteiscale = FRACUNIT*SCREENWIDTH/viewwidth;
|
||||
|
||||
|
||||
// thing clipping
|
||||
for (i=0 ; i<viewwidth ; i++)
|
||||
screenheightarray[i] = viewheight;
|
||||
|
||||
|
||||
// planes
|
||||
for (i=0 ; i<viewheight ; i++)
|
||||
{
|
||||
@@ -733,13 +733,13 @@ void R_ExecuteSetViewSize (void)
|
||||
dy = abs(dy);
|
||||
yslope[i] = FixedDiv ( (viewwidth<<detailshift)/2*FRACUNIT, dy);
|
||||
}
|
||||
|
||||
|
||||
for (i=0 ; i<viewwidth ; i++)
|
||||
{
|
||||
cosadj = abs(finecosine[xtoviewangle[i]>>ANGLETOFINESHIFT]);
|
||||
distscale[i] = FixedDiv (FRACUNIT,cosadj);
|
||||
}
|
||||
|
||||
|
||||
// Calculate the light levels to use
|
||||
// for each level / scale combination.
|
||||
for (i=0 ; i< LIGHTLEVELS ; i++)
|
||||
@@ -748,7 +748,7 @@ void R_ExecuteSetViewSize (void)
|
||||
for (j=0 ; j<MAXLIGHTSCALE ; j++)
|
||||
{
|
||||
level = startmap - j*SCREENWIDTH/(viewwidth<<detailshift)/DISTMAP;
|
||||
|
||||
|
||||
if (level < 0)
|
||||
level = 0;
|
||||
|
||||
@@ -789,7 +789,7 @@ void R_Init (void)
|
||||
printf ("\nR_InitSkyMap");
|
||||
R_InitTranslationTables ();
|
||||
printf ("\nR_InitTranslationsTables");
|
||||
|
||||
|
||||
framecount = 0;
|
||||
}
|
||||
|
||||
@@ -807,9 +807,9 @@ R_PointInSubsector
|
||||
int nodenum;
|
||||
|
||||
// single subsector is a special case
|
||||
if (!numnodes)
|
||||
if (!numnodes)
|
||||
return subsectors;
|
||||
|
||||
|
||||
nodenum = numnodes-1;
|
||||
|
||||
while (! (nodenum & NF_SUBSECTOR) )
|
||||
@@ -818,7 +818,7 @@ R_PointInSubsector
|
||||
side = R_PointOnSide (x, y, node);
|
||||
nodenum = node->children[side];
|
||||
}
|
||||
|
||||
|
||||
return &subsectors[nodenum & ~NF_SUBSECTOR];
|
||||
}
|
||||
|
||||
@@ -828,9 +828,9 @@ R_PointInSubsector
|
||||
// R_SetupFrame
|
||||
//
|
||||
void R_SetupFrame (player_t* player)
|
||||
{
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
viewplayer = player;
|
||||
viewx = player->mo->x;
|
||||
viewy = player->mo->y;
|
||||
@@ -838,18 +838,18 @@ void R_SetupFrame (player_t* player)
|
||||
extralight = player->extralight;
|
||||
|
||||
viewz = player->viewz;
|
||||
|
||||
|
||||
viewsin = finesine[viewangle>>ANGLETOFINESHIFT];
|
||||
viewcos = finecosine[viewangle>>ANGLETOFINESHIFT];
|
||||
|
||||
|
||||
sscount = 0;
|
||||
|
||||
|
||||
if (player->fixedcolormap)
|
||||
{
|
||||
fixedcolormap =
|
||||
colormaps
|
||||
+ player->fixedcolormap*256*sizeof(lighttable_t);
|
||||
|
||||
|
||||
walllights = scalelightfixed;
|
||||
|
||||
for (i=0 ; i<MAXLIGHTSCALE ; i++)
|
||||
@@ -857,7 +857,7 @@ void R_SetupFrame (player_t* player)
|
||||
}
|
||||
else
|
||||
fixedcolormap = 0;
|
||||
|
||||
|
||||
framecount++;
|
||||
validcount++;
|
||||
}
|
||||
@@ -868,7 +868,7 @@ void R_SetupFrame (player_t* player)
|
||||
// R_RenderView
|
||||
//
|
||||
void R_RenderPlayerView (player_t* player)
|
||||
{
|
||||
{
|
||||
R_SetupFrame (player);
|
||||
|
||||
// Clear buffers.
|
||||
@@ -876,23 +876,23 @@ void R_RenderPlayerView (player_t* player)
|
||||
R_ClearDrawSegs ();
|
||||
R_ClearPlanes ();
|
||||
R_ClearSprites ();
|
||||
|
||||
|
||||
// check for new console commands.
|
||||
NetUpdate ();
|
||||
|
||||
// The head node is the last node output.
|
||||
R_RenderBSPNode (numnodes-1);
|
||||
|
||||
|
||||
// Check for new console commands.
|
||||
NetUpdate ();
|
||||
|
||||
|
||||
R_DrawPlanes ();
|
||||
|
||||
|
||||
// Check for new console commands.
|
||||
NetUpdate ();
|
||||
|
||||
|
||||
R_DrawMasked ();
|
||||
|
||||
// Check for new console commands.
|
||||
NetUpdate ();
|
||||
NetUpdate ();
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $Id:$
|
||||
@@ -127,7 +127,7 @@ R_MapPlane
|
||||
fixed_t distance;
|
||||
fixed_t length;
|
||||
unsigned index;
|
||||
|
||||
|
||||
#ifdef RANGECHECK
|
||||
if (x2 < x1
|
||||
|| x1<0
|
||||
@@ -151,7 +151,7 @@ R_MapPlane
|
||||
ds_xstep = cachedxstep[y];
|
||||
ds_ystep = cachedystep[y];
|
||||
}
|
||||
|
||||
|
||||
length = FixedMul (distance,distscale[x1]);
|
||||
angle = (viewangle + xtoviewangle[x1])>>ANGLETOFINESHIFT;
|
||||
ds_xfrac = viewx + FixedMul(finecosine[angle], length);
|
||||
@@ -162,31 +162,31 @@ R_MapPlane
|
||||
else
|
||||
{
|
||||
index = distance >> LIGHTZSHIFT;
|
||||
|
||||
|
||||
if (index >= MAXLIGHTZ )
|
||||
index = MAXLIGHTZ-1;
|
||||
|
||||
ds_colormap = planezlight[index];
|
||||
}
|
||||
|
||||
|
||||
ds_y = y;
|
||||
ds_x1 = x1;
|
||||
ds_x2 = x2;
|
||||
|
||||
// high or low detail
|
||||
spanfunc ();
|
||||
spanfunc ();
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// R_ClearPlanes
|
||||
// At beginning of frame.
|
||||
// At begining of frame.
|
||||
//
|
||||
void R_ClearPlanes (void)
|
||||
{
|
||||
int i;
|
||||
angle_t angle;
|
||||
|
||||
|
||||
// opening / clipping determination
|
||||
for (i=0 ; i<viewwidth ; i++)
|
||||
{
|
||||
@@ -196,13 +196,13 @@ void R_ClearPlanes (void)
|
||||
|
||||
lastvisplane = visplanes;
|
||||
lastopening = openings;
|
||||
|
||||
|
||||
// texture calculation
|
||||
memset (cachedheight, 0, sizeof(cachedheight));
|
||||
|
||||
// left to right mapping
|
||||
angle = (viewangle-ANG90)>>ANGLETOFINESHIFT;
|
||||
|
||||
|
||||
// scale will be unit scale at SCREENWIDTH/2 distance
|
||||
basexscale = FixedDiv (finecosine[angle],centerxfrac);
|
||||
baseyscale = -FixedDiv (finesine[angle],centerxfrac);
|
||||
@@ -221,13 +221,13 @@ R_FindPlane
|
||||
int lightlevel )
|
||||
{
|
||||
visplane_t* check;
|
||||
|
||||
|
||||
if (picnum == skyflatnum)
|
||||
{
|
||||
height = 0; // all skys map together
|
||||
lightlevel = 0;
|
||||
}
|
||||
|
||||
|
||||
for (check=visplanes; check<lastvisplane; check++)
|
||||
{
|
||||
if (height == check->height
|
||||
@@ -237,14 +237,14 @@ R_FindPlane
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if (check < lastvisplane)
|
||||
return check;
|
||||
|
||||
|
||||
if (lastvisplane - visplanes == MAXVISPLANES)
|
||||
I_Error ("R_FindPlane: no more visplanes");
|
||||
|
||||
|
||||
lastvisplane++;
|
||||
|
||||
check->height = height;
|
||||
@@ -252,9 +252,9 @@ R_FindPlane
|
||||
check->lightlevel = lightlevel;
|
||||
check->minx = SCREENWIDTH;
|
||||
check->maxx = -1;
|
||||
|
||||
|
||||
memset (check->top,0xff,sizeof(check->top));
|
||||
|
||||
|
||||
return check;
|
||||
}
|
||||
|
||||
@@ -273,7 +273,7 @@ R_CheckPlane
|
||||
int unionl;
|
||||
int unionh;
|
||||
int x;
|
||||
|
||||
|
||||
if (start < pl->minx)
|
||||
{
|
||||
intrl = pl->minx;
|
||||
@@ -284,7 +284,7 @@ R_CheckPlane
|
||||
unionl = pl->minx;
|
||||
intrl = start;
|
||||
}
|
||||
|
||||
|
||||
if (stop > pl->maxx)
|
||||
{
|
||||
intrh = pl->maxx;
|
||||
@@ -306,20 +306,20 @@ R_CheckPlane
|
||||
pl->maxx = unionh;
|
||||
|
||||
// use the same one
|
||||
return pl;
|
||||
return pl;
|
||||
}
|
||||
|
||||
|
||||
// make a new visplane
|
||||
lastvisplane->height = pl->height;
|
||||
lastvisplane->picnum = pl->picnum;
|
||||
lastvisplane->lightlevel = pl->lightlevel;
|
||||
|
||||
|
||||
pl = lastvisplane++;
|
||||
pl->minx = start;
|
||||
pl->maxx = stop;
|
||||
|
||||
memset (pl->top,0xff,sizeof(pl->top));
|
||||
|
||||
|
||||
return pl;
|
||||
}
|
||||
|
||||
@@ -345,7 +345,7 @@ R_MakeSpans
|
||||
R_MapPlane (b1,spanstart[b1],x-1);
|
||||
b1--;
|
||||
}
|
||||
|
||||
|
||||
while (t2 < t1 && t2<=b2)
|
||||
{
|
||||
spanstart[t2] = x;
|
||||
@@ -371,16 +371,16 @@ void R_DrawPlanes (void)
|
||||
int x;
|
||||
int stop;
|
||||
int angle;
|
||||
|
||||
|
||||
#ifdef RANGECHECK
|
||||
if (ds_p - drawsegs > MAXDRAWSEGS)
|
||||
I_Error ("R_DrawPlanes: drawsegs overflow (%i)",
|
||||
ds_p - drawsegs);
|
||||
|
||||
|
||||
if (lastvisplane - visplanes > MAXVISPLANES)
|
||||
I_Error ("R_DrawPlanes: visplane overflow (%i)",
|
||||
lastvisplane - visplanes);
|
||||
|
||||
|
||||
if (lastopening - openings > MAXOPENINGS)
|
||||
I_Error ("R_DrawPlanes: opening overflow (%i)",
|
||||
lastopening - openings);
|
||||
@@ -391,13 +391,13 @@ void R_DrawPlanes (void)
|
||||
if (pl->minx > pl->maxx)
|
||||
continue;
|
||||
|
||||
|
||||
|
||||
// sky flat
|
||||
if (pl->picnum == skyflatnum)
|
||||
{
|
||||
dc_iscale = pspriteiscale>>detailshift;
|
||||
|
||||
// Sky is always drawn full bright,
|
||||
|
||||
// Sky is allways drawn full bright,
|
||||
// i.e. colormaps[0] is used.
|
||||
// Because of this hack, sky is not affected
|
||||
// by INVUL inverse mapping.
|
||||
@@ -418,12 +418,12 @@ void R_DrawPlanes (void)
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
// regular flat
|
||||
ds_source = W_CacheLumpNum(firstflat +
|
||||
flattranslation[pl->picnum],
|
||||
PU_STATIC);
|
||||
|
||||
|
||||
planeheight = abs(pl->height-viewz);
|
||||
light = (pl->lightlevel >> LIGHTSEGSHIFT)+extralight;
|
||||
|
||||
@@ -437,7 +437,7 @@ void R_DrawPlanes (void)
|
||||
|
||||
pl->top[pl->maxx+1] = 0xff;
|
||||
pl->top[pl->minx-1] = 0xff;
|
||||
|
||||
|
||||
stop = pl->maxx + 1;
|
||||
|
||||
for (x=pl->minx ; x<= stop ; x++)
|
||||
@@ -447,7 +447,7 @@ void R_DrawPlanes (void)
|
||||
pl->top[x],
|
||||
pl->bottom[x]);
|
||||
}
|
||||
|
||||
|
||||
Z_ChangeTag (ds_source, PU_CACHE);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $Id:$
|
||||
@@ -55,7 +55,7 @@ typedef struct
|
||||
{
|
||||
int x1;
|
||||
int x2;
|
||||
|
||||
|
||||
int column;
|
||||
int topclip;
|
||||
int bottomclip;
|
||||
@@ -110,14 +110,14 @@ R_InstallSpriteLump
|
||||
boolean flipped )
|
||||
{
|
||||
int r;
|
||||
|
||||
|
||||
if (frame >= 29 || rotation > 8)
|
||||
I_Error("R_InstallSpriteLump: "
|
||||
"Bad frame characters in lump %i", lump);
|
||||
|
||||
|
||||
if ((int)frame > maxframe)
|
||||
maxframe = frame;
|
||||
|
||||
|
||||
if (rotation == 0)
|
||||
{
|
||||
// the lump should be used for all rotations
|
||||
@@ -128,7 +128,7 @@ R_InstallSpriteLump
|
||||
if (sprtemp[frame].rotate == true)
|
||||
I_Error ("R_InitSprites: Sprite %s frame %c has rotations "
|
||||
"and a rot=0 lump", spritename, 'A'+frame);
|
||||
|
||||
|
||||
sprtemp[frame].rotate = false;
|
||||
for (r=0 ; r<8 ; r++)
|
||||
{
|
||||
@@ -137,21 +137,21 @@ R_InstallSpriteLump
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// the lump is only used for one rotation
|
||||
if (sprtemp[frame].rotate == false)
|
||||
I_Error ("R_InitSprites: Sprite %s frame %c has rotations "
|
||||
"and a rot=0 lump", spritename, 'A'+frame);
|
||||
|
||||
|
||||
sprtemp[frame].rotate = true;
|
||||
|
||||
// make 0 based
|
||||
rotation--;
|
||||
rotation--;
|
||||
if (sprtemp[frame].lump[rotation] != -1)
|
||||
I_Error ("R_InitSprites: Sprite %s : %c : %c "
|
||||
"has two lumps mapped to it",
|
||||
spritename, 'A'+frame, '1'+rotation);
|
||||
|
||||
|
||||
sprtemp[frame].lump[rotation] = lump - firstspritelump;
|
||||
sprtemp[frame].flip[rotation] = (byte)flipped;
|
||||
}
|
||||
@@ -165,7 +165,7 @@ R_InstallSpriteLump
|
||||
// (4 chars exactly) to be used.
|
||||
// Builds the sprite rotation matrixes to account
|
||||
// for horizontally flipped sprites.
|
||||
// Will report an error if the lumps are inconsistent.
|
||||
// Will report an error if the lumps are inconsistant.
|
||||
// Only called at startup.
|
||||
//
|
||||
// Sprite lump names are 4 characters for the actor,
|
||||
@@ -174,8 +174,8 @@ R_InstallSpriteLump
|
||||
// letter/number appended.
|
||||
// The rotation character can be 0 to signify no rotations.
|
||||
//
|
||||
void R_InitSpriteDefs (char** namelist)
|
||||
{
|
||||
void R_InitSpriteDefs (char** namelist)
|
||||
{
|
||||
char** check;
|
||||
int i;
|
||||
int l;
|
||||
@@ -185,22 +185,22 @@ void R_InitSpriteDefs (char** namelist)
|
||||
int start;
|
||||
int end;
|
||||
int patched;
|
||||
|
||||
|
||||
// count the number of sprite names
|
||||
check = namelist;
|
||||
while (*check != NULL)
|
||||
check++;
|
||||
|
||||
numsprites = check-namelist;
|
||||
|
||||
|
||||
if (!numsprites)
|
||||
return;
|
||||
|
||||
|
||||
sprites = Z_Malloc(numsprites *sizeof(*sprites), PU_STATIC, NULL);
|
||||
|
||||
|
||||
start = firstspritelump-1;
|
||||
end = lastspritelump+1;
|
||||
|
||||
|
||||
// scan all the lump names for each of the names,
|
||||
// noting the highest frame letter.
|
||||
// Just compare 4 characters as ints
|
||||
@@ -208,10 +208,10 @@ void R_InitSpriteDefs (char** namelist)
|
||||
{
|
||||
spritename = namelist[i];
|
||||
memset (sprtemp,-1, sizeof(sprtemp));
|
||||
|
||||
|
||||
maxframe = -1;
|
||||
intname = *(int *)namelist[i];
|
||||
|
||||
|
||||
// scan the lumps,
|
||||
// filling in the frames for whatever is found
|
||||
for (l=start+1 ; l<end ; l++)
|
||||
@@ -236,16 +236,16 @@ void R_InitSpriteDefs (char** namelist)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// check the frames that were found for completeness
|
||||
if (maxframe == -1)
|
||||
{
|
||||
sprites[i].numframes = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
maxframe++;
|
||||
|
||||
|
||||
for (frame = 0 ; frame < maxframe ; frame++)
|
||||
{
|
||||
switch ((int)sprtemp[frame].rotate)
|
||||
@@ -255,11 +255,11 @@ void R_InitSpriteDefs (char** namelist)
|
||||
I_Error ("R_InitSprites: No patches found "
|
||||
"for %s frame %c", namelist[i], frame+'A');
|
||||
break;
|
||||
|
||||
|
||||
case 0:
|
||||
// only the first rotation is needed
|
||||
break;
|
||||
|
||||
|
||||
case 1:
|
||||
// must have all 8 frames
|
||||
for (rotation=0 ; rotation<8 ; rotation++)
|
||||
@@ -270,10 +270,10 @@ void R_InitSpriteDefs (char** namelist)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// allocate space for the frames present and copy sprtemp to it
|
||||
sprites[i].numframes = maxframe;
|
||||
sprites[i].spriteframes =
|
||||
sprites[i].spriteframes =
|
||||
Z_Malloc (maxframe * sizeof(spriteframe_t), PU_STATIC, NULL);
|
||||
memcpy (sprites[i].spriteframes, sprtemp, maxframe*sizeof(spriteframe_t));
|
||||
}
|
||||
@@ -299,12 +299,12 @@ int newvissprite;
|
||||
void R_InitSprites (char** namelist)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
for (i=0 ; i<SCREENWIDTH ; i++)
|
||||
{
|
||||
negonearray[i] = -1;
|
||||
}
|
||||
|
||||
|
||||
R_InitSpriteDefs (namelist);
|
||||
}
|
||||
|
||||
@@ -329,7 +329,7 @@ vissprite_t* R_NewVisSprite (void)
|
||||
{
|
||||
if (vissprite_p == &vissprites[MAXVISSPRITES])
|
||||
return &overflowsprite;
|
||||
|
||||
|
||||
vissprite_p++;
|
||||
return vissprite_p-1;
|
||||
}
|
||||
@@ -353,10 +353,10 @@ void R_DrawMaskedColumn (column_t* column)
|
||||
int topscreen;
|
||||
int bottomscreen;
|
||||
fixed_t basetexturemid;
|
||||
|
||||
|
||||
basetexturemid = dc_texturemid;
|
||||
|
||||
for ( ; column->topdelta != 0xff ; )
|
||||
|
||||
for ( ; column->topdelta != 0xff ; )
|
||||
{
|
||||
// calculate unclipped screen coordinates
|
||||
// for post
|
||||
@@ -365,7 +365,7 @@ void R_DrawMaskedColumn (column_t* column)
|
||||
|
||||
dc_yl = (topscreen+FRACUNIT-1)>>FRACBITS;
|
||||
dc_yh = (bottomscreen-1)>>FRACBITS;
|
||||
|
||||
|
||||
if (dc_yh >= mfloorclip[dc_x])
|
||||
dc_yh = mfloorclip[dc_x]-1;
|
||||
if (dc_yl <= mceilingclip[dc_x])
|
||||
@@ -379,11 +379,11 @@ void R_DrawMaskedColumn (column_t* column)
|
||||
|
||||
// Drawn by either R_DrawColumn
|
||||
// or (SHADOW) R_DrawFuzzColumn.
|
||||
colfunc ();
|
||||
colfunc ();
|
||||
}
|
||||
column = (column_t *)( (byte *)column + column->length + 4);
|
||||
}
|
||||
|
||||
|
||||
dc_texturemid = basetexturemid;
|
||||
}
|
||||
|
||||
@@ -403,12 +403,12 @@ R_DrawVisSprite
|
||||
int texturecolumn;
|
||||
fixed_t frac;
|
||||
patch_t* patch;
|
||||
|
||||
|
||||
|
||||
|
||||
patch = W_CacheLumpNum (vis->patch+firstspritelump, PU_CACHE);
|
||||
|
||||
dc_colormap = vis->colormap;
|
||||
|
||||
|
||||
if (!dc_colormap)
|
||||
{
|
||||
// NULL colormap = shadow draw
|
||||
@@ -420,13 +420,13 @@ R_DrawVisSprite
|
||||
dc_translation = translationtables - 256 +
|
||||
( (vis->mobjflags & MF_TRANSLATION) >> (MF_TRANSSHIFT-8) );
|
||||
}
|
||||
|
||||
|
||||
dc_iscale = abs(vis->xiscale)>>detailshift;
|
||||
dc_texturemid = vis->texturemid;
|
||||
frac = vis->startfrac;
|
||||
spryscale = vis->scale;
|
||||
sprtopscreen = centeryfrac - FixedMul(dc_texturemid,spryscale);
|
||||
|
||||
|
||||
for (dc_x=vis->x1 ; dc_x<=vis->x2 ; dc_x++, frac += vis->xiscale)
|
||||
{
|
||||
texturecolumn = frac>>FRACBITS;
|
||||
@@ -453,55 +453,55 @@ void R_ProjectSprite (mobj_t* thing)
|
||||
{
|
||||
fixed_t tr_x;
|
||||
fixed_t tr_y;
|
||||
|
||||
|
||||
fixed_t gxt;
|
||||
fixed_t gyt;
|
||||
|
||||
|
||||
fixed_t tx;
|
||||
fixed_t tz;
|
||||
|
||||
fixed_t xscale;
|
||||
|
||||
|
||||
int x1;
|
||||
int x2;
|
||||
|
||||
spritedef_t* sprdef;
|
||||
spriteframe_t* sprframe;
|
||||
int lump;
|
||||
|
||||
|
||||
unsigned rot;
|
||||
boolean flip;
|
||||
|
||||
|
||||
int index;
|
||||
|
||||
vissprite_t* vis;
|
||||
|
||||
|
||||
angle_t ang;
|
||||
fixed_t iscale;
|
||||
|
||||
|
||||
// transform the origin point
|
||||
tr_x = thing->x - viewx;
|
||||
tr_y = thing->y - viewy;
|
||||
|
||||
gxt = FixedMul(tr_x,viewcos);
|
||||
|
||||
gxt = FixedMul(tr_x,viewcos);
|
||||
gyt = -FixedMul(tr_y,viewsin);
|
||||
|
||||
tz = gxt-gyt;
|
||||
|
||||
tz = gxt-gyt;
|
||||
|
||||
// thing is behind view plane?
|
||||
if (tz < MINZ)
|
||||
return;
|
||||
|
||||
|
||||
xscale = FixedDiv(projection, tz);
|
||||
|
||||
gxt = -FixedMul(tr_x,viewsin);
|
||||
gyt = FixedMul(tr_y,viewcos);
|
||||
tx = -(gyt+gxt);
|
||||
|
||||
gxt = -FixedMul(tr_x,viewsin);
|
||||
gyt = FixedMul(tr_y,viewcos);
|
||||
tx = -(gyt+gxt);
|
||||
|
||||
// too far off the side?
|
||||
if (abs(tx)>(tz<<2))
|
||||
return;
|
||||
|
||||
|
||||
// decide which patch to use for sprite relative to player
|
||||
#ifdef RANGECHECK
|
||||
if ((unsigned)thing->sprite >= numsprites)
|
||||
@@ -530,22 +530,22 @@ void R_ProjectSprite (mobj_t* thing)
|
||||
lump = sprframe->lump[0];
|
||||
flip = (boolean)sprframe->flip[0];
|
||||
}
|
||||
|
||||
|
||||
// calculate edges of the shape
|
||||
tx -= spriteoffset[lump];
|
||||
tx -= spriteoffset[lump];
|
||||
x1 = (centerxfrac + FixedMul (tx,xscale) ) >>FRACBITS;
|
||||
|
||||
// off the right side?
|
||||
if (x1 > viewwidth)
|
||||
return;
|
||||
|
||||
|
||||
tx += spritewidth[lump];
|
||||
x2 = ((centerxfrac + FixedMul (tx,xscale) ) >>FRACBITS) - 1;
|
||||
|
||||
// off the left side
|
||||
if (x2 < 0)
|
||||
return;
|
||||
|
||||
|
||||
// store information in a vissprite
|
||||
vis = R_NewVisSprite ();
|
||||
vis->mobjflags = thing->flags;
|
||||
@@ -556,7 +556,7 @@ void R_ProjectSprite (mobj_t* thing)
|
||||
vis->gzt = thing->z + spritetopoffset[lump];
|
||||
vis->texturemid = vis->gzt - viewz;
|
||||
vis->x1 = x1 < 0 ? 0 : x1;
|
||||
vis->x2 = x2 >= viewwidth ? viewwidth-1 : x2;
|
||||
vis->x2 = x2 >= viewwidth ? viewwidth-1 : x2;
|
||||
iscale = FixedDiv (FRACUNIT, xscale);
|
||||
|
||||
if (flip)
|
||||
@@ -573,7 +573,7 @@ void R_ProjectSprite (mobj_t* thing)
|
||||
if (vis->x1 > x1)
|
||||
vis->startfrac += vis->xiscale*(vis->x1-x1);
|
||||
vis->patch = lump;
|
||||
|
||||
|
||||
// get light level
|
||||
if (thing->flags & MF_SHADOW)
|
||||
{
|
||||
@@ -590,17 +590,17 @@ void R_ProjectSprite (mobj_t* thing)
|
||||
// full bright
|
||||
vis->colormap = colormaps;
|
||||
}
|
||||
|
||||
|
||||
else
|
||||
{
|
||||
// diminished light
|
||||
index = xscale>>(LIGHTSCALESHIFT-detailshift);
|
||||
|
||||
if (index >= MAXLIGHTSCALE)
|
||||
if (index >= MAXLIGHTSCALE)
|
||||
index = MAXLIGHTSCALE-1;
|
||||
|
||||
vis->colormap = spritelights[index];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -620,14 +620,14 @@ void R_AddSprites (sector_t* sec)
|
||||
// subsectors during BSP building.
|
||||
// Thus we check whether its already added.
|
||||
if (sec->validcount == validcount)
|
||||
return;
|
||||
return;
|
||||
|
||||
// Well, now it will be done.
|
||||
sec->validcount = validcount;
|
||||
|
||||
|
||||
lightnum = (sec->lightlevel >> LIGHTSEGSHIFT)+extralight;
|
||||
|
||||
if (lightnum < 0)
|
||||
if (lightnum < 0)
|
||||
spritelights = scalelight[0];
|
||||
else if (lightnum >= LIGHTLEVELS)
|
||||
spritelights = scalelight[LIGHTLEVELS-1];
|
||||
@@ -654,7 +654,7 @@ void R_DrawPSprite (pspdef_t* psp)
|
||||
boolean flip;
|
||||
vissprite_t* vis;
|
||||
vissprite_t avis;
|
||||
|
||||
|
||||
// decide which patch to use
|
||||
#ifdef RANGECHECK
|
||||
if ( (unsigned)psp->state->sprite >= numsprites)
|
||||
@@ -671,16 +671,16 @@ void R_DrawPSprite (pspdef_t* psp)
|
||||
|
||||
lump = sprframe->lump[0];
|
||||
flip = (boolean)sprframe->flip[0];
|
||||
|
||||
|
||||
// calculate edges of the shape
|
||||
tx = psp->sx-160*FRACUNIT;
|
||||
|
||||
tx -= spriteoffset[lump];
|
||||
|
||||
tx -= spriteoffset[lump];
|
||||
x1 = (centerxfrac + FixedMul (tx,pspritescale) ) >>FRACBITS;
|
||||
|
||||
// off the right side
|
||||
if (x1 > viewwidth)
|
||||
return;
|
||||
return;
|
||||
|
||||
tx += spritewidth[lump];
|
||||
x2 = ((centerxfrac + FixedMul (tx, pspritescale) ) >>FRACBITS) - 1;
|
||||
@@ -688,15 +688,15 @@ void R_DrawPSprite (pspdef_t* psp)
|
||||
// off the left side
|
||||
if (x2 < 0)
|
||||
return;
|
||||
|
||||
|
||||
// store information in a vissprite
|
||||
vis = &avis;
|
||||
vis->mobjflags = 0;
|
||||
vis->texturemid = (BASEYCENTER<<FRACBITS)+FRACUNIT/2-(psp->sy-spritetopoffset[lump]);
|
||||
vis->x1 = x1 < 0 ? 0 : x1;
|
||||
vis->x2 = x2 >= viewwidth ? viewwidth-1 : x2;
|
||||
vis->x2 = x2 >= viewwidth ? viewwidth-1 : x2;
|
||||
vis->scale = pspritescale<<detailshift;
|
||||
|
||||
|
||||
if (flip)
|
||||
{
|
||||
vis->xiscale = -pspriteiscale;
|
||||
@@ -707,7 +707,7 @@ void R_DrawPSprite (pspdef_t* psp)
|
||||
vis->xiscale = pspriteiscale;
|
||||
vis->startfrac = 0;
|
||||
}
|
||||
|
||||
|
||||
if (vis->x1 > x1)
|
||||
vis->startfrac += vis->xiscale*(vis->x1-x1);
|
||||
|
||||
@@ -734,7 +734,7 @@ void R_DrawPSprite (pspdef_t* psp)
|
||||
// local light
|
||||
vis->colormap = spritelights[MAXLIGHTSCALE-1];
|
||||
}
|
||||
|
||||
|
||||
R_DrawVisSprite (vis, vis->x1, vis->x2);
|
||||
}
|
||||
|
||||
@@ -748,23 +748,23 @@ void R_DrawPlayerSprites (void)
|
||||
int i;
|
||||
int lightnum;
|
||||
pspdef_t* psp;
|
||||
|
||||
|
||||
// get light level
|
||||
lightnum =
|
||||
(viewplayer->mo->subsector->sector->lightlevel >> LIGHTSEGSHIFT)
|
||||
(viewplayer->mo->subsector->sector->lightlevel >> LIGHTSEGSHIFT)
|
||||
+extralight;
|
||||
|
||||
if (lightnum < 0)
|
||||
if (lightnum < 0)
|
||||
spritelights = scalelight[0];
|
||||
else if (lightnum >= LIGHTLEVELS)
|
||||
spritelights = scalelight[LIGHTLEVELS-1];
|
||||
else
|
||||
spritelights = scalelight[lightnum];
|
||||
|
||||
|
||||
// clip to screen bounds
|
||||
mfloorclip = screenheightarray;
|
||||
mceilingclip = negonearray;
|
||||
|
||||
|
||||
// add all active psprites
|
||||
for (i=0, psp=viewplayer->psprites;
|
||||
i<NUMPSPRITES;
|
||||
@@ -794,23 +794,23 @@ void R_SortVisSprites (void)
|
||||
fixed_t bestscale;
|
||||
|
||||
count = vissprite_p - vissprites;
|
||||
|
||||
|
||||
unsorted.next = unsorted.prev = &unsorted;
|
||||
|
||||
if (!count)
|
||||
return;
|
||||
|
||||
|
||||
for (ds=vissprites ; ds<vissprite_p ; ds++)
|
||||
{
|
||||
ds->next = ds+1;
|
||||
ds->prev = ds-1;
|
||||
}
|
||||
|
||||
|
||||
vissprites[0].prev = &unsorted;
|
||||
unsorted.next = &vissprites[0];
|
||||
(vissprite_p-1)->next = &unsorted;
|
||||
unsorted.prev = vissprite_p-1;
|
||||
|
||||
|
||||
// pull the vissprites out by scale
|
||||
//best = 0; // shut up the compiler warning
|
||||
vsprsortedhead.next = vsprsortedhead.prev = &vsprsortedhead;
|
||||
@@ -850,10 +850,10 @@ void R_DrawSprite (vissprite_t* spr)
|
||||
fixed_t scale;
|
||||
fixed_t lowscale;
|
||||
int silhouette;
|
||||
|
||||
|
||||
for (x = spr->x1 ; x<=spr->x2 ; x++)
|
||||
clipbot[x] = cliptop[x] = -2;
|
||||
|
||||
|
||||
// Scan drawsegs from end to start for obscuring segs.
|
||||
// The first drawseg that has a greater scale
|
||||
// is the clip seg.
|
||||
@@ -868,7 +868,7 @@ void R_DrawSprite (vissprite_t* spr)
|
||||
// does not cover sprite
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
r1 = ds->x1 < spr->x1 ? spr->x1 : ds->x1;
|
||||
r2 = ds->x2 > spr->x2 ? spr->x2 : ds->x2;
|
||||
|
||||
@@ -882,28 +882,28 @@ void R_DrawSprite (vissprite_t* spr)
|
||||
lowscale = ds->scale1;
|
||||
scale = ds->scale2;
|
||||
}
|
||||
|
||||
|
||||
if (scale < spr->scale
|
||||
|| ( lowscale < spr->scale
|
||||
&& !R_PointOnSegSide (spr->gx, spr->gy, ds->curline) ) )
|
||||
{
|
||||
// masked mid texture?
|
||||
if (ds->maskedtexturecol)
|
||||
if (ds->maskedtexturecol)
|
||||
R_RenderMaskedSegRange (ds, r1, r2);
|
||||
// seg is behind sprite
|
||||
continue;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// clip this piece of the sprite
|
||||
silhouette = ds->silhouette;
|
||||
|
||||
|
||||
if (spr->gz >= ds->bsilheight)
|
||||
silhouette &= ~SIL_BOTTOM;
|
||||
|
||||
if (spr->gzt <= ds->tsilheight)
|
||||
silhouette &= ~SIL_TOP;
|
||||
|
||||
|
||||
if (silhouette == 1)
|
||||
{
|
||||
// bottom sil
|
||||
@@ -929,21 +929,21 @@ void R_DrawSprite (vissprite_t* spr)
|
||||
cliptop[x] = ds->sprtopclip[x];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
// all clipping has been performed, so draw the sprite
|
||||
|
||||
// check for unclipped columns
|
||||
for (x = spr->x1 ; x<=spr->x2 ; x++)
|
||||
{
|
||||
if (clipbot[x] == -2)
|
||||
if (clipbot[x] == -2)
|
||||
clipbot[x] = viewheight;
|
||||
|
||||
if (cliptop[x] == -2)
|
||||
cliptop[x] = -1;
|
||||
}
|
||||
|
||||
|
||||
mfloorclip = clipbot;
|
||||
mceilingclip = cliptop;
|
||||
R_DrawVisSprite (spr, spr->x1, spr->x2);
|
||||
@@ -959,7 +959,7 @@ void R_DrawMasked (void)
|
||||
{
|
||||
vissprite_t* spr;
|
||||
drawseg_t* ds;
|
||||
|
||||
|
||||
R_SortVisSprites ();
|
||||
|
||||
if (vissprite_p > vissprites)
|
||||
@@ -969,18 +969,21 @@ void R_DrawMasked (void)
|
||||
spr != &vsprsortedhead ;
|
||||
spr=spr->next)
|
||||
{
|
||||
|
||||
|
||||
R_DrawSprite (spr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// render any remaining masked mid textures
|
||||
for (ds=ds_p-1 ; ds >= drawsegs ; ds--)
|
||||
if (ds->maskedtexturecol)
|
||||
R_RenderMaskedSegRange (ds, ds->x1, ds->x2);
|
||||
|
||||
|
||||
// draw the psprites on top of everything
|
||||
// but does not draw on side views
|
||||
if (!viewangleoffset)
|
||||
if (!viewangleoffset)
|
||||
R_DrawPlayerSprites ();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $Id:$
|
||||
@@ -100,7 +100,7 @@ typedef struct
|
||||
|
||||
// handle of the sound being played
|
||||
int handle;
|
||||
|
||||
|
||||
} channel_t;
|
||||
|
||||
|
||||
@@ -113,12 +113,12 @@ static channel_t* channels;
|
||||
int snd_SfxVolume = 15;
|
||||
|
||||
// Maximum volume of music. Useless so far.
|
||||
int snd_MusicVolume = 15;
|
||||
int snd_MusicVolume = 15;
|
||||
|
||||
|
||||
|
||||
// whether songs are mus_paused
|
||||
static boolean mus_paused;
|
||||
static boolean mus_paused;
|
||||
|
||||
// music currently being played
|
||||
static musicinfo_t* mus_playing=0;
|
||||
@@ -126,7 +126,7 @@ static musicinfo_t* mus_playing=0;
|
||||
// following is set
|
||||
// by the defaults code in M_misc:
|
||||
// number of channels available
|
||||
int numChannels;
|
||||
int numChannels;
|
||||
|
||||
static int nextcleanup;
|
||||
|
||||
@@ -161,14 +161,14 @@ void S_StopChannel(int cnum);
|
||||
void S_Init
|
||||
( int sfxVolume,
|
||||
int musicVolume )
|
||||
{
|
||||
{
|
||||
int i;
|
||||
|
||||
fprintf( stderr, "S_Init: default sfx volume %d\n", sfxVolume);
|
||||
|
||||
// Whatever these did with DMX, these are rather dummies now.
|
||||
I_SetChannels();
|
||||
|
||||
|
||||
S_SetSfxVolume(sfxVolume);
|
||||
// No music with Linux - another dummy.
|
||||
S_SetMusicVolume(musicVolume);
|
||||
@@ -178,11 +178,11 @@ void S_Init
|
||||
// simultaneously) within zone memory.
|
||||
channels =
|
||||
(channel_t *) Z_Malloc(numChannels*sizeof(channel_t), PU_STATIC, 0);
|
||||
|
||||
|
||||
// Free all channels for use
|
||||
for (i=0 ; i<numChannels ; i++)
|
||||
channels[i].sfxinfo = 0;
|
||||
|
||||
|
||||
// no sounds are playing, and they are not mus_paused
|
||||
mus_paused = 0;
|
||||
|
||||
@@ -209,10 +209,10 @@ void S_Start(void)
|
||||
for (cnum=0 ; cnum<numChannels ; cnum++)
|
||||
if (channels[cnum].sfxinfo)
|
||||
S_StopChannel(cnum);
|
||||
|
||||
|
||||
// start new music for the level
|
||||
mus_paused = 0;
|
||||
|
||||
|
||||
if (gamemode == commercial)
|
||||
mnum = mus_runnin + gamemap - 1;
|
||||
else
|
||||
@@ -220,7 +220,7 @@ void S_Start(void)
|
||||
int spmus[]=
|
||||
{
|
||||
// Song - Who? - Where?
|
||||
|
||||
|
||||
mus_e3m4, // American e4m1
|
||||
mus_e3m2, // Romero e4m2
|
||||
mus_e3m3, // Shawn e4m3
|
||||
@@ -231,21 +231,21 @@ void S_Start(void)
|
||||
mus_e2m5, // Shawn e4m8
|
||||
mus_e1m9 // Tim e4m9
|
||||
};
|
||||
|
||||
|
||||
if (gameepisode < 4)
|
||||
mnum = mus_e1m1 + (gameepisode-1)*9 + gamemap-1;
|
||||
else
|
||||
mnum = spmus[gamemap-1];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// HACK FOR COMMERCIAL
|
||||
// if (commercial && mnum > mus_e3m9)
|
||||
// if (commercial && mnum > mus_e3m9)
|
||||
// mnum -= mus_e3m9;
|
||||
|
||||
|
||||
S_ChangeMusic(mnum, true);
|
||||
|
||||
|
||||
nextcleanup = 15;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -264,34 +264,34 @@ S_StartSoundAtVolume
|
||||
int priority;
|
||||
sfxinfo_t* sfx;
|
||||
int cnum;
|
||||
|
||||
|
||||
mobj_t* origin = (mobj_t *) origin_p;
|
||||
|
||||
|
||||
|
||||
|
||||
// Debug.
|
||||
/*fprintf( stderr,
|
||||
"S_StartSoundAtVolume: playing sound %d (%s)\n",
|
||||
sfx_id, S_sfx[sfx_id].name );*/
|
||||
|
||||
|
||||
// check for bogus sound #
|
||||
if (sfx_id < 1 || sfx_id > NUMSFX)
|
||||
I_Error("Bad sfx #: %d", sfx_id);
|
||||
|
||||
|
||||
sfx = &S_sfx[sfx_id];
|
||||
|
||||
|
||||
// Initialize sound parameters
|
||||
if (sfx->link)
|
||||
{
|
||||
pitch = sfx->pitch;
|
||||
priority = sfx->priority;
|
||||
volume += sfx->volume;
|
||||
|
||||
|
||||
if (volume < 1)
|
||||
return;
|
||||
|
||||
|
||||
if (volume > snd_SfxVolume)
|
||||
volume = snd_SfxVolume;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pitch = NORM_PITCH;
|
||||
@@ -308,27 +308,27 @@ S_StartSoundAtVolume
|
||||
&volume,
|
||||
&sep,
|
||||
&pitch);
|
||||
|
||||
|
||||
if ( origin->x == players[consoleplayer].mo->x
|
||||
&& origin->y == players[consoleplayer].mo->y)
|
||||
{
|
||||
{
|
||||
sep = NORM_SEP;
|
||||
}
|
||||
|
||||
|
||||
if (!rc)
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sep = NORM_SEP;
|
||||
}
|
||||
|
||||
|
||||
// hacks to vary the sfx pitches
|
||||
if (sfx_id >= sfx_sawup
|
||||
&& sfx_id <= sfx_sawhit)
|
||||
{
|
||||
{
|
||||
pitch += 8 - (M_Random()&15);
|
||||
|
||||
|
||||
if (pitch<0)
|
||||
pitch = 0;
|
||||
else if (pitch>255)
|
||||
@@ -338,7 +338,7 @@ S_StartSoundAtVolume
|
||||
&& sfx_id != sfx_tink)
|
||||
{
|
||||
pitch += 16 - (M_Random()&31);
|
||||
|
||||
|
||||
if (pitch<0)
|
||||
pitch = 0;
|
||||
else if (pitch>255)
|
||||
@@ -350,7 +350,7 @@ S_StartSoundAtVolume
|
||||
|
||||
// try to find a channel
|
||||
cnum = S_getChannel(origin, sfx);
|
||||
|
||||
|
||||
if (cnum<0)
|
||||
return;
|
||||
|
||||
@@ -359,7 +359,7 @@ S_StartSoundAtVolume
|
||||
// For some odd reason, the caching is done nearly
|
||||
// each time the sound is needed?
|
||||
//
|
||||
|
||||
|
||||
// get lumpnum if necessary
|
||||
if (sfx->lumpnum < 0)
|
||||
sfx->lumpnum = I_GetSfxLumpNum(sfx);
|
||||
@@ -376,14 +376,14 @@ S_StartSoundAtVolume
|
||||
// fprintf( stderr,
|
||||
// "S_StartSoundAtVolume: loading %d (lump %d) : 0x%x\n",
|
||||
// sfx_id, sfx->lumpnum, (int)sfx->data );
|
||||
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
// increase the usefulness
|
||||
if (sfx->usefulness++ < 0)
|
||||
sfx->usefulness = 1;
|
||||
|
||||
|
||||
// Assigns the handle to one of the channels in the
|
||||
// mix/output buffer.
|
||||
channels[cnum].handle = I_StartSound(sfx_id,
|
||||
@@ -392,7 +392,7 @@ S_StartSoundAtVolume
|
||||
sep,
|
||||
pitch,
|
||||
priority);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
S_StartSound
|
||||
@@ -403,7 +403,7 @@ S_StartSound
|
||||
// if (sfx_id == sfx_sawful)
|
||||
// sfx_id = sfx_itemup;
|
||||
#endif
|
||||
|
||||
|
||||
S_StartSoundAtVolume(origin, sfx_id, snd_SfxVolume);
|
||||
|
||||
|
||||
@@ -412,11 +412,11 @@ S_StartSound
|
||||
{
|
||||
int i;
|
||||
int n;
|
||||
|
||||
|
||||
static mobj_t* last_saw_origins[10] = {1,1,1,1,1,1,1,1,1,1};
|
||||
static int first_saw=0;
|
||||
static int next_saw=0;
|
||||
|
||||
|
||||
if (sfx_id == sfx_sawidl
|
||||
|| sfx_id == sfx_sawful
|
||||
|| sfx_id == sfx_sawhit)
|
||||
@@ -428,19 +428,19 @@ S_StartSound
|
||||
last_saw_origins[i],
|
||||
origin,
|
||||
sfx_id);
|
||||
|
||||
|
||||
last_saw_origins[next_saw] = origin;
|
||||
next_saw = (next_saw + 1) % 10;
|
||||
if (next_saw == first_saw)
|
||||
first_saw = (first_saw + 1) % 10;
|
||||
|
||||
|
||||
for (n=i=0; i<numChannels ; i++)
|
||||
{
|
||||
if (channels[i].sfxinfo == &S_sfx[sfx_sawidl]
|
||||
|| channels[i].sfxinfo == &S_sfx[sfx_sawful]
|
||||
|| channels[i].sfxinfo == &S_sfx[sfx_sawhit]) n++;
|
||||
}
|
||||
|
||||
|
||||
if (n>1)
|
||||
{
|
||||
for (i=0; i<numChannels ; i++)
|
||||
@@ -462,7 +462,7 @@ S_StartSound
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -525,14 +525,14 @@ void S_UpdateSounds(void* listener_p)
|
||||
int pitch;
|
||||
sfxinfo_t* sfx;
|
||||
channel_t* c;
|
||||
|
||||
|
||||
mobj_t* listener = (mobj_t*)listener_p;
|
||||
|
||||
|
||||
|
||||
|
||||
// Clean up unused data.
|
||||
// This is currently not done for 16bit (sounds cached static).
|
||||
// DOS 8bit remains.
|
||||
// DOS 8bit remains.
|
||||
/*if (gametic > nextcleanup)
|
||||
{
|
||||
for (i=1 ; i<NUMSFX ; i++)
|
||||
@@ -549,7 +549,7 @@ void S_UpdateSounds(void* listener_p)
|
||||
}
|
||||
nextcleanup = gametic + 15;
|
||||
}*/
|
||||
|
||||
|
||||
for (cnum=0 ; cnum<numChannels ; cnum++)
|
||||
{
|
||||
c = &channels[cnum];
|
||||
@@ -588,7 +588,7 @@ void S_UpdateSounds(void* listener_p)
|
||||
&volume,
|
||||
&sep,
|
||||
&pitch);
|
||||
|
||||
|
||||
if (!audible)
|
||||
{
|
||||
S_StopChannel(cnum);
|
||||
@@ -619,7 +619,7 @@ void S_SetMusicVolume(int volume)
|
||||
{
|
||||
I_Error("Attempt to set music volume at %d",
|
||||
volume);
|
||||
}
|
||||
}
|
||||
|
||||
I_SetMusicVolume(127);
|
||||
I_SetMusicVolume(volume);
|
||||
@@ -668,7 +668,7 @@ S_ChangeMusic
|
||||
// shutdown old music
|
||||
S_StopMusic();
|
||||
|
||||
// get lumpnum if necessary
|
||||
// get lumpnum if neccessary
|
||||
if (!music->lumpnum)
|
||||
{
|
||||
sprintf(namebuf, "d_%s", music->name);
|
||||
@@ -696,7 +696,7 @@ void S_StopMusic(void)
|
||||
I_StopSong(mus_playing->handle);
|
||||
I_UnRegisterSong(mus_playing->handle);
|
||||
Z_ChangeTag(mus_playing->data, PU_CACHE);
|
||||
|
||||
|
||||
mus_playing->data = 0;
|
||||
mus_playing = 0;
|
||||
}
|
||||
@@ -733,7 +733,7 @@ void S_StopChannel(int cnum)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// degrade usefulness of sound data
|
||||
c->sfxinfo->usefulness--;
|
||||
|
||||
@@ -769,13 +769,13 @@ S_AdjustSoundParams
|
||||
|
||||
// From _GG1_ p.428. Appox. eucledian distance fast.
|
||||
approx_dist = adx + ady - ((adx < ady ? adx : ady)>>1);
|
||||
|
||||
|
||||
if (gamemap != 8
|
||||
&& approx_dist > S_CLIPPING_DIST)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// angle of source to listener
|
||||
angle = R_PointToAngle2(listener->x,
|
||||
listener->y,
|
||||
@@ -811,9 +811,9 @@ S_AdjustSoundParams
|
||||
// distance effect
|
||||
*vol = (snd_SfxVolume
|
||||
* ((S_CLIPPING_DIST - approx_dist)>>FRACBITS))
|
||||
/ S_ATTENUATOR;
|
||||
/ S_ATTENUATOR;
|
||||
}
|
||||
|
||||
|
||||
return (*vol > 0);
|
||||
}
|
||||
|
||||
@@ -831,7 +831,7 @@ S_getChannel
|
||||
{
|
||||
// channel number to use
|
||||
int cnum;
|
||||
|
||||
|
||||
channel_t* c;
|
||||
|
||||
// Find an open channel
|
||||
@@ -855,7 +855,7 @@ S_getChannel
|
||||
|
||||
if (cnum == numChannels)
|
||||
{
|
||||
// FUCK! No lower priority. Sorry, Charlie.
|
||||
// FUCK! No lower priority. Sorry, Charlie.
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
@@ -873,3 +873,7 @@ S_getChannel
|
||||
|
||||
return cnum;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $Id:$
|
||||
@@ -135,12 +135,12 @@ rcsid[] = "$Id: st_stuff.c,v 1.6 1997/02/03 22:45:13 b1 Exp $";
|
||||
// or into the frame buffer?
|
||||
|
||||
// AMMO number pos.
|
||||
#define ST_AMMOWIDTH 3
|
||||
#define ST_AMMOWIDTH 3
|
||||
#define ST_AMMOX 44
|
||||
#define ST_AMMOY 171
|
||||
|
||||
// HEALTH number pos.
|
||||
#define ST_HEALTHWIDTH 3
|
||||
#define ST_HEALTHWIDTH 3
|
||||
#define ST_HEALTHX 90
|
||||
#define ST_HEALTHY 171
|
||||
|
||||
@@ -154,7 +154,7 @@ rcsid[] = "$Id: st_stuff.c,v 1.6 1997/02/03 22:45:13 b1 Exp $";
|
||||
|
||||
// Frags pos.
|
||||
#define ST_FRAGSX 138
|
||||
#define ST_FRAGSY 171
|
||||
#define ST_FRAGSY 171
|
||||
#define ST_FRAGSWIDTH 2
|
||||
|
||||
// ARMOR number pos.
|
||||
@@ -206,23 +206,23 @@ rcsid[] = "$Id: st_stuff.c,v 1.6 1997/02/03 22:45:13 b1 Exp $";
|
||||
#define ST_MAXAMMO3Y 185
|
||||
|
||||
// pistol
|
||||
#define ST_WEAPON0X 110
|
||||
#define ST_WEAPON0X 110
|
||||
#define ST_WEAPON0Y 172
|
||||
|
||||
// shotgun
|
||||
#define ST_WEAPON1X 122
|
||||
#define ST_WEAPON1X 122
|
||||
#define ST_WEAPON1Y 172
|
||||
|
||||
// chain gun
|
||||
#define ST_WEAPON2X 134
|
||||
#define ST_WEAPON2X 134
|
||||
#define ST_WEAPON2Y 172
|
||||
|
||||
// missile launcher
|
||||
#define ST_WEAPON3X 110
|
||||
#define ST_WEAPON3X 110
|
||||
#define ST_WEAPON3Y 181
|
||||
|
||||
// plasma gun
|
||||
#define ST_WEAPON4X 122
|
||||
#define ST_WEAPON4X 122
|
||||
#define ST_WEAPON4Y 181
|
||||
|
||||
// bfg
|
||||
@@ -230,7 +230,7 @@ rcsid[] = "$Id: st_stuff.c,v 1.6 1997/02/03 22:45:13 b1 Exp $";
|
||||
#define ST_WEAPON5Y 181
|
||||
|
||||
// WPNS title
|
||||
#define ST_WPNSX 109
|
||||
#define ST_WPNSX 109
|
||||
#define ST_WPNSY 191
|
||||
|
||||
// DETH title
|
||||
@@ -252,8 +252,8 @@ rcsid[] = "$Id: st_stuff.c,v 1.6 1997/02/03 22:45:13 b1 Exp $";
|
||||
#define ST_OUTTEXTY 6
|
||||
|
||||
// Width, in characters again.
|
||||
#define ST_OUTWIDTH 52
|
||||
// Height, in lines.
|
||||
#define ST_OUTWIDTH 52
|
||||
// Height, in lines.
|
||||
#define ST_OUTHEIGHT 1
|
||||
|
||||
#define ST_MAPWIDTH \
|
||||
@@ -265,9 +265,9 @@ rcsid[] = "$Id: st_stuff.c,v 1.6 1997/02/03 22:45:13 b1 Exp $";
|
||||
#define ST_MAPTITLEY 0
|
||||
#define ST_MAPHEIGHT 1
|
||||
|
||||
|
||||
|
||||
// main player in game
|
||||
static player_t* plyr;
|
||||
static player_t* plyr;
|
||||
|
||||
// ST_Start() has just been called
|
||||
static boolean st_firsttime;
|
||||
@@ -284,7 +284,7 @@ static unsigned int st_clock;
|
||||
// used for making messages go away
|
||||
static int st_msgcounter=0;
|
||||
|
||||
// used when in chat
|
||||
// used when in chat
|
||||
static st_chatstateenum_t st_chatstate;
|
||||
|
||||
// whether in automap or first-person
|
||||
@@ -303,13 +303,13 @@ static boolean st_oldchat;
|
||||
static boolean st_cursoron;
|
||||
|
||||
// !deathmatch
|
||||
static boolean st_notdeathmatch;
|
||||
static boolean st_notdeathmatch;
|
||||
|
||||
// !deathmatch && st_statusbaron
|
||||
static boolean st_armson;
|
||||
|
||||
// !deathmatch
|
||||
static boolean st_fragson;
|
||||
static boolean st_fragson;
|
||||
|
||||
// main bar left
|
||||
static patch_t* sbar;
|
||||
@@ -324,7 +324,7 @@ static patch_t* tallpercent;
|
||||
static patch_t* shortnum[10];
|
||||
|
||||
// 3 key-cards, 3 skulls
|
||||
static patch_t* keys[NUMCARDS];
|
||||
static patch_t* keys[NUMCARDS];
|
||||
|
||||
// face status patches
|
||||
static patch_t* faces[ST_NUMFACES];
|
||||
@@ -336,7 +336,7 @@ static patch_t* faceback;
|
||||
static patch_t* armsbg;
|
||||
|
||||
// weapon ownership patches
|
||||
static patch_t* arms[6][2];
|
||||
static patch_t* arms[6][2];
|
||||
|
||||
// ready-weapon widget
|
||||
static st_number_t w_ready;
|
||||
@@ -348,14 +348,14 @@ static st_number_t w_frags;
|
||||
static st_percent_t w_health;
|
||||
|
||||
// arms background
|
||||
static st_binicon_t w_armsbg;
|
||||
static st_binicon_t w_armsbg;
|
||||
|
||||
|
||||
// weapon ownership widgets
|
||||
static st_multicon_t w_arms[6];
|
||||
|
||||
// face status widget
|
||||
static st_multicon_t w_faces;
|
||||
static st_multicon_t w_faces;
|
||||
|
||||
// keycard widgets
|
||||
static st_multicon_t w_keyboxes[3];
|
||||
@@ -367,18 +367,18 @@ static st_percent_t w_armor;
|
||||
static st_number_t w_ammo[4];
|
||||
|
||||
// max ammo widgets
|
||||
static st_number_t w_maxammo[4];
|
||||
static st_number_t w_maxammo[4];
|
||||
|
||||
|
||||
|
||||
// number of frags so far in deathmatch
|
||||
static int st_fragscount;
|
||||
|
||||
// used to use appropriately pained face
|
||||
// used to use appopriately pained face
|
||||
static int st_oldhealth = -1;
|
||||
|
||||
// used for evil grin
|
||||
static boolean oldweaponsowned[NUMWEAPONS];
|
||||
static boolean oldweaponsowned[NUMWEAPONS];
|
||||
|
||||
// count until face changes
|
||||
static int st_facecount = 0;
|
||||
@@ -387,10 +387,10 @@ static int st_facecount = 0;
|
||||
static int st_faceindex = 0;
|
||||
|
||||
// holds key-type for each key box on bar
|
||||
static int keyboxes[3];
|
||||
static int keyboxes[3];
|
||||
|
||||
// a random number per tick
|
||||
static int st_randomnumber;
|
||||
static int st_randomnumber;
|
||||
|
||||
|
||||
|
||||
@@ -423,7 +423,7 @@ unsigned char cheat_ammonokey_seq[] =
|
||||
};
|
||||
|
||||
|
||||
// Smashing Pumpkins Into Samml Piles Of Putried Debris.
|
||||
// Smashing Pumpkins Into Samml Piles Of Putried Debris.
|
||||
unsigned char cheat_noclip_seq[] =
|
||||
{
|
||||
0xb2, 0x26, 0xea, 0x2a, 0xb2, // idspispopd
|
||||
@@ -434,7 +434,7 @@ unsigned char cheat_noclip_seq[] =
|
||||
unsigned char cheat_commercial_noclip_seq[] =
|
||||
{
|
||||
0xb2, 0x26, 0xe2, 0x36, 0xb2, 0x2a, 0xff // idclip
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -460,7 +460,7 @@ unsigned char cheat_clev_seq[] =
|
||||
unsigned char cheat_mypos_seq[] =
|
||||
{
|
||||
0xb2, 0x26, 0xb6, 0xba, 0x2a, 0xf6, 0xea, 0xff // idmypos
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
// Now what?
|
||||
@@ -487,7 +487,7 @@ cheatseq_t cheat_clev = { cheat_clev_seq, 0 };
|
||||
cheatseq_t cheat_mypos = { cheat_mypos_seq, 0 };
|
||||
|
||||
|
||||
//
|
||||
//
|
||||
extern char* mapnames[];
|
||||
|
||||
|
||||
@@ -518,7 +518,7 @@ boolean
|
||||
ST_Responder (event_t* ev)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
// Filter automap on/off.
|
||||
if (ev->type == ev_keyup
|
||||
&& ((ev->data1 & 0xffff0000) == AM_MSGHEADER))
|
||||
@@ -529,7 +529,7 @@ ST_Responder (event_t* ev)
|
||||
st_gamestate = AutomapState;
|
||||
st_firsttime = true;
|
||||
break;
|
||||
|
||||
|
||||
case AM_MSGEXITED:
|
||||
// fprintf(stderr, "AM exited\n");
|
||||
st_gamestate = FirstPersonState;
|
||||
@@ -544,7 +544,7 @@ ST_Responder (event_t* ev)
|
||||
{
|
||||
// b. - enabled for more debug fun.
|
||||
// if (gameskill != sk_nightmare) {
|
||||
|
||||
|
||||
// 'dqd' cheat for toggleable god mode
|
||||
if (cht_CheckCheat(&cheat_god, ev->data1))
|
||||
{
|
||||
@@ -553,11 +553,11 @@ ST_Responder (event_t* ev)
|
||||
{
|
||||
if (plyr->mo)
|
||||
plyr->mo->health = 100;
|
||||
|
||||
|
||||
plyr->health = 100;
|
||||
plyr->message = STSTR_DQDON;
|
||||
}
|
||||
else
|
||||
else
|
||||
plyr->message = STSTR_DQDOFF;
|
||||
}
|
||||
// 'fa' cheat for killer fucking arsenal
|
||||
@@ -565,13 +565,13 @@ ST_Responder (event_t* ev)
|
||||
{
|
||||
plyr->armorpoints = 200;
|
||||
plyr->armortype = 2;
|
||||
|
||||
|
||||
for (i=0;i<NUMWEAPONS;i++)
|
||||
plyr->weaponowned[i] = true;
|
||||
|
||||
|
||||
for (i=0;i<NUMAMMO;i++)
|
||||
plyr->ammo[i] = plyr->maxammo[i];
|
||||
|
||||
|
||||
plyr->message = STSTR_FAADDED;
|
||||
}
|
||||
// 'kfa' cheat for key full ammo
|
||||
@@ -579,32 +579,32 @@ ST_Responder (event_t* ev)
|
||||
{
|
||||
plyr->armorpoints = 200;
|
||||
plyr->armortype = 2;
|
||||
|
||||
|
||||
for (i=0;i<NUMWEAPONS;i++)
|
||||
plyr->weaponowned[i] = true;
|
||||
|
||||
|
||||
for (i=0;i<NUMAMMO;i++)
|
||||
plyr->ammo[i] = plyr->maxammo[i];
|
||||
|
||||
|
||||
for (i=0;i<NUMCARDS;i++)
|
||||
plyr->cards[i] = true;
|
||||
|
||||
|
||||
plyr->message = STSTR_KFAADDED;
|
||||
}
|
||||
// 'mus' cheat for changing music
|
||||
else if (cht_CheckCheat(&cheat_mus, ev->data1))
|
||||
{
|
||||
|
||||
|
||||
char buf[3];
|
||||
int musnum;
|
||||
|
||||
|
||||
plyr->message = STSTR_MUS;
|
||||
cht_GetParam(&cheat_mus, buf);
|
||||
|
||||
|
||||
if (gamemode == commercial)
|
||||
{
|
||||
musnum = mus_runnin + (buf[0]-'0')*10 + buf[1]-'0' - 1;
|
||||
|
||||
|
||||
if (((buf[0]-'0')*10 + buf[1]-'0') > 35)
|
||||
plyr->message = STSTR_NOMUS;
|
||||
else
|
||||
@@ -613,7 +613,7 @@ ST_Responder (event_t* ev)
|
||||
else
|
||||
{
|
||||
musnum = mus_e1m1 + (buf[0]-'1')*9 + (buf[1]-'1');
|
||||
|
||||
|
||||
if (((buf[0]-'1')*9 + buf[1]-'1') > 31)
|
||||
plyr->message = STSTR_NOMUS;
|
||||
else
|
||||
@@ -622,11 +622,11 @@ ST_Responder (event_t* ev)
|
||||
}
|
||||
// Simplified, accepting both "noclip" and "idspispopd".
|
||||
// no clipping mode cheat
|
||||
else if ( cht_CheckCheat(&cheat_noclip, ev->data1)
|
||||
else if ( cht_CheckCheat(&cheat_noclip, ev->data1)
|
||||
|| cht_CheckCheat(&cheat_commercial_noclip,ev->data1) )
|
||||
{
|
||||
{
|
||||
plyr->cheats ^= CF_NOCLIP;
|
||||
|
||||
|
||||
if (plyr->cheats & CF_NOCLIP)
|
||||
plyr->message = STSTR_NCON;
|
||||
else
|
||||
@@ -643,11 +643,11 @@ ST_Responder (event_t* ev)
|
||||
plyr->powers[i] = 1;
|
||||
else
|
||||
plyr->powers[i] = 0;
|
||||
|
||||
|
||||
plyr->message = STSTR_BEHOLDX;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 'behold' power-up menu
|
||||
if (cht_CheckCheat(&cheat_powerup[6], ev->data1))
|
||||
{
|
||||
@@ -671,16 +671,16 @@ ST_Responder (event_t* ev)
|
||||
plyr->message = buf;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 'clev' change-level cheat
|
||||
if (cht_CheckCheat(&cheat_clev, ev->data1))
|
||||
{
|
||||
char buf[3];
|
||||
int epsd;
|
||||
int map;
|
||||
|
||||
|
||||
cht_GetParam(&cheat_clev, buf);
|
||||
|
||||
|
||||
if (gamemode == commercial)
|
||||
{
|
||||
epsd = 0;
|
||||
@@ -698,7 +698,7 @@ ST_Responder (event_t* ev)
|
||||
|
||||
if (map < 1)
|
||||
return false;
|
||||
|
||||
|
||||
// Ohmygod - this is not going to work.
|
||||
if ((gamemode == retail)
|
||||
&& ((epsd > 4) || (map > 9)))
|
||||
@@ -719,7 +719,7 @@ ST_Responder (event_t* ev)
|
||||
// So be it.
|
||||
plyr->message = STSTR_CLEV;
|
||||
G_DeferedInitNew(gameskill, epsd, map);
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -731,7 +731,7 @@ int ST_calcPainOffset(void)
|
||||
int health;
|
||||
static int lastcalc;
|
||||
static int oldhealth = -1;
|
||||
|
||||
|
||||
health = plyr->health > 100 ? 100 : plyr->health;
|
||||
|
||||
if (health != oldhealth)
|
||||
@@ -784,7 +784,7 @@ void ST_updateFaceWidget(void)
|
||||
oldweaponsowned[i] = plyr->weaponowned[i];
|
||||
}
|
||||
}
|
||||
if (doevilgrin)
|
||||
if (doevilgrin)
|
||||
{
|
||||
// evil grin if just picked up weapon
|
||||
priority = 8;
|
||||
@@ -794,7 +794,7 @@ void ST_updateFaceWidget(void)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (priority < 8)
|
||||
{
|
||||
if (plyr->damagecount
|
||||
@@ -803,7 +803,7 @@ void ST_updateFaceWidget(void)
|
||||
{
|
||||
// being attacked
|
||||
priority = 7;
|
||||
|
||||
|
||||
if (plyr->health - st_oldhealth > ST_MUCHPAIN)
|
||||
{
|
||||
st_facecount = ST_TURNCOUNT;
|
||||
@@ -815,27 +815,27 @@ void ST_updateFaceWidget(void)
|
||||
plyr->mo->y,
|
||||
plyr->attacker->x,
|
||||
plyr->attacker->y);
|
||||
|
||||
|
||||
if (badguyangle > plyr->mo->angle)
|
||||
{
|
||||
// whether right or left
|
||||
diffang = badguyangle - plyr->mo->angle;
|
||||
i = diffang > ANG180;
|
||||
i = diffang > ANG180;
|
||||
}
|
||||
else
|
||||
{
|
||||
// whether left or right
|
||||
diffang = plyr->mo->angle - badguyangle;
|
||||
i = diffang <= ANG180;
|
||||
i = diffang <= ANG180;
|
||||
} // confusing, aint it?
|
||||
|
||||
|
||||
|
||||
st_facecount = ST_TURNCOUNT;
|
||||
st_faceindex = ST_calcPainOffset();
|
||||
|
||||
|
||||
if (diffang < ANG45)
|
||||
{
|
||||
// head-on
|
||||
// head-on
|
||||
st_faceindex += ST_RAMPAGEOFFSET;
|
||||
}
|
||||
else if (i)
|
||||
@@ -851,7 +851,7 @@ void ST_updateFaceWidget(void)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (priority < 7)
|
||||
{
|
||||
// getting hurt because of your own damn stupidity
|
||||
@@ -873,7 +873,7 @@ void ST_updateFaceWidget(void)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (priority < 6)
|
||||
{
|
||||
// rapid firing
|
||||
@@ -893,7 +893,7 @@ void ST_updateFaceWidget(void)
|
||||
lastattackdown = -1;
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (priority < 5)
|
||||
{
|
||||
// invulnerability
|
||||
@@ -963,12 +963,12 @@ void ST_updateWidgets(void)
|
||||
|
||||
// used by the w_armsbg widget
|
||||
st_notdeathmatch = !deathmatch;
|
||||
|
||||
|
||||
// used by w_arms[] widgets
|
||||
st_armson = st_statusbaron && !deathmatch;
|
||||
st_armson = st_statusbaron && !deathmatch;
|
||||
|
||||
// used by w_frags widget
|
||||
st_fragson = deathmatch && st_statusbaron;
|
||||
st_fragson = deathmatch && st_statusbaron;
|
||||
st_fragscount = 0;
|
||||
|
||||
for (i=0 ; i<MAXPLAYERS ; i++)
|
||||
@@ -1015,11 +1015,11 @@ void ST_doPaletteStuff(void)
|
||||
if (bzc > cnt)
|
||||
cnt = bzc;
|
||||
}
|
||||
|
||||
|
||||
if (cnt)
|
||||
{
|
||||
palette = (cnt+7)>>3;
|
||||
|
||||
|
||||
if (palette >= NUMREDPALS)
|
||||
palette = NUMREDPALS-1;
|
||||
|
||||
@@ -1059,7 +1059,7 @@ void ST_drawWidgets(boolean refresh)
|
||||
st_armson = st_statusbaron && !deathmatch;
|
||||
|
||||
// used by w_frags widget
|
||||
st_fragson = deathmatch && st_statusbaron;
|
||||
st_fragson = deathmatch && st_statusbaron;
|
||||
|
||||
STlib_updateNum(&w_ready, refresh);
|
||||
|
||||
@@ -1107,7 +1107,7 @@ void ST_diffDraw(void)
|
||||
|
||||
void ST_Drawer (boolean fullscreen, boolean refresh)
|
||||
{
|
||||
|
||||
|
||||
st_statusbaron = (!fullscreen) || automapactive;
|
||||
st_firsttime = st_firsttime || refresh;
|
||||
|
||||
@@ -1127,7 +1127,7 @@ void ST_loadGraphics(void)
|
||||
int i;
|
||||
int j;
|
||||
int facenum;
|
||||
|
||||
|
||||
char namebuf[9];
|
||||
|
||||
// Load the numbers, tall and short
|
||||
@@ -1163,7 +1163,7 @@ void ST_loadGraphics(void)
|
||||
arms[i][0] = (patch_t *) W_CacheLumpName(namebuf, PU_STATIC);
|
||||
|
||||
// yellow #
|
||||
arms[i][1] = shortnum[i+2];
|
||||
arms[i][1] = shortnum[i+2];
|
||||
}
|
||||
|
||||
// face backgrounds for different color players
|
||||
@@ -1216,15 +1216,15 @@ void ST_unloadGraphics(void)
|
||||
Z_ChangeTag(shortnum[i], PU_CACHE);
|
||||
}
|
||||
// unload tall percent
|
||||
Z_ChangeTag(tallpercent, PU_CACHE);
|
||||
Z_ChangeTag(tallpercent, PU_CACHE);
|
||||
|
||||
// unload arms background
|
||||
Z_ChangeTag(armsbg, PU_CACHE);
|
||||
Z_ChangeTag(armsbg, PU_CACHE);
|
||||
|
||||
// unload gray #'s
|
||||
for (i=0;i<6;i++)
|
||||
Z_ChangeTag(arms[i][0], PU_CACHE);
|
||||
|
||||
|
||||
// unload the key cards
|
||||
for (i=0;i<NUMCARDS;i++)
|
||||
Z_ChangeTag(keys[i], PU_CACHE);
|
||||
@@ -1237,7 +1237,7 @@ void ST_unloadGraphics(void)
|
||||
|
||||
// Note: nobody ain't seen no unloading
|
||||
// of stminus yet. Dude.
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1294,7 +1294,7 @@ void ST_createWidgets(void)
|
||||
ST_AMMOWIDTH );
|
||||
|
||||
// the last weapon type
|
||||
w_ready.data = plyr->readyweapon;
|
||||
w_ready.data = plyr->readyweapon;
|
||||
|
||||
// health percentage
|
||||
STlib_initPercent(&w_health,
|
||||
@@ -1355,7 +1355,7 @@ void ST_createWidgets(void)
|
||||
keys,
|
||||
&keyboxes[0],
|
||||
&st_statusbaron);
|
||||
|
||||
|
||||
STlib_initMultIcon(&w_keyboxes[1],
|
||||
ST_KEY1X,
|
||||
ST_KEY1Y,
|
||||
@@ -1394,7 +1394,7 @@ void ST_createWidgets(void)
|
||||
&plyr->ammo[2],
|
||||
&st_statusbaron,
|
||||
ST_AMMO2WIDTH);
|
||||
|
||||
|
||||
STlib_initNum(&w_ammo[3],
|
||||
ST_AMMO3X,
|
||||
ST_AMMO3Y,
|
||||
@@ -1427,7 +1427,7 @@ void ST_createWidgets(void)
|
||||
&plyr->maxammo[2],
|
||||
&st_statusbaron,
|
||||
ST_MAXAMMO2WIDTH);
|
||||
|
||||
|
||||
STlib_initNum(&w_maxammo[3],
|
||||
ST_MAXAMMO3X,
|
||||
ST_MAXAMMO3Y,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $Id:$
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
#include "doomdef.h"
|
||||
|
||||
// Needed because we are referring to patches.
|
||||
// Needed because we are refering to patches.
|
||||
#include "r_data.h"
|
||||
|
||||
//
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $Id:$
|
||||
@@ -59,7 +59,7 @@ rcsid[] = "$Id: wi_stuff.c,v 1.7 1997/02/03 22:45:13 b1 Exp $";
|
||||
|
||||
|
||||
//
|
||||
// Different between registered DOOM (1994) and
|
||||
// Different vetween registered DOOM (1994) and
|
||||
// Ultimate DOOM - Final edition (retail, 1995?).
|
||||
// This is supposedly ignored for commercial
|
||||
// release (aka DOOM II), which had 34 maps
|
||||
@@ -69,11 +69,11 @@ rcsid[] = "$Id: wi_stuff.c,v 1.7 1997/02/03 22:45:13 b1 Exp $";
|
||||
|
||||
|
||||
// in tics
|
||||
//U #define PAUSELEN (TICRATE*2)
|
||||
//U #define PAUSELEN (TICRATE*2)
|
||||
//U #define SCORESTEP 100
|
||||
//U #define ANIMPERIOD 32
|
||||
// pixel distance from "(YOU)" to "PLAYER N"
|
||||
//U #define STARDIST 10
|
||||
//U #define STARDIST 10
|
||||
//U #define WK 1
|
||||
|
||||
|
||||
@@ -124,7 +124,7 @@ typedef struct
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
|
||||
|
||||
} point_t;
|
||||
|
||||
|
||||
@@ -153,10 +153,10 @@ typedef struct
|
||||
// ALWAYS: n/a,
|
||||
// RANDOM: random base period,
|
||||
// LEVEL: n/a
|
||||
int data2;
|
||||
int data2;
|
||||
|
||||
// actual graphics for frames of animations
|
||||
patch_t* p[3];
|
||||
patch_t* p[3];
|
||||
|
||||
// following must be initialized to zero before use!
|
||||
|
||||
@@ -168,9 +168,9 @@ typedef struct
|
||||
|
||||
// next frame number to animate
|
||||
int ctr;
|
||||
|
||||
|
||||
// used by RANDOM and LEVEL when animating
|
||||
int state;
|
||||
int state;
|
||||
|
||||
} anim_t;
|
||||
|
||||
@@ -290,8 +290,8 @@ static anim_t *anims[NUMEPISODES] =
|
||||
#define SP_KILLS 0
|
||||
#define SP_ITEMS 2
|
||||
#define SP_SECRET 4
|
||||
#define SP_FRAGS 6
|
||||
#define SP_TIME 8
|
||||
#define SP_FRAGS 6
|
||||
#define SP_TIME 8
|
||||
#define SP_PAR ST_TIME
|
||||
|
||||
#define SP_PAUSE 1
|
||||
@@ -316,13 +316,13 @@ static wbstartstruct_t* wbs;
|
||||
static wbplayerstruct_t* plrs; // wbs->plyr[]
|
||||
|
||||
// used for general timing
|
||||
static int cnt;
|
||||
static int cnt;
|
||||
|
||||
// used for timing of background animation
|
||||
static int bcnt;
|
||||
|
||||
// signals to refresh everything for one frame
|
||||
static int firstrefresh;
|
||||
static int firstrefresh;
|
||||
|
||||
static int cnt_kills[MAXPLAYERS];
|
||||
static int cnt_items[MAXPLAYERS];
|
||||
@@ -332,7 +332,7 @@ static int cnt_par;
|
||||
static int cnt_pause;
|
||||
|
||||
// # of commercial levels
|
||||
static int NUMCMAPS;
|
||||
static int NUMCMAPS;
|
||||
|
||||
|
||||
//
|
||||
@@ -343,7 +343,7 @@ static int NUMCMAPS;
|
||||
static patch_t* bg;
|
||||
|
||||
// You Are Here graphic
|
||||
static patch_t* yah[2];
|
||||
static patch_t* yah[2];
|
||||
|
||||
// splat
|
||||
static patch_t* splat;
|
||||
@@ -362,7 +362,7 @@ static patch_t* wiminus;
|
||||
static patch_t* finished;
|
||||
|
||||
// "Entering" graphic
|
||||
static patch_t* entering;
|
||||
static patch_t* entering;
|
||||
|
||||
// "secret"
|
||||
static patch_t* sp_secret;
|
||||
@@ -380,7 +380,7 @@ static patch_t* sucks;
|
||||
|
||||
// "killers", "victims"
|
||||
static patch_t* killers;
|
||||
static patch_t* victims;
|
||||
static patch_t* victims;
|
||||
|
||||
// "Total", your face, your dead face
|
||||
static patch_t* total;
|
||||
@@ -423,13 +423,13 @@ void WI_drawLF(void)
|
||||
{
|
||||
int y = WI_TITLEY;
|
||||
|
||||
// draw <LevelName>
|
||||
// draw <LevelName>
|
||||
V_DrawPatch((SCREENWIDTH - SHORT(lnames[wbs->last]->width))/2,
|
||||
y, FB, lnames[wbs->last]);
|
||||
|
||||
// draw "Finished!"
|
||||
y += (5*SHORT(lnames[wbs->last]->height))/4;
|
||||
|
||||
|
||||
V_DrawPatch((SCREENWIDTH - SHORT(finished->width))/2,
|
||||
y, FB, finished);
|
||||
}
|
||||
@@ -495,7 +495,7 @@ WI_drawOnLnode
|
||||
else
|
||||
{
|
||||
// DEBUG
|
||||
printf("Could not place patch on level %d", n+1);
|
||||
printf("Could not place patch on level %d", n+1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -563,7 +563,7 @@ void WI_updateAnimatedBack(void)
|
||||
}
|
||||
else a->nexttic = bcnt + a->period;
|
||||
break;
|
||||
|
||||
|
||||
case ANIM_LEVEL:
|
||||
// gawd-awful hack for level anims
|
||||
if (!(state == StatCount && i == 7)
|
||||
@@ -711,13 +711,13 @@ WI_drawTime
|
||||
// draw
|
||||
if (div==60 || t / div)
|
||||
V_DrawPatch(x, y, FB, colon);
|
||||
|
||||
|
||||
} while (t / div);
|
||||
}
|
||||
else
|
||||
{
|
||||
// "sucks"
|
||||
V_DrawPatch(x - SHORT(sucks->width), y, FB, sucks);
|
||||
V_DrawPatch(x - SHORT(sucks->width), y, FB, sucks);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -778,7 +778,7 @@ void WI_drawShowNextLoc(void)
|
||||
WI_slamBackground();
|
||||
|
||||
// draw animated background
|
||||
WI_drawAnimatedBack();
|
||||
WI_drawAnimatedBack();
|
||||
|
||||
if ( gamemode != commercial)
|
||||
{
|
||||
@@ -787,7 +787,7 @@ void WI_drawShowNextLoc(void)
|
||||
WI_drawEL();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
last = (wbs->last == 8) ? wbs->next - 1 : wbs->last;
|
||||
|
||||
// draw a splat on taken cities.
|
||||
@@ -800,13 +800,13 @@ void WI_drawShowNextLoc(void)
|
||||
|
||||
// draw flashing ptr
|
||||
if (snl_pointeron)
|
||||
WI_drawOnLnode(wbs->next, yah);
|
||||
WI_drawOnLnode(wbs->next, yah);
|
||||
}
|
||||
|
||||
// draws which level you are entering..
|
||||
if ( (gamemode != commercial)
|
||||
|| wbs->next != 30)
|
||||
WI_drawEL();
|
||||
WI_drawEL();
|
||||
|
||||
}
|
||||
|
||||
@@ -820,7 +820,7 @@ int WI_fragSum(int playernum)
|
||||
{
|
||||
int i;
|
||||
int frags = 0;
|
||||
|
||||
|
||||
for (i=0 ; i<MAXPLAYERS ; i++)
|
||||
{
|
||||
if (playeringame[i]
|
||||
@@ -830,7 +830,7 @@ int WI_fragSum(int playernum)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// JDC hack - negative frags.
|
||||
frags -= plrs[playernum].frags[playernum];
|
||||
// UNUSED if (frags < 0)
|
||||
@@ -870,7 +870,7 @@ void WI_initDeathmatchStats(void)
|
||||
dm_totals[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
WI_initAnimatedBack();
|
||||
}
|
||||
|
||||
@@ -881,7 +881,7 @@ void WI_updateDeathmatchStats(void)
|
||||
|
||||
int i;
|
||||
int j;
|
||||
|
||||
|
||||
boolean stillticking;
|
||||
|
||||
WI_updateAnimatedBack();
|
||||
@@ -901,18 +901,18 @@ void WI_updateDeathmatchStats(void)
|
||||
dm_totals[i] = WI_fragSum(i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
S_StartSound(0, sfx_barexp);
|
||||
dm_state = 4;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (dm_state == 2)
|
||||
{
|
||||
if (!(bcnt&3))
|
||||
S_StartSound(0, sfx_pistol);
|
||||
|
||||
|
||||
stillticking = false;
|
||||
|
||||
for (i=0 ; i<MAXPLAYERS ; i++)
|
||||
@@ -934,7 +934,7 @@ void WI_updateDeathmatchStats(void)
|
||||
|
||||
if (dm_frags[i][j] < -99)
|
||||
dm_frags[i][j] = -99;
|
||||
|
||||
|
||||
stillticking = true;
|
||||
}
|
||||
}
|
||||
@@ -942,11 +942,11 @@ void WI_updateDeathmatchStats(void)
|
||||
|
||||
if (dm_totals[i] > 99)
|
||||
dm_totals[i] = 99;
|
||||
|
||||
|
||||
if (dm_totals[i] < -99)
|
||||
dm_totals[i] = -99;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
if (!stillticking)
|
||||
{
|
||||
@@ -987,15 +987,15 @@ void WI_drawDeathmatchStats(void)
|
||||
int x;
|
||||
int y;
|
||||
int w;
|
||||
|
||||
|
||||
int lh; // line height
|
||||
|
||||
lh = WI_SPACINGY;
|
||||
|
||||
WI_slamBackground();
|
||||
|
||||
|
||||
// draw animated background
|
||||
WI_drawAnimatedBack();
|
||||
WI_drawAnimatedBack();
|
||||
WI_drawLF();
|
||||
|
||||
// draw stat titles (top line)
|
||||
@@ -1003,7 +1003,7 @@ void WI_drawDeathmatchStats(void)
|
||||
DM_MATRIXY-WI_SPACINGY+10,
|
||||
FB,
|
||||
total);
|
||||
|
||||
|
||||
V_DrawPatch(DM_KILLERSX, DM_KILLERSY, FB, killers);
|
||||
V_DrawPatch(DM_VICTIMSX, DM_VICTIMSY, FB, victims);
|
||||
|
||||
@@ -1019,7 +1019,7 @@ void WI_drawDeathmatchStats(void)
|
||||
DM_MATRIXY - WI_SPACINGY,
|
||||
FB,
|
||||
p[i]);
|
||||
|
||||
|
||||
V_DrawPatch(DM_MATRIXX-SHORT(p[i]->width)/2,
|
||||
y,
|
||||
FB,
|
||||
@@ -1109,7 +1109,7 @@ void WI_updateNetgameStats(void)
|
||||
|
||||
int i;
|
||||
int fsum;
|
||||
|
||||
|
||||
boolean stillticking;
|
||||
|
||||
WI_updateAnimatedBack();
|
||||
@@ -1153,7 +1153,7 @@ void WI_updateNetgameStats(void)
|
||||
else
|
||||
stillticking = true;
|
||||
}
|
||||
|
||||
|
||||
if (!stillticking)
|
||||
{
|
||||
S_StartSound(0, sfx_barexp);
|
||||
@@ -1203,7 +1203,7 @@ void WI_updateNetgameStats(void)
|
||||
else
|
||||
stillticking = true;
|
||||
}
|
||||
|
||||
|
||||
if (!stillticking)
|
||||
{
|
||||
S_StartSound(0, sfx_barexp);
|
||||
@@ -1229,7 +1229,7 @@ void WI_updateNetgameStats(void)
|
||||
else
|
||||
stillticking = true;
|
||||
}
|
||||
|
||||
|
||||
if (!stillticking)
|
||||
{
|
||||
S_StartSound(0, sfx_pldeth);
|
||||
@@ -1267,9 +1267,9 @@ void WI_drawNetgameStats(void)
|
||||
int pwidth = SHORT(percent->width);
|
||||
|
||||
WI_slamBackground();
|
||||
|
||||
|
||||
// draw animated background
|
||||
WI_drawAnimatedBack();
|
||||
WI_drawAnimatedBack();
|
||||
|
||||
WI_drawLF();
|
||||
|
||||
@@ -1282,7 +1282,7 @@ void WI_drawNetgameStats(void)
|
||||
|
||||
V_DrawPatch(NG_STATSX+3*NG_SPACINGX-SHORT(secret->width),
|
||||
NG_STATSY, FB, secret);
|
||||
|
||||
|
||||
if (dofrags)
|
||||
V_DrawPatch(NG_STATSX+4*NG_SPACINGX-SHORT(frags->width),
|
||||
NG_STATSY, FB, frags);
|
||||
@@ -1437,7 +1437,7 @@ void WI_updateStats(void)
|
||||
void WI_drawStats(void)
|
||||
{
|
||||
// line height
|
||||
int lh;
|
||||
int lh;
|
||||
|
||||
lh = (3*SHORT(num[0]->height))/2;
|
||||
|
||||
@@ -1445,7 +1445,7 @@ void WI_drawStats(void)
|
||||
|
||||
// draw animated background
|
||||
WI_drawAnimatedBack();
|
||||
|
||||
|
||||
WI_drawLF();
|
||||
|
||||
V_DrawPatch(SP_STATSX, SP_STATSY, FB, kills);
|
||||
@@ -1504,7 +1504,7 @@ void WI_checkForAccelerate(void)
|
||||
void WI_Ticker(void)
|
||||
{
|
||||
// counter for general background animation
|
||||
bcnt++;
|
||||
bcnt++;
|
||||
|
||||
if (bcnt == 1)
|
||||
{
|
||||
@@ -1512,7 +1512,7 @@ void WI_Ticker(void)
|
||||
if ( gamemode == commercial )
|
||||
S_ChangeMusic(mus_dm2int, true);
|
||||
else
|
||||
S_ChangeMusic(mus_inter, true);
|
||||
S_ChangeMusic(mus_inter, true);
|
||||
}
|
||||
|
||||
WI_checkForAccelerate();
|
||||
@@ -1524,11 +1524,11 @@ void WI_Ticker(void)
|
||||
else if (netgame) WI_updateNetgameStats();
|
||||
else WI_updateStats();
|
||||
break;
|
||||
|
||||
|
||||
case ShowNextLoc:
|
||||
WI_updateShowNextLoc();
|
||||
break;
|
||||
|
||||
|
||||
case NoState:
|
||||
WI_updateNoState();
|
||||
break;
|
||||
@@ -1545,9 +1545,9 @@ void WI_loadData(void)
|
||||
|
||||
if (gamemode == commercial)
|
||||
strcpy(name, "INTERPIC");
|
||||
else
|
||||
else
|
||||
sprintf(name, "WIMAP%d", wbs->epsd);
|
||||
|
||||
|
||||
if ( gamemode == retail )
|
||||
{
|
||||
if (wbs->epsd == 3)
|
||||
@@ -1555,7 +1555,7 @@ void WI_loadData(void)
|
||||
}
|
||||
|
||||
// background
|
||||
bg = W_CacheLumpName(name, PU_CACHE);
|
||||
bg = W_CacheLumpName(name, PU_CACHE);
|
||||
V_DrawPatch(0, 0, 1, bg);
|
||||
|
||||
|
||||
@@ -1572,14 +1572,14 @@ void WI_loadData(void)
|
||||
|
||||
if (gamemode == commercial)
|
||||
{
|
||||
NUMCMAPS = 32;
|
||||
NUMCMAPS = 32;
|
||||
lnames = (patch_t **) Z_Malloc(sizeof(patch_t*) * NUMCMAPS,
|
||||
PU_STATIC, 0);
|
||||
for (i=0 ; i<NUMCMAPS ; i++)
|
||||
{
|
||||
{
|
||||
sprintf(name, "CWILV%2.2d", i);
|
||||
lnames[i] = W_CacheLumpName(name, PU_STATIC);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1598,8 +1598,8 @@ void WI_loadData(void)
|
||||
yah[1] = W_CacheLumpName("WIURH1", PU_STATIC);
|
||||
|
||||
// splat
|
||||
splat = W_CacheLumpName("WISPLAT", PU_STATIC);
|
||||
|
||||
splat = W_CacheLumpName("WISPLAT", PU_STATIC);
|
||||
|
||||
if (wbs->epsd < 3)
|
||||
{
|
||||
for (j=0;j<NUMANIMS[wbs->epsd];j++)
|
||||
@@ -1608,16 +1608,16 @@ void WI_loadData(void)
|
||||
for (i=0;i<a->nanims;i++)
|
||||
{
|
||||
// MONDO HACK!
|
||||
if (wbs->epsd != 1 || j != 8)
|
||||
if (wbs->epsd != 1 || j != 8)
|
||||
{
|
||||
// animations
|
||||
sprintf(name, "WIA%d%.2d%.2d", wbs->epsd, j, i);
|
||||
sprintf(name, "WIA%d%.2d%.2d", wbs->epsd, j, i);
|
||||
a->p[i] = W_CacheLumpName(name, PU_STATIC);
|
||||
}
|
||||
else
|
||||
{
|
||||
// HACK ALERT!
|
||||
a->p[i] = anims[1][4].p[i];
|
||||
a->p[i] = anims[1][4].p[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1625,12 +1625,12 @@ void WI_loadData(void)
|
||||
}
|
||||
|
||||
// More hacks on minus sign.
|
||||
wiminus = W_CacheLumpName("WIMINUS", PU_STATIC);
|
||||
wiminus = W_CacheLumpName("WIMINUS", PU_STATIC);
|
||||
|
||||
for (i=0;i<10;i++)
|
||||
{
|
||||
// numbers 0-9
|
||||
sprintf(name, "WINUM%d", i);
|
||||
sprintf(name, "WINUM%d", i);
|
||||
num[i] = W_CacheLumpName(name, PU_STATIC);
|
||||
}
|
||||
|
||||
@@ -1644,7 +1644,7 @@ void WI_loadData(void)
|
||||
entering = W_CacheLumpName("WIENTER", PU_STATIC);
|
||||
|
||||
// "kills"
|
||||
kills = W_CacheLumpName("WIOSTK", PU_STATIC);
|
||||
kills = W_CacheLumpName("WIOSTK", PU_STATIC);
|
||||
|
||||
// "scrt"
|
||||
secret = W_CacheLumpName("WIOSTS", PU_STATIC);
|
||||
@@ -1652,31 +1652,31 @@ void WI_loadData(void)
|
||||
// "secret"
|
||||
sp_secret = W_CacheLumpName("WISCRT2", PU_STATIC);
|
||||
|
||||
// Yuck.
|
||||
// Yuck.
|
||||
if (french)
|
||||
{
|
||||
// "items"
|
||||
if (netgame && !deathmatch)
|
||||
items = W_CacheLumpName("WIOBJ", PU_STATIC);
|
||||
items = W_CacheLumpName("WIOBJ", PU_STATIC);
|
||||
else
|
||||
items = W_CacheLumpName("WIOSTI", PU_STATIC);
|
||||
} else
|
||||
items = W_CacheLumpName("WIOSTI", PU_STATIC);
|
||||
|
||||
// "frgs"
|
||||
frags = W_CacheLumpName("WIFRGS", PU_STATIC);
|
||||
frags = W_CacheLumpName("WIFRGS", PU_STATIC);
|
||||
|
||||
// ":"
|
||||
colon = W_CacheLumpName("WICOLON", PU_STATIC);
|
||||
colon = W_CacheLumpName("WICOLON", PU_STATIC);
|
||||
|
||||
// "time"
|
||||
d_time = W_CacheLumpName("WITIME", PU_STATIC);
|
||||
d_time = W_CacheLumpName("WITIME", PU_STATIC);
|
||||
|
||||
// "sucks"
|
||||
sucks = W_CacheLumpName("WISUCKS", PU_STATIC);
|
||||
sucks = W_CacheLumpName("WISUCKS", PU_STATIC);
|
||||
|
||||
// "par"
|
||||
par = W_CacheLumpName("WIPAR", PU_STATIC);
|
||||
par = W_CacheLumpName("WIPAR", PU_STATIC);
|
||||
|
||||
// "killers" (vertical)
|
||||
killers = W_CacheLumpName("WIKILRS", PU_STATIC);
|
||||
@@ -1685,22 +1685,22 @@ void WI_loadData(void)
|
||||
victims = W_CacheLumpName("WIVCTMS", PU_STATIC);
|
||||
|
||||
// "total"
|
||||
total = W_CacheLumpName("WIMSTT", PU_STATIC);
|
||||
total = W_CacheLumpName("WIMSTT", PU_STATIC);
|
||||
|
||||
// your face
|
||||
star = W_CacheLumpName("STFST01", PU_STATIC);
|
||||
|
||||
// dead face
|
||||
bstar = W_CacheLumpName("STFDEAD0", PU_STATIC);
|
||||
bstar = W_CacheLumpName("STFDEAD0", PU_STATIC);
|
||||
|
||||
for (i=0 ; i<MAXPLAYERS ; i++)
|
||||
{
|
||||
// "1,2,3,4"
|
||||
sprintf(name, "STPB%d", i);
|
||||
sprintf(name, "STPB%d", i);
|
||||
p[i] = W_CacheLumpName(name, PU_STATIC);
|
||||
|
||||
// "1,2,3,4"
|
||||
sprintf(name, "WIBP%d", i+1);
|
||||
sprintf(name, "WIBP%d", i+1);
|
||||
bp[i] = W_CacheLumpName(name, PU_STATIC);
|
||||
}
|
||||
|
||||
@@ -1715,7 +1715,7 @@ void WI_unloadData(void)
|
||||
|
||||
for (i=0 ; i<10 ; i++)
|
||||
Z_ChangeTag(num[i], PU_CACHE);
|
||||
|
||||
|
||||
if (gamemode == commercial)
|
||||
{
|
||||
for (i=0 ; i<NUMCMAPS ; i++)
|
||||
@@ -1730,7 +1730,7 @@ void WI_unloadData(void)
|
||||
|
||||
for (i=0 ; i<NUMMAPS ; i++)
|
||||
Z_ChangeTag(lnames[i], PU_CACHE);
|
||||
|
||||
|
||||
if (wbs->epsd < 3)
|
||||
{
|
||||
for (j=0;j<NUMANIMS[wbs->epsd];j++)
|
||||
@@ -1741,7 +1741,7 @@ void WI_unloadData(void)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Z_Free(lnames);
|
||||
|
||||
Z_ChangeTag(percent, PU_CACHE);
|
||||
@@ -1762,7 +1762,7 @@ void WI_unloadData(void)
|
||||
Z_ChangeTag(total, PU_CACHE);
|
||||
// Z_ChangeTag(star, PU_CACHE);
|
||||
// Z_ChangeTag(bstar, PU_CACHE);
|
||||
|
||||
|
||||
for (i=0 ; i<MAXPLAYERS ; i++)
|
||||
Z_ChangeTag(p[i], PU_CACHE);
|
||||
|
||||
@@ -1782,11 +1782,11 @@ void WI_Drawer (void)
|
||||
else
|
||||
WI_drawStats();
|
||||
break;
|
||||
|
||||
|
||||
case ShowNextLoc:
|
||||
WI_drawShowNextLoc();
|
||||
break;
|
||||
|
||||
|
||||
case NoState:
|
||||
WI_drawNoState();
|
||||
break;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $Id:$
|
||||
@@ -36,10 +36,10 @@ rcsid[] = "$Id: z_zone.c,v 1.4 1997/02/03 16:47:58 b1 Exp $";
|
||||
// and there will never be two contiguous free memblocks.
|
||||
// The rover can be left pointing at a non-empty block.
|
||||
//
|
||||
// It is of no value to free a cacheable block,
|
||||
// It is of no value to free a cachable block,
|
||||
// because it will get overwritten automatically if needed.
|
||||
//
|
||||
|
||||
//
|
||||
|
||||
#define ZONEID 0x1d4a11
|
||||
|
||||
|
||||
@@ -50,9 +50,9 @@ typedef struct
|
||||
|
||||
// start / end cap for linked list
|
||||
memblock_t blocklist;
|
||||
|
||||
|
||||
memblock_t* rover;
|
||||
|
||||
|
||||
} memzone_t;
|
||||
|
||||
|
||||
@@ -67,20 +67,20 @@ memzone_t* mainzone;
|
||||
void Z_ClearZone (memzone_t* zone)
|
||||
{
|
||||
memblock_t* block;
|
||||
|
||||
|
||||
// set the entire zone to one free block
|
||||
zone->blocklist.next =
|
||||
zone->blocklist.prev =
|
||||
block = (memblock_t *)( (byte *)zone + sizeof(memzone_t) );
|
||||
|
||||
|
||||
zone->blocklist.user = (void *)zone;
|
||||
zone->blocklist.tag = PU_STATIC;
|
||||
zone->rover = block;
|
||||
|
||||
|
||||
block->prev = block->next = &zone->blocklist;
|
||||
|
||||
|
||||
// NULL indicates a free block.
|
||||
block->user = NULL;
|
||||
block->user = NULL;
|
||||
|
||||
block->size = zone->size - sizeof(memzone_t);
|
||||
}
|
||||
@@ -106,12 +106,12 @@ void Z_Init (void)
|
||||
mainzone->blocklist.user = (void *)mainzone;
|
||||
mainzone->blocklist.tag = PU_STATIC;
|
||||
mainzone->rover = block;
|
||||
|
||||
|
||||
block->prev = block->next = &mainzone->blocklist;
|
||||
|
||||
// NULL indicates a free block.
|
||||
block->user = NULL;
|
||||
|
||||
|
||||
block->size = mainzone->size - sizeof(memzone_t);
|
||||
}
|
||||
|
||||
@@ -123,26 +123,26 @@ void Z_Free (void* ptr)
|
||||
{
|
||||
memblock_t* block;
|
||||
memblock_t* other;
|
||||
|
||||
|
||||
block = (memblock_t *) ( (byte *)ptr - sizeof(memblock_t));
|
||||
|
||||
if (block->id != ZONEID)
|
||||
I_Error ("Z_Free: freed a pointer without ZONEID");
|
||||
|
||||
|
||||
if (block->user > (void **)0x100)
|
||||
{
|
||||
// smaller values are not pointers
|
||||
// Note: OS-dependent?
|
||||
|
||||
// Note: OS-dependend?
|
||||
|
||||
// clear the user's mark
|
||||
*block->user = 0;
|
||||
}
|
||||
|
||||
// mark as free
|
||||
block->user = NULL;
|
||||
block->user = NULL;
|
||||
block->tag = 0;
|
||||
block->id = 0;
|
||||
|
||||
|
||||
other = block->prev;
|
||||
|
||||
if (!other->user)
|
||||
@@ -157,7 +157,7 @@ void Z_Free (void* ptr)
|
||||
|
||||
block = other;
|
||||
}
|
||||
|
||||
|
||||
other = block->next;
|
||||
if (!other->user)
|
||||
{
|
||||
@@ -193,25 +193,25 @@ Z_Malloc
|
||||
memblock_t* base;
|
||||
|
||||
size = (size + 3) & ~3;
|
||||
|
||||
|
||||
// scan through the block list,
|
||||
// looking for the first free block
|
||||
// of sufficient size,
|
||||
// throwing out any purgeable blocks along the way.
|
||||
// throwing out any purgable blocks along the way.
|
||||
|
||||
// account for size of block header
|
||||
size += sizeof(memblock_t);
|
||||
|
||||
|
||||
// if there is a free block behind the rover,
|
||||
// back up over them
|
||||
base = mainzone->rover;
|
||||
|
||||
|
||||
if (!base->prev->user)
|
||||
base = base->prev;
|
||||
|
||||
|
||||
rover = base;
|
||||
start = base->prev;
|
||||
|
||||
|
||||
do
|
||||
{
|
||||
if (rover == start)
|
||||
@@ -219,7 +219,7 @@ Z_Malloc
|
||||
// scanned all the way around the list
|
||||
I_Error ("Z_Malloc: failed on allocation of %i bytes", size);
|
||||
}
|
||||
|
||||
|
||||
if (rover->user)
|
||||
{
|
||||
if (rover->tag < PU_PURGELEVEL)
|
||||
@@ -243,18 +243,18 @@ Z_Malloc
|
||||
rover = rover->next;
|
||||
} while (base->user || base->size < size);
|
||||
|
||||
|
||||
|
||||
// found a block big enough
|
||||
extra = base->size - size;
|
||||
|
||||
|
||||
if (extra > MINFRAGMENT)
|
||||
{
|
||||
// there will be a free fragment after the allocated block
|
||||
newblock = (memblock_t *) ((byte *)base + size );
|
||||
newblock->size = extra;
|
||||
|
||||
|
||||
// NULL indicates free block.
|
||||
newblock->user = NULL;
|
||||
newblock->user = NULL;
|
||||
newblock->tag = 0;
|
||||
newblock->prev = base;
|
||||
newblock->next = base->next;
|
||||
@@ -263,28 +263,28 @@ Z_Malloc
|
||||
base->next = newblock;
|
||||
base->size = size;
|
||||
}
|
||||
|
||||
|
||||
if (user)
|
||||
{
|
||||
// mark as an in use block
|
||||
base->user = user;
|
||||
base->user = user;
|
||||
*(void **)user = (void *) ((byte *)base + sizeof(memblock_t));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (tag >= PU_PURGELEVEL)
|
||||
I_Error ("Z_Malloc: an owner is required for purgeable blocks");
|
||||
I_Error ("Z_Malloc: an owner is required for purgable blocks");
|
||||
|
||||
// mark as in use, but unowned
|
||||
base->user = (void *)2;
|
||||
// mark as in use, but unowned
|
||||
base->user = (void *)2;
|
||||
}
|
||||
base->tag = tag;
|
||||
|
||||
// next allocation will start looking here
|
||||
mainzone->rover = base->next;
|
||||
|
||||
mainzone->rover = base->next;
|
||||
|
||||
base->id = ZONEID;
|
||||
|
||||
|
||||
return (void *) ((byte *)base + sizeof(memblock_t));
|
||||
}
|
||||
|
||||
@@ -300,7 +300,7 @@ Z_FreeTags
|
||||
{
|
||||
memblock_t* block;
|
||||
memblock_t* next;
|
||||
|
||||
|
||||
for (block = mainzone->blocklist.next ;
|
||||
block != &mainzone->blocklist ;
|
||||
block = next)
|
||||
@@ -311,7 +311,7 @@ Z_FreeTags
|
||||
// free block?
|
||||
if (!block->user)
|
||||
continue;
|
||||
|
||||
|
||||
if (block->tag >= lowtag && block->tag <= hightag)
|
||||
Z_Free ( (byte *)block+sizeof(memblock_t));
|
||||
}
|
||||
@@ -329,25 +329,25 @@ Z_DumpHeap
|
||||
int hightag )
|
||||
{
|
||||
memblock_t* block;
|
||||
|
||||
|
||||
printf ("zone size: %i location: %p\n",
|
||||
mainzone->size,mainzone);
|
||||
|
||||
|
||||
printf ("tag range: %i to %i\n",
|
||||
lowtag, hightag);
|
||||
|
||||
|
||||
for (block = mainzone->blocklist.next ; ; block = block->next)
|
||||
{
|
||||
if (block->tag >= lowtag && block->tag <= hightag)
|
||||
printf ("block:%p size:%7i user:%p tag:%3i\n",
|
||||
block, block->size, block->user, block->tag);
|
||||
|
||||
|
||||
if (block->next == &mainzone->blocklist)
|
||||
{
|
||||
// all blocks have been hit
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if ( (byte *)block + block->size != (byte *)block->next)
|
||||
printf ("ERROR: block size does not touch the next block\n");
|
||||
|
||||
@@ -366,20 +366,20 @@ Z_DumpHeap
|
||||
void Z_FileDumpHeap (FILE* f)
|
||||
{
|
||||
memblock_t* block;
|
||||
|
||||
|
||||
fprintf (f,"zone size: %i location: %p\n",mainzone->size,mainzone);
|
||||
|
||||
|
||||
for (block = mainzone->blocklist.next ; ; block = block->next)
|
||||
{
|
||||
fprintf (f,"block:%p size:%7i user:%p tag:%3i\n",
|
||||
block, block->size, block->user, block->tag);
|
||||
|
||||
|
||||
if (block->next == &mainzone->blocklist)
|
||||
{
|
||||
// all blocks have been hit
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if ( (byte *)block + block->size != (byte *)block->next)
|
||||
fprintf (f,"ERROR: block size does not touch the next block\n");
|
||||
|
||||
@@ -399,7 +399,7 @@ void Z_FileDumpHeap (FILE* f)
|
||||
void Z_CheckHeap (void)
|
||||
{
|
||||
memblock_t* block;
|
||||
|
||||
|
||||
for (block = mainzone->blocklist.next ; ; block = block->next)
|
||||
{
|
||||
if (block->next == &mainzone->blocklist)
|
||||
@@ -407,7 +407,7 @@ void Z_CheckHeap (void)
|
||||
// all blocks have been hit
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if ( (byte *)block + block->size != (byte *)block->next)
|
||||
I_Error ("Z_CheckHeap: block size does not touch the next block\n");
|
||||
|
||||
@@ -431,14 +431,14 @@ Z_ChangeTag2
|
||||
int tag )
|
||||
{
|
||||
memblock_t* block;
|
||||
|
||||
|
||||
block = (memblock_t *) ( (byte *)ptr - sizeof(memblock_t));
|
||||
|
||||
if (block->id != ZONEID)
|
||||
I_Error ("Z_ChangeTag: freed a pointer without ZONEID");
|
||||
|
||||
if (tag >= PU_PURGELEVEL && (unsigned)block->user < 0x100)
|
||||
I_Error ("Z_ChangeTag: an owner is required for purgeable blocks");
|
||||
I_Error ("Z_ChangeTag: an owner is required for purgable blocks");
|
||||
|
||||
block->tag = tag;
|
||||
}
|
||||
@@ -452,9 +452,9 @@ int Z_FreeMemory (void)
|
||||
{
|
||||
memblock_t* block;
|
||||
int free;
|
||||
|
||||
|
||||
free = 0;
|
||||
|
||||
|
||||
for (block = mainzone->blocklist.next ;
|
||||
block != &mainzone->blocklist;
|
||||
block = block->next)
|
||||
@@ -464,3 +464,4 @@ int Z_FreeMemory (void)
|
||||
}
|
||||
return free;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $Id:$
|
||||
@@ -39,7 +39,7 @@
|
||||
#define PU_DAVE 4 // anything else Dave wants static
|
||||
#define PU_LEVEL 50 // static until level exited
|
||||
#define PU_LEVSPEC 51 // a special thinker in a level
|
||||
// Tags >= 100 are purgeable whenever needed.
|
||||
// Tags >= 100 are purgable whenever needed.
|
||||
#define PU_PURGELEVEL 100
|
||||
#define PU_CACHE 101
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ dnl AM_PATH_SDL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
|
||||
dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS
|
||||
dnl
|
||||
AC_DEFUN(AM_PATH_SDL,
|
||||
[dnl
|
||||
[dnl
|
||||
dnl Get the cflags and libraries from the sdl-config script
|
||||
dnl
|
||||
AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)],
|
||||
@@ -68,7 +68,7 @@ char*
|
||||
my_strdup (char *str)
|
||||
{
|
||||
char *new_str;
|
||||
|
||||
|
||||
if (str)
|
||||
{
|
||||
new_str = malloc ((strlen (str) + 1) * sizeof(char));
|
||||
@@ -76,7 +76,7 @@ my_strdup (char *str)
|
||||
}
|
||||
else
|
||||
new_str = NULL;
|
||||
|
||||
|
||||
return new_str;
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ int main ()
|
||||
fi
|
||||
if test "x$no_sdl" = x ; then
|
||||
AC_MSG_RESULT(yes)
|
||||
ifelse([$2], , :, [$2])
|
||||
ifelse([$2], , :, [$2])
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
if test "$SDL_CONFIG" = "no" ; then
|
||||
@@ -148,7 +148,7 @@ int main ()
|
||||
echo "*** If you have an old version installed, it is best to remove it, although"
|
||||
echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
|
||||
[ echo "*** The test program failed to compile or link. See the file config.log for the"
|
||||
echo "*** exact error that occurred. This usually means SDL was incorrectly installed"
|
||||
echo "*** exact error that occured. This usually means SDL was incorrectly installed"
|
||||
echo "*** or that you have moved SDL since it was installed. In the latter case, you"
|
||||
echo "*** may want to edit the sdl-config script: $SDL_CONFIG" ])
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
|
||||
+6
-5
@@ -21,7 +21,7 @@ dnl AM_PATH_SDL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
|
||||
dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS
|
||||
dnl
|
||||
AC_DEFUN(AM_PATH_SDL,
|
||||
[dnl
|
||||
[dnl
|
||||
dnl Get the cflags and libraries from the sdl-config script
|
||||
dnl
|
||||
AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)],
|
||||
@@ -80,7 +80,7 @@ char*
|
||||
my_strdup (char *str)
|
||||
{
|
||||
char *new_str;
|
||||
|
||||
|
||||
if (str)
|
||||
{
|
||||
new_str = malloc ((strlen (str) + 1) * sizeof(char));
|
||||
@@ -88,7 +88,7 @@ my_strdup (char *str)
|
||||
}
|
||||
else
|
||||
new_str = NULL;
|
||||
|
||||
|
||||
return new_str;
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ int main ()
|
||||
fi
|
||||
if test "x$no_sdl" = x ; then
|
||||
AC_MSG_RESULT(yes)
|
||||
ifelse([$2], , :, [$2])
|
||||
ifelse([$2], , :, [$2])
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
if test "$SDL_CONFIG" = "no" ; then
|
||||
@@ -160,7 +160,7 @@ int main ()
|
||||
echo "*** If you have an old version installed, it is best to remove it, although"
|
||||
echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
|
||||
[ echo "*** The test program failed to compile or link. See the file config.log for the"
|
||||
echo "*** exact error that occurred. This usually means SDL was incorrectly installed"
|
||||
echo "*** exact error that occured. This usually means SDL was incorrectly installed"
|
||||
echo "*** or that you have moved SDL since it was installed. In the latter case, you"
|
||||
echo "*** may want to edit the sdl-config script: $SDL_CONFIG" ])
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
@@ -267,3 +267,4 @@ else
|
||||
AC_MSG_RESULT(missing)
|
||||
fi
|
||||
AC_SUBST($1)])
|
||||
|
||||
@@ -8,7 +8,7 @@ of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
@@ -498,7 +498,7 @@ void CDAudio_Play(byte track, qboolean looping)
|
||||
|
||||
if (!initialized || !enabled)
|
||||
return;
|
||||
|
||||
|
||||
if (!cd.valid)
|
||||
return;
|
||||
|
||||
@@ -523,7 +523,7 @@ void CDAudio_Play(byte track, qboolean looping)
|
||||
|
||||
if (cd.track[track].isData)
|
||||
{
|
||||
Con_DPrintf("CDAudio_Play: Cannot play data.\n");
|
||||
Con_DPrintf("CDAudio_Play: Can not play data.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -571,7 +571,7 @@ void CDAudio_Stop(void)
|
||||
{
|
||||
if (!initialized || !enabled)
|
||||
return;
|
||||
|
||||
|
||||
cdRequest->headerLength = 13;
|
||||
cdRequest->unit = 0;
|
||||
cdRequest->command = COMMAND_STOP_AUDIO;
|
||||
@@ -598,13 +598,13 @@ void CDAudio_Resume(void)
|
||||
{
|
||||
if (!initialized || !enabled)
|
||||
return;
|
||||
|
||||
|
||||
if (!cd.valid)
|
||||
return;
|
||||
|
||||
if (!wasPlaying)
|
||||
return;
|
||||
|
||||
|
||||
cdRequest->headerLength = 13;
|
||||
cdRequest->unit = 0;
|
||||
cdRequest->command = COMMAND_RESUME_AUDIO;
|
||||
@@ -822,7 +822,7 @@ int CDAudio_Init(void)
|
||||
"disabled. Use \"-nocdaudio\" if you\n"
|
||||
"wish to avoid this message in the\n"
|
||||
"future. See README.TXT for help.\n"
|
||||
);
|
||||
);
|
||||
return -1;
|
||||
}
|
||||
if (regs.x.bx > 1)
|
||||
@@ -838,7 +838,7 @@ int CDAudio_Init(void)
|
||||
"MSCDEX version 2.00 or later\n"
|
||||
"required for music. See README.TXT\n"
|
||||
"for help.\n"
|
||||
);
|
||||
);
|
||||
Con_DPrintf("CDAudio_Init: MSCDEX version 2.00 or later required.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
@@ -91,16 +91,16 @@ int CL_GetMessage (void)
|
||||
{
|
||||
int r, i;
|
||||
float f;
|
||||
|
||||
|
||||
if (cls.demoplayback)
|
||||
{
|
||||
// decide if it is time to grab the next message
|
||||
if (cls.signon == SIGNONS) // always grab until fully connected
|
||||
// decide if it is time to grab the next message
|
||||
if (cls.signon == SIGNONS) // allways grab until fully connected
|
||||
{
|
||||
if (cls.timedemo)
|
||||
{
|
||||
if (host_framecount == cls.td_lastframe)
|
||||
return 0; // already read this frame's message
|
||||
return 0; // allready read this frame's message
|
||||
cls.td_lastframe = host_framecount;
|
||||
// if this is the second frame, grab the real td_starttime
|
||||
// so the bogus time on the first frame doesn't count
|
||||
@@ -112,7 +112,7 @@ int CL_GetMessage (void)
|
||||
return 0; // don't need another message yet
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// get the next message
|
||||
fread (&net_message.cursize, 4, 1, cls.demofile);
|
||||
VectorCopy (cl.mviewangles[0], cl.mviewangles[1]);
|
||||
@@ -121,7 +121,7 @@ int CL_GetMessage (void)
|
||||
r = fread (&f, 4, 1, cls.demofile);
|
||||
cl.mviewangles[0][i] = LittleFloat (f);
|
||||
}
|
||||
|
||||
|
||||
net_message.cursize = LittleLong (net_message.cursize);
|
||||
if (net_message.cursize > MAX_MSGLEN)
|
||||
Sys_Error ("Demo message > MAX_MSGLEN");
|
||||
@@ -131,17 +131,17 @@ int CL_GetMessage (void)
|
||||
CL_StopPlayback ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
while (1)
|
||||
{
|
||||
r = NET_GetMessage (cls.netcon);
|
||||
|
||||
|
||||
if (r != 1 && r != 2)
|
||||
return r;
|
||||
|
||||
|
||||
// discard nop keepalive message
|
||||
if (net_message.cursize == 1 && net_message.data[0] == svc_nop)
|
||||
Con_Printf ("<-- server to client keepalive\n");
|
||||
@@ -151,7 +151,7 @@ int CL_GetMessage (void)
|
||||
|
||||
if (cls.demorecording)
|
||||
CL_WriteDemoMessage ();
|
||||
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
@@ -217,7 +217,7 @@ void CL_Record_f (void)
|
||||
|
||||
if (c == 2 && cls.state == ca_connected)
|
||||
{
|
||||
Con_Printf("cannot record - already connected to server\nClient demo recording must be started before connecting\n");
|
||||
Con_Printf("Can not record - already connected to server\nClient demo recording must be started before connecting\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -228,16 +228,16 @@ void CL_Record_f (void)
|
||||
Con_Printf ("Forcing CD track to %i\n", cls.forcetrack);
|
||||
}
|
||||
else
|
||||
track = -1;
|
||||
track = -1;
|
||||
|
||||
sprintf (name, "%s/%s", com_gamedir, Cmd_Argv(1));
|
||||
|
||||
|
||||
//
|
||||
// start the map up
|
||||
//
|
||||
if (c > 2)
|
||||
Cmd_ExecuteString ( va("map %s", Cmd_Argv(2)), src_command);
|
||||
|
||||
|
||||
//
|
||||
// open the demo file
|
||||
//
|
||||
@@ -253,7 +253,7 @@ void CL_Record_f (void)
|
||||
|
||||
cls.forcetrack = track;
|
||||
fprintf (cls.demofile, "%i\n", cls.forcetrack);
|
||||
|
||||
|
||||
cls.demorecording = true;
|
||||
}
|
||||
|
||||
@@ -284,7 +284,7 @@ void CL_PlayDemo_f (void)
|
||||
// disconnect from server
|
||||
//
|
||||
CL_Disconnect ();
|
||||
|
||||
|
||||
//
|
||||
// open the demo file
|
||||
//
|
||||
@@ -326,9 +326,9 @@ void CL_FinishTimeDemo (void)
|
||||
{
|
||||
int frames;
|
||||
float time;
|
||||
|
||||
|
||||
cls.timedemo = false;
|
||||
|
||||
|
||||
// the first frame didn't count
|
||||
frames = (host_framecount - cls.td_startframe) - 1;
|
||||
time = realtime - cls.td_starttime;
|
||||
@@ -356,11 +356,12 @@ void CL_TimeDemo_f (void)
|
||||
}
|
||||
|
||||
CL_PlayDemo_f ();
|
||||
|
||||
|
||||
// cls.td_starttime will be grabbed at the second frame of the demo, so
|
||||
// all the loading time doesn't get counted
|
||||
|
||||
|
||||
cls.timedemo = true;
|
||||
cls.td_startframe = host_framecount;
|
||||
cls.td_lastframe = -1; // get a new message this frame
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
@@ -68,7 +68,7 @@ void KeyDown (kbutton_t *b)
|
||||
|
||||
if (k == b->down[0] || k == b->down[1])
|
||||
return; // repeating key
|
||||
|
||||
|
||||
if (!b->down[0])
|
||||
b->down[0] = k;
|
||||
else if (!b->down[1])
|
||||
@@ -78,7 +78,7 @@ void KeyDown (kbutton_t *b)
|
||||
Con_Printf ("Three keys down for a button!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (b->state & 1)
|
||||
return; // still down
|
||||
b->state |= 1 + 2; // down + impulse down
|
||||
@@ -88,7 +88,7 @@ void KeyUp (kbutton_t *b)
|
||||
{
|
||||
int k;
|
||||
char *c;
|
||||
|
||||
|
||||
c = Cmd_Argv(1);
|
||||
if (c[0])
|
||||
k = atoi(c);
|
||||
@@ -104,7 +104,7 @@ void KeyUp (kbutton_t *b)
|
||||
else if (b->down[1] == k)
|
||||
b->down[1] = 0;
|
||||
else
|
||||
return; // key up without corresponding down (menu pass through)
|
||||
return; // key up without coresponding down (menu pass through)
|
||||
if (b->down[0] || b->down[1])
|
||||
return; // some other key is still holding it down
|
||||
|
||||
@@ -172,12 +172,12 @@ float CL_KeyState (kbutton_t *key)
|
||||
{
|
||||
float val;
|
||||
qboolean impulsedown, impulseup, down;
|
||||
|
||||
|
||||
impulsedown = key->state & 2;
|
||||
impulseup = key->state & 4;
|
||||
down = key->state & 1;
|
||||
val = 0;
|
||||
|
||||
|
||||
if (impulsedown && !impulseup)
|
||||
if (down)
|
||||
val = 0.5; // pressed and held this frame
|
||||
@@ -200,7 +200,7 @@ float CL_KeyState (kbutton_t *key)
|
||||
val = 0.25; // pressed and released this frame
|
||||
|
||||
key->state &= 1; // clear impulses
|
||||
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
@@ -233,7 +233,7 @@ void CL_AdjustAngles (void)
|
||||
{
|
||||
float speed;
|
||||
float up, down;
|
||||
|
||||
|
||||
if (in_speed.state & 1)
|
||||
speed = host_frametime * cl_anglespeedkey.value;
|
||||
else
|
||||
@@ -251,16 +251,16 @@ void CL_AdjustAngles (void)
|
||||
cl.viewangles[PITCH] -= speed*cl_pitchspeed.value * CL_KeyState (&in_forward);
|
||||
cl.viewangles[PITCH] += speed*cl_pitchspeed.value * CL_KeyState (&in_back);
|
||||
}
|
||||
|
||||
|
||||
up = CL_KeyState (&in_lookup);
|
||||
down = CL_KeyState(&in_lookdown);
|
||||
|
||||
|
||||
cl.viewangles[PITCH] -= speed*cl_pitchspeed.value * up;
|
||||
cl.viewangles[PITCH] += speed*cl_pitchspeed.value * down;
|
||||
|
||||
if (up || down)
|
||||
V_StopPitchDrift ();
|
||||
|
||||
|
||||
if (cl.viewangles[PITCH] > 80)
|
||||
cl.viewangles[PITCH] = 80;
|
||||
if (cl.viewangles[PITCH] < -70)
|
||||
@@ -270,7 +270,7 @@ void CL_AdjustAngles (void)
|
||||
cl.viewangles[ROLL] = 50;
|
||||
if (cl.viewangles[ROLL] < -50)
|
||||
cl.viewangles[ROLL] = -50;
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -281,14 +281,14 @@ Send the intended movement message to the server
|
||||
================
|
||||
*/
|
||||
void CL_BaseMove (usercmd_t *cmd)
|
||||
{
|
||||
{
|
||||
if (cls.signon != SIGNONS)
|
||||
return;
|
||||
|
||||
|
||||
CL_AdjustAngles ();
|
||||
|
||||
|
||||
Q_memset (cmd, 0, sizeof(*cmd));
|
||||
|
||||
|
||||
if (in_strafe.state & 1)
|
||||
{
|
||||
cmd->sidemove += cl_sidespeed.value * CL_KeyState (&in_right);
|
||||
@@ -302,10 +302,10 @@ void CL_BaseMove (usercmd_t *cmd)
|
||||
cmd->upmove -= cl_upspeed.value * CL_KeyState (&in_down);
|
||||
|
||||
if (! (in_klook.state & 1) )
|
||||
{
|
||||
{
|
||||
cmd->forwardmove += cl_forwardspeed.value * CL_KeyState (&in_forward);
|
||||
cmd->forwardmove -= cl_backspeed.value * CL_KeyState (&in_back);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// adjust for speed key
|
||||
@@ -335,11 +335,11 @@ void CL_SendMove (usercmd_t *cmd)
|
||||
int bits;
|
||||
sizebuf_t buf;
|
||||
byte data[128];
|
||||
|
||||
|
||||
buf.maxsize = 128;
|
||||
buf.cursize = 0;
|
||||
buf.data = data;
|
||||
|
||||
|
||||
cl.cmd = *cmd;
|
||||
|
||||
//
|
||||
@@ -351,7 +351,7 @@ void CL_SendMove (usercmd_t *cmd)
|
||||
|
||||
for (i=0 ; i<3 ; i++)
|
||||
MSG_WriteAngle (&buf, cl.viewangles[i]);
|
||||
|
||||
|
||||
MSG_WriteShort (&buf, cmd->forwardmove);
|
||||
MSG_WriteShort (&buf, cmd->sidemove);
|
||||
MSG_WriteShort (&buf, cmd->upmove);
|
||||
@@ -360,15 +360,15 @@ void CL_SendMove (usercmd_t *cmd)
|
||||
// send button bits
|
||||
//
|
||||
bits = 0;
|
||||
|
||||
|
||||
if ( in_attack.state & 3 )
|
||||
bits |= 1;
|
||||
in_attack.state &= ~2;
|
||||
|
||||
|
||||
if (in_jump.state & 3)
|
||||
bits |= 2;
|
||||
in_jump.state &= ~2;
|
||||
|
||||
|
||||
MSG_WriteByte (&buf, bits);
|
||||
|
||||
MSG_WriteByte (&buf, in_impulse);
|
||||
@@ -388,12 +388,12 @@ void CL_SendMove (usercmd_t *cmd)
|
||||
return;
|
||||
|
||||
//
|
||||
// always dump the first two message, because it may contain leftover inputs
|
||||
// allways dump the first two message, because it may contain leftover inputs
|
||||
// from the last level
|
||||
//
|
||||
if (++cl.movemessages <= 2)
|
||||
return;
|
||||
|
||||
|
||||
if (NET_SendUnreliableMessage (cls.netcon, &buf) == -1)
|
||||
{
|
||||
Con_Printf ("CL_SendMove: lost server connection\n");
|
||||
@@ -445,3 +445,4 @@ void CL_InitInput (void)
|
||||
Cmd_AddCommand ("-mlook", IN_MLookUp);
|
||||
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
@@ -35,7 +35,7 @@ char *svc_strings[] =
|
||||
"svc_stufftext", // [string] stuffed into client's console buffer
|
||||
// the string should be \n terminated
|
||||
"svc_setangle", // [vec3] set the view angle to this absolute value
|
||||
|
||||
|
||||
"svc_serverinfo", // [long] version
|
||||
// [string] signon string
|
||||
// [string]..[0]model cache [string]...[0]sounds cache
|
||||
@@ -48,11 +48,11 @@ char *svc_strings[] =
|
||||
"svc_updatecolors", // [byte] [byte]
|
||||
"svc_particle", // [vec3] <variable>
|
||||
"svc_damage", // [byte] impact [byte] blood [vec3] from
|
||||
|
||||
|
||||
"svc_spawnstatic",
|
||||
"OBSOLETE svc_spawnbinary",
|
||||
"svc_spawnbaseline",
|
||||
|
||||
|
||||
"svc_temp_entity", // <variable>
|
||||
"svc_setpause",
|
||||
"svc_signonnum",
|
||||
@@ -88,7 +88,7 @@ entity_t *CL_EntityNum (int num)
|
||||
cl.num_entities++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return &cl_entities[num];
|
||||
}
|
||||
|
||||
@@ -105,21 +105,21 @@ void CL_ParseStartSoundPacket(void)
|
||||
int sound_num;
|
||||
int volume;
|
||||
int field_mask;
|
||||
float attenuation;
|
||||
float attenuation;
|
||||
int i;
|
||||
|
||||
field_mask = MSG_ReadByte();
|
||||
|
||||
field_mask = MSG_ReadByte();
|
||||
|
||||
if (field_mask & SND_VOLUME)
|
||||
volume = MSG_ReadByte ();
|
||||
else
|
||||
volume = DEFAULT_SOUND_PACKET_VOLUME;
|
||||
|
||||
|
||||
if (field_mask & SND_ATTENUATION)
|
||||
attenuation = MSG_ReadByte () / 64.0;
|
||||
else
|
||||
attenuation = DEFAULT_SOUND_PACKET_ATTENUATION;
|
||||
|
||||
|
||||
channel = MSG_ReadShort ();
|
||||
sound_num = MSG_ReadByte ();
|
||||
|
||||
@@ -128,12 +128,12 @@ void CL_ParseStartSoundPacket(void)
|
||||
|
||||
if (ent > MAX_EDICTS)
|
||||
Host_Error ("CL_ParseStartSoundPacket: ent = %i", ent);
|
||||
|
||||
|
||||
for (i=0 ; i<3 ; i++)
|
||||
pos[i] = MSG_ReadCoord ();
|
||||
|
||||
|
||||
S_StartSound (ent, channel, cl.sound_precache[sound_num], pos, volume/255.0, attenuation);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
@@ -150,7 +150,7 @@ void CL_KeepaliveMessage (void)
|
||||
int ret;
|
||||
sizebuf_t old;
|
||||
byte olddata[8192];
|
||||
|
||||
|
||||
if (sv.active)
|
||||
return; // no need if server is local
|
||||
if (cls.demoplayback)
|
||||
@@ -159,14 +159,14 @@ void CL_KeepaliveMessage (void)
|
||||
// read messages from server, should just be nops
|
||||
old = net_message;
|
||||
memcpy (olddata, net_message.data, net_message.cursize);
|
||||
|
||||
|
||||
do
|
||||
{
|
||||
ret = CL_GetMessage ();
|
||||
switch (ret)
|
||||
{
|
||||
default:
|
||||
Host_Error ("CL_KeepaliveMessage: CL_GetMessage failed");
|
||||
Host_Error ("CL_KeepaliveMessage: CL_GetMessage failed");
|
||||
case 0:
|
||||
break; // nothing waiting
|
||||
case 1:
|
||||
@@ -208,7 +208,7 @@ void CL_ParseServerInfo (void)
|
||||
int nummodels, numsounds;
|
||||
char model_precache[MAX_MODELS][MAX_QPATH];
|
||||
char sound_precache[MAX_SOUNDS][MAX_QPATH];
|
||||
|
||||
|
||||
Con_DPrintf ("Serverinfo packet received.\n");
|
||||
//
|
||||
// wipe the client_state_t struct
|
||||
@@ -239,7 +239,7 @@ void CL_ParseServerInfo (void)
|
||||
str = MSG_ReadString ();
|
||||
strncpy (cl.levelname, str, sizeof(cl.levelname)-1);
|
||||
|
||||
// separate the printfs so the server message can have a color
|
||||
// seperate the printfs so the server message can have a color
|
||||
Con_Printf("\n\n\35\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\37\n\n");
|
||||
Con_Printf ("%c%s\n", 2, str);
|
||||
|
||||
@@ -307,12 +307,12 @@ void CL_ParseServerInfo (void)
|
||||
|
||||
// local state
|
||||
cl_entities[0].model = cl.worldmodel = cl.model_precache[1];
|
||||
|
||||
|
||||
R_NewMap ();
|
||||
|
||||
Hunk_Check (); // make sure nothing is hurt
|
||||
|
||||
noclip_anglehack = false; // noclip is turned off at start
|
||||
|
||||
noclip_anglehack = false; // noclip is turned off at start
|
||||
}
|
||||
|
||||
|
||||
@@ -349,7 +349,7 @@ void CL_ParseUpdate (int bits)
|
||||
bits |= (i<<8);
|
||||
}
|
||||
|
||||
if (bits & U_LONGENTITY)
|
||||
if (bits & U_LONGENTITY)
|
||||
num = MSG_ReadShort ();
|
||||
else
|
||||
num = MSG_ReadByte ();
|
||||
@@ -366,7 +366,7 @@ if (bits&(1<<i))
|
||||
forcelink = false;
|
||||
|
||||
ent->msgtime = cl.mtime[0];
|
||||
|
||||
|
||||
if (bits & U_MODEL)
|
||||
{
|
||||
modnum = MSG_ReadByte ();
|
||||
@@ -375,7 +375,7 @@ if (bits&(1<<i))
|
||||
}
|
||||
else
|
||||
modnum = ent->baseline.modelindex;
|
||||
|
||||
|
||||
model = cl.model_precache[modnum];
|
||||
if (model != ent->model)
|
||||
{
|
||||
@@ -396,7 +396,7 @@ if (bits&(1<<i))
|
||||
R_TranslatePlayerSkin (num - 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
if (bits & U_FRAME)
|
||||
ent->frame = MSG_ReadByte ();
|
||||
else
|
||||
@@ -491,7 +491,7 @@ CL_ParseBaseline
|
||||
void CL_ParseBaseline (entity_t *ent)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
ent->baseline.modelindex = MSG_ReadByte ();
|
||||
ent->baseline.frame = MSG_ReadByte ();
|
||||
ent->baseline.colormap = MSG_ReadByte();
|
||||
@@ -514,7 +514,7 @@ Server information pertaining to this client only
|
||||
void CL_ParseClientdata (int bits)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
|
||||
if (bits & SU_VIEWHEIGHT)
|
||||
cl.viewheight = MSG_ReadChar ();
|
||||
else
|
||||
@@ -524,7 +524,7 @@ void CL_ParseClientdata (int bits)
|
||||
cl.idealpitch = MSG_ReadChar ();
|
||||
else
|
||||
cl.idealpitch = 0;
|
||||
|
||||
|
||||
VectorCopy (cl.mvelocity[0], cl.mvelocity[1]);
|
||||
for (i=0 ; i<3 ; i++)
|
||||
{
|
||||
@@ -549,7 +549,7 @@ void CL_ParseClientdata (int bits)
|
||||
cl.item_gettime[j] = cl.time;
|
||||
cl.items = i;
|
||||
}
|
||||
|
||||
|
||||
cl.onground = (bits & SU_ONGROUND) != 0;
|
||||
cl.inwater = (bits & SU_INWATER) != 0;
|
||||
|
||||
@@ -577,7 +577,7 @@ void CL_ParseClientdata (int bits)
|
||||
cl.stats[STAT_WEAPON] = i;
|
||||
Sbar_Changed ();
|
||||
}
|
||||
|
||||
|
||||
i = MSG_ReadShort ();
|
||||
if (cl.stats[STAT_HEALTH] != i)
|
||||
{
|
||||
@@ -632,7 +632,7 @@ void CL_NewTranslation (int slot)
|
||||
int i, j;
|
||||
int top, bottom;
|
||||
byte *dest, *source;
|
||||
|
||||
|
||||
if (slot > cl.maxclients)
|
||||
Sys_Error ("CL_NewTranslation: slot > cl.maxclients");
|
||||
dest = cl.scores[slot].translations;
|
||||
@@ -651,12 +651,12 @@ void CL_NewTranslation (int slot)
|
||||
else
|
||||
for (j=0 ; j<16 ; j++)
|
||||
dest[TOP_RANGE+j] = source[top+15-j];
|
||||
|
||||
|
||||
if (bottom < 128)
|
||||
memcpy (dest + BOTTOM_RANGE, source + bottom, 16);
|
||||
else
|
||||
for (j=0 ; j<16 ; j++)
|
||||
dest[BOTTOM_RANGE+j] = source[bottom+15-j];
|
||||
dest[BOTTOM_RANGE+j] = source[bottom+15-j];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -669,7 +669,7 @@ void CL_ParseStatic (void)
|
||||
{
|
||||
entity_t *ent;
|
||||
int i;
|
||||
|
||||
|
||||
i = cl.num_statics;
|
||||
if (i >= MAX_STATIC_ENTITIES)
|
||||
Host_Error ("Too many static entities");
|
||||
@@ -685,7 +685,7 @@ void CL_ParseStatic (void)
|
||||
ent->effects = ent->baseline.effects;
|
||||
|
||||
VectorCopy (ent->baseline.origin, ent->origin);
|
||||
VectorCopy (ent->baseline.angles, ent->angles);
|
||||
VectorCopy (ent->baseline.angles, ent->angles);
|
||||
R_AddEfrags (ent);
|
||||
}
|
||||
|
||||
@@ -699,13 +699,13 @@ void CL_ParseStaticSound (void)
|
||||
vec3_t org;
|
||||
int sound_num, vol, atten;
|
||||
int i;
|
||||
|
||||
|
||||
for (i=0 ; i<3 ; i++)
|
||||
org[i] = MSG_ReadCoord ();
|
||||
sound_num = MSG_ReadByte ();
|
||||
vol = MSG_ReadByte ();
|
||||
atten = MSG_ReadByte ();
|
||||
|
||||
|
||||
S_StaticSound (cl.sound_precache[sound_num], org, vol, atten);
|
||||
}
|
||||
|
||||
@@ -721,7 +721,7 @@ void CL_ParseServerMessage (void)
|
||||
{
|
||||
int cmd;
|
||||
int i;
|
||||
|
||||
|
||||
//
|
||||
// if recording demos, copy the message out
|
||||
//
|
||||
@@ -729,13 +729,13 @@ void CL_ParseServerMessage (void)
|
||||
Con_Printf ("%i ",net_message.cursize);
|
||||
else if (cl_shownet.value == 2)
|
||||
Con_Printf ("------------------\n");
|
||||
|
||||
cl.onground = false; // unless the server says otherwise
|
||||
|
||||
cl.onground = false; // unless the server says otherwise
|
||||
//
|
||||
// parse the message
|
||||
//
|
||||
MSG_BeginReading ();
|
||||
|
||||
|
||||
while (1)
|
||||
{
|
||||
if (msg_badread)
|
||||
@@ -758,67 +758,67 @@ void CL_ParseServerMessage (void)
|
||||
}
|
||||
|
||||
SHOWNET(svc_strings[cmd]);
|
||||
|
||||
|
||||
// other commands
|
||||
switch (cmd)
|
||||
{
|
||||
default:
|
||||
Host_Error ("CL_ParseServerMessage: Illegible server message\n");
|
||||
break;
|
||||
|
||||
|
||||
case svc_nop:
|
||||
// Con_Printf ("svc_nop\n");
|
||||
break;
|
||||
|
||||
|
||||
case svc_time:
|
||||
cl.mtime[1] = cl.mtime[0];
|
||||
cl.mtime[0] = MSG_ReadFloat ();
|
||||
cl.mtime[0] = MSG_ReadFloat ();
|
||||
break;
|
||||
|
||||
|
||||
case svc_clientdata:
|
||||
i = MSG_ReadShort ();
|
||||
CL_ParseClientdata (i);
|
||||
break;
|
||||
|
||||
|
||||
case svc_version:
|
||||
i = MSG_ReadLong ();
|
||||
if (i != PROTOCOL_VERSION)
|
||||
Host_Error ("CL_ParseServerMessage: Server is protocol %i instead of %i\n", i, PROTOCOL_VERSION);
|
||||
break;
|
||||
|
||||
|
||||
case svc_disconnect:
|
||||
Host_EndGame ("Server disconnected\n");
|
||||
|
||||
case svc_print:
|
||||
Con_Printf ("%s", MSG_ReadString ());
|
||||
break;
|
||||
|
||||
|
||||
case svc_centerprint:
|
||||
SCR_CenterPrint (MSG_ReadString ());
|
||||
break;
|
||||
|
||||
|
||||
case svc_stufftext:
|
||||
Cbuf_AddText (MSG_ReadString ());
|
||||
break;
|
||||
|
||||
|
||||
case svc_damage:
|
||||
V_ParseDamage ();
|
||||
break;
|
||||
|
||||
|
||||
case svc_serverinfo:
|
||||
CL_ParseServerInfo ();
|
||||
vid.recalc_refdef = true; // leave intermission full screen
|
||||
break;
|
||||
|
||||
|
||||
case svc_setangle:
|
||||
for (i=0 ; i<3 ; i++)
|
||||
cl.viewangles[i] = MSG_ReadAngle ();
|
||||
break;
|
||||
|
||||
|
||||
case svc_setview:
|
||||
cl.viewentity = MSG_ReadShort ();
|
||||
break;
|
||||
|
||||
|
||||
case svc_lightstyle:
|
||||
i = MSG_ReadByte ();
|
||||
if (i >= MAX_LIGHTSTYLES)
|
||||
@@ -826,16 +826,16 @@ void CL_ParseServerMessage (void)
|
||||
Q_strcpy (cl_lightstyle[i].map, MSG_ReadString());
|
||||
cl_lightstyle[i].length = Q_strlen(cl_lightstyle[i].map);
|
||||
break;
|
||||
|
||||
|
||||
case svc_sound:
|
||||
CL_ParseStartSoundPacket();
|
||||
break;
|
||||
|
||||
|
||||
case svc_stopsound:
|
||||
i = MSG_ReadShort();
|
||||
S_StopSound(i>>3, i&7);
|
||||
break;
|
||||
|
||||
|
||||
case svc_updatename:
|
||||
Sbar_Changed ();
|
||||
i = MSG_ReadByte ();
|
||||
@@ -843,14 +843,14 @@ void CL_ParseServerMessage (void)
|
||||
Host_Error ("CL_ParseServerMessage: svc_updatename > MAX_SCOREBOARD");
|
||||
strcpy (cl.scores[i].name, MSG_ReadString ());
|
||||
break;
|
||||
|
||||
|
||||
case svc_updatefrags:
|
||||
Sbar_Changed ();
|
||||
i = MSG_ReadByte ();
|
||||
if (i >= cl.maxclients)
|
||||
Host_Error ("CL_ParseServerMessage: svc_updatefrags > MAX_SCOREBOARD");
|
||||
cl.scores[i].frags = MSG_ReadShort ();
|
||||
break;
|
||||
break;
|
||||
|
||||
case svc_updatecolors:
|
||||
Sbar_Changed ();
|
||||
@@ -860,7 +860,7 @@ void CL_ParseServerMessage (void)
|
||||
cl.scores[i].colors = MSG_ReadByte ();
|
||||
CL_NewTranslation (i);
|
||||
break;
|
||||
|
||||
|
||||
case svc_particle:
|
||||
R_ParseParticleEffect ();
|
||||
break;
|
||||
@@ -872,7 +872,7 @@ void CL_ParseServerMessage (void)
|
||||
break;
|
||||
case svc_spawnstatic:
|
||||
CL_ParseStatic ();
|
||||
break;
|
||||
break;
|
||||
case svc_temp_entity:
|
||||
CL_ParseTEnt ();
|
||||
break;
|
||||
@@ -897,7 +897,7 @@ void CL_ParseServerMessage (void)
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case svc_signonnum:
|
||||
i = MSG_ReadByte ();
|
||||
if (i <= cls.signon)
|
||||
@@ -920,7 +920,7 @@ void CL_ParseServerMessage (void)
|
||||
Sys_Error ("svc_updatestat: %i is invalid", i);
|
||||
cl.stats[i] = MSG_ReadLong ();;
|
||||
break;
|
||||
|
||||
|
||||
case svc_spawnstaticsound:
|
||||
CL_ParseStaticSound ();
|
||||
break;
|
||||
@@ -944,14 +944,14 @@ void CL_ParseServerMessage (void)
|
||||
cl.intermission = 2;
|
||||
cl.completed_time = cl.time;
|
||||
vid.recalc_refdef = true; // go to full screen
|
||||
SCR_CenterPrint (MSG_ReadString ());
|
||||
SCR_CenterPrint (MSG_ReadString ());
|
||||
break;
|
||||
|
||||
case svc_cutscene:
|
||||
cl.intermission = 3;
|
||||
cl.completed_time = cl.time;
|
||||
vid.recalc_refdef = true; // go to full screen
|
||||
SCR_CenterPrint (MSG_ReadString ());
|
||||
SCR_CenterPrint (MSG_ReadString ());
|
||||
break;
|
||||
|
||||
case svc_sellscreen:
|
||||
@@ -960,3 +960,4 @@ void CL_ParseServerMessage (void)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
@@ -105,14 +105,14 @@ ca_connected // valid netcon, talking to a server
|
||||
} cactive_t;
|
||||
|
||||
//
|
||||
// the client_static_t structure is persistent through an arbitrary number
|
||||
// the client_static_t structure is persistant through an arbitrary number
|
||||
// of server connections
|
||||
//
|
||||
typedef struct
|
||||
{
|
||||
cactive_t state;
|
||||
|
||||
// personalization data sent to server
|
||||
// personalization data sent to server
|
||||
char mapstring[MAX_QPATH];
|
||||
char spawnparms[MAX_MAPSTRING]; // to restart a level
|
||||
|
||||
@@ -136,7 +136,7 @@ typedef struct
|
||||
int signon; // 0 to SIGNONS
|
||||
struct qsocket_s *netcon;
|
||||
sizebuf_t message; // writing buffer to send to server
|
||||
|
||||
|
||||
} client_static_t;
|
||||
|
||||
extern client_static_t cls;
|
||||
@@ -149,14 +149,14 @@ typedef struct
|
||||
{
|
||||
int movemessages; // since connecting to this server
|
||||
// throw out the first couple, so the player
|
||||
// doesn't accidentally do something the
|
||||
// doesn't accidentally do something the
|
||||
// first frame
|
||||
usercmd_t cmd; // last command sent to the server
|
||||
|
||||
// information for local display
|
||||
int stats[MAX_CL_STATS]; // health, etc
|
||||
int items; // inventory bit flags
|
||||
float item_gettime[32]; // cl.time of acquiring item, for blinking
|
||||
float item_gettime[32]; // cl.time of aquiring item, for blinking
|
||||
float faceanimtime; // use anim frame if cl.time < this
|
||||
|
||||
cshift_t cshifts[NUM_CSHIFTS]; // color shifts for damage, powerups
|
||||
@@ -169,13 +169,13 @@ typedef struct
|
||||
vec3_t mviewangles[2]; // during demo playback viewangles is lerped
|
||||
// between these
|
||||
vec3_t viewangles;
|
||||
|
||||
|
||||
vec3_t mvelocity[2]; // update by server, used for lean+bob
|
||||
// (0 is newest)
|
||||
vec3_t velocity; // lerped between mvelocity[0] and [1]
|
||||
|
||||
vec3_t punchangle; // temporary offset
|
||||
|
||||
|
||||
// pitch drifting vars
|
||||
float idealpitch;
|
||||
float pitchvel;
|
||||
@@ -189,17 +189,17 @@ typedef struct
|
||||
qboolean paused; // send over by server
|
||||
qboolean onground;
|
||||
qboolean inwater;
|
||||
|
||||
|
||||
int intermission; // don't change view angle, full screen, etc
|
||||
int completed_time; // latched at intermission start
|
||||
|
||||
double mtime[2]; // the timestamp of last two messages
|
||||
|
||||
double mtime[2]; // the timestamp of last two messages
|
||||
double time; // clients view of time, should be between
|
||||
// servertime and oldservertime to generate
|
||||
// a lerp point for other data
|
||||
double oldtime; // previous cl.time, time-oldtime is used
|
||||
// to decay light values and smooth step ups
|
||||
|
||||
|
||||
|
||||
float last_received_message; // (realtime) for net trouble icon
|
||||
|
||||
@@ -229,7 +229,7 @@ typedef struct
|
||||
#ifdef QUAKE2
|
||||
// light level at player's position including dlights
|
||||
// this is sent back to the server each frame
|
||||
// architecturally ugly but it works
|
||||
// architectually ugly but it works
|
||||
int light_level;
|
||||
#endif
|
||||
} client_state_t;
|
||||
|
||||
@@ -8,7 +8,7 @@ of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
@@ -86,7 +86,7 @@ Adds command text at the end of the buffer
|
||||
void Cbuf_AddText (char *text)
|
||||
{
|
||||
int l;
|
||||
|
||||
|
||||
l = Q_strlen (text);
|
||||
|
||||
if (cmd_text.cursize + l >= cmd_text.maxsize)
|
||||
@@ -123,10 +123,10 @@ void Cbuf_InsertText (char *text)
|
||||
}
|
||||
else
|
||||
temp = NULL; // shut up compiler
|
||||
|
||||
|
||||
// add the entire text of the file
|
||||
Cbuf_AddText (text);
|
||||
|
||||
|
||||
// add the copied off data
|
||||
if (templen)
|
||||
{
|
||||
@@ -146,7 +146,7 @@ void Cbuf_Execute (void)
|
||||
char *text;
|
||||
char line[1024];
|
||||
int quotes;
|
||||
|
||||
|
||||
while (cmd_text.cursize)
|
||||
{
|
||||
// find a \n or ; line break
|
||||
@@ -162,11 +162,11 @@ void Cbuf_Execute (void)
|
||||
if (text[i] == '\n')
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
memcpy (line, text, i);
|
||||
line[i] = 0;
|
||||
|
||||
|
||||
// delete the text from the command buffer and move remaining commands down
|
||||
// this is necessary because commands (exec, alias) can insert data at the
|
||||
// beginning of the text buffer
|
||||
@@ -182,7 +182,7 @@ void Cbuf_Execute (void)
|
||||
|
||||
// execute the command line
|
||||
Cmd_ExecuteString (line, src_command);
|
||||
|
||||
|
||||
if (cmd_wait)
|
||||
{ // skip out while text still remains in buffer, leaving it
|
||||
// for next frame
|
||||
@@ -215,7 +215,7 @@ void Cmd_StuffCmds_f (void)
|
||||
int i, j;
|
||||
int s;
|
||||
char *text, *build, c;
|
||||
|
||||
|
||||
if (Cmd_Argc () != 1)
|
||||
{
|
||||
Con_Printf ("stuffcmds : execute command line parameters\n");
|
||||
@@ -232,7 +232,7 @@ void Cmd_StuffCmds_f (void)
|
||||
}
|
||||
if (!s)
|
||||
return;
|
||||
|
||||
|
||||
text = Z_Malloc (s+1);
|
||||
text[0] = 0;
|
||||
for (i=1 ; i<com_argc ; i++)
|
||||
@@ -243,11 +243,11 @@ void Cmd_StuffCmds_f (void)
|
||||
if (i != com_argc-1)
|
||||
Q_strcat (text, " ");
|
||||
}
|
||||
|
||||
|
||||
// pull out the commands
|
||||
build = Z_Malloc (s+1);
|
||||
build[0] = 0;
|
||||
|
||||
|
||||
for (i=0 ; i<s-1 ; i++)
|
||||
{
|
||||
if (text[i] == '+')
|
||||
@@ -259,17 +259,17 @@ void Cmd_StuffCmds_f (void)
|
||||
|
||||
c = text[j];
|
||||
text[j] = 0;
|
||||
|
||||
|
||||
Q_strcat (build, text+i);
|
||||
Q_strcat (build, "\n");
|
||||
text[j] = c;
|
||||
i = j-1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (build[0])
|
||||
Cbuf_InsertText (build);
|
||||
|
||||
|
||||
Z_Free (text);
|
||||
Z_Free (build);
|
||||
}
|
||||
@@ -299,7 +299,7 @@ void Cmd_Exec_f (void)
|
||||
return;
|
||||
}
|
||||
Con_Printf ("execing %s\n",Cmd_Argv(1));
|
||||
|
||||
|
||||
Cbuf_InsertText (f);
|
||||
Hunk_FreeToLowMark (mark);
|
||||
}
|
||||
@@ -315,7 +315,7 @@ Just prints the rest of the line to the console
|
||||
void Cmd_Echo_f (void)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
for (i=1 ; i<Cmd_Argc() ; i++)
|
||||
Con_Printf ("%s ",Cmd_Argv(i));
|
||||
Con_Printf ("\n");
|
||||
@@ -325,14 +325,14 @@ void Cmd_Echo_f (void)
|
||||
===============
|
||||
Cmd_Alias_f
|
||||
|
||||
Creates a new command that executes a command string (possibly ; separated)
|
||||
Creates a new command that executes a command string (possibly ; seperated)
|
||||
===============
|
||||
*/
|
||||
|
||||
char *CopyString (char *in)
|
||||
{
|
||||
char *out;
|
||||
|
||||
|
||||
out = Z_Malloc (strlen(in)+1);
|
||||
strcpy (out, in);
|
||||
return out;
|
||||
@@ -360,7 +360,7 @@ void Cmd_Alias_f (void)
|
||||
return;
|
||||
}
|
||||
|
||||
// if the alias already exists, reuse it
|
||||
// if the alias allready exists, reuse it
|
||||
for (a = cmd_alias ; a ; a=a->next)
|
||||
{
|
||||
if (!strcmp(s, a->name))
|
||||
@@ -376,7 +376,7 @@ void Cmd_Alias_f (void)
|
||||
a->next = cmd_alias;
|
||||
cmd_alias = a;
|
||||
}
|
||||
strcpy (a->name, s);
|
||||
strcpy (a->name, s);
|
||||
|
||||
// copy the rest of the command line
|
||||
cmd[0] = 0; // start out with a null string
|
||||
@@ -388,7 +388,7 @@ void Cmd_Alias_f (void)
|
||||
strcat (cmd, " ");
|
||||
}
|
||||
strcat (cmd, "\n");
|
||||
|
||||
|
||||
a->value = CopyString (cmd);
|
||||
}
|
||||
|
||||
@@ -457,7 +457,7 @@ char *Cmd_Argv (int arg)
|
||||
{
|
||||
if ( (unsigned)arg >= cmd_argc )
|
||||
return cmd_null_string;
|
||||
return cmd_argv[arg];
|
||||
return cmd_argv[arg];
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -481,14 +481,14 @@ Parses the given string into command line tokens.
|
||||
void Cmd_TokenizeString (char *text)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
// clear the args from the last string
|
||||
for (i=0 ; i<cmd_argc ; i++)
|
||||
Z_Free (cmd_argv[i]);
|
||||
|
||||
|
||||
cmd_argc = 0;
|
||||
cmd_args = NULL;
|
||||
|
||||
|
||||
while (1)
|
||||
{
|
||||
// skip whitespace up to a /n
|
||||
@@ -496,19 +496,19 @@ void Cmd_TokenizeString (char *text)
|
||||
{
|
||||
text++;
|
||||
}
|
||||
|
||||
|
||||
if (*text == '\n')
|
||||
{ // a newline separates commands in the buffer
|
||||
{ // a newline seperates commands in the buffer
|
||||
text++;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!*text)
|
||||
return;
|
||||
|
||||
|
||||
if (cmd_argc == 1)
|
||||
cmd_args = text;
|
||||
|
||||
|
||||
text = COM_Parse (text);
|
||||
if (!text)
|
||||
return;
|
||||
@@ -520,7 +520,7 @@ void Cmd_TokenizeString (char *text)
|
||||
cmd_argc++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -532,17 +532,17 @@ Cmd_AddCommand
|
||||
void Cmd_AddCommand (char *cmd_name, xcommand_t function)
|
||||
{
|
||||
cmd_function_t *cmd;
|
||||
|
||||
|
||||
if (host_initialized) // because hunk allocation would get stomped
|
||||
Sys_Error ("Cmd_AddCommand after host_initialized");
|
||||
|
||||
|
||||
// fail if the command is a variable name
|
||||
if (Cvar_VariableString(cmd_name)[0])
|
||||
{
|
||||
Con_Printf ("Cmd_AddCommand: %s already defined as a var\n", cmd_name);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// fail if the command already exists
|
||||
for (cmd=cmd_functions ; cmd ; cmd=cmd->next)
|
||||
{
|
||||
@@ -589,12 +589,12 @@ char *Cmd_CompleteCommand (char *partial)
|
||||
{
|
||||
cmd_function_t *cmd;
|
||||
int len;
|
||||
|
||||
|
||||
len = Q_strlen(partial);
|
||||
|
||||
|
||||
if (!len)
|
||||
return NULL;
|
||||
|
||||
|
||||
// check functions
|
||||
for (cmd=cmd_functions ; cmd ; cmd=cmd->next)
|
||||
if (!Q_strncmp (partial,cmd->name, len))
|
||||
@@ -612,13 +612,13 @@ FIXME: lookupnoadd the token to speed search?
|
||||
============
|
||||
*/
|
||||
void Cmd_ExecuteString (char *text, cmd_source_t src)
|
||||
{
|
||||
{
|
||||
cmd_function_t *cmd;
|
||||
cmdalias_t *a;
|
||||
|
||||
cmd_source = src;
|
||||
Cmd_TokenizeString (text);
|
||||
|
||||
|
||||
// execute the command line
|
||||
if (!Cmd_Argc())
|
||||
return; // no tokens
|
||||
@@ -642,11 +642,11 @@ void Cmd_ExecuteString (char *text, cmd_source_t src)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// check cvars
|
||||
if (!Cvar_Command ())
|
||||
Con_Printf ("Unknown command \"%s\"\n", Cmd_Argv(0));
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -664,7 +664,7 @@ void Cmd_ForwardToServer (void)
|
||||
Con_Printf ("Can't \"%s\", not connected\n", Cmd_Argv(0));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (cls.demoplayback)
|
||||
return; // not really connected
|
||||
|
||||
@@ -686,20 +686,20 @@ void Cmd_ForwardToServer (void)
|
||||
Cmd_CheckParm
|
||||
|
||||
Returns the position (1 to argc-1) in the command's argument list
|
||||
where the given parameter appears, or 0 if not present
|
||||
where the given parameter apears, or 0 if not present
|
||||
================
|
||||
*/
|
||||
|
||||
int Cmd_CheckParm (char *parm)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
if (!parm)
|
||||
Sys_Error ("Cmd_CheckParm: NULL");
|
||||
|
||||
for (i = 1; i < Cmd_Argc (); i++)
|
||||
if (! Q_strcasecmp (parm, Cmd_Argv (i)))
|
||||
return i;
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -8,7 +8,7 @@ of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
@@ -61,8 +61,8 @@ Command execution takes a null terminated string, breaks it into tokens,
|
||||
then searches for a command or variable that matches the first token.
|
||||
|
||||
Commands can come from three sources, but the handler functions may choose
|
||||
to disallow the action or forward it to a remote server if the source is
|
||||
not appropriate.
|
||||
to dissallow the action or forward it to a remote server if the source is
|
||||
not apropriate.
|
||||
|
||||
*/
|
||||
|
||||
@@ -96,11 +96,11 @@ char *Cmd_Argv (int arg);
|
||||
char *Cmd_Args (void);
|
||||
// The functions that execute commands get their parameters with these
|
||||
// functions. Cmd_Argv () will return an empty string, not a NULL
|
||||
// if arg > argc, so string operations are always safe.
|
||||
// if arg > argc, so string operations are allways safe.
|
||||
|
||||
int Cmd_CheckParm (char *parm);
|
||||
// Returns the position (1 to argc-1) in the command's argument list
|
||||
// where the given parameter appears, or 0 if not present
|
||||
// where the given parameter apears, or 0 if not present
|
||||
|
||||
void Cmd_TokenizeString (char *text);
|
||||
// Takes a null terminated string. Does not need to be /n terminated.
|
||||
@@ -118,3 +118,4 @@ void Cmd_ForwardToServer (void);
|
||||
void Cmd_Print (char *text);
|
||||
// used by command functions to send output to either the graphics console or
|
||||
// passed as a print message to the client
|
||||
|
||||
@@ -8,7 +8,7 @@ of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
@@ -94,7 +94,7 @@ into the cache directory, then opened there.
|
||||
|
||||
FIXME:
|
||||
The file "parms.txt" will be read out of the game directory and appended to the current command line arguments to allow different games to initialize startup parms differently. This could be used to add a "-sspeed 22050" for the high quality sound edition. Because they are added at the end, they will not override an explicit setting on the original command line.
|
||||
|
||||
|
||||
*/
|
||||
|
||||
//============================================================================
|
||||
@@ -138,7 +138,7 @@ void InsertLinkAfter (link_t *l, link_t *after)
|
||||
void Q_memset (void *dest, int fill, int count)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
if ( (((long)dest | count) & 3) == 0)
|
||||
{
|
||||
count >>= 2;
|
||||
@@ -154,7 +154,7 @@ void Q_memset (void *dest, int fill, int count)
|
||||
void Q_memcpy (void *dest, void *src, int count)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
if (( ( (long)dest | (long)src | count) & 3) == 0 )
|
||||
{
|
||||
count>>=2;
|
||||
@@ -199,7 +199,7 @@ void Q_strncpy (char *dest, char *src, int count)
|
||||
int Q_strlen (char *str)
|
||||
{
|
||||
int count;
|
||||
|
||||
|
||||
count = 0;
|
||||
while (str[count])
|
||||
count++;
|
||||
@@ -227,13 +227,13 @@ int Q_strcmp (char *s1, char *s2)
|
||||
while (1)
|
||||
{
|
||||
if (*s1 != *s2)
|
||||
return -1; // strings not equal
|
||||
return -1; // strings not equal
|
||||
if (!*s1)
|
||||
return 0; // strings are equal
|
||||
s1++;
|
||||
s2++;
|
||||
}
|
||||
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -244,20 +244,20 @@ int Q_strncmp (char *s1, char *s2, int count)
|
||||
if (!count--)
|
||||
return 0;
|
||||
if (*s1 != *s2)
|
||||
return -1; // strings not equal
|
||||
return -1; // strings not equal
|
||||
if (!*s1)
|
||||
return 0; // strings are equal
|
||||
s1++;
|
||||
s2++;
|
||||
}
|
||||
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int Q_strncasecmp (char *s1, char *s2, int n)
|
||||
{
|
||||
int c1, c2;
|
||||
|
||||
|
||||
while (1)
|
||||
{
|
||||
c1 = *s1++;
|
||||
@@ -265,7 +265,7 @@ int Q_strncasecmp (char *s1, char *s2, int n)
|
||||
|
||||
if (!n--)
|
||||
return 0; // strings are equal until end point
|
||||
|
||||
|
||||
if (c1 != c2)
|
||||
{
|
||||
if (c1 >= 'a' && c1 <= 'z')
|
||||
@@ -280,7 +280,7 @@ int Q_strncasecmp (char *s1, char *s2, int n)
|
||||
// s1++;
|
||||
// s2++;
|
||||
}
|
||||
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -294,7 +294,7 @@ int Q_atoi (char *str)
|
||||
int val;
|
||||
int sign;
|
||||
int c;
|
||||
|
||||
|
||||
if (*str == '-')
|
||||
{
|
||||
sign = -1;
|
||||
@@ -302,7 +302,7 @@ int Q_atoi (char *str)
|
||||
}
|
||||
else
|
||||
sign = 1;
|
||||
|
||||
|
||||
val = 0;
|
||||
|
||||
//
|
||||
@@ -324,7 +324,7 @@ int Q_atoi (char *str)
|
||||
return val*sign;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// check for character
|
||||
//
|
||||
@@ -332,7 +332,7 @@ int Q_atoi (char *str)
|
||||
{
|
||||
return sign * str[1];
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// assume decimal
|
||||
//
|
||||
@@ -343,7 +343,7 @@ int Q_atoi (char *str)
|
||||
return val*sign;
|
||||
val = val*10 + c - '0';
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -354,7 +354,7 @@ float Q_atof (char *str)
|
||||
int sign;
|
||||
int c;
|
||||
int decimal, total;
|
||||
|
||||
|
||||
if (*str == '-')
|
||||
{
|
||||
sign = -1;
|
||||
@@ -362,7 +362,7 @@ float Q_atof (char *str)
|
||||
}
|
||||
else
|
||||
sign = 1;
|
||||
|
||||
|
||||
val = 0;
|
||||
|
||||
//
|
||||
@@ -384,7 +384,7 @@ float Q_atof (char *str)
|
||||
return val*sign;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// check for character
|
||||
//
|
||||
@@ -392,7 +392,7 @@ float Q_atof (char *str)
|
||||
{
|
||||
return sign * str[1];
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// assume decimal
|
||||
//
|
||||
@@ -419,7 +419,7 @@ float Q_atof (char *str)
|
||||
val /= 10;
|
||||
total--;
|
||||
}
|
||||
|
||||
|
||||
return val*sign;
|
||||
}
|
||||
|
||||
@@ -483,8 +483,8 @@ float FloatSwap (float f)
|
||||
float f;
|
||||
byte b[4];
|
||||
} dat1, dat2;
|
||||
|
||||
|
||||
|
||||
|
||||
dat1.f = f;
|
||||
dat2.b[0] = dat1.b[3];
|
||||
dat2.b[1] = dat1.b[2];
|
||||
@@ -514,7 +514,7 @@ Handles byte ordering and avoids alignment errors
|
||||
void MSG_WriteChar (sizebuf_t *sb, int c)
|
||||
{
|
||||
byte *buf;
|
||||
|
||||
|
||||
#ifdef PARANOID
|
||||
if (c < -128 || c > 127)
|
||||
Sys_Error ("MSG_WriteChar: range error");
|
||||
@@ -527,7 +527,7 @@ void MSG_WriteChar (sizebuf_t *sb, int c)
|
||||
void MSG_WriteByte (sizebuf_t *sb, int c)
|
||||
{
|
||||
byte *buf;
|
||||
|
||||
|
||||
#ifdef PARANOID
|
||||
if (c < 0 || c > 255)
|
||||
Sys_Error ("MSG_WriteByte: range error");
|
||||
@@ -540,7 +540,7 @@ void MSG_WriteByte (sizebuf_t *sb, int c)
|
||||
void MSG_WriteShort (sizebuf_t *sb, int c)
|
||||
{
|
||||
byte *buf;
|
||||
|
||||
|
||||
#ifdef PARANOID
|
||||
if (c < ((short)0x8000) || c > (short)0x7fff)
|
||||
Sys_Error ("MSG_WriteShort: range error");
|
||||
@@ -554,7 +554,7 @@ void MSG_WriteShort (sizebuf_t *sb, int c)
|
||||
void MSG_WriteLong (sizebuf_t *sb, int c)
|
||||
{
|
||||
byte *buf;
|
||||
|
||||
|
||||
buf = SZ_GetSpace (sb, 4);
|
||||
buf[0] = c&0xff;
|
||||
buf[1] = (c>>8)&0xff;
|
||||
@@ -569,11 +569,11 @@ void MSG_WriteFloat (sizebuf_t *sb, float f)
|
||||
float f;
|
||||
int l;
|
||||
} dat;
|
||||
|
||||
|
||||
|
||||
|
||||
dat.f = f;
|
||||
dat.l = LittleLong (dat.l);
|
||||
|
||||
|
||||
SZ_Write (sb, &dat.l, 4);
|
||||
}
|
||||
|
||||
@@ -611,70 +611,70 @@ void MSG_BeginReading (void)
|
||||
int MSG_ReadChar (void)
|
||||
{
|
||||
int c;
|
||||
|
||||
|
||||
if (msg_readcount+1 > net_message.cursize)
|
||||
{
|
||||
msg_badread = true;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
c = (signed char)net_message.data[msg_readcount];
|
||||
msg_readcount++;
|
||||
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
int MSG_ReadByte (void)
|
||||
{
|
||||
int c;
|
||||
|
||||
|
||||
if (msg_readcount+1 > net_message.cursize)
|
||||
{
|
||||
msg_badread = true;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
c = (unsigned char)net_message.data[msg_readcount];
|
||||
msg_readcount++;
|
||||
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
int MSG_ReadShort (void)
|
||||
{
|
||||
int c;
|
||||
|
||||
|
||||
if (msg_readcount+2 > net_message.cursize)
|
||||
{
|
||||
msg_badread = true;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
c = (short)(net_message.data[msg_readcount]
|
||||
+ (net_message.data[msg_readcount+1]<<8));
|
||||
|
||||
|
||||
msg_readcount += 2;
|
||||
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
int MSG_ReadLong (void)
|
||||
{
|
||||
int c;
|
||||
|
||||
|
||||
if (msg_readcount+4 > net_message.cursize)
|
||||
{
|
||||
msg_badread = true;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
c = net_message.data[msg_readcount]
|
||||
+ (net_message.data[msg_readcount+1]<<8)
|
||||
+ (net_message.data[msg_readcount+2]<<16)
|
||||
+ (net_message.data[msg_readcount+3]<<24);
|
||||
|
||||
|
||||
msg_readcount += 4;
|
||||
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
@@ -686,23 +686,23 @@ float MSG_ReadFloat (void)
|
||||
float f;
|
||||
int l;
|
||||
} dat;
|
||||
|
||||
|
||||
dat.b[0] = net_message.data[msg_readcount];
|
||||
dat.b[1] = net_message.data[msg_readcount+1];
|
||||
dat.b[2] = net_message.data[msg_readcount+2];
|
||||
dat.b[3] = net_message.data[msg_readcount+3];
|
||||
msg_readcount += 4;
|
||||
|
||||
|
||||
dat.l = LittleLong (dat.l);
|
||||
|
||||
return dat.f;
|
||||
return dat.f;
|
||||
}
|
||||
|
||||
char *MSG_ReadString (void)
|
||||
{
|
||||
static char string[2048];
|
||||
int l,c;
|
||||
|
||||
|
||||
l = 0;
|
||||
do
|
||||
{
|
||||
@@ -712,9 +712,9 @@ char *MSG_ReadString (void)
|
||||
string[l] = c;
|
||||
l++;
|
||||
} while (l < sizeof(string)-1);
|
||||
|
||||
|
||||
string[l] = 0;
|
||||
|
||||
|
||||
return string;
|
||||
}
|
||||
|
||||
@@ -758,35 +758,35 @@ void SZ_Clear (sizebuf_t *buf)
|
||||
void *SZ_GetSpace (sizebuf_t *buf, int length)
|
||||
{
|
||||
void *data;
|
||||
|
||||
|
||||
if (buf->cursize + length > buf->maxsize)
|
||||
{
|
||||
if (!buf->allowoverflow)
|
||||
Sys_Error ("SZ_GetSpace: overflow without allowoverflow set");
|
||||
|
||||
|
||||
if (length > buf->maxsize)
|
||||
Sys_Error ("SZ_GetSpace: %i is > full buffer size", length);
|
||||
|
||||
|
||||
buf->overflowed = true;
|
||||
Con_Printf ("SZ_GetSpace: overflow");
|
||||
SZ_Clear (buf);
|
||||
SZ_Clear (buf);
|
||||
}
|
||||
|
||||
data = buf->data + buf->cursize;
|
||||
buf->cursize += length;
|
||||
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
void SZ_Write (sizebuf_t *buf, void *data, int length)
|
||||
{
|
||||
Q_memcpy (SZ_GetSpace(buf,length),data,length);
|
||||
Q_memcpy (SZ_GetSpace(buf,length),data,length);
|
||||
}
|
||||
|
||||
void SZ_Print (sizebuf_t *buf, char *data)
|
||||
{
|
||||
int len;
|
||||
|
||||
|
||||
len = Q_strlen(data)+1;
|
||||
|
||||
// byte * cast to keep VC++ happy
|
||||
@@ -808,7 +808,7 @@ COM_SkipPath
|
||||
char *COM_SkipPath (char *pathname)
|
||||
{
|
||||
char *last;
|
||||
|
||||
|
||||
last = pathname;
|
||||
while (*pathname)
|
||||
{
|
||||
@@ -860,15 +860,15 @@ COM_FileBase
|
||||
void COM_FileBase (char *in, char *out)
|
||||
{
|
||||
char *s, *s2;
|
||||
|
||||
|
||||
s = in + strlen(in) - 1;
|
||||
|
||||
|
||||
while (s != in && *s != '.')
|
||||
s--;
|
||||
|
||||
|
||||
for (s2 = s ; *s2 && *s2 != '/' ; s2--)
|
||||
;
|
||||
|
||||
|
||||
if (s-s2 < 2)
|
||||
strcpy (out,"?model?");
|
||||
else
|
||||
@@ -916,13 +916,13 @@ char *COM_Parse (char *data)
|
||||
{
|
||||
int c;
|
||||
int len;
|
||||
|
||||
|
||||
len = 0;
|
||||
com_token[0] = 0;
|
||||
|
||||
|
||||
if (!data)
|
||||
return NULL;
|
||||
|
||||
|
||||
// skip whitespace
|
||||
skipwhite:
|
||||
while ( (c = *data) <= ' ')
|
||||
@@ -931,7 +931,7 @@ skipwhite:
|
||||
return NULL; // end of file;
|
||||
data++;
|
||||
}
|
||||
|
||||
|
||||
// skip // comments
|
||||
if (c=='/' && data[1] == '/')
|
||||
{
|
||||
@@ -939,7 +939,7 @@ skipwhite:
|
||||
data++;
|
||||
goto skipwhite;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// handle quoted strings specially
|
||||
if (c == '\"')
|
||||
@@ -977,7 +977,7 @@ skipwhite:
|
||||
if (c=='{' || c=='}'|| c==')'|| c=='(' || c=='\'' || c==':')
|
||||
break;
|
||||
} while (c>32);
|
||||
|
||||
|
||||
com_token[len] = 0;
|
||||
return data;
|
||||
}
|
||||
@@ -988,13 +988,13 @@ skipwhite:
|
||||
COM_CheckParm
|
||||
|
||||
Returns the position (1 to argc-1) in the program's argument list
|
||||
where the given parameter appears, or 0 if not present
|
||||
where the given parameter apears, or 0 if not present
|
||||
================
|
||||
*/
|
||||
int COM_CheckParm (char *parm)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
for (i=1 ; i<com_argc ; i++)
|
||||
{
|
||||
if (!com_argv[i])
|
||||
@@ -1002,7 +1002,7 @@ int COM_CheckParm (char *parm)
|
||||
if (!Q_strcmp (parm,com_argv[i]))
|
||||
return i;
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1038,11 +1038,11 @@ void COM_CheckRegistered (void)
|
||||
|
||||
Sys_FileRead (h, check, sizeof(check));
|
||||
COM_CloseFile (h);
|
||||
|
||||
|
||||
for (i=0 ; i<128 ; i++)
|
||||
if (pop[i] != (unsigned short)BigShort (check[i]))
|
||||
Sys_Error ("Corrupted data file.");
|
||||
|
||||
|
||||
Cvar_Set ("cmdline", com_cmdline);
|
||||
Cvar_Set ("registered", "1");
|
||||
static_registered = 1;
|
||||
@@ -1130,7 +1130,7 @@ void COM_Init (char *basedir)
|
||||
{
|
||||
byte swaptest[2] = {1,0};
|
||||
|
||||
// set the byte swapping variables in a portable manner
|
||||
// set the byte swapping variables in a portable manner
|
||||
#ifdef SDL
|
||||
// This is necessary because egcs 1.1.1 mis-compiles swaptest with -O2
|
||||
if ( SDL_BYTEORDER == SDL_LIL_ENDIAN )
|
||||
@@ -1179,12 +1179,12 @@ char *va(char *format, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
static char string[1024];
|
||||
|
||||
|
||||
va_start (argptr, format);
|
||||
vsprintf (string, format,argptr);
|
||||
va_end (argptr);
|
||||
|
||||
return string;
|
||||
return string;
|
||||
}
|
||||
|
||||
|
||||
@@ -1192,7 +1192,7 @@ char *va(char *format, ...)
|
||||
int memsearch (byte *start, int count, int search)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
for (i=0 ; i<count ; i++)
|
||||
if (start[i] == search)
|
||||
return i;
|
||||
@@ -1267,7 +1267,7 @@ COM_Path_f
|
||||
void COM_Path_f (void)
|
||||
{
|
||||
searchpath_t *s;
|
||||
|
||||
|
||||
Con_Printf ("Current search path:\n");
|
||||
for (s=com_searchpaths ; s ; s=s->next)
|
||||
{
|
||||
@@ -1291,7 +1291,7 @@ void COM_WriteFile (char *filename, void *data, int len)
|
||||
{
|
||||
int handle;
|
||||
char name[MAX_OSPATH];
|
||||
|
||||
|
||||
sprintf (name, "%s/%s", com_gamedir, filename);
|
||||
|
||||
handle = Sys_FileOpenWrite (name);
|
||||
@@ -1300,7 +1300,7 @@ void COM_WriteFile (char *filename, void *data, int len)
|
||||
Sys_Printf ("COM_WriteFile: failed on %s\n", name);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Sys_Printf ("COM_WriteFile: %s\n", name);
|
||||
Sys_FileWrite (handle, data, len);
|
||||
Sys_FileClose (handle);
|
||||
@@ -1317,7 +1317,7 @@ Only used for CopyFile
|
||||
void COM_CreatePath (char *path)
|
||||
{
|
||||
char *ofs;
|
||||
|
||||
|
||||
for (ofs = path+1 ; *ofs ; ofs++)
|
||||
{
|
||||
if (*ofs == '/')
|
||||
@@ -1343,11 +1343,11 @@ void COM_CopyFile (char *netpath, char *cachepath)
|
||||
int in, out;
|
||||
int remaining, count;
|
||||
char buf[4096];
|
||||
|
||||
remaining = Sys_FileOpenRead (netpath, &in);
|
||||
|
||||
remaining = Sys_FileOpenRead (netpath, &in);
|
||||
COM_CreatePath (cachepath); // create directories up to the cache file
|
||||
out = Sys_FileOpenWrite (cachepath);
|
||||
|
||||
|
||||
while (remaining)
|
||||
{
|
||||
if (remaining < sizeof(buf))
|
||||
@@ -1360,7 +1360,7 @@ void COM_CopyFile (char *netpath, char *cachepath)
|
||||
}
|
||||
|
||||
Sys_FileClose (in);
|
||||
Sys_FileClose (out);
|
||||
Sys_FileClose (out);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1384,7 +1384,7 @@ int COM_FindFile (char *filename, int *handle, FILE **file)
|
||||
Sys_Error ("COM_FindFile: both handle and file set");
|
||||
if (!file && !handle)
|
||||
Sys_Error ("COM_FindFile: neither handle or file set");
|
||||
|
||||
|
||||
//
|
||||
// search through the path, one element at a time
|
||||
//
|
||||
@@ -1422,25 +1422,25 @@ int COM_FindFile (char *filename, int *handle, FILE **file)
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
// check a file in the directory tree
|
||||
if (!static_registered)
|
||||
{ // if not a registered version, don't ever go beyond base
|
||||
if ( strchr (filename, '/') || strchr (filename,'\\'))
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
sprintf (netpath, "%s/%s",search->filename, filename);
|
||||
|
||||
|
||||
findtime = Sys_FileTime (netpath);
|
||||
if (findtime == -1)
|
||||
continue;
|
||||
|
||||
|
||||
// see if the file needs to be updated in the cache
|
||||
if (!com_cachedir[0])
|
||||
strcpy (cachepath, netpath);
|
||||
else
|
||||
{
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
if ((strlen(netpath) < 2) || (netpath[1] != ':'))
|
||||
sprintf (cachepath,"%s%s", com_cachedir, netpath);
|
||||
@@ -1451,11 +1451,11 @@ int COM_FindFile (char *filename, int *handle, FILE **file)
|
||||
#endif
|
||||
|
||||
cachetime = Sys_FileTime (cachepath);
|
||||
|
||||
|
||||
if (cachetime < findtime)
|
||||
COM_CopyFile (netpath, cachepath);
|
||||
strcpy (netpath, cachepath);
|
||||
}
|
||||
}
|
||||
|
||||
Sys_Printf ("FindFile: %s\n",netpath);
|
||||
com_filesize = Sys_FileOpenRead (netpath, &i);
|
||||
@@ -1468,11 +1468,11 @@ int COM_FindFile (char *filename, int *handle, FILE **file)
|
||||
}
|
||||
return com_filesize;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
Sys_Printf ("FindFile: can't find %s\n", filename);
|
||||
|
||||
|
||||
if (handle)
|
||||
*handle = -1;
|
||||
else
|
||||
@@ -1519,11 +1519,11 @@ If it is a pak file handle, don't really close it
|
||||
void COM_CloseFile (int h)
|
||||
{
|
||||
searchpath_t *s;
|
||||
|
||||
|
||||
for (s = com_searchpaths ; s ; s=s->next)
|
||||
if (s->pack && s->pack->handle == h)
|
||||
return;
|
||||
|
||||
|
||||
Sys_FileClose (h);
|
||||
}
|
||||
|
||||
@@ -1532,8 +1532,8 @@ void COM_CloseFile (int h)
|
||||
============
|
||||
COM_LoadFile
|
||||
|
||||
Filename are relative to the quake directory.
|
||||
Always appends a 0 byte.
|
||||
Filename are reletive to the quake directory.
|
||||
Allways appends a 0 byte.
|
||||
============
|
||||
*/
|
||||
cache_user_t *loadcache;
|
||||
@@ -1552,10 +1552,10 @@ byte *COM_LoadFile (char *path, int usehunk)
|
||||
len = COM_OpenFile (path, &h);
|
||||
if (h == -1)
|
||||
return NULL;
|
||||
|
||||
|
||||
// extract the filename base name for hunk tag
|
||||
COM_FileBase (path, base);
|
||||
|
||||
|
||||
if (usehunk == 1)
|
||||
buf = Hunk_AllocName (len+1, base);
|
||||
else if (usehunk == 2)
|
||||
@@ -1576,11 +1576,11 @@ byte *COM_LoadFile (char *path, int usehunk)
|
||||
|
||||
if (!buf)
|
||||
Sys_Error ("COM_LoadFile: not enough space for %s", path);
|
||||
|
||||
|
||||
((byte *)buf)[len] = 0;
|
||||
|
||||
Draw_BeginDisc ();
|
||||
Sys_FileRead (h, buf, len);
|
||||
Sys_FileRead (h, buf, len);
|
||||
COM_CloseFile (h);
|
||||
Draw_EndDisc ();
|
||||
|
||||
@@ -1607,11 +1607,11 @@ void COM_LoadCacheFile (char *path, struct cache_user_s *cu)
|
||||
byte *COM_LoadStackFile (char *path, void *buffer, int bufsize)
|
||||
{
|
||||
byte *buf;
|
||||
|
||||
|
||||
loadbuf = (byte *)buffer;
|
||||
loadsize = bufsize;
|
||||
buf = COM_LoadFile (path, 4);
|
||||
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
@@ -1681,7 +1681,7 @@ pack_t *COM_LoadPackFile (char *packfile)
|
||||
pack->handle = packhandle;
|
||||
pack->numfiles = numpackfiles;
|
||||
pack->files = newfiles;
|
||||
|
||||
|
||||
Con_Printf ("Added packfile %s (%i files)\n", packfile, numpackfiles);
|
||||
return pack;
|
||||
}
|
||||
@@ -1692,7 +1692,7 @@ pack_t *COM_LoadPackFile (char *packfile)
|
||||
COM_AddGameDirectory
|
||||
|
||||
Sets com_gamedir, adds the directory to the head of the path,
|
||||
then loads and adds pak1.pak pak2.pak ...
|
||||
then loads and adds pak1.pak pak2.pak ...
|
||||
================
|
||||
*/
|
||||
void COM_AddGameDirectory (char *dir)
|
||||
@@ -1724,7 +1724,7 @@ void COM_AddGameDirectory (char *dir)
|
||||
search = Hunk_Alloc (sizeof(searchpath_t));
|
||||
search->pack = pak;
|
||||
search->next = com_searchpaths;
|
||||
com_searchpaths = search;
|
||||
com_searchpaths = search;
|
||||
}
|
||||
|
||||
//
|
||||
@@ -1807,7 +1807,7 @@ void COM_InitFilesystem (void)
|
||||
|
||||
//
|
||||
// -path <dir or packfile> [<dir or packfile>] ...
|
||||
// Fully specifies the exact search path, overriding the generated one
|
||||
// Fully specifies the exact serach path, overriding the generated one
|
||||
//
|
||||
i = COM_CheckParm ("-path");
|
||||
if (i)
|
||||
@@ -1818,7 +1818,7 @@ void COM_InitFilesystem (void)
|
||||
{
|
||||
if (!com_argv[i] || com_argv[i][0] == '+' || com_argv[i][0] == '-')
|
||||
break;
|
||||
|
||||
|
||||
search = Hunk_Alloc (sizeof(searchpath_t));
|
||||
if ( !strcmp(COM_FileExtension(com_argv[i]), "pak") )
|
||||
{
|
||||
@@ -1836,3 +1836,5 @@ void COM_InitFilesystem (void)
|
||||
if (COM_CheckParm ("-proghack"))
|
||||
proghack = true;
|
||||
}
|
||||
|
||||
|
||||
+17
-16
@@ -1,7 +1,7 @@
|
||||
#! /bin/sh
|
||||
|
||||
# Guess values for system-dependent variables and create Makefiles.
|
||||
# Generated automatically using autoconf version 2.13
|
||||
# Generated automatically using autoconf version 2.13
|
||||
# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
|
||||
#
|
||||
# This configure script is free software; the Free Software Foundation
|
||||
@@ -477,9 +477,9 @@ else
|
||||
fi
|
||||
if test ! -r $srcdir/$ac_unique_file; then
|
||||
if test "$ac_srcdir_defaulted" = yes; then
|
||||
{ echo "configure: error: cannot find sources in $ac_confdir or .." 1>&2; exit 1; }
|
||||
{ echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
|
||||
else
|
||||
{ echo "configure: error: cannot find sources in $srcdir" 1>&2; exit 1; }
|
||||
{ echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
|
||||
fi
|
||||
fi
|
||||
srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
|
||||
@@ -543,7 +543,7 @@ for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
|
||||
fi
|
||||
done
|
||||
if test -z "$ac_aux_dir"; then
|
||||
{ echo "configure: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; }
|
||||
{ echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; }
|
||||
fi
|
||||
ac_config_guess=$ac_aux_dir/config.guess
|
||||
ac_config_sub=$ac_aux_dir/config.sub
|
||||
@@ -786,7 +786,7 @@ fi
|
||||
|
||||
# Make sure we can run config.sub.
|
||||
if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
|
||||
else { echo "configure: error: cannot run $ac_config_sub" 1>&2; exit 1; }
|
||||
else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
|
||||
fi
|
||||
|
||||
echo $ac_n "checking host system type""... $ac_c" 1>&6
|
||||
@@ -798,7 +798,7 @@ NONE)
|
||||
case $nonopt in
|
||||
NONE)
|
||||
if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then :
|
||||
else { echo "configure: error: cannot guess host type; you must specify one" 1>&2; exit 1; }
|
||||
else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
|
||||
fi ;;
|
||||
*) host_alias=$nonopt ;;
|
||||
esac ;;
|
||||
@@ -1239,13 +1239,13 @@ else
|
||||
/*)
|
||||
ac_cv_path_SDL_CONFIG="$SDL_CONFIG" # Let the user override the test with a path.
|
||||
;;
|
||||
?:/*)
|
||||
?:/*)
|
||||
ac_cv_path_SDL_CONFIG="$SDL_CONFIG" # Let the user override the test with a dos path.
|
||||
;;
|
||||
*)
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
|
||||
ac_dummy="$PATH"
|
||||
for ac_dir in $ac_dummy; do
|
||||
for ac_dir in $ac_dummy; do
|
||||
test -z "$ac_dir" && ac_dir=.
|
||||
if test -f $ac_dir/$ac_word; then
|
||||
ac_cv_path_SDL_CONFIG="$ac_dir/$ac_word"
|
||||
@@ -1302,7 +1302,7 @@ char*
|
||||
my_strdup (char *str)
|
||||
{
|
||||
char *new_str;
|
||||
|
||||
|
||||
if (str)
|
||||
{
|
||||
new_str = malloc ((strlen (str) + 1) * sizeof(char));
|
||||
@@ -1310,7 +1310,7 @@ my_strdup (char *str)
|
||||
}
|
||||
else
|
||||
new_str = NULL;
|
||||
|
||||
|
||||
return new_str;
|
||||
}
|
||||
|
||||
@@ -1366,7 +1366,7 @@ fi
|
||||
fi
|
||||
if test "x$no_sdl" = x ; then
|
||||
echo "$ac_t""yes" 1>&6
|
||||
:
|
||||
:
|
||||
else
|
||||
echo "$ac_t""no" 1>&6
|
||||
if test "$SDL_CONFIG" = "no" ; then
|
||||
@@ -1389,7 +1389,7 @@ fi
|
||||
#include "SDL.h"
|
||||
|
||||
int main() {
|
||||
return 0;
|
||||
return 0;
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:1396: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
@@ -1408,9 +1408,9 @@ else
|
||||
cat conftest.$ac_ext >&5
|
||||
rm -rf conftest*
|
||||
echo "*** The test program failed to compile or link. See the file config.log for the"
|
||||
echo "*** exact error that occurred. This usually means SDL was incorrectly installed"
|
||||
echo "*** exact error that occured. This usually means SDL was incorrectly installed"
|
||||
echo "*** or that you have moved SDL since it was installed. In the latter case, you"
|
||||
echo "*** may want to edit the sdl-config script: $SDL_CONFIG"
|
||||
echo "*** may want to edit the sdl-config script: $SDL_CONFIG"
|
||||
fi
|
||||
rm -f conftest*
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
@@ -1422,8 +1422,8 @@ rm -f conftest*
|
||||
{ echo "configure: error: *** SDL version $SDL_VERSION not found!" 1>&2; exit 1; }
|
||||
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
rm -f conf.sdltest
|
||||
|
||||
CFLAGS="$CFLAGS $SDL_CFLAGS -DSDL"
|
||||
@@ -1742,3 +1742,4 @@ EOF
|
||||
chmod +x $CONFIG_STATUS
|
||||
rm -fr confdefs* $ac_clean_files
|
||||
test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
|
||||
|
||||
@@ -8,7 +8,7 @@ of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
@@ -32,7 +32,7 @@ Cvar_FindVar
|
||||
cvar_t *Cvar_FindVar (char *var_name)
|
||||
{
|
||||
cvar_t *var;
|
||||
|
||||
|
||||
for (var=cvar_vars ; var ; var=var->next)
|
||||
if (!Q_strcmp (var_name, var->name))
|
||||
return var;
|
||||
@@ -48,7 +48,7 @@ Cvar_VariableValue
|
||||
float Cvar_VariableValue (char *var_name)
|
||||
{
|
||||
cvar_t *var;
|
||||
|
||||
|
||||
var = Cvar_FindVar (var_name);
|
||||
if (!var)
|
||||
return 0;
|
||||
@@ -64,7 +64,7 @@ Cvar_VariableString
|
||||
char *Cvar_VariableString (char *var_name)
|
||||
{
|
||||
cvar_t *var;
|
||||
|
||||
|
||||
var = Cvar_FindVar (var_name);
|
||||
if (!var)
|
||||
return cvar_null_string;
|
||||
@@ -81,12 +81,12 @@ char *Cvar_CompleteVariable (char *partial)
|
||||
{
|
||||
cvar_t *cvar;
|
||||
int len;
|
||||
|
||||
|
||||
len = Q_strlen(partial);
|
||||
|
||||
|
||||
if (!len)
|
||||
return NULL;
|
||||
|
||||
|
||||
// check functions
|
||||
for (cvar=cvar_vars ; cvar ; cvar=cvar->next)
|
||||
if (!Q_strncmp (partial,cvar->name, len))
|
||||
@@ -105,7 +105,7 @@ void Cvar_Set (char *var_name, char *value)
|
||||
{
|
||||
cvar_t *var;
|
||||
qboolean changed;
|
||||
|
||||
|
||||
var = Cvar_FindVar (var_name);
|
||||
if (!var)
|
||||
{ // there is an error in C code if this happens
|
||||
@@ -114,9 +114,9 @@ void Cvar_Set (char *var_name, char *value)
|
||||
}
|
||||
|
||||
changed = Q_strcmp(var->string, value);
|
||||
|
||||
|
||||
Z_Free (var->string); // free the old value string
|
||||
|
||||
|
||||
var->string = Z_Malloc (Q_strlen(value)+1);
|
||||
Q_strcpy (var->string, value);
|
||||
var->value = Q_atof (var->string);
|
||||
@@ -135,7 +135,7 @@ Cvar_SetValue
|
||||
void Cvar_SetValue (char *var_name, float value)
|
||||
{
|
||||
char val[32];
|
||||
|
||||
|
||||
sprintf (val, "%f",value);
|
||||
Cvar_Set (var_name, val);
|
||||
}
|
||||
@@ -151,27 +151,27 @@ Adds a freestanding variable to the variable list.
|
||||
void Cvar_RegisterVariable (cvar_t *variable)
|
||||
{
|
||||
char *oldstr;
|
||||
|
||||
// first check to see if it has already been defined
|
||||
|
||||
// first check to see if it has allready been defined
|
||||
if (Cvar_FindVar (variable->name))
|
||||
{
|
||||
Con_Printf ("Can't register variable %s, already defined\n", variable->name);
|
||||
Con_Printf ("Can't register variable %s, allready defined\n", variable->name);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// check for overlap with a command
|
||||
if (Cmd_Exists (variable->name))
|
||||
{
|
||||
Con_Printf ("Cvar_RegisterVariable: %s is a command\n", variable->name);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// copy the value off, because future sets will Z_Free it
|
||||
oldstr = variable->string;
|
||||
variable->string = Z_Malloc (Q_strlen(variable->string)+1);
|
||||
variable->string = Z_Malloc (Q_strlen(variable->string)+1);
|
||||
Q_strcpy (variable->string, oldstr);
|
||||
variable->value = Q_atof (variable->string);
|
||||
|
||||
|
||||
// link the variable in
|
||||
variable->next = cvar_vars;
|
||||
cvar_vars = variable;
|
||||
@@ -192,7 +192,7 @@ qboolean Cvar_Command (void)
|
||||
v = Cvar_FindVar (Cmd_Argv(0));
|
||||
if (!v)
|
||||
return false;
|
||||
|
||||
|
||||
// perform a variable print or set
|
||||
if (Cmd_Argc() == 1)
|
||||
{
|
||||
@@ -216,8 +216,9 @@ with the archive flag set to true.
|
||||
void Cvar_WriteVariables (FILE *f)
|
||||
{
|
||||
cvar_t *var;
|
||||
|
||||
|
||||
for (var = cvar_vars ; var ; var = var->next)
|
||||
if (var->archive)
|
||||
fprintf (f, "%s \"%s\"\n", var->name, var->string);
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
@@ -31,7 +31,7 @@ file when the game is quit:
|
||||
cvar_t r_draworder = {"r_draworder","1"};
|
||||
cvar_t scr_screensize = {"screensize","1",true};
|
||||
|
||||
Cvars must be registered before use, or they will have a 0 value instead of the float interpretation of the string. Generally, all cvar_t declarations should be registered in the appropriate init function before any console commands are executed:
|
||||
Cvars must be registered before use, or they will have a 0 value instead of the float interpretation of the string. Generally, all cvar_t declarations should be registered in the apropriate init function before any console commands are executed:
|
||||
Cvar_RegisterVariable (&host_framerate);
|
||||
|
||||
|
||||
@@ -64,11 +64,11 @@ typedef struct cvar_s
|
||||
} cvar_t;
|
||||
|
||||
void Cvar_RegisterVariable (cvar_t *variable);
|
||||
// registers a cvar that already has the name, string, and optionally the
|
||||
// registers a cvar that allready has the name, string, and optionally the
|
||||
// archive elements set.
|
||||
|
||||
void Cvar_Set (char *var_name, char *value);
|
||||
// equivalent to "<name> <variable>" typed at the console
|
||||
// equivelant to "<name> <variable>" typed at the console
|
||||
|
||||
void Cvar_SetValue (char *var_name, float value);
|
||||
// expands value to a string and calls Cvar_Set
|
||||
|
||||
@@ -8,7 +8,7 @@ of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
@@ -41,13 +41,13 @@ int D_SurfaceCacheForRes (int width, int height)
|
||||
size = Q_atoi(com_argv[COM_CheckParm("-surfcachesize")+1]) * 1024;
|
||||
return size;
|
||||
}
|
||||
|
||||
|
||||
size = SURFCACHE_SIZE_AT_320X200;
|
||||
|
||||
pix = width*height;
|
||||
if (pix > 64000)
|
||||
size += (pix-64000)*3;
|
||||
|
||||
|
||||
|
||||
return size;
|
||||
}
|
||||
@@ -67,7 +67,7 @@ void D_ClearCacheGuard (void)
|
||||
{
|
||||
byte *s;
|
||||
int i;
|
||||
|
||||
|
||||
s = (byte *)sc_base + sc_size;
|
||||
for (i=0 ; i<GUARDSIZE ; i++)
|
||||
s[i] = (byte)i;
|
||||
@@ -89,11 +89,11 @@ void D_InitCaches (void *buffer, int size)
|
||||
sc_size = size - GUARDSIZE;
|
||||
sc_base = (surfcache_t *)buffer;
|
||||
sc_rover = sc_base;
|
||||
|
||||
|
||||
sc_base->next = NULL;
|
||||
sc_base->owner = NULL;
|
||||
sc_base->size = sc_size;
|
||||
|
||||
|
||||
D_ClearCacheGuard ();
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ D_FlushCaches
|
||||
void D_FlushCaches (void)
|
||||
{
|
||||
surfcache_t *c;
|
||||
|
||||
|
||||
if (!sc_base)
|
||||
return;
|
||||
|
||||
@@ -115,7 +115,7 @@ void D_FlushCaches (void)
|
||||
if (c->owner)
|
||||
*c->owner = NULL;
|
||||
}
|
||||
|
||||
|
||||
sc_rover = sc_base;
|
||||
sc_base->next = NULL;
|
||||
sc_base->owner = NULL;
|
||||
@@ -137,7 +137,7 @@ surfcache_t *D_SCAlloc (int width, int size)
|
||||
|
||||
if ((size <= 0) || (size > 0x10000))
|
||||
Sys_Error ("D_SCAlloc: bad cache size %d\n", size);
|
||||
|
||||
|
||||
size = (int)&((surfcache_t *)0)->data[size];
|
||||
size = (size + 3) & ~3;
|
||||
if (size > sc_size)
|
||||
@@ -154,12 +154,12 @@ surfcache_t *D_SCAlloc (int width, int size)
|
||||
}
|
||||
sc_rover = sc_base;
|
||||
}
|
||||
|
||||
|
||||
// colect and free surfcache_t blocks until the rover block is large enough
|
||||
new = sc_rover;
|
||||
if (sc_rover->owner)
|
||||
*sc_rover->owner = NULL;
|
||||
|
||||
|
||||
while (new->size < size)
|
||||
{
|
||||
// free another
|
||||
@@ -168,7 +168,7 @@ surfcache_t *D_SCAlloc (int width, int size)
|
||||
Sys_Error ("D_SCAlloc: hit the end of memory");
|
||||
if (sc_rover->owner)
|
||||
*sc_rover->owner = NULL;
|
||||
|
||||
|
||||
new->size += sc_rover->size;
|
||||
new->next = sc_rover->next;
|
||||
}
|
||||
@@ -186,7 +186,7 @@ surfcache_t *D_SCAlloc (int width, int size)
|
||||
}
|
||||
else
|
||||
sc_rover = new->next;
|
||||
|
||||
|
||||
new->width = width;
|
||||
// DEBUG
|
||||
if (width > 0)
|
||||
@@ -200,7 +200,7 @@ surfcache_t *D_SCAlloc (int width, int size)
|
||||
r_cache_thrash = true;
|
||||
}
|
||||
else if (wrapped_this_time)
|
||||
{
|
||||
{
|
||||
d_roverwrapped = true;
|
||||
}
|
||||
|
||||
@@ -246,9 +246,9 @@ int MaskForNum (int num)
|
||||
int D_log2 (int num)
|
||||
{
|
||||
int c;
|
||||
|
||||
|
||||
c = 0;
|
||||
|
||||
|
||||
while (num>>=1)
|
||||
c++;
|
||||
return c;
|
||||
@@ -273,9 +273,9 @@ surfcache_t *D_CacheSurface (msurface_t *surface, int miplevel)
|
||||
r_drawsurf.lightadj[1] = d_lightstylevalue[surface->styles[1]];
|
||||
r_drawsurf.lightadj[2] = d_lightstylevalue[surface->styles[2]];
|
||||
r_drawsurf.lightadj[3] = d_lightstylevalue[surface->styles[3]];
|
||||
|
||||
|
||||
//
|
||||
// see if the cache holds appropriate data
|
||||
// see if the cache holds apropriate data
|
||||
//
|
||||
cache = surface->cachespots[miplevel];
|
||||
|
||||
@@ -295,7 +295,7 @@ surfcache_t *D_CacheSurface (msurface_t *surface, int miplevel)
|
||||
r_drawsurf.surfwidth = surface->extents[0] >> miplevel;
|
||||
r_drawsurf.rowbytes = r_drawsurf.surfwidth;
|
||||
r_drawsurf.surfheight = surface->extents[1] >> miplevel;
|
||||
|
||||
|
||||
//
|
||||
// allocate memory if needed
|
||||
//
|
||||
@@ -307,14 +307,14 @@ surfcache_t *D_CacheSurface (msurface_t *surface, int miplevel)
|
||||
cache->owner = &surface->cachespots[miplevel];
|
||||
cache->mipscale = surfscale;
|
||||
}
|
||||
|
||||
|
||||
if (surface->dlightframe == r_framecount)
|
||||
cache->dlight = 1;
|
||||
else
|
||||
cache->dlight = 0;
|
||||
|
||||
r_drawsurf.surfdat = (pixel_t *)cache->data;
|
||||
|
||||
|
||||
cache->texture = r_drawsurf.texture;
|
||||
cache->lightadj[0] = r_drawsurf.lightadj[0];
|
||||
cache->lightadj[1] = r_drawsurf.lightadj[1];
|
||||
@@ -331,3 +331,5 @@ surfcache_t *D_CacheSurface (msurface_t *surface, int miplevel)
|
||||
|
||||
return surface->cachespots[miplevel];
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ IBM PC and Compatibles
|
||||
Pentium processor or better
|
||||
VGA Compatible Display or better
|
||||
8MB RAM minimum, 16MB recommended (16 MB required for running under Win95)
|
||||
CD-ROM drive Required
|
||||
CD-ROM drive Required
|
||||
MS-DOS 5.0 or better or Windows 95 (does NOT run under Windows NT)
|
||||
Hard Drive (30MB for Shareware, 80 MB for Registered)
|
||||
|
||||
@@ -138,7 +138,7 @@ short sound F/X delay.
|
||||
|
||||
UltraSound PnP and PnP Pro
|
||||
--------------------------
|
||||
You must make sure that you do NOT have IWSBOS or MegaEm loaded.
|
||||
You must make sure that you do NOT have IWSBOS or MegaEm loaded.
|
||||
|
||||
Setup
|
||||
-----
|
||||
@@ -151,8 +151,8 @@ and in the IW.INI (PnP) file to determine what port settings to use.
|
||||
|
||||
Troubleshooting Windows 95 (DOS Box)
|
||||
------------------------------------
|
||||
We recommend that you restart your computer in MS-DOS Mode. DOS Box
|
||||
may or may not work, so use at your own risk.
|
||||
We recommend that you restart your computer in MS-DOS Mode. DOS Box
|
||||
may or may not work, so use at your own risk.
|
||||
|
||||
CD Audio Input
|
||||
--------------
|
||||
@@ -229,7 +229,7 @@ results as using a Boot Disk. To create a Quake Shortcut, do the following:
|
||||
== Known Problems ==
|
||||
======================================================
|
||||
|
||||
Problem: Zombies sometime get stuck on the ground and cannot get back up.
|
||||
Problem: Zombies sometime get stuck on the ground and connot get back up.
|
||||
(You can still hear them, but you cannot kill them. This bug makes it
|
||||
impossible to get 100% kills on whatever level it occurs on.)
|
||||
Solution: There is no workaround for this bug.
|
||||
@@ -240,7 +240,7 @@ Solution: If you get stuck, use the 'kill' console command. It is a good
|
||||
idea to save your game often.
|
||||
|
||||
Problem: View centering problems. Sometimes during a game, the view will not
|
||||
center properly. The end result is the player view looking up towards the
|
||||
center properly. The end result is the player view looking up torwards the
|
||||
ceiling while walking.
|
||||
Solution: Exit to the next level or use the 'kill' console command..
|
||||
|
||||
@@ -290,18 +290,18 @@ also refer to our web page, www.idsoftware.com, or call 1-800-idgames.
|
||||
When sending support e-mail, cut and paste the following into your e-mail
|
||||
message and fill in the blanks:
|
||||
|
||||
Date:
|
||||
Name:
|
||||
Phone number:
|
||||
Date:
|
||||
Name:
|
||||
Phone number:
|
||||
E-mail address: (please include this, we redirect tons of mail)
|
||||
Game Title:
|
||||
Version #:
|
||||
Game Title:
|
||||
Version #:
|
||||
Operating system (i.e., DOS 6.0 or Windows 95):
|
||||
Computer type:
|
||||
Computer type:
|
||||
BIOS date:
|
||||
BIOS version:
|
||||
Processor type:
|
||||
Processor speed:
|
||||
Processor type:
|
||||
Processor speed:
|
||||
Do you program at school/work?
|
||||
Do you provide tech. support at school/work?
|
||||
Please state the problem you encountered:
|
||||
@@ -440,7 +440,7 @@ You can turn off joystick reading during the game by typing "joystick 0" at
|
||||
the Quake command console.
|
||||
|
||||
You MUST configure your buttons from the configure keys menu before they will
|
||||
work. There is no default configuration.
|
||||
work. There is no default configuration.
|
||||
|
||||
If your joystick or interface card improperly sets the third or fourth
|
||||
joystick buttons, type "joybuttons 2" at the quake console or in your
|
||||
@@ -449,7 +449,7 @@ joystick buttons, type "joybuttons 2" at the quake console or in your
|
||||
The "mlook" button command now lets the joystick as well as the mouse control
|
||||
pitch angles.
|
||||
|
||||
The "sidestep" button command works on joysticks as with mice and keyboard
|
||||
The "sidestep" buttom command works on joysticks as with mice and keyboard
|
||||
movement.
|
||||
|
||||
The "invert mouse up/down" menu option also inverts the joystick pitch
|
||||
|
||||
@@ -83,7 +83,7 @@ again.
|
||||
leaving it set so Quake will then run in that mode. We suggest that you
|
||||
test a mode by pressing the 'T' key before setting it by pressing the Enter
|
||||
key. Note that a selection made with the Enter key remains in effect only
|
||||
until Quake is exited (or a new mode is set). You must explicitly make a mode
|
||||
until Quake is exited (or a new mode is set). You must explictly make a mode
|
||||
the default mode by pressing the 'D' key in order to automatically set that
|
||||
mode when you start Quake up in the future.
|
||||
|
||||
@@ -830,7 +830,7 @@ CDAudio_Play: Bad track number N.
|
||||
are that a CD other than Quake is in the player, or a custom level has
|
||||
specified an invalid track number.
|
||||
|
||||
CDAudio_Play: cannot play data.
|
||||
CDAudio_Play: Can not play data.
|
||||
A valid track was requested to be played, but it was a not an audio track.
|
||||
The probable causes are the same as for a bad track number.
|
||||
|
||||
@@ -872,7 +872,7 @@ Most normal configuration can be done via the game menus.
|
||||
There are two types of Quake servers: dedicated and listen. A listen server
|
||||
is a machine that is used to play the game and also hosts the game for other
|
||||
players. A dedicated server only hosts the game; it runs in text mode and
|
||||
does not let anyone play on that machine. A single player game is really
|
||||
does not let anyone play on that machine. A single player game is really
|
||||
just a 1 player listen server that doesn't listen for network connections.
|
||||
|
||||
Dedicated vs Listen. I'll try to make this simple: it is always better to
|
||||
@@ -944,7 +944,7 @@ Command line parameters
|
||||
If you do not specify a number <n> after -listen it will default to 8.
|
||||
The maximum allowed value is 16. A dedicated Quake server stays in
|
||||
text mode. This is the Quake console with most commands still
|
||||
available; those that make no sense (like vid_mode) are omitted.
|
||||
available; those that make no sense (like vid_mode) are ommitted.
|
||||
|
||||
Console Variables
|
||||
-----------------
|
||||
@@ -961,10 +961,10 @@ hostname
|
||||
sys_ticrate
|
||||
Only used by dedicated servers. This determines the rate at which the
|
||||
server will send out updates to the clients. The default value is 0.05
|
||||
(20 updates per second). For servers where bandwidth is limited, using
|
||||
(20 updatesper second). For servers where bandwidth is limited, using
|
||||
modems or the internet for example, it is advisable to lower this value
|
||||
to 0.1 (10 updates per second). This will have a very minor effect on
|
||||
responsiveness, but will half to outbound bandwidth required making the
|
||||
responsiveness, but will half to outbound bandwitdh required making the
|
||||
modem players a lot happier.
|
||||
|
||||
|
||||
@@ -1018,13 +1018,13 @@ Beame & Whiteside TCP/IP
|
||||
------------------------
|
||||
|
||||
This is the only DOS TCP/IP stack supported in the test release.
|
||||
It is not shareware... it's what we use on our network (in case you
|
||||
It is not shareware...it's what we use on our network (in case you
|
||||
were wondering why this particular stack). This has been "tested"
|
||||
extensively over ethernet and you should encounter no problems
|
||||
with it. Their SLIP and PPP have not been tested. When connecting
|
||||
to a server using TCP/IP (UDP actually), you specify it's "dot notation"
|
||||
to a server using TCP/IP (UDP actually), you specifiy it's "dot notation"
|
||||
address (like 123.45.67.89). You only need to specify the unique portion
|
||||
of the address. For example, if your IP address is 123.45.12.34
|
||||
of the adress. For example, if your IP address is 123.45.12.34
|
||||
and the server's is 123.45.56.78, you could use "connect 56.78".
|
||||
|
||||
Playing over the Internet
|
||||
@@ -1078,8 +1078,8 @@ uart: 16550
|
||||
port: 3f8
|
||||
irq: 4
|
||||
baud: 57600
|
||||
CTS: ignored
|
||||
DSR: ignored
|
||||
CTS: ignored
|
||||
DSR: ignored
|
||||
CD: ignored
|
||||
clear: ATZ
|
||||
startup:
|
||||
@@ -1150,7 +1150,7 @@ change these
|
||||
ignore all 3 lines.
|
||||
|
||||
Quake always uses no parity, 8 data bits, and 1 stop bit; these
|
||||
values cannot be changed. The baud, port, irq, and uart type can
|
||||
values can not be changed. The baud, port, irq, and uart type can
|
||||
not be changed on an enabled port, you must disable it first.
|
||||
|
||||
|
||||
@@ -1206,9 +1206,9 @@ You need to increase the number specified by "FILES=" in the DOS
|
||||
config.sys file.
|
||||
|
||||
Severe lag using TCP/IP under Win95:
|
||||
- Occasionally when you first connect in to a Quake game using Win95
|
||||
- Occasionaly when you first connect in to a Quake game using Win95
|
||||
TCP/IP you will experience severe lag and not be able to control your
|
||||
player's actions. This usually clears up in 10 to 15 seconds.
|
||||
player's actions. This usually clears up in 10 to 15 seconds.
|
||||
- There is apparently a strange limbo state for Microsoft's File and
|
||||
Print sharing. This has been seen when it was installed and then later
|
||||
removed, but it still appears on the menus. For some unknown reason
|
||||
@@ -1297,7 +1297,7 @@ Nokia ECM 4896M Trellis V.32:
|
||||
AT Z %C0 /N0
|
||||
|
||||
Nuvotel IFX 14.4 (internal):
|
||||
&F \N1 &D2
|
||||
&F \N1 &D2
|
||||
|
||||
Practical Peripherals 14400FX v.32bis:
|
||||
AT Z S46=0 &Q0 &D2
|
||||
@@ -1376,7 +1376,7 @@ USR 14.4k Dual Standard
|
||||
ATB0&R1&B1&N6Q0X4&A0&D2&H0&I0&K0&M0M1
|
||||
|
||||
USR (model?):
|
||||
&F E1 V1 X4 &C1 &D2 &N0
|
||||
&F E1 V1 X4 &C1 &D2 &N0
|
||||
|
||||
ViVa 14.4k:
|
||||
AT&F&Q6\N0%C0&D2N0S37=9
|
||||
@@ -1568,10 +1568,10 @@ Watch out for limbo subsystems
|
||||
------------------------------
|
||||
Microsoft's File and Print sharing and IPX protocol stack have both been
|
||||
known to cause strange problems when they are in a limbo state. The limbo
|
||||
state seems to be an uninstall that did not complete successfully. Both
|
||||
state is seems to be an uninstall that did not complete succesfully. Both
|
||||
of these cause poor network play performance. If you are experiencing
|
||||
severe lag, check the File and Print services. If you get the warning "IPX
|
||||
driver send failure: 04", check the IPX protocol stack. They need to be
|
||||
severe lag, check the File and Print services. If you the warning "IPX
|
||||
driver send failue: 04", check the IPX protocol stack. They need to be
|
||||
either completely installed or removed; the problems only occur when they
|
||||
get into this strange semi-installed state.
|
||||
|
||||
@@ -1591,7 +1591,7 @@ Where <key> is a valid key control and <command> is a valid quake command.
|
||||
|
||||
Example:
|
||||
To bind the j key to the 'jump' command, you would type:
|
||||
bind j +jump
|
||||
bind j +jump
|
||||
and press enter.
|
||||
|
||||
Non-printable keys such as 'page up' and buttons from the mouse/joystick are
|
||||
@@ -1660,7 +1660,7 @@ MOUSE3 (mouse button 3)
|
||||
|
||||
* Can only be bound on the command line or in a .cfg file.
|
||||
|
||||
The ESC key cannot be bound.
|
||||
The ESC key cannot be bound.
|
||||
|
||||
|
||||
==========================================
|
||||
@@ -1768,7 +1768,7 @@ Quake servers on the local network, "+connect 192.12.34.56" or
|
||||
Quake server.
|
||||
|
||||
There is another way to not show the demos; one that also keeps your
|
||||
customizations in a separate directory from the data files in the
|
||||
customizations in a seperate directory from the data files in the
|
||||
Quake distribution.
|
||||
|
||||
Do this in the quake directory (the directory where you installed Quake;
|
||||
@@ -1792,7 +1792,7 @@ that file.
|
||||
Now you can run "q" and quake will start off with the main menu displayed
|
||||
instead of running the demos.
|
||||
|
||||
You can also make a separate subdirectory for this if you'd like. For
|
||||
You can also make a seperate subdirectory for this if you'd like. For
|
||||
example, make a directory named "mine" in the quake directory. Create
|
||||
the "quake.rc" file as specified above in this directory. Use
|
||||
"-game mine" instead of "-game ." in your batch file.
|
||||
@@ -1844,21 +1844,21 @@ tilde ('~') key. Press tilde ('~') again or ESC to exit.
|
||||
|
||||
|
||||
============================================================================
|
||||
== Quake Bug Report - Primary information ==
|
||||
== Quake Bug Report - Primary information ==
|
||||
============================================================================
|
||||
|
||||
Date:
|
||||
Name:
|
||||
Phone number:
|
||||
Date:
|
||||
Name:
|
||||
Phone number:
|
||||
E-mail address: (please include this, we redirect tons of mail)
|
||||
Game Title:
|
||||
Version #:
|
||||
Game Title:
|
||||
Version #:
|
||||
Operating system (i.e., DOS 6.0 or Windows 95):
|
||||
Computer type:
|
||||
Computer type:
|
||||
BIOS date:
|
||||
BIOS version:
|
||||
Processor type:
|
||||
Processor speed:
|
||||
Processor type:
|
||||
Processor speed:
|
||||
Do you program at school/work?
|
||||
Do you provide tech. support at school/work?
|
||||
Please state the problem you encountered:
|
||||
@@ -1873,7 +1873,7 @@ and write it down here:
|
||||
== Quake Bug Report - Secondary information ==
|
||||
============================================================================
|
||||
|
||||
------------------------------ Video Related ------------------------------
|
||||
------------------------------ Video Related ------------------------------
|
||||
|
||||
Video Card Manufacturer:
|
||||
Video Card Model:
|
||||
@@ -1888,7 +1888,7 @@ built into board BIOS, or manufacturer provided TSR)
|
||||
|
||||
------------------------------ Sound Related ------------------------------
|
||||
|
||||
Audio card brand and model:
|
||||
Audio card brand and model:
|
||||
|
||||
If DOS or a DOS box, please run the command "set > set.txt" then
|
||||
attach "set.txt" to the end of the report.
|
||||
@@ -1900,6 +1900,14 @@ What type of network connection was established when the error occurred?
|
||||
If modem, Modem brand and model:
|
||||
|
||||
If network, Network card brand and model:
|
||||
Network protocol/configuration:
|
||||
Network protocol/configuration:
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ Included with Linux Quake are:
|
||||
Installation
|
||||
------------
|
||||
|
||||
Mount the Quake CD as one would usually mount a CDROM, this can be
|
||||
Mount the Quake CD as one would usually mount a CDROM, this can be
|
||||
accomplished by using the command:
|
||||
|
||||
mount /dev/cdrom /mnt
|
||||
@@ -102,24 +102,24 @@ since it was written specifically with supporting GLQuake in mind.
|
||||
lib3dfxgl.so requires that GLIDE be installed.
|
||||
|
||||
3. The binary "glquake.glx" is linked against standard OpenGL libraries.
|
||||
It should run on many different hardware OpenGL implementations under
|
||||
It should run on many different hardward OpenGL implementations under
|
||||
Linux and X11. This binary is an X11 application and must be run under
|
||||
X11. It will work with Mesa 3-D as a standard glX based OpenGL
|
||||
X11. It will work with Mesa 3-D as a standard glX based OpenGL
|
||||
applications. If the Mesa 3-D library is compiled with 3DFX support,
|
||||
you can have Mesa 3-D support 3DFX hardware under X11 by setting the
|
||||
environment variable "MESA_GLX_FX" to "fullscreen" for fullscreen mode
|
||||
and "window" for windowed mode, eg. "export MESA_GLX_FX=fullscreen" for sh
|
||||
enviroment variable "MESA_GLX_FX" to "fullscreen" for fullscreen mode
|
||||
and "window" for windowed mode, eg. "export MESA_GLX_FX=fullscreen" for sh
|
||||
or "setenv MESA_GLX_FX fullscreen" for csh.
|
||||
|
||||
For glquake, you must also have SVGALib or later installed (1.3.0 or later
|
||||
preferred). GLQuake uses SVGALib for mouse and keyboard handling.
|
||||
prefered). GLQuake uses SVGALib for mouse and keyboard handling.
|
||||
|
||||
If you have gpm and/or selection running, you will have to terminate them
|
||||
before running GLQuake since they will not give up the mouse when GLQuake
|
||||
attempts to run. You can kill gpm by typing 'killall gpm' as root.
|
||||
|
||||
You must run GLQuake as root or setuid root since it needs to access things
|
||||
such as sound, keyboard, mouse and the 3DFX video. Future versions may not
|
||||
You must run GLQuake as root or setuid root since it needs to access things
|
||||
such as sound, keyboard, mouse and the 3DFX video. Future versions may not
|
||||
require root permissions.
|
||||
|
||||
Additional notes for X11 Quake
|
||||
@@ -174,3 +174,4 @@ Set mono sound
|
||||
|
||||
-sndstereo
|
||||
Set stereo sound (default if supported)
|
||||
|
||||
@@ -16,7 +16,7 @@ Included with Linux Quake are:
|
||||
Installation
|
||||
------------
|
||||
|
||||
Mount the Quake CD as one would usually mount a CDROM, this can be
|
||||
Mount the Quake CD as one would usually mount a CDROM, this can be
|
||||
accomplished by using the command:
|
||||
|
||||
mount /dev/cdrom /mnt
|
||||
@@ -102,24 +102,24 @@ since it was written specifically with supporting GLQuake in mind.
|
||||
lib3dfxgl.so requires that GLIDE be installed.
|
||||
|
||||
3. The binary "glquake.glx" is linked against standard OpenGL libraries.
|
||||
It should run on many different hardware OpenGL implementations under
|
||||
It should run on many different hardward OpenGL implementations under
|
||||
Linux and X11. This binary is an X11 application and must be run under
|
||||
X11. It will work with Mesa 3-D as a standard glX based OpenGL
|
||||
X11. It will work with Mesa 3-D as a standard glX based OpenGL
|
||||
applications. If the Mesa 3-D library is compiled with 3DFX support,
|
||||
you can have Mesa 3-D support 3DFX hardware under X11 by setting the
|
||||
environment variable "MESA_GLX_FX" to "fullscreen" for fullscreen mode
|
||||
and "window" for windowed mode, eg. "export MESA_GLX_FX=fullscreen" for sh
|
||||
enviroment variable "MESA_GLX_FX" to "fullscreen" for fullscreen mode
|
||||
and "window" for windowed mode, eg. "export MESA_GLX_FX=fullscreen" for sh
|
||||
or "setenv MESA_GLX_FX fullscreen" for csh.
|
||||
|
||||
For glquake, you must also have SVGALib or later installed (1.3.0 or later
|
||||
preferred). GLQuake uses SVGALib for mouse and keyboard handling.
|
||||
prefered). GLQuake uses SVGALib for mouse and keyboard handling.
|
||||
|
||||
If you have gpm and/or selection running, you will have to terminate them
|
||||
before running GLQuake since they will not give up the mouse when GLQuake
|
||||
attempts to run. You can kill gpm by typing 'killall gpm' as root.
|
||||
|
||||
You must run GLQuake as root or setuid root since it needs to access things
|
||||
such as sound, keyboard, mouse and the 3DFX video. Future versions may not
|
||||
You must run GLQuake as root or setuid root since it needs to access things
|
||||
such as sound, keyboard, mouse and the 3DFX video. Future versions may not
|
||||
require root permissions.
|
||||
|
||||
Additional notes for X11 Quake
|
||||
@@ -174,3 +174,4 @@ Set mono sound
|
||||
|
||||
-sndstereo
|
||||
Set stereo sound (default if supported)
|
||||
|
||||
@@ -20,7 +20,7 @@ on 3DFX hardware.
|
||||
Installation
|
||||
------------
|
||||
|
||||
Mount the Quake2 CD as one would usually mount a CDROM, this can be
|
||||
Mount the Quake2 CD as one would usually mount a CDROM, this can be
|
||||
accomplished by using the command:
|
||||
|
||||
mount /dev/cdrom /mnt
|
||||
@@ -35,7 +35,7 @@ As root. Once the CD is mounted, run the setup script on the CD as root.
|
||||
The script will ask some questions about what options you want to install
|
||||
and automatically install the software into /usr/local/games/quake2.
|
||||
|
||||
Make sure you have the appropriate hardware, drivers and libraries installed
|
||||
Make sure you have the appropirate hardware, drivers and libraries installed
|
||||
for the renderer you are going to play on.
|
||||
|
||||
Quake2 for Linux supports the following renderers:
|
||||
@@ -60,14 +60,14 @@ Quake2 for Linux supports the following renderers:
|
||||
Quake2 to grab the mouse, select 'Windowed Mouse' from the video menu,
|
||||
or type '_windowed_mouse 0' at the console. Do the reverse to release it.
|
||||
You can bind keys to grab and release the mouse in the console, like so:
|
||||
bind i "_windowed_mouse 1"
|
||||
bind o "_windowed_mouse 0"
|
||||
bind i "_windowed_mouse 1"
|
||||
bind o "_windowed_mouse 0"
|
||||
Then "i" will grab the mouse and "o" will release it.
|
||||
|
||||
- ref_gl
|
||||
This render can be run with two different OpenGL drivers: Mesa 3-D
|
||||
ontop of Linux GLIDE, or 3DFX's mini-OpenGL Quake driver.
|
||||
For Mesa 3-D, the necessary libMesaGL.so.2.6 is included with this archive.
|
||||
ontop of Linux GLIDE, or 3DFX's mini-OpenGL Quake driver.
|
||||
For Mesa 3-D, the necessary libMesaGL.so.2.6 is included with this archive.
|
||||
You must copy it to /usr/lib or /usr/local/lib and run ldconfig (as root)
|
||||
in order to use it. You can do this as follows:
|
||||
tar cf - lib*GL* | (cd /usr/lib; tar xf -)
|
||||
@@ -89,7 +89,7 @@ Quake2 for Linux supports the following renderers:
|
||||
or in /etc/quake2.conf
|
||||
|
||||
**NOTE: There is a problem on libc5 systems where a vid_restart (causing
|
||||
a reload of the video system) will crash. There doesn't seem to be a
|
||||
a reload of the video system) will crash. There doesn't seem to be a
|
||||
solution to this yet. It looks to be some sort of ld.so dynamic loading
|
||||
interaction with SVGALib and ref_gl.so. A work around is to start in
|
||||
software mode (./quake2 +set vid_ref soft), then use the menu to set your
|
||||
@@ -99,13 +99,13 @@ Quake2 for Linux supports the following renderers:
|
||||
works fine on there.
|
||||
|
||||
- ref_glx
|
||||
ref_glx should run on many different hardware OpenGL implementations under
|
||||
ref_glx should run on many different hardward OpenGL implementations under
|
||||
Linux and X11. This binary is an X11 application and must be run under
|
||||
X11. It will work with Mesa 3-D as a standard glX based OpenGL
|
||||
X11. It will work with Mesa 3-D as a standard glX based OpenGL
|
||||
applications. If the Mesa 3-D library is compiled with 3DFX support,
|
||||
you can have Mesa 3-D support 3DFX hardware under X11 by setting the
|
||||
environment variable "MESA_GLX_FX" to "fullscreen" for fullscreen mode
|
||||
and "window" for windowed mode, eg. "export MESA_GLX_FX=fullscreen" for sh
|
||||
enviroment variable "MESA_GLX_FX" to "fullscreen" for fullscreen mode
|
||||
and "window" for windowed mode, eg. "export MESA_GLX_FX=fullscreen" for sh
|
||||
or "setenv MESA_GLX_FX fullscreen" for csh.
|
||||
|
||||
As with ref_gl, the "gl_driver" cvar indicates the shared library to load
|
||||
@@ -141,7 +141,7 @@ are given up after the renderer is loaded. You can switch renderers on the
|
||||
fly if you run quake2 as root (su or log in as root).
|
||||
|
||||
NOTE: When the quake2 binary is run in dedicated server mode
|
||||
(+set dedicated 1), no special permissions are required and
|
||||
(+set dedicated 1), no special permissions are required and
|
||||
/etc/quake2.conf is not read since no renderer is loaded.
|
||||
|
||||
----
|
||||
@@ -210,8 +210,9 @@ most modern Linux installations now.
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Linux Quake2 is an unsupported product. Usage of this product is bound by
|
||||
Linux Quake2 is an unsupported product. Usage of this product is bound by
|
||||
the legal notice found on the distribution Quake2 CDROM.
|
||||
|
||||
/// Zoid
|
||||
zoid@idsoftware.com
|
||||
|
||||
@@ -71,24 +71,24 @@ since it was written specifically with supporting GLQuake in mind.
|
||||
lib3dfxgl.so requires that GLIDE be installed.
|
||||
|
||||
3. The binary "glquake.glx" is linked against standard OpenGL libraries.
|
||||
It should run on many different hardware OpenGL implementations under
|
||||
It should run on many different hardward OpenGL implementations under
|
||||
Linux and X11. This binary is an X11 application and must be run under
|
||||
X11. It will work with Mesa 3-D as a standard glX based OpenGL
|
||||
X11. It will work with Mesa 3-D as a standard glX based OpenGL
|
||||
applications. If the Mesa 3-D library is compiled with 3DFX support,
|
||||
you can have Mesa 3-D support 3DFX hardware under X11 by setting the
|
||||
environment variable "MESA_GLX_FX" to "fullscreen" for fullscreen mode
|
||||
and "window" for windowed mode, eg. "export MESA_GLX_FX=fullscreen" for sh
|
||||
enviroment variable "MESA_GLX_FX" to "fullscreen" for fullscreen mode
|
||||
and "window" for windowed mode, eg. "export MESA_GLX_FX=fullscreen" for sh
|
||||
or "setenv MESA_GLX_FX fullscreen" for csh.
|
||||
|
||||
For glquake, you must also have SVGALib or later installed (1.3.0 or later
|
||||
preferred). GLQuake uses SVGALib for mouse and keyboard handling.
|
||||
prefered). GLQuake uses SVGALib for mouse and keyboard handling.
|
||||
|
||||
If you have gpm and/or selection running, you will have to terminate them
|
||||
before running GLQuake since they will not give up the mouse when GLQuake
|
||||
attempts to run. You can kill gpm by typing 'killall gpm' as root.
|
||||
|
||||
You must run GLQuake as root or setuid root since it needs to access things
|
||||
such as sound, keyboard, mouse and the 3DFX video. Future versions may not
|
||||
You must run GLQuake as root or setuid root since it needs to access things
|
||||
such as sound, keyboard, mouse and the 3DFX video. Future versions may not
|
||||
require root permissions.
|
||||
|
||||
Additional notes for X11 Quake
|
||||
|
||||
@@ -60,7 +60,7 @@ Installation
|
||||
------------
|
||||
|
||||
Boot DOS (I know, but you need it to run the Quake install program) and
|
||||
install Quake from your Quake CD to a DOS partition.
|
||||
install Quake from your Quake CD to a DOS parition.
|
||||
|
||||
Boot Linux and make a directory for Quake. Copy everything from the DOS Quake
|
||||
directory into it. i.e.:
|
||||
@@ -104,3 +104,4 @@ Dave Taylor <ddt@crack.com> for basic Linux support.
|
||||
id Software for Quake and making me port it. :)
|
||||
|
||||
Lots of people on #linux, #quake for testing.
|
||||
|
||||
@@ -3,7 +3,7 @@ Linux Glquake v0.98, Quake v1.09 release notes
|
||||
Requirements
|
||||
------------
|
||||
|
||||
For 3DFX based hardware, you must download and install Linux GLIDE from
|
||||
For 3DFX based hardware, you must download and install Linux GLIDE from
|
||||
http://glide.xxedgexx.com/3DfxRPMS.html and install as per the
|
||||
instructions.
|
||||
|
||||
@@ -24,12 +24,12 @@ since it was written specifically with supporting GLQuake in mind.
|
||||
lib3dfxgl.so requires that GLIDE be installed.
|
||||
|
||||
3. The binary "glquake.glx" is linked against standard OpenGL libraries.
|
||||
It should run on many different hardware OpenGL implementations under
|
||||
It should run on many different hardward OpenGL implementations under
|
||||
Linux and X11. This binary is an X11 application and must be run under
|
||||
X11. It will work with Mesa 3-D as a standard glX based OpenGL
|
||||
X11. It will work with Mesa 3-D as a standard glX based OpenGL
|
||||
applications. If the Mesa 3-D library is compiled with 3DFX support,
|
||||
you can have Mesa 3-D support 3DFX hardware under X11 by setting the
|
||||
environment variable "MESA_GLX_FX" to "fullscreen" for fullscreen mode
|
||||
enviroment variable "MESA_GLX_FX" to "fullscreen" for fullscreen mode
|
||||
and "window" for windowed mode.
|
||||
|
||||
You must also have SVGALib 1.3.0 or later installed. GLQuake uses SVGALib
|
||||
@@ -39,20 +39,20 @@ If you have gpm and/or selection running, you will have to terminate them
|
||||
before running GLQuake since they will not give up the mouse when GLQuake
|
||||
attempts to run. You can kill gpm by typing 'killall gpm' as root.
|
||||
|
||||
You must run GLQuake as root or setuid root since it needs to access things
|
||||
such as sound, keyboard, mouse and the 3DFX video. Future versions may not
|
||||
You must run GLQuake as root or setuid root since it needs to access things
|
||||
such as sound, keyboard, mouse and the 3DFX video. Future versions may not
|
||||
require root permissions.
|
||||
|
||||
resolution options
|
||||
------------------
|
||||
glquake -width 512 -height 384
|
||||
Tries to run glquake at the specified resolution.
|
||||
Tries to run glquake at the specified resolution.
|
||||
Only highend VooDoo cards support such high resolutions (most
|
||||
cards on the market right now do not). Another popular and supported mode
|
||||
is 512x384 (-width 512 -height 384) which can offer a faster speed than
|
||||
the default 640x480.
|
||||
|
||||
You can also specify the resolution of the console independent of the screen
|
||||
You can also specify the resolution of the console independant of the screen
|
||||
resolution.
|
||||
|
||||
glquake -conwidth 320
|
||||
@@ -61,45 +61,45 @@ automatically determined by the default 4:3 aspect ratio, you can also
|
||||
specify the height directly with -conheight).
|
||||
|
||||
In higher resolution modes such as 800x600 and 1024x768, glquake will default
|
||||
to a 640x480 console, since the font becomes small enough at higher
|
||||
to a 640x480 console, since the font becomes small enough at higher
|
||||
resolutions to become unreadable. If do you wish to have a higher resolution
|
||||
console and status bar, specify it as well, such as:
|
||||
glquake -width 800 -height 600 -conwidth 800
|
||||
|
||||
texture options
|
||||
---------------
|
||||
The amount of textures used in the game can have a large impact on performance.
|
||||
There are several options that let you trade off visual quality for better
|
||||
The amount of textures used in the game can have a large impact on performance.
|
||||
There are several options that let you trade off visual quality for better
|
||||
performance.
|
||||
|
||||
There is no way to flush already loaded textures, so it is best to change
|
||||
these options on the command line, or they will only take effect on some of
|
||||
There is no way to flush already loaded textures, so it is best to change
|
||||
these options on the command line, or they will only take effect on some of
|
||||
the textures when you change levels.
|
||||
|
||||
OpenGL only allows textures to repeat on power of two boundaries (32, 64,
|
||||
128, etc), but software quake had a number of textures that repeated at 24
|
||||
or 96 pixel boundaries. These need to be either stretched out to the next
|
||||
higher size, or shrunk down to the next lower. By default, they are filtered
|
||||
down to the smaller size, but you can cause it to use the larger size if you
|
||||
really want by using:
|
||||
OpenGL only allows textures to repeat on power of two boundaries (32, 64,
|
||||
128, etc), but software quake had a number of textures that repeated at 24
|
||||
or 96 pixel boundaries. These need to be either stretched out to the next
|
||||
higher size, or shrunk down to the next lower. By default, they are filtered
|
||||
down to the smaller size, but you can cause it to use the larger size if you
|
||||
really want by using:
|
||||
|
||||
glquake +gl_round_down 0
|
||||
This will generally run well on a normal 4 MB 3dfx card, but for other cards
|
||||
that have either worse texture management or slower texture swapping speeds,
|
||||
there are some additional settings that can drastically lower the amount of
|
||||
This will generally run well on a normal 4 MB 3dfx card, but for other cards
|
||||
that have either worse texture management or slower texture swapping speeds,
|
||||
there are some additional settings that can drastically lower the amount of
|
||||
textures to be managed.
|
||||
|
||||
glquake +gl_picmip 1
|
||||
This causes all textures to have one half the dimensions they otherwise would.
|
||||
This makes them blurry, but very small. You can set this to 2 to make the
|
||||
This causes all textures to have one half the dimensions they otherwise would.
|
||||
This makes them blurry, but very small. You can set this to 2 to make the
|
||||
textures one quarter the resolution on each axis for REALLY blurry textures.
|
||||
|
||||
glquake +gl_playermip 1
|
||||
This is similar to picmip, but is only used for other players in deathmatch.
|
||||
Each player in a deathmatch requires an individual skin texture, so this can
|
||||
be a serious problem for texture management. It wouldn't be unreasonable to
|
||||
set this to 2 or even 3 if you are playing competatively (and don't care if
|
||||
the other guys have smudged skins). If you change this during the game, it
|
||||
This is similar to picmip, but is only used for other players in deathmatch.
|
||||
Each player in a deathmatch requires an individual skin texture, so this can
|
||||
be a serious problem for texture management. It wouldn't be unreasonable to
|
||||
set this to 2 or even 3 if you are playing competatively (and don't care if
|
||||
the other guys have smudged skins). If you change this during the game, it
|
||||
will take effect as soon as a player changes their skin colors.
|
||||
|
||||
run time options
|
||||
@@ -107,55 +107,56 @@ run time options
|
||||
At the console, you can set these values to effect drawing.
|
||||
|
||||
gl_texturemode GL_NEAREST
|
||||
Sets texture mapping to point sampled, which may be faster on some GL systems
|
||||
Sets texture mapping to point sampled, which may be faster on some GL systems
|
||||
(not on 3dfx).
|
||||
|
||||
gl_texturemode GL_LINEAR_MIPMAP
|
||||
This is the default texture mode.
|
||||
|
||||
gl_texturemode GL_LINEAR_MIPMAP_LINEAR
|
||||
This is the highest quality texture mapping (trilinear), but only very high
|
||||
end hardware (intergraph intense 3D / realizm) supports it. Not that big of
|
||||
This is the highest quality texture mapping (trilinear), but only very high
|
||||
end hardware (intergraph intense 3D / realizm) supports it. Not that big of
|
||||
a deal, actually.
|
||||
|
||||
gl_finish 0
|
||||
This causes the game to not issue a glFinish() call each frame, which may make
|
||||
some hardware run faster. If this is cleared, the 3dfx will back up a number
|
||||
This causes the game to not issue a glFinish() call each frame, which may make
|
||||
some hardware run faster. If this is cleared, the 3dfx will back up a number
|
||||
of frames and not be very playable.
|
||||
|
||||
gl_flashblend 0
|
||||
By default, glquake just draws a shaded ball around objects that are emitting
|
||||
light. Clearing this variable will cause it to properly relight the world
|
||||
By default, glquake just draws a shaded ball around objects that are emiting
|
||||
light. Clearing this variable will cause it to properly relight the world
|
||||
like normal quake, but it can be a significant speed hit on some systems.
|
||||
|
||||
gl_ztrick 0
|
||||
Glquake uses a buffering method that avoids clearing the Z buffer, but some
|
||||
hardware platforms don't like it. If the status bar and console are flashing
|
||||
Glquake uses a buffering method that avoids clearing the Z buffer, but some
|
||||
hardware platforms don't like it. If the status bar and console are flashing
|
||||
every other frame, clear this variable.
|
||||
|
||||
gl_keeptjunctions 0
|
||||
If you clear this, glquake will remove colinear vertexes when it reloads the
|
||||
level. This can give a few percent speedup, but it can leave a couple stray
|
||||
If you clear this, glquake will remove colinear vertexes when it reloads the
|
||||
level. This can give a few percent speedup, but it can leave a couple stray
|
||||
blinking pixels on the screen.
|
||||
|
||||
novelty features
|
||||
----------------
|
||||
These are some rendering tricks that were easy to do in glquake. They aren't
|
||||
These are some rendering tricks that were easy to do in glquake. They aren't
|
||||
very robust, but they are pretty cool to look at.
|
||||
|
||||
r_shadows 1
|
||||
This causes every object to cast a shadow.
|
||||
|
||||
r_wateralpha 0.7
|
||||
This sets the opacity of water textures, so you can see through it in properly
|
||||
processed maps. 0.3 is very faint, almost like fog. 1 is completely solid
|
||||
(the default). Unfortunately, the standard quake maps don't contain any
|
||||
visibility information for seeing past water surfaces, so you can't just play
|
||||
quake with this turned on. If you just want to see what it looks like, you
|
||||
can set "r_novis 1", but that will make things go very slow. When I get a
|
||||
chance, I will probably release some maps that have been processed properly
|
||||
This sets the opacity of water textures, so you can see through it in properly
|
||||
processed maps. 0.3 is very faint, almost like fog. 1 is completely solid
|
||||
(the default). Unfortunately, the standard quake maps don't contain any
|
||||
visibility information for seeing past water surfaces, so you can't just play
|
||||
quake with this turned on. If you just want to see what it looks like, you
|
||||
can set "r_novis 1", but that will make things go very slow. When I get a
|
||||
chance, I will probably release some maps that have been processed properly
|
||||
for this.
|
||||
|
||||
r_mirroralpha 0.3
|
||||
This changes one particular texture (the stained glass texture in the EASY
|
||||
This changes one particular texture (the stained glass texture in the EASY
|
||||
start hall) into a mirror. The value is the opacity of the mirror surface.
|
||||
|
||||
@@ -71,7 +71,7 @@ Installation
|
||||
------------
|
||||
|
||||
Boot DOS (I know, but you need it to run the Quake install program) and
|
||||
install Quake from your Quake CD to a DOS partition.
|
||||
install Quake from your Quake CD to a DOS parition.
|
||||
|
||||
Boot Linux and make a directory for Quake. Copy everything from the DOS Quake
|
||||
directory into it. i.e.:
|
||||
@@ -124,3 +124,4 @@ Dave Taylor <ddt@crack.com> for basic Linux support.
|
||||
id Software for Quake and making me port it. :)
|
||||
|
||||
Lots of people on #linux, #quake for testing.
|
||||
|
||||
@@ -8,7 +8,7 @@ of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
@@ -90,8 +90,8 @@ void GL_Bind (int texnum)
|
||||
|
||||
scrap allocation
|
||||
|
||||
Allocate all the little status bar objects into a single texture
|
||||
to support hardware / drivers
|
||||
Allocate all the little status bar obejcts into a single texture
|
||||
to crutch up stupid hardware / drivers
|
||||
|
||||
=============================================================================
|
||||
*/
|
||||
@@ -248,7 +248,7 @@ qpic_t *Draw_CachePic (char *path)
|
||||
//
|
||||
// load the pic from disk
|
||||
//
|
||||
dat = (qpic_t *)COM_LoadTempFile (path);
|
||||
dat = (qpic_t *)COM_LoadTempFile (path);
|
||||
if (!dat)
|
||||
Sys_Error ("Draw_CachePic: failed to load %s", path);
|
||||
SwapPic (dat);
|
||||
@@ -403,7 +403,7 @@ void Draw_Init (void)
|
||||
|
||||
start = Hunk_LowMark();
|
||||
|
||||
cb = (qpic_t *)COM_LoadTempFile ("gfx/conback.lmp");
|
||||
cb = (qpic_t *)COM_LoadTempFile ("gfx/conback.lmp");
|
||||
if (!cb)
|
||||
Sys_Error ("Couldn't load gfx/conback.lmp");
|
||||
SwapPic (cb);
|
||||
@@ -425,7 +425,7 @@ void Draw_Init (void)
|
||||
|
||||
// scale console to vid size
|
||||
dest = ncdata = Hunk_AllocName(vid.conwidth * vid.conheight, "conback");
|
||||
|
||||
|
||||
for (y=0 ; y<vid.conheight ; y++, dest += vid.conwidth)
|
||||
{
|
||||
src = cb->data + cb->width * (y*cb->height/vid.conheight);
|
||||
@@ -499,7 +499,7 @@ void Draw_Character (int x, int y, int num)
|
||||
byte *dest;
|
||||
byte *source;
|
||||
unsigned short *pusdest;
|
||||
int drawline;
|
||||
int drawline;
|
||||
int row, col;
|
||||
float frow, fcol, size;
|
||||
|
||||
@@ -507,7 +507,7 @@ void Draw_Character (int x, int y, int num)
|
||||
return; // space
|
||||
|
||||
num &= 255;
|
||||
|
||||
|
||||
if (y <= -8)
|
||||
return; // totally off screen
|
||||
|
||||
@@ -643,7 +643,7 @@ void Draw_TransPic (int x, int y, qpic_t *pic)
|
||||
{
|
||||
Sys_Error ("Draw_TransPic: bad coordinates");
|
||||
}
|
||||
|
||||
|
||||
Draw_Pic (x, y, pic);
|
||||
}
|
||||
|
||||
@@ -1086,7 +1086,7 @@ done: ;
|
||||
}
|
||||
}
|
||||
|
||||
void GL_Upload8_EXT (byte *data, int width, int height, qboolean mipmap, qboolean alpha)
|
||||
void GL_Upload8_EXT (byte *data, int width, int height, qboolean mipmap, qboolean alpha)
|
||||
{
|
||||
int i, s;
|
||||
qboolean noalpha;
|
||||
@@ -1237,7 +1237,7 @@ int GL_LoadTexture (char *identifier, int width, int height, byte *data, qboolea
|
||||
int i, p, s;
|
||||
gltexture_t *glt;
|
||||
|
||||
// see if the texture is already present
|
||||
// see if the texture is allready present
|
||||
if (identifier[0])
|
||||
{
|
||||
for (i=0, glt=gltextures ; i<numgltextures ; i++, glt++)
|
||||
@@ -1284,12 +1284,12 @@ int GL_LoadPicTexture (qpic_t *pic)
|
||||
|
||||
static GLenum oldtarget = TEXTURE0_SGIS;
|
||||
|
||||
void GL_SelectTexture (GLenum target)
|
||||
void GL_SelectTexture (GLenum target)
|
||||
{
|
||||
if (!gl_mtexable)
|
||||
return;
|
||||
qglSelectTextureSGIS(target);
|
||||
if (target == oldtarget)
|
||||
if (target == oldtarget)
|
||||
return;
|
||||
cnttextures[oldtarget-TEXTURE0_SGIS] = currenttexture;
|
||||
currenttexture = cnttextures[target-TEXTURE0_SGIS];
|
||||
|
||||
@@ -8,7 +8,7 @@ of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
@@ -61,13 +61,13 @@ Caches the data if needed
|
||||
void *Mod_Extradata (model_t *mod)
|
||||
{
|
||||
void *r;
|
||||
|
||||
|
||||
r = Cache_Check (&mod->cache);
|
||||
if (r)
|
||||
return r;
|
||||
|
||||
Mod_LoadModel (mod, true);
|
||||
|
||||
|
||||
if (!mod->cache.data)
|
||||
Sys_Error ("Mod_Extradata: caching failed");
|
||||
return mod->cache.data;
|
||||
@@ -83,7 +83,7 @@ mleaf_t *Mod_PointInLeaf (vec3_t p, model_t *model)
|
||||
mnode_t *node;
|
||||
float d;
|
||||
mplane_t *plane;
|
||||
|
||||
|
||||
if (!model || !model->nodes)
|
||||
Sys_Error ("Mod_PointInLeaf: bad model");
|
||||
|
||||
@@ -99,7 +99,7 @@ mleaf_t *Mod_PointInLeaf (vec3_t p, model_t *model)
|
||||
else
|
||||
node = node->children[1];
|
||||
}
|
||||
|
||||
|
||||
return NULL; // never reached
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ byte *Mod_DecompressVis (byte *in, model_t *model)
|
||||
byte *out;
|
||||
int row;
|
||||
|
||||
row = (model->numleafs+7)>>3;
|
||||
row = (model->numleafs+7)>>3;
|
||||
out = decompressed;
|
||||
|
||||
#if 0
|
||||
@@ -129,7 +129,7 @@ byte *Mod_DecompressVis (byte *in, model_t *model)
|
||||
*out++ = 0xff;
|
||||
row--;
|
||||
}
|
||||
return decompressed;
|
||||
return decompressed;
|
||||
}
|
||||
|
||||
do
|
||||
@@ -139,7 +139,7 @@ byte *Mod_DecompressVis (byte *in, model_t *model)
|
||||
*out++ = *in++;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
c = in[1];
|
||||
in += 2;
|
||||
while (c)
|
||||
@@ -149,7 +149,7 @@ byte *Mod_DecompressVis (byte *in, model_t *model)
|
||||
}
|
||||
} while (out - decompressed < row);
|
||||
#endif
|
||||
|
||||
|
||||
return decompressed;
|
||||
}
|
||||
|
||||
@@ -169,7 +169,7 @@ void Mod_ClearAll (void)
|
||||
{
|
||||
int i;
|
||||
model_t *mod;
|
||||
|
||||
|
||||
for (i=0 , mod=mod_known ; i<mod_numknown ; i++, mod++)
|
||||
if (mod->type != mod_alias)
|
||||
mod->needload = true;
|
||||
@@ -185,17 +185,17 @@ model_t *Mod_FindName (char *name)
|
||||
{
|
||||
int i;
|
||||
model_t *mod;
|
||||
|
||||
|
||||
if (!name[0])
|
||||
Sys_Error ("Mod_ForName: NULL name");
|
||||
|
||||
|
||||
//
|
||||
// search the currently loaded models
|
||||
//
|
||||
for (i=0 , mod=mod_known ; i<mod_numknown ; i++, mod++)
|
||||
if (!strcmp (mod->name, name) )
|
||||
break;
|
||||
|
||||
|
||||
if (i == mod_numknown)
|
||||
{
|
||||
if (mod_numknown == MAX_MOD_KNOWN)
|
||||
@@ -217,9 +217,9 @@ Mod_TouchModel
|
||||
void Mod_TouchModel (char *name)
|
||||
{
|
||||
model_t *mod;
|
||||
|
||||
|
||||
mod = Mod_FindName (name);
|
||||
|
||||
|
||||
if (!mod->needload)
|
||||
{
|
||||
if (mod->type == mod_alias)
|
||||
@@ -257,9 +257,9 @@ model_t *Mod_LoadModel (model_t *mod, qboolean crash)
|
||||
//
|
||||
if (!crash)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// load the file
|
||||
//
|
||||
@@ -270,31 +270,31 @@ model_t *Mod_LoadModel (model_t *mod, qboolean crash)
|
||||
Sys_Error ("Mod_NumForName: %s not found", mod->name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// allocate a new model
|
||||
//
|
||||
COM_FileBase (mod->name, loadname);
|
||||
|
||||
|
||||
loadmodel = mod;
|
||||
|
||||
//
|
||||
// fill it in
|
||||
//
|
||||
|
||||
// call the appropriate loader
|
||||
// call the apropriate loader
|
||||
mod->needload = false;
|
||||
|
||||
|
||||
switch (LittleLong(*(unsigned *)buf))
|
||||
{
|
||||
case IDPOLYHEADER:
|
||||
Mod_LoadAliasModel (mod, buf);
|
||||
break;
|
||||
|
||||
|
||||
case IDSPRITEHEADER:
|
||||
Mod_LoadSpriteModel (mod, buf);
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
Mod_LoadBrushModel (mod, buf);
|
||||
break;
|
||||
@@ -313,9 +313,9 @@ Loads in a model for the given name
|
||||
model_t *Mod_ForName (char *name, qboolean crash)
|
||||
{
|
||||
model_t *mod;
|
||||
|
||||
|
||||
mod = Mod_FindName (name);
|
||||
|
||||
|
||||
return Mod_LoadModel (mod, crash);
|
||||
}
|
||||
|
||||
@@ -351,9 +351,9 @@ void Mod_LoadTextures (lump_t *l)
|
||||
return;
|
||||
}
|
||||
m = (dmiptexlump_t *)(mod_base + l->fileofs);
|
||||
|
||||
|
||||
m->nummiptex = LittleLong (m->nummiptex);
|
||||
|
||||
|
||||
loadmodel->numtextures = m->nummiptex;
|
||||
loadmodel->textures = Hunk_AllocName (m->nummiptex * sizeof(*loadmodel->textures) , loadname);
|
||||
|
||||
@@ -367,7 +367,7 @@ void Mod_LoadTextures (lump_t *l)
|
||||
mt->height = LittleLong (mt->height);
|
||||
for (j=0 ; j<MIPLEVELS ; j++)
|
||||
mt->offsets[j] = LittleLong (mt->offsets[j]);
|
||||
|
||||
|
||||
if ( (mt->width & 15) || (mt->height & 15) )
|
||||
Sys_Error ("Texture %s is not 16 aligned", mt->name);
|
||||
pixels = mt->width*mt->height/64*85;
|
||||
@@ -381,9 +381,9 @@ void Mod_LoadTextures (lump_t *l)
|
||||
tx->offsets[j] = mt->offsets[j] + sizeof(texture_t) - sizeof(miptex_t);
|
||||
// the pixels immediately follow the structures
|
||||
memcpy ( tx+1, mt+1, pixels);
|
||||
|
||||
|
||||
|
||||
if (!Q_strncmp(mt->name,"sky",3))
|
||||
if (!Q_strncmp(mt->name,"sky",3))
|
||||
R_InitSky (tx);
|
||||
else
|
||||
{
|
||||
@@ -402,7 +402,7 @@ void Mod_LoadTextures (lump_t *l)
|
||||
if (!tx || tx->name[0] != '+')
|
||||
continue;
|
||||
if (tx->anim_next)
|
||||
continue; // already sequenced
|
||||
continue; // allready sequenced
|
||||
|
||||
// find the number of frames in the animation
|
||||
memset (anims, 0, sizeof(anims));
|
||||
@@ -457,7 +457,7 @@ void Mod_LoadTextures (lump_t *l)
|
||||
else
|
||||
Sys_Error ("Bad animating texture %s", tx->name);
|
||||
}
|
||||
|
||||
|
||||
#define ANIM_CYCLE 2
|
||||
// link them all together
|
||||
for (j=0 ; j<max ; j++)
|
||||
@@ -499,7 +499,7 @@ void Mod_LoadLighting (lump_t *l)
|
||||
loadmodel->lightdata = NULL;
|
||||
return;
|
||||
}
|
||||
loadmodel->lightdata = Hunk_AllocName ( l->filelen, loadname);
|
||||
loadmodel->lightdata = Hunk_AllocName ( l->filelen, loadname);
|
||||
memcpy (loadmodel->lightdata, mod_base + l->fileofs, l->filelen);
|
||||
}
|
||||
|
||||
@@ -516,7 +516,7 @@ void Mod_LoadVisibility (lump_t *l)
|
||||
loadmodel->visdata = NULL;
|
||||
return;
|
||||
}
|
||||
loadmodel->visdata = Hunk_AllocName ( l->filelen, loadname);
|
||||
loadmodel->visdata = Hunk_AllocName ( l->filelen, loadname);
|
||||
memcpy (loadmodel->visdata, mod_base + l->fileofs, l->filelen);
|
||||
}
|
||||
|
||||
@@ -533,7 +533,7 @@ void Mod_LoadEntities (lump_t *l)
|
||||
loadmodel->entities = NULL;
|
||||
return;
|
||||
}
|
||||
loadmodel->entities = Hunk_AllocName ( l->filelen, loadname);
|
||||
loadmodel->entities = Hunk_AllocName ( l->filelen, loadname);
|
||||
memcpy (loadmodel->entities, mod_base + l->fileofs, l->filelen);
|
||||
}
|
||||
|
||||
@@ -553,7 +553,7 @@ void Mod_LoadVertexes (lump_t *l)
|
||||
if (l->filelen % sizeof(*in))
|
||||
Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
|
||||
count = l->filelen / sizeof(*in);
|
||||
out = Hunk_AllocName ( count*sizeof(*out), loadname);
|
||||
out = Hunk_AllocName ( count*sizeof(*out), loadname);
|
||||
|
||||
loadmodel->vertexes = out;
|
||||
loadmodel->numvertexes = count;
|
||||
@@ -581,7 +581,7 @@ void Mod_LoadSubmodels (lump_t *l)
|
||||
if (l->filelen % sizeof(*in))
|
||||
Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
|
||||
count = l->filelen / sizeof(*in);
|
||||
out = Hunk_AllocName ( count*sizeof(*out), loadname);
|
||||
out = Hunk_AllocName ( count*sizeof(*out), loadname);
|
||||
|
||||
loadmodel->submodels = out;
|
||||
loadmodel->numsubmodels = count;
|
||||
@@ -617,7 +617,7 @@ void Mod_LoadEdges (lump_t *l)
|
||||
if (l->filelen % sizeof(*in))
|
||||
Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
|
||||
count = l->filelen / sizeof(*in);
|
||||
out = Hunk_AllocName ( (count + 1) * sizeof(*out), loadname);
|
||||
out = Hunk_AllocName ( (count + 1) * sizeof(*out), loadname);
|
||||
|
||||
loadmodel->edges = out;
|
||||
loadmodel->numedges = count;
|
||||
@@ -646,7 +646,7 @@ void Mod_LoadTexinfo (lump_t *l)
|
||||
if (l->filelen % sizeof(*in))
|
||||
Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
|
||||
count = l->filelen / sizeof(*in);
|
||||
out = Hunk_AllocName ( count*sizeof(*out), loadname);
|
||||
out = Hunk_AllocName ( count*sizeof(*out), loadname);
|
||||
|
||||
loadmodel->texinfo = out;
|
||||
loadmodel->numtexinfo = count;
|
||||
@@ -675,7 +675,7 @@ void Mod_LoadTexinfo (lump_t *l)
|
||||
|
||||
miptex = LittleLong (in->miptex);
|
||||
out->flags = LittleLong (in->flags);
|
||||
|
||||
|
||||
if (!loadmodel->textures)
|
||||
{
|
||||
out->texture = r_notexture_mip; // checkerboard texture
|
||||
@@ -714,7 +714,7 @@ void CalcSurfaceExtents (msurface_t *s)
|
||||
maxs[0] = maxs[1] = -99999;
|
||||
|
||||
tex = s->texinfo;
|
||||
|
||||
|
||||
for (i=0 ; i<s->numedges ; i++)
|
||||
{
|
||||
e = loadmodel->surfedges[s->firstedge+i];
|
||||
@@ -722,10 +722,10 @@ void CalcSurfaceExtents (msurface_t *s)
|
||||
v = &loadmodel->vertexes[loadmodel->edges[e].v[0]];
|
||||
else
|
||||
v = &loadmodel->vertexes[loadmodel->edges[-e].v[1]];
|
||||
|
||||
|
||||
for (j=0 ; j<2 ; j++)
|
||||
{
|
||||
val = v->position[0] * tex->vecs[j][0] +
|
||||
val = v->position[0] * tex->vecs[j][0] +
|
||||
v->position[1] * tex->vecs[j][1] +
|
||||
v->position[2] * tex->vecs[j][2] +
|
||||
tex->vecs[j][3];
|
||||
@@ -737,7 +737,7 @@ void CalcSurfaceExtents (msurface_t *s)
|
||||
}
|
||||
|
||||
for (i=0 ; i<2 ; i++)
|
||||
{
|
||||
{
|
||||
bmins[i] = floor(mins[i]/16);
|
||||
bmaxs[i] = ceil(maxs[i]/16);
|
||||
|
||||
@@ -765,7 +765,7 @@ void Mod_LoadFaces (lump_t *l)
|
||||
if (l->filelen % sizeof(*in))
|
||||
Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
|
||||
count = l->filelen / sizeof(*in);
|
||||
out = Hunk_AllocName ( count*sizeof(*out), loadname);
|
||||
out = Hunk_AllocName ( count*sizeof(*out), loadname);
|
||||
|
||||
loadmodel->surfaces = out;
|
||||
loadmodel->numsurfaces = count;
|
||||
@@ -773,20 +773,20 @@ void Mod_LoadFaces (lump_t *l)
|
||||
for ( surfnum=0 ; surfnum<count ; surfnum++, in++, out++)
|
||||
{
|
||||
out->firstedge = LittleLong(in->firstedge);
|
||||
out->numedges = LittleShort(in->numedges);
|
||||
out->numedges = LittleShort(in->numedges);
|
||||
out->flags = 0;
|
||||
|
||||
planenum = LittleShort(in->planenum);
|
||||
side = LittleShort(in->side);
|
||||
if (side)
|
||||
out->flags |= SURF_PLANEBACK;
|
||||
out->flags |= SURF_PLANEBACK;
|
||||
|
||||
out->plane = loadmodel->planes + planenum;
|
||||
|
||||
out->texinfo = loadmodel->texinfo + LittleShort (in->texinfo);
|
||||
|
||||
CalcSurfaceExtents (out);
|
||||
|
||||
|
||||
// lighting info
|
||||
|
||||
for (i=0 ; i<MAXLIGHTMAPS ; i++)
|
||||
@@ -796,9 +796,9 @@ void Mod_LoadFaces (lump_t *l)
|
||||
out->samples = NULL;
|
||||
else
|
||||
out->samples = loadmodel->lightdata + i;
|
||||
|
||||
|
||||
// set the drawing flags flag
|
||||
|
||||
|
||||
if (!Q_strncmp(out->texinfo->texture->name,"sky",3)) // sky
|
||||
{
|
||||
out->flags |= (SURF_DRAWSKY | SURF_DRAWTILED);
|
||||
@@ -807,7 +807,7 @@ void Mod_LoadFaces (lump_t *l)
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (!Q_strncmp(out->texinfo->texture->name,"*",1)) // turbulent
|
||||
{
|
||||
out->flags |= (SURF_DRAWTURB | SURF_DRAWTILED);
|
||||
@@ -853,7 +853,7 @@ void Mod_LoadNodes (lump_t *l)
|
||||
if (l->filelen % sizeof(*in))
|
||||
Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
|
||||
count = l->filelen / sizeof(*in);
|
||||
out = Hunk_AllocName ( count*sizeof(*out), loadname);
|
||||
out = Hunk_AllocName ( count*sizeof(*out), loadname);
|
||||
|
||||
loadmodel->nodes = out;
|
||||
loadmodel->numnodes = count;
|
||||
@@ -865,13 +865,13 @@ void Mod_LoadNodes (lump_t *l)
|
||||
out->minmaxs[j] = LittleShort (in->mins[j]);
|
||||
out->minmaxs[3+j] = LittleShort (in->maxs[j]);
|
||||
}
|
||||
|
||||
|
||||
p = LittleLong(in->planenum);
|
||||
out->plane = loadmodel->planes + p;
|
||||
|
||||
out->firstsurface = LittleShort (in->firstface);
|
||||
out->numsurfaces = LittleShort (in->numfaces);
|
||||
|
||||
|
||||
for (j=0 ; j<2 ; j++)
|
||||
{
|
||||
p = LittleShort (in->children[j]);
|
||||
@@ -881,7 +881,7 @@ void Mod_LoadNodes (lump_t *l)
|
||||
out->children[j] = (mnode_t *)(loadmodel->leafs + (-1 - p));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Mod_SetParent (loadmodel->nodes, NULL); // sets nodes and leafs
|
||||
}
|
||||
|
||||
@@ -900,7 +900,7 @@ void Mod_LoadLeafs (lump_t *l)
|
||||
if (l->filelen % sizeof(*in))
|
||||
Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
|
||||
count = l->filelen / sizeof(*in);
|
||||
out = Hunk_AllocName ( count*sizeof(*out), loadname);
|
||||
out = Hunk_AllocName ( count*sizeof(*out), loadname);
|
||||
|
||||
loadmodel->leafs = out;
|
||||
loadmodel->numleafs = count;
|
||||
@@ -919,14 +919,14 @@ void Mod_LoadLeafs (lump_t *l)
|
||||
out->firstmarksurface = loadmodel->marksurfaces +
|
||||
LittleShort(in->firstmarksurface);
|
||||
out->nummarksurfaces = LittleShort(in->nummarksurfaces);
|
||||
|
||||
|
||||
p = LittleLong(in->visofs);
|
||||
if (p == -1)
|
||||
out->compressed_vis = NULL;
|
||||
else
|
||||
out->compressed_vis = loadmodel->visdata + p;
|
||||
out->efrags = NULL;
|
||||
|
||||
|
||||
for (j=0 ; j<4 ; j++)
|
||||
out->ambient_sound_level[j] = in->ambient_level[j];
|
||||
|
||||
@@ -936,7 +936,7 @@ void Mod_LoadLeafs (lump_t *l)
|
||||
for (j=0 ; j<out->nummarksurfaces ; j++)
|
||||
out->firstmarksurface[j]->flags |= SURF_UNDERWATER;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -954,7 +954,7 @@ void Mod_LoadClipnodes (lump_t *l)
|
||||
if (l->filelen % sizeof(*in))
|
||||
Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
|
||||
count = l->filelen / sizeof(*in);
|
||||
out = Hunk_AllocName ( count*sizeof(*out), loadname);
|
||||
out = Hunk_AllocName ( count*sizeof(*out), loadname);
|
||||
|
||||
loadmodel->clipnodes = out;
|
||||
loadmodel->numclipnodes = count;
|
||||
@@ -995,7 +995,7 @@ void Mod_LoadClipnodes (lump_t *l)
|
||||
=================
|
||||
Mod_MakeHull0
|
||||
|
||||
Duplicate the drawing hull structure as a clipping hull
|
||||
Deplicate the drawing hull structure as a clipping hull
|
||||
=================
|
||||
*/
|
||||
void Mod_MakeHull0 (void)
|
||||
@@ -1004,12 +1004,12 @@ void Mod_MakeHull0 (void)
|
||||
dclipnode_t *out;
|
||||
int i, j, count;
|
||||
hull_t *hull;
|
||||
|
||||
hull = &loadmodel->hulls[0];
|
||||
|
||||
|
||||
hull = &loadmodel->hulls[0];
|
||||
|
||||
in = loadmodel->nodes;
|
||||
count = loadmodel->numnodes;
|
||||
out = Hunk_AllocName ( count*sizeof(*out), loadname);
|
||||
out = Hunk_AllocName ( count*sizeof(*out), loadname);
|
||||
|
||||
hull->clipnodes = out;
|
||||
hull->firstclipnode = 0;
|
||||
@@ -1036,16 +1036,16 @@ Mod_LoadMarksurfaces
|
||||
=================
|
||||
*/
|
||||
void Mod_LoadMarksurfaces (lump_t *l)
|
||||
{
|
||||
{
|
||||
int i, j, count;
|
||||
short *in;
|
||||
msurface_t **out;
|
||||
|
||||
|
||||
in = (void *)(mod_base + l->fileofs);
|
||||
if (l->filelen % sizeof(*in))
|
||||
Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
|
||||
count = l->filelen / sizeof(*in);
|
||||
out = Hunk_AllocName ( count*sizeof(*out), loadname);
|
||||
out = Hunk_AllocName ( count*sizeof(*out), loadname);
|
||||
|
||||
loadmodel->marksurfaces = out;
|
||||
loadmodel->nummarksurfaces = count;
|
||||
@@ -1065,15 +1065,15 @@ Mod_LoadSurfedges
|
||||
=================
|
||||
*/
|
||||
void Mod_LoadSurfedges (lump_t *l)
|
||||
{
|
||||
{
|
||||
int i, count;
|
||||
int *in, *out;
|
||||
|
||||
|
||||
in = (void *)(mod_base + l->fileofs);
|
||||
if (l->filelen % sizeof(*in))
|
||||
Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
|
||||
count = l->filelen / sizeof(*in);
|
||||
out = Hunk_AllocName ( count*sizeof(*out), loadname);
|
||||
out = Hunk_AllocName ( count*sizeof(*out), loadname);
|
||||
|
||||
loadmodel->surfedges = out;
|
||||
loadmodel->numsurfedges = count;
|
||||
@@ -1095,13 +1095,13 @@ void Mod_LoadPlanes (lump_t *l)
|
||||
dplane_t *in;
|
||||
int count;
|
||||
int bits;
|
||||
|
||||
|
||||
in = (void *)(mod_base + l->fileofs);
|
||||
if (l->filelen % sizeof(*in))
|
||||
Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
|
||||
count = l->filelen / sizeof(*in);
|
||||
out = Hunk_AllocName ( count*2*sizeof(*out), loadname);
|
||||
|
||||
out = Hunk_AllocName ( count*2*sizeof(*out), loadname);
|
||||
|
||||
loadmodel->planes = out;
|
||||
loadmodel->numplanes = count;
|
||||
|
||||
@@ -1149,9 +1149,9 @@ void Mod_LoadBrushModel (model_t *mod, void *buffer)
|
||||
int i, j;
|
||||
dheader_t *header;
|
||||
dmodel_t *bm;
|
||||
|
||||
|
||||
loadmodel->type = mod_brush;
|
||||
|
||||
|
||||
header = (dheader_t *)buffer;
|
||||
|
||||
i = LittleLong (header->version);
|
||||
@@ -1165,7 +1165,7 @@ void Mod_LoadBrushModel (model_t *mod, void *buffer)
|
||||
((int *)header)[i] = LittleLong ( ((int *)header)[i]);
|
||||
|
||||
// load into heap
|
||||
|
||||
|
||||
Mod_LoadVertexes (&header->lumps[LUMP_VERTEXES]);
|
||||
Mod_LoadEdges (&header->lumps[LUMP_EDGES]);
|
||||
Mod_LoadSurfedges (&header->lumps[LUMP_SURFEDGES]);
|
||||
@@ -1183,9 +1183,9 @@ void Mod_LoadBrushModel (model_t *mod, void *buffer)
|
||||
Mod_LoadSubmodels (&header->lumps[LUMP_MODELS]);
|
||||
|
||||
Mod_MakeHull0 ();
|
||||
|
||||
|
||||
mod->numframes = 2; // regular and alternate animation
|
||||
|
||||
|
||||
//
|
||||
// set up the submodels (FIXME: this is confusing)
|
||||
//
|
||||
@@ -1199,10 +1199,10 @@ void Mod_LoadBrushModel (model_t *mod, void *buffer)
|
||||
mod->hulls[j].firstclipnode = bm->headnode[j];
|
||||
mod->hulls[j].lastclipnode = mod->numclipnodes-1;
|
||||
}
|
||||
|
||||
|
||||
mod->firstmodelsurface = bm->firstface;
|
||||
mod->nummodelsurfaces = bm->numfaces;
|
||||
|
||||
|
||||
VectorCopy (bm->maxs, mod->maxs);
|
||||
VectorCopy (bm->mins, mod->mins);
|
||||
|
||||
@@ -1254,7 +1254,7 @@ void * Mod_LoadAliasFrame (void * pin, maliasframedesc_t *frame)
|
||||
trivertx_t *pframe, *pinframe;
|
||||
int i, j;
|
||||
daliasframe_t *pdaliasframe;
|
||||
|
||||
|
||||
pdaliasframe = (daliasframe_t *)pin;
|
||||
|
||||
strcpy (frame->name, pdaliasframe->name);
|
||||
@@ -1291,7 +1291,7 @@ void *Mod_LoadAliasGroup (void * pin, maliasframedesc_t *frame)
|
||||
int i, numframes;
|
||||
daliasinterval_t *pin_intervals;
|
||||
void *ptemp;
|
||||
|
||||
|
||||
pingroup = (daliasgroup_t *)pin;
|
||||
|
||||
numframes = LittleLong (pingroup->numframes);
|
||||
@@ -1419,7 +1419,7 @@ void *Mod_LoadAllSkins (int numskins, daliasskintype_t *pskintype)
|
||||
daliasskingroup_t *pinskingroup;
|
||||
int groupskins;
|
||||
daliasskininterval_t *pinskinintervals;
|
||||
|
||||
|
||||
skin = (byte *)(pskintype + 1);
|
||||
|
||||
if (numskins < 1 || numskins > MAX_SKINS)
|
||||
@@ -1443,7 +1443,7 @@ void *Mod_LoadAllSkins (int numskins, daliasskintype_t *pskintype)
|
||||
pheader->gl_texturenum[i][1] =
|
||||
pheader->gl_texturenum[i][2] =
|
||||
pheader->gl_texturenum[i][3] =
|
||||
GL_LoadTexture (name, pheader->skinwidth,
|
||||
GL_LoadTexture (name, pheader->skinwidth,
|
||||
pheader->skinheight, (byte *)(pskintype + 1), true, false);
|
||||
pskintype = (daliasskintype_t *)((byte *)(pskintype+1) + s);
|
||||
} else {
|
||||
@@ -1464,15 +1464,15 @@ void *Mod_LoadAllSkins (int numskins, daliasskintype_t *pskintype)
|
||||
memcpy (texels, (byte *)(pskintype), s);
|
||||
}
|
||||
sprintf (name, "%s_%i_%i", loadmodel->name, i,j);
|
||||
pheader->gl_texturenum[i][j&3] =
|
||||
GL_LoadTexture (name, pheader->skinwidth,
|
||||
pheader->gl_texturenum[i][j&3] =
|
||||
GL_LoadTexture (name, pheader->skinwidth,
|
||||
pheader->skinheight, (byte *)(pskintype), true, false);
|
||||
pskintype = (daliasskintype_t *)((byte *)(pskintype) + s);
|
||||
}
|
||||
k = j;
|
||||
for (/* */; j < 4; j++)
|
||||
pheader->gl_texturenum[i][j&3] =
|
||||
pheader->gl_texturenum[i][j - k];
|
||||
pheader->gl_texturenum[i][j&3] =
|
||||
pheader->gl_texturenum[i][j - k];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1497,7 +1497,7 @@ void Mod_LoadAliasModel (model_t *mod, void *buffer)
|
||||
daliasframetype_t *pframetype;
|
||||
daliasskintype_t *pskintype;
|
||||
int start, end, total;
|
||||
|
||||
|
||||
start = Hunk_LowMark ();
|
||||
|
||||
pinmodel = (mdl_t *)buffer;
|
||||
@@ -1511,11 +1511,11 @@ void Mod_LoadAliasModel (model_t *mod, void *buffer)
|
||||
// allocate space for a working header, plus all the data except the frames,
|
||||
// skin and group info
|
||||
//
|
||||
size = sizeof (aliashdr_t)
|
||||
size = sizeof (aliashdr_t)
|
||||
+ (LittleLong (pinmodel->numframes) - 1) *
|
||||
sizeof (pheader->frames[0]);
|
||||
pheader = Hunk_AllocName (size, loadname);
|
||||
|
||||
|
||||
mod->flags = LittleLong (pinmodel->flags);
|
||||
|
||||
//
|
||||
@@ -1633,10 +1633,10 @@ void Mod_LoadAliasModel (model_t *mod, void *buffer)
|
||||
|
||||
//
|
||||
// move the complete, relocatable alias model to the cache
|
||||
//
|
||||
//
|
||||
end = Hunk_LowMark ();
|
||||
total = end - start;
|
||||
|
||||
|
||||
Cache_Alloc (&mod->cache, total, loadname);
|
||||
if (!mod->cache.data)
|
||||
return;
|
||||
@@ -1756,7 +1756,7 @@ void Mod_LoadSpriteModel (model_t *mod, void *buffer)
|
||||
int numframes;
|
||||
int size;
|
||||
dspriteframetype_t *pframetype;
|
||||
|
||||
|
||||
pin = (dsprite_t *)buffer;
|
||||
|
||||
version = LittleLong (pin->version);
|
||||
@@ -1783,7 +1783,7 @@ void Mod_LoadSpriteModel (model_t *mod, void *buffer)
|
||||
mod->maxs[0] = mod->maxs[1] = psprite->maxwidth/2;
|
||||
mod->mins[2] = -psprite->maxheight/2;
|
||||
mod->maxs[2] = psprite->maxheight/2;
|
||||
|
||||
|
||||
//
|
||||
// load the frames
|
||||
//
|
||||
@@ -1836,3 +1836,5 @@ void Mod_Print (void)
|
||||
Con_Printf ("%8p : %s\n",mod->cache.data, mod->name);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loaded 100 of 317 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user