contrib/other: minor typos (#461)

- Fix errors and improve spellings for fluency.
- Note: Line endings standardised from `CRLF` > `LF` and trailing whitespace removed automatically due to `.editorconfig`; best to view diffs with whitespace changes at EOL hidden.

---------

Co-authored-by: Kiril Lipatov <lipatov.kiril@gmail.com>
Co-authored-by: Burer <burer@kolibrios.org>
Reviewed-on: #461
Reviewed-by: Burer <burer@kolibrios.org>
Reviewed-by: Kiril Lipatov <lipatov.kiril@gmail.com>
Co-authored-by: Andrew <dent.ace@gmail.com>
Co-committed-by: Andrew <dent.ace@gmail.com>
This commit was merged in pull request #461.
This commit is contained in:
2026-06-12 04:05:07 +00:00
committed by Burer
co-authored by Leency Burer
parent 0381abade7
commit 5e1b701c84
121 changed files with 6176 additions and 6285 deletions
+478 -479
View File
@@ -1,479 +1,478 @@
#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);
};
};
#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);
};
};
+146 -146
View File
@@ -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 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
/* 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
+64 -64
View File
@@ -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 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
/* 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
+6 -14
View File
@@ -1,4 +1,4 @@
// Emacs style mode select -*- C++ -*-
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id:$
@@ -33,11 +33,11 @@ rcsid[] = "$Id:$";
//
// PSPRITE ACTIONS for waepons.
// PSPRITE ACTIONS for weapons.
// This struct controls the weapon animations.
//
// Each entry is:
// ammo/amunition type
// ammo/ammunition 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,13 +126,5 @@ weaponinfo_t weaponinfo[NUMWEAPONS] =
S_DSGUN,
S_DSGUN1,
S_DSGUNFLASH1
},
},
};
+57 -57
View File
@@ -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 syncronous IO operations
I_StartFrame ();
// frame synchronous 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 dependend demo numbers?
// FIXME - version dependent 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);
@@ -647,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");
@@ -722,7 +722,7 @@ void FindResponseFile (void)
{
int i;
#define MAXARGVS 100
for (i = 1;i < myargc;i++)
if (myargv[i][0] == '@')
{
@@ -735,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)
@@ -750,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)
@@ -774,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++)
@@ -798,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");
@@ -867,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)
@@ -892,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
//
@@ -914,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]);
@@ -926,7 +926,7 @@ void D_DoomMain (void)
}
D_AddFile (file);
}
p = M_CheckParm ("-file");
if (p)
{
@@ -948,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)
{
@@ -970,7 +970,7 @@ void D_DoomMain (void)
startmap = 1;
autostart = true;
}
p = M_CheckParm ("-timer");
if (p && p < myargc-1 && deathmatch)
{
@@ -998,7 +998,7 @@ void D_DoomMain (void)
}
autostart = true;
}
// init subsystems
printf ("V_Init: allocate screens.\n");
V_Init ();
@@ -1012,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)
@@ -1026,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 additonal PWAD files are used, print modified banner
// Iff additional PWAD files are used, print modified banner
if (modifiedgame)
{
/*m*/printf (
@@ -1052,7 +1052,7 @@ printf("added\n");
);
getchar ();
}
// Check and print which version is executed.
switch ( gamemode )
@@ -1075,7 +1075,7 @@ printf("added\n");
"===========================================================================\n"
);
break;
default:
// Ouch.
break;
@@ -1110,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 apropriate game based on parms
// start the appropriate game based on parms
p = M_CheckParm ("-record");
if (p && p < myargc-1)
@@ -1124,7 +1124,7 @@ printf("added\n");
G_RecordDemo (myargv[p+1]);
autostart = true;
}
p = M_CheckParm ("-playdemo");
if (p && p < myargc-1)
{
@@ -1132,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)
{
@@ -1149,7 +1149,7 @@ printf("added\n");
sprintf(file, SAVEGAMENAME"%c.dsg",myargv[p+1][0]);
G_LoadGame (file);
}
if ( gameaction != ga_loadgame )
{
+3 -3
View File
@@ -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 overrided by user input, calls N_AdvanceDemo.
// If not overridden 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
+92 -92
View File
@@ -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 independend parts.
// all OS independent 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 -endianess?
// FIXME -endianness?
#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 syncronous
return; // singletic update is synchronous
// 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 consistantly slower, speed up time
// if we are consistently 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];
+9 -10
View File
@@ -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 allways node 0.
// Console is always 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,4 +146,3 @@ void TryRunTics (void);
// $Log:$
//
//-----------------------------------------------------------------------------
+2 -2
View File
@@ -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 consistancy; // checks for net game
short consistency; // checks for net game
byte chatchar;
byte buttons;
} ticcmd_t;
+7 -8
View File
@@ -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 allways have the first row of
// Unpegged textures always 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,4 +219,3 @@ typedef struct
// $Log:$
//
//-----------------------------------------------------------------------------
+13 -13
View File
@@ -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 dependend animations etc.
// to handle IWAD dependent 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,
// menues etc. is tied to the scale implied
// menus 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"
// Endianess handling.
// Endianness handling.
//#include "m_swap.h"
+11 -11
View File
@@ -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 explicitely.
// status bar explicitly.
extern boolean statusbaractive;
extern boolean automapactive; // In AutoMap mode?
extern boolean menuactive; // Menu overlayed?
extern boolean menuactive; // Menu overlaid?
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];
+55 -57
View File
@@ -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 dependend stuff.
// This has been changed severly, and
// Okay - IWAD dependent stuff.
// This has been changed severely, 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,7 +732,5 @@ void F_Drawer (void)
break;
}
}
}
File diff suppressed because it is too large Load Diff
+9 -9
View File
@@ -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 udpated
int needsupdate;
// whether this line needs to be updated
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
//-----------------------------------------------------------------------------
+266 -266
View File
@@ -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].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);
}
#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);
}
+44 -45
View File
@@ -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 seperation )
int separation )
{
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
seperation += 1;
separation += 1;
// Per left/right channel.
// x^2 seperation,
// x^2 separation,
// adjust volume properly.
volume *= 8;
leftvol =
volume - ((volume*seperation*seperation) >> 16); ///(256*256);
seperation = seperation - 257;
volume - ((volume*separation*separation) >> 16); ///(256*256);
separation = separation - 257;
rightvol =
volume - ((volume*seperation*seperation) >> 16);
volume - ((volume*separation*separation) >> 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 chache - made this a loop.
// Love thy L2 cache - 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,20 +562,20 @@ I_UpdateSoundParams
void I_ShutdownSound(void)
{
{
SDL_CloseAudio();
}
void
I_InitSound()
{
{
SDL_AudioSpec wanted;
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 ) {
@@ -593,18 +593,18 @@ I_InitSound()
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?
@@ -614,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);
@@ -657,7 +657,7 @@ void I_StopSong(int handle)
{
// UNUSED.
handle = 0;
looping = 0;
musicdies = 0;
}
@@ -672,7 +672,7 @@ int I_RegisterSong(void* data)
{
// UNUSED.
data = NULL;
return 1;
}
@@ -683,4 +683,3 @@ int I_QrySongPlaying(int handle)
handle = 0;
return looping || musicdies > gametic;
}
+2 -2
View File
@@ -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 relase at program termination.
// ... shut down and release at program termination.
void I_ShutdownSound(void);
+4 -4
View File
@@ -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 ammount of memory to malloc
// to get the amount 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 syncronous operations
// Time consuming synchronous 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 syncronous operations are performed here.
// Quick synchronous operations are performed here.
// Can call D_PostEvent.
void I_StartTic (void);
+2 -3
View File
@@ -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 utilitiy.
// generated by multigen utility.
// This one is the original DOOM version, preserved.
//
//-----------------------------------------------------------------------------
@@ -4667,4 +4667,3 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = {
S_NULL // raisestate
}
};
+2 -2
View File
@@ -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 utilitiy.
// generated by multigen utility.
// This one is the original DOOM version, preserved.
//
//-----------------------------------------------------------------------------
+3 -5
View File
@@ -1,4 +1,4 @@
// Emacs style mode select -*- C++ -*-
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id:$
@@ -17,7 +17,7 @@
// $Log:$
//
// DESCRIPTION:
// Endianess handling, swapping 16bit and 32bit.
// Endianness 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,5 +47,3 @@ unsigned long SwapLONG( unsigned long x)
| ((x<<8) & 0xff0000)
| (x<<24);
}
+3 -3
View File
@@ -1,4 +1,4 @@
// Emacs style mode select -*- C++ -*-
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id:$
@@ -15,7 +15,7 @@
// for more details.
//
// DESCRIPTION:
// Endianess handling, swapping 16bit and 32bit.
// Endianness handling, swapping 16bit and 32bit.
//
//-----------------------------------------------------------------------------
@@ -29,7 +29,7 @@
#endif
// Endianess handling.
// Endianness handling.
// WAD files are stored little endian.
#ifdef sparc
#define __BIG_ENDIAN__
File diff suppressed because it is too large Load Diff
+4 -6
View File
@@ -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 exlusively for 3 seconds
// follow a player exclusively 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,5 +285,3 @@ P_DamageMobj
// $Log:$
//
//-----------------------------------------------------------------------------
+106 -107
View File
@@ -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;
// somthing is occupying it's position?
if (!P_CheckPosition (mobj, x, y) )
return; // no respwan
x = mobj->spawnpoint.x << FRACBITS;
y = mobj->spawnpoint.y << FRACBITS;
// something is occupying its position?
if (!P_CheckPosition (mobj, x, y) )
return; // no respawn
// 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 can not be called yet
// because action routines cannot 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 apropriate skill level
// check for appropriate 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,4 +985,3 @@ P_SpawnPlayerMissile
P_CheckMissileSpawn (th);
}
+14 -14
View File
@@ -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 allmost allways set
// The sprite and frame values are almost always 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;
+77 -79
View File
@@ -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 allready be validated)
// (pending weapon should already 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 aproximately
// Sets a slope so a near miss is at approximately
// 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,32 +848,30 @@ 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;
}
+1 -1
View File
@@ -34,7 +34,7 @@
// sprite animation tables.
// Header generated by multigen utility.
// This includes all the data for thing animation,
// i.e. the Thing Atrributes table
// i.e. the Thing Attributes table
// and the Frame Sequence table.
#include "info.h"
+65 -68
View File
@@ -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 = &sectors[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 devlopment map, reload it
W_Reload ();
// if working with a development 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,6 +703,3 @@ void P_Init (void)
P_InitPicAnims ();
R_InitSprites (sprnames);
}
+36 -38
View File
@@ -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;
// allready checked other side?
// already 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,7 +343,5 @@ 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
View File
@@ -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));
}
}