Compare commits
74
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
90b4bce087 | ||
|
|
19a9c425ac | ||
|
|
81e502c21b | ||
|
|
11c6fc2cca | ||
|
|
dc2d1b4cd9 | ||
|
|
cfa0bb0405 | ||
|
|
b35a658249 | ||
|
|
ff41198bce | ||
|
|
0c58228c21 | ||
|
|
9a60441e54 | ||
|
|
29cf728fac | ||
|
|
3c78c5c57d | ||
|
|
7f3f332821 | ||
|
|
38576082fb | ||
|
|
4a4b5661f2 | ||
|
|
1e879dc432 | ||
|
|
f3c8ff19b9 | ||
|
|
fdd19632bf | ||
|
|
e102d218ff | ||
|
|
20cdec33fb | ||
|
|
12d4a6d291 | ||
|
|
d2b1ff595d | ||
|
|
03d79fba16 | ||
|
|
989c29f7a0 | ||
|
|
8a79c0a4e0 | ||
|
|
307c333c50 | ||
|
|
3ce8b9f09c | ||
|
|
4dbe637510 | ||
|
|
c0e97e7f43 | ||
|
|
37fc64e97d | ||
|
|
ca93f08230 | ||
|
|
3581ce811c | ||
|
|
0411c40fae | ||
|
|
0159b8d0a3 | ||
|
|
aea3b49a51 | ||
|
|
1a6f775cc3 | ||
|
|
ddd192fad0 | ||
|
|
2e4fb32dac | ||
|
|
7d6e210625 | ||
|
|
3ca42ce42f | ||
|
|
e4e40cf049 | ||
|
|
d4f912e3b0 | ||
|
|
eec4443c95 | ||
|
|
b938c75892 | ||
|
|
455cb9ca24 | ||
|
|
24e7f5f864 | ||
|
|
298fa36c5d | ||
|
|
d31e9c5b55 | ||
|
|
30f53f398f | ||
|
|
eee217deec | ||
|
|
487ef6f1b9 | ||
|
|
a554b886c6 | ||
|
|
f2d68b075c | ||
|
|
dc24de3501 | ||
|
|
d2c73f072e | ||
|
|
96bc7f7aa6 | ||
|
|
bd48b24000 | ||
|
|
a26867bbdb | ||
|
|
8d570b7ba3 | ||
|
|
96f5a8adb3 | ||
|
|
3b34f0a972 | ||
|
|
fe5a0b7c64 | ||
|
|
2aa5324225 | ||
|
|
22f50402fe | ||
|
|
4e2f1bcf2b | ||
|
|
ca34b0c8d6 | ||
|
|
0df5ef996c | ||
|
|
4c0ea2695e | ||
|
|
48556ca428 | ||
|
|
5db50bbaff | ||
|
|
416da7cdc8 | ||
|
|
f47057e800 | ||
|
|
090559a766 | ||
|
|
1a6a3de443 |
No files matched your search
@@ -69,6 +69,7 @@ opts+=-DHAVE_MINIUPNPC
|
||||
endif
|
||||
|
||||
ifndef NOLIBBACKTRACE
|
||||
$(eval $(call Propogate_flags,LIBBACKTRACE))
|
||||
libs+=-lbacktrace
|
||||
opts+=-DHAVE_LIBBACKTRACE
|
||||
endif
|
||||
@@ -81,6 +82,7 @@ endif
|
||||
endif
|
||||
|
||||
ifdef HAVE_DISCORDRPC
|
||||
$(eval $(call Propogate_flags,DISCORDRPC))
|
||||
libs+=-ldiscord-rpc
|
||||
opts+=-DUSE_STUN
|
||||
sources+=discord.c stun.c
|
||||
|
||||
+5
-5
@@ -133,26 +133,26 @@ LUALIB_API void *luaL_checkudata (lua_State *L, int ud, const char *tname) {
|
||||
|
||||
|
||||
LUALIB_API void luaL_checkstack (lua_State *L, int space, const char *mes) {
|
||||
if (!lua_checkstack(L, space))
|
||||
if (l_unlikely(!lua_checkstack(L, space)))
|
||||
luaL_error(L, "stack overflow (%s)", mes);
|
||||
}
|
||||
|
||||
|
||||
LUALIB_API void luaL_checktype (lua_State *L, int narg, int t) {
|
||||
if (lua_type(L, narg) != t)
|
||||
if (l_unlikely(lua_type(L, narg) != t))
|
||||
tag_error(L, narg, t);
|
||||
}
|
||||
|
||||
|
||||
LUALIB_API void luaL_checkany (lua_State *L, int narg) {
|
||||
if (lua_type(L, narg) == LUA_TNONE)
|
||||
if (l_unlikely(lua_type(L, narg) == LUA_TNONE))
|
||||
luaL_argerror(L, narg, "value expected");
|
||||
}
|
||||
|
||||
|
||||
LUALIB_API const char *luaL_checklstring (lua_State *L, int narg, size_t *len) {
|
||||
const char *s = lua_tolstring(L, narg, len);
|
||||
if (!s) tag_error(L, narg, LUA_TSTRING);
|
||||
if (l_unlikely(!s)) tag_error(L, narg, LUA_TSTRING);
|
||||
return s;
|
||||
}
|
||||
|
||||
@@ -170,7 +170,7 @@ LUALIB_API const char *luaL_optlstring (lua_State *L, int narg,
|
||||
|
||||
LUALIB_API lua_Number luaL_checknumber (lua_State *L, int narg) {
|
||||
lua_Number d = lua_tonumber(L, narg);
|
||||
if (d == 0 && !lua_isnumber(L, narg)) /* avoid extra test when d is not 0 */
|
||||
if (l_unlikely(d == 0 && !lua_isnumber(L, narg))) /* avoid extra test when d is not 0 */
|
||||
tag_error(L, narg, LUA_TNUMBER);
|
||||
return d;
|
||||
}
|
||||
|
||||
+1
-1
@@ -102,7 +102,7 @@ LUALIB_API const char *(luaL_findtable) (lua_State *L, int idx,
|
||||
*/
|
||||
|
||||
#define luaL_argcheck(L, cond,numarg,extramsg) \
|
||||
((void)((cond) || luaL_argerror(L, (numarg), (extramsg))))
|
||||
((void)(l_likely(cond) || luaL_argerror(L, (numarg), (extramsg))))
|
||||
#define luaL_checkstring(L,n) (luaL_checklstring(L, (n), NULL))
|
||||
#define luaL_optstring(L,n,d) (luaL_optlstring(L, (n), (d), NULL))
|
||||
#define luaL_checkint(L,n) ((int)luaL_checkinteger(L, (n)))
|
||||
|
||||
+9
-9
@@ -106,7 +106,7 @@ static int luaB_setmetatable (lua_State *L) {
|
||||
luaL_checktype(L, 1, LUA_TTABLE);
|
||||
luaL_argcheck(L, t == LUA_TNIL || t == LUA_TTABLE, 2,
|
||||
"nil or table expected");
|
||||
if (luaL_getmetafield(L, 1, "__metatable"))
|
||||
if (l_unlikely(luaL_getmetafield(L, 1, "__metatable")))
|
||||
luaL_error(L, "cannot change a protected metatable");
|
||||
lua_settop(L, 2);
|
||||
lua_setmetatable(L, 1);
|
||||
@@ -120,10 +120,10 @@ static void getfunc (lua_State *L, int opt) {
|
||||
lua_Debug ar;
|
||||
int level = opt ? luaL_optint(L, 1, 1) : luaL_checkint(L, 1);
|
||||
luaL_argcheck(L, level >= 0, 1, "level must be non-negative");
|
||||
if (lua_getstack(L, level, &ar) == 0)
|
||||
if (l_unlikely(lua_getstack(L, level, &ar) == 0))
|
||||
luaL_argerror(L, 1, "invalid level");
|
||||
lua_getinfo(L, "f", &ar);
|
||||
if (lua_isnil(L, -1))
|
||||
if (l_unlikely(lua_isnil(L, -1)))
|
||||
luaL_error(L, "no function environment for tail call at level %d",
|
||||
level);
|
||||
}
|
||||
@@ -151,7 +151,7 @@ static int luaB_setfenv (lua_State *L) {
|
||||
lua_setfenv(L, -2);
|
||||
return 0;
|
||||
}
|
||||
else if (lua_iscfunction(L, -2) || lua_setfenv(L, -2) == 0)
|
||||
else if (l_unlikely(lua_iscfunction(L, -2) || lua_setfenv(L, -2) == 0))
|
||||
luaL_error(L,
|
||||
LUA_QL("setfenv") " cannot change environment of given object");
|
||||
return 1;
|
||||
@@ -265,7 +265,7 @@ static int luaB_ipairs (lua_State *L) {
|
||||
|
||||
static int luaB_assert (lua_State *L) {
|
||||
luaL_checkany(L, 1);
|
||||
if (!lua_toboolean(L, 1))
|
||||
if (l_unlikely(!lua_toboolean(L, 1)))
|
||||
return luaL_error(L, "%s", luaL_optstring(L, 2, "assertion failed!"));
|
||||
return lua_gettop(L);
|
||||
}
|
||||
@@ -278,7 +278,7 @@ static int luaB_unpack (lua_State *L) {
|
||||
e = luaL_opt(L, luaL_checkint, 3, luaL_getn(L, 1));
|
||||
if (i > e) return 0; /* empty range */
|
||||
n = e - i + 1; /* number of elements */
|
||||
if (n <= 0 || !lua_checkstack(L, n)) /* n <= 0 means arith. overflow */
|
||||
if (l_unlikely(n <= 0 || !lua_checkstack(L, n))) /* n <= 0 means arith. overflow */
|
||||
return luaL_error(L, "too many results to unpack");
|
||||
lua_rawgeti(L, 1, i); /* push arg[i] (avoiding overflow problems) */
|
||||
while (i++ < e) /* push arg[i + 1...e] */
|
||||
@@ -445,9 +445,9 @@ static int luaB_costatus (lua_State *L) {
|
||||
|
||||
static int auxresume (lua_State *L, lua_State *co, int narg) {
|
||||
int status = costatus(L, co);
|
||||
if (!lua_checkstack(co, narg))
|
||||
if (l_unlikely(!lua_checkstack(co, narg)))
|
||||
luaL_error(L, "too many arguments to resume");
|
||||
if (status != CO_SUS) {
|
||||
if (l_unlikely(status != CO_SUS)) {
|
||||
lua_pushfstring(L, "cannot resume %s coroutine", statnames[status]);
|
||||
return -1; /* error flag */
|
||||
}
|
||||
@@ -456,7 +456,7 @@ static int auxresume (lua_State *L, lua_State *co, int narg) {
|
||||
status = lua_resume(co, narg);
|
||||
if (status == 0 || status == LUA_YIELD) {
|
||||
int nres = lua_gettop(co);
|
||||
if (!lua_checkstack(L, nres + 1))
|
||||
if (l_unlikely(!lua_checkstack(L, nres + 1)))
|
||||
luaL_error(L, "too many results to resume");
|
||||
lua_xmove(co, L, nres); /* move yielded values */
|
||||
return nres;
|
||||
|
||||
+2
-2
@@ -73,7 +73,7 @@ static int db_getinfo (lua_State *L) {
|
||||
}
|
||||
else
|
||||
return luaL_argerror(L, arg+1, "function or level expected");
|
||||
if (!lua_getinfo(L1, options, &ar))
|
||||
if (l_unlikely(!lua_getinfo(L1, options, &ar)))
|
||||
return luaL_argerror(L, arg+2, "invalid option");
|
||||
lua_createtable(L, 0, 2);
|
||||
if (strchr(options, 'S')) {
|
||||
@@ -104,7 +104,7 @@ static int db_getlocal (lua_State *L) {
|
||||
lua_State *L1 = getthread(L, &arg);
|
||||
lua_Debug ar;
|
||||
const char *name;
|
||||
if (!lua_getstack(L1, luaL_checkint(L, arg+1), &ar)) /* out of range? */
|
||||
if (l_unlikely(!lua_getstack(L1, luaL_checkint(L, arg+1), &ar))) /* out of range? */
|
||||
return luaL_argerror(L, arg+1, "level out of range");
|
||||
name = lua_getlocal(L1, &ar, luaL_checkint(L, arg+2));
|
||||
if (name) {
|
||||
|
||||
+13
-13
@@ -172,7 +172,7 @@ void luaD_reallocCI (lua_State *L, int newsize) {
|
||||
|
||||
|
||||
void luaD_growstack (lua_State *L, int n) {
|
||||
if (n <= L->stacksize) /* double size is enough? */
|
||||
if (l_likely(n <= L->stacksize)) /* double size is enough? */
|
||||
luaD_reallocstack(L, 2*L->stacksize);
|
||||
else
|
||||
luaD_reallocstack(L, L->stacksize + n);
|
||||
@@ -180,11 +180,11 @@ void luaD_growstack (lua_State *L, int n) {
|
||||
|
||||
|
||||
static CallInfo *growCI (lua_State *L) {
|
||||
if (L->size_ci > LUAI_MAXCALLS) /* overflow while handling overflow? */
|
||||
if (l_unlikely(L->size_ci > LUAI_MAXCALLS)) /* overflow while handling overflow? */
|
||||
luaD_throw(L, LUA_ERRERR);
|
||||
else {
|
||||
luaD_reallocCI(L, 2*L->size_ci);
|
||||
if (L->size_ci > LUAI_MAXCALLS)
|
||||
if (l_unlikely(L->size_ci > LUAI_MAXCALLS))
|
||||
luaG_runerror(L, "stack overflow");
|
||||
}
|
||||
return ++L->ci;
|
||||
@@ -257,7 +257,7 @@ static StkId tryfuncTM (lua_State *L, StkId func) {
|
||||
const TValue *tm = luaT_gettmbyobj(L, func, TM_CALL);
|
||||
StkId p;
|
||||
ptrdiff_t funcr = savestack(L, func);
|
||||
if (!ttisfunction(tm))
|
||||
if (l_unlikely(!ttisfunction(tm)))
|
||||
luaG_typeerror(L, func, "call");
|
||||
/* Open a hole inside the stack at `func' */
|
||||
for (p = L->top; p > func; p--) setobjs2s(L, p, p-1);
|
||||
@@ -356,7 +356,7 @@ int luaD_poscall (lua_State *L, StkId firstResult) {
|
||||
StkId res;
|
||||
int wanted, i;
|
||||
CallInfo *ci;
|
||||
if (L->hookmask & LUA_MASKRET)
|
||||
if (l_unlikely(L->hookmask) & LUA_MASKRET)
|
||||
firstResult = callrethooks(L, firstResult);
|
||||
ci = L->ci--;
|
||||
res = ci->func; /* res == final position of 1st result */
|
||||
@@ -380,7 +380,7 @@ int luaD_poscall (lua_State *L, StkId firstResult) {
|
||||
** function position.
|
||||
*/
|
||||
void luaD_call (lua_State *L, StkId func, int nResults) {
|
||||
if (++L->nCcalls >= LUAI_MAXCCALLS) {
|
||||
if (l_unlikely(++L->nCcalls >= LUAI_MAXCCALLS)) {
|
||||
if (L->nCcalls == LUAI_MAXCCALLS)
|
||||
luaG_runerror(L, "C stack overflow");
|
||||
else if (L->nCcalls >= (LUAI_MAXCCALLS + (LUAI_MAXCCALLS>>3)))
|
||||
@@ -430,15 +430,15 @@ static int resume_error (lua_State *L, const char *msg) {
|
||||
LUA_API int lua_resume (lua_State *L, int nargs) {
|
||||
int status;
|
||||
lua_lock(L);
|
||||
if (L->status != LUA_YIELD && (L->status != 0 || L->ci != L->base_ci))
|
||||
if (l_unlikely(L->status != LUA_YIELD && (L->status != 0 || L->ci != L->base_ci)))
|
||||
return resume_error(L, "cannot resume non-suspended coroutine");
|
||||
if (L->nCcalls >= LUAI_MAXCCALLS)
|
||||
if (l_unlikely(L->nCcalls >= LUAI_MAXCCALLS))
|
||||
return resume_error(L, "C stack overflow");
|
||||
luai_userstateresume(L, nargs);
|
||||
lua_assert(L->errfunc == 0);
|
||||
L->baseCcalls = ++L->nCcalls;
|
||||
status = luaD_rawrunprotected(L, resume, L->top - nargs);
|
||||
if (status != 0) { /* error? */
|
||||
if (l_unlikely(status != 0)) { /* error? */
|
||||
L->status = cast_byte(status); /* mark thread as `dead' */
|
||||
luaD_seterrorobj(L, status, L->top);
|
||||
L->ci->top = L->top;
|
||||
@@ -456,7 +456,7 @@ LUA_API int lua_resume (lua_State *L, int nargs) {
|
||||
LUA_API int lua_yield (lua_State *L, int nresults) {
|
||||
luai_userstateyield(L, nresults);
|
||||
lua_lock(L);
|
||||
if (L->nCcalls > L->baseCcalls)
|
||||
if (l_unlikely(L->nCcalls > L->baseCcalls))
|
||||
luaG_runerror(L, "attempt to yield across metamethod/C-call boundary");
|
||||
L->base = L->top - nresults; /* protect stack slots below */
|
||||
L->status = LUA_YIELD;
|
||||
@@ -474,7 +474,7 @@ int luaD_pcall (lua_State *L, Pfunc func, void *u,
|
||||
ptrdiff_t old_errfunc = L->errfunc;
|
||||
L->errfunc = ef;
|
||||
status = luaD_rawrunprotected(L, func, u);
|
||||
if (status != 0) { /* an error occurred? */
|
||||
if (l_unlikely(status != 0)) { /* an error occurred? */
|
||||
StkId oldtop = restorestack(L, old_top);
|
||||
luaF_close(L, oldtop); /* close eventual pending closures */
|
||||
luaD_seterrorobj(L, status, oldtop);
|
||||
@@ -511,8 +511,8 @@ static void f_parser (lua_State *L, void *ud) {
|
||||
tf = ((c == LUA_SIGNATURE[0]) ? luaU_undump : luaY_parser)(L, p->z,
|
||||
&p->buff, p->name);
|
||||
#else
|
||||
if (c == LUA_SIGNATURE[0])
|
||||
luaG_runerror(L, "invalid format, cannot load bytecode scripts");
|
||||
if (l_unlikely(c == LUA_SIGNATURE[0]))
|
||||
luaG_runerror(L, "invalid format, cannot load bytecode scripts");
|
||||
tf = luaY_parser(L, p->z, &p->buff, p->name);
|
||||
#endif
|
||||
cl = luaF_newLclosure(L, tf->nups, hvalue(gt(L)));
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
|
||||
|
||||
#define luaD_checkstack(L,n) \
|
||||
if ((char *)L->stack_last - (char *)L->top <= (n)*(int)sizeof(TValue)) \
|
||||
if (l_unlikely((char *)L->stack_last - (char *)L->top <= (n)*(int)sizeof(TValue))) \
|
||||
luaD_growstack(L, n); \
|
||||
else condhardstacktests(luaD_reallocstack(L, L->stacksize - EXTRA_STACK - 1));
|
||||
|
||||
|
||||
+10
-10
@@ -84,7 +84,7 @@ static int io_type (lua_State *L) {
|
||||
|
||||
static FILE *tofile (lua_State *L) {
|
||||
FILE **f = tofilep(L);
|
||||
if (*f == NULL)
|
||||
if (l_unlikely(*f == NULL))
|
||||
luaL_error(L, "attempt to use a closed file");
|
||||
return *f;
|
||||
}
|
||||
@@ -184,8 +184,8 @@ static int io_open (lua_State *L) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (strstr(filename, "..") || strchr(filename, ':') || StartsWith(filename, "\\")
|
||||
|| StartsWith(filename, "/") || !pass)
|
||||
if (l_unlikely(strstr(filename, "..") || strchr(filename, ':') || StartsWith(filename, "\\")
|
||||
|| StartsWith(filename, "/") || !pass))
|
||||
{
|
||||
luaL_error(L,"access denied to %s", filename);
|
||||
return pushresult(L,0,filename);
|
||||
@@ -202,7 +202,7 @@ static int io_open (lua_State *L) {
|
||||
{
|
||||
*splitter = 0;
|
||||
I_mkdir(destFilename, 0755);
|
||||
*splitter = '/';
|
||||
*splitter = '/';
|
||||
splitter++;
|
||||
|
||||
forward = strchr(splitter, '/');
|
||||
@@ -226,7 +226,7 @@ static FILE *getiofile (lua_State *L, int findex) {
|
||||
FILE *f;
|
||||
lua_rawgeti(L, LUA_ENVIRONINDEX, findex);
|
||||
f = *(FILE **)lua_touserdata(L, -1);
|
||||
if (f == NULL)
|
||||
if (l_unlikely(f == NULL))
|
||||
luaL_error(L, "standard %s file is closed", fnames[findex - 1]);
|
||||
return f;
|
||||
}
|
||||
@@ -238,7 +238,7 @@ static int g_iofile (lua_State *L, int f, const char *mode) {
|
||||
if (filename) {
|
||||
FILE **pf = newfile(L);
|
||||
*pf = fopen(filename, mode);
|
||||
if (*pf == NULL)
|
||||
if (l_unlikely(*pf == NULL))
|
||||
fileerror(L, 1, filename);
|
||||
}
|
||||
else {
|
||||
@@ -290,7 +290,7 @@ static int io_lines (lua_State *L) {
|
||||
const char *filename = luaL_checkstring(L, 1);
|
||||
FILE **pf = newfile(L);
|
||||
*pf = fopen(filename, "r");
|
||||
if (*pf == NULL)
|
||||
if (l_unlikely(*pf == NULL))
|
||||
fileerror(L, 1, filename);
|
||||
aux_lines(L, lua_gettop(L), 1);
|
||||
return 1;
|
||||
@@ -307,7 +307,7 @@ static int io_lines (lua_State *L) {
|
||||
|
||||
static int read_number (lua_State *L, FILE *f) {
|
||||
lua_Number d;
|
||||
if (fscanf(f, LUA_NUMBER_SCAN, &d) == 1) {
|
||||
if (l_likely(fscanf(f, LUA_NUMBER_SCAN, &d) == 1)) {
|
||||
lua_pushnumber(L, d);
|
||||
return 1;
|
||||
}
|
||||
@@ -454,7 +454,7 @@ static int g_write (lua_State *L, FILE *f, int arg) {
|
||||
else {
|
||||
size_t l;
|
||||
const char *s = luaL_checklstring(L, arg, &l);
|
||||
if (ftell(f) + l > FILELIMIT)
|
||||
if (l_unlikely(ftell(f) + l > FILELIMIT))
|
||||
{
|
||||
luaL_error(L,"write limit bypassed in file. Changes have been discarded.");
|
||||
break;
|
||||
@@ -483,7 +483,7 @@ static int f_seek (lua_State *L) {
|
||||
int op = luaL_checkoption(L, 2, "cur", modenames);
|
||||
long offset = luaL_optlong(L, 3, 0);
|
||||
op = fseek(f, offset, mode[op]);
|
||||
if (op)
|
||||
if (l_unlikely(op))
|
||||
return pushresult(L, 0, NULL); /* error */
|
||||
else {
|
||||
lua_pushinteger(L, ftell(f));
|
||||
|
||||
+2
-2
@@ -48,7 +48,7 @@ void *luaM_growaux_ (lua_State *L, void *block, int *size, size_t size_elems,
|
||||
void *newblock;
|
||||
int newsize;
|
||||
if (*size >= limit/2) { /* cannot double it? */
|
||||
if (*size >= limit) /* cannot grow even a little? */
|
||||
if (l_unlikely(*size >= limit)) /* cannot grow even a little? */
|
||||
luaG_runerror(L, errormsg);
|
||||
newsize = limit; /* still have at least one free place */
|
||||
}
|
||||
@@ -77,7 +77,7 @@ void *luaM_realloc_ (lua_State *L, void *block, size_t osize, size_t nsize) {
|
||||
global_State *g = G(L);
|
||||
lua_assert((osize == 0) == (block == NULL));
|
||||
block = (*g->frealloc)(g->ud, block, osize, nsize);
|
||||
if (block == NULL && nsize > 0)
|
||||
if (l_unlikely(block == NULL && nsize > 0))
|
||||
luaD_throw(L, LUA_ERRMEM);
|
||||
lua_assert((nsize == 0) == (block == NULL));
|
||||
g->totalbytes = (g->totalbytes - osize) + nsize;
|
||||
|
||||
+6
-6
@@ -103,7 +103,7 @@ static void checknext (LexState *ls, int c) {
|
||||
|
||||
|
||||
static void check_match (LexState *ls, int what, int who, int where) {
|
||||
if (!testnext(ls, what)) {
|
||||
if (l_unlikely(!testnext(ls, what))) {
|
||||
if (where == ls->linenumber)
|
||||
error_expected(ls, what);
|
||||
else {
|
||||
@@ -275,7 +275,7 @@ static void adjust_assign (LexState *ls, int nvars, int nexps, expdesc *e) {
|
||||
|
||||
|
||||
static void enterlevel (LexState *ls) {
|
||||
if (++ls->L->nCcalls > LUAI_MAXCCALLS)
|
||||
if (l_unlikely(++ls->L->nCcalls > LUAI_MAXCCALLS))
|
||||
luaX_lexerror(ls, "chunk has too many syntax levels", 0);
|
||||
}
|
||||
|
||||
@@ -643,7 +643,7 @@ static void funcargs (LexState *ls, expdesc *f) {
|
||||
int line = ls->linenumber;
|
||||
switch (ls->t.token) {
|
||||
case '(': { /* funcargs -> `(' [ explist1 ] `)' */
|
||||
if (line != ls->lastline)
|
||||
if (l_unlikely(line != ls->lastline))
|
||||
luaX_syntaxerror(ls,"ambiguous syntax (function call x new statement)");
|
||||
luaX_next(ls);
|
||||
if (ls->t.token == ')') /* arg list is empty? */
|
||||
@@ -712,7 +712,7 @@ static void prefixexp (LexState *ls, expdesc *v) {
|
||||
case '$': {
|
||||
lua_Number i = ls->t.seminfo.r;
|
||||
if (i == 0) i = ls->fs->nrhs;
|
||||
if (i <= 0 || i > ls->fs->nlhs)
|
||||
if (l_unlikely(i <= 0 || i > ls->fs->nlhs))
|
||||
luaX_syntaxerror(ls, "pseudo-variable out of range or not in assignment");
|
||||
else {
|
||||
expdesc_list *lhs = ls->fs->lhs;
|
||||
@@ -1105,7 +1105,7 @@ static void breakstat (LexState *ls, lua_Number n) {
|
||||
upval |= bl->upval;
|
||||
bl = bl->previous;
|
||||
}
|
||||
if (!bl)
|
||||
if (l_unlikely(!bl))
|
||||
luaX_syntaxerror(ls, "no loop to break");
|
||||
if (upval)
|
||||
luaK_codeABC(fs, OP_CLOSE, bl->nactvar, 0, 0);
|
||||
@@ -1124,7 +1124,7 @@ static void continuestat (LexState *ls) {
|
||||
//upval |= bl->upval; // AK: ADDITION (would this fix forbody probs?)
|
||||
bl = bl->previous;
|
||||
}
|
||||
if (!bl)
|
||||
if (l_unlikely(!bl))
|
||||
luaX_syntaxerror(ls, "no loop to continue");
|
||||
|
||||
//if (upval) //AK: experimental
|
||||
|
||||
+2
-2
@@ -83,7 +83,7 @@ TString *luaS_newlstr (lua_State *L, const char *str, size_t l) {
|
||||
o != NULL;
|
||||
o = o->gch.next) {
|
||||
TString *ts = rawgco2ts(o);
|
||||
if (ts->tsv.len == l && (memcmp(str, getstr(ts), l) == 0)) {
|
||||
if (l_unlikely(ts->tsv.len == l && (memcmp(str, getstr(ts), l) == 0))) {
|
||||
/* string may be dead */
|
||||
if (isdead(G(L), o)) changewhite(o);
|
||||
return ts;
|
||||
@@ -95,7 +95,7 @@ TString *luaS_newlstr (lua_State *L, const char *str, size_t l) {
|
||||
|
||||
Udata *luaS_newudata (lua_State *L, size_t s, Table *e) {
|
||||
Udata *u;
|
||||
if (s > MAX_SIZET - sizeof(Udata))
|
||||
if (l_unlikely(s > MAX_SIZET - sizeof(Udata)))
|
||||
luaM_toobig(L);
|
||||
u = cast(Udata *, luaM_malloc(L, s + sizeof(Udata)));
|
||||
u->uv.marked = luaC_white(G(L)); /* is not finalized */
|
||||
|
||||
+14
-12
@@ -113,7 +113,7 @@ static int str_byte (lua_State *L) {
|
||||
if ((size_t)pose > l) pose = l;
|
||||
if (posi > pose) return 0; /* empty interval; return no values */
|
||||
n = (int)(pose - posi + 1);
|
||||
if (posi + n <= pose) /* overflow? */
|
||||
if (l_unlikely(posi + n <= pose)) /* overflow? */
|
||||
luaL_error(L, "string slice too long");
|
||||
luaL_checkstack(L, n, "string slice too long");
|
||||
for (i=0; i<n; i++)
|
||||
@@ -187,7 +187,7 @@ typedef struct MatchState {
|
||||
|
||||
static int check_capture (MatchState *ms, int l) {
|
||||
l -= '1';
|
||||
if (l < 0 || l >= ms->level || ms->capture[l].len == CAP_UNFINISHED)
|
||||
if (l_unlikely(l < 0 || l >= ms->level || ms->capture[l].len == CAP_UNFINISHED))
|
||||
return luaL_error(ms->L, "invalid capture index");
|
||||
return l;
|
||||
}
|
||||
@@ -204,14 +204,14 @@ static int capture_to_close (MatchState *ms) {
|
||||
static const char *classend (MatchState *ms, const char *p) {
|
||||
switch (*p++) {
|
||||
case L_ESC: {
|
||||
if (*p == '\0')
|
||||
if (l_unlikely(*p == '\0'))
|
||||
luaL_error(ms->L, "malformed pattern (ends with " LUA_QL("%%") ")");
|
||||
return p+1;
|
||||
}
|
||||
case '[': {
|
||||
if (*p == '^') p++;
|
||||
do { /* look for a `]' */
|
||||
if (*p == '\0')
|
||||
if (l_unlikely(*p == '\0'))
|
||||
luaL_error(ms->L, "malformed pattern (missing " LUA_QL("]") ")");
|
||||
if (*(p++) == L_ESC && *p != '\0')
|
||||
p++; /* skip escapes (e.g. `%]') */
|
||||
@@ -282,7 +282,7 @@ static const char *match (MatchState *ms, const char *s, const char *p);
|
||||
|
||||
static const char *matchbalance (MatchState *ms, const char *s,
|
||||
const char *p) {
|
||||
if (*p == 0 || *(p+1) == 0)
|
||||
if (l_unlikely(*p == 0 || *(p+1) == 0))
|
||||
luaL_error(ms->L, "unbalanced pattern");
|
||||
if (*s != *p) return NULL;
|
||||
else {
|
||||
@@ -332,7 +332,8 @@ static const char *start_capture (MatchState *ms, const char *s,
|
||||
const char *p, int what) {
|
||||
const char *res;
|
||||
int level = ms->level;
|
||||
if (level >= LUA_MAXCAPTURES) luaL_error(ms->L, "too many captures");
|
||||
if (l_unlikely(level >= LUA_MAXCAPTURES))
|
||||
luaL_error(ms->L, "too many captures");
|
||||
ms->capture[level].init = s;
|
||||
ms->capture[level].len = what;
|
||||
ms->level = level+1;
|
||||
@@ -386,7 +387,7 @@ static const char *match (MatchState *ms, const char *s, const char *p) {
|
||||
case 'f': { /* frontier? */
|
||||
const char *ep; char previous;
|
||||
p += 2;
|
||||
if (*p != '[')
|
||||
if (l_unlikely(*p != '['))
|
||||
luaL_error(ms->L, "missing " LUA_QL("[") " after "
|
||||
LUA_QL("%%f") " in pattern");
|
||||
ep = classend(ms, p); /* points to what is next */
|
||||
@@ -468,14 +469,15 @@ static const char *lmemfind (const char *s1, size_t l1,
|
||||
static void push_onecapture (MatchState *ms, int i, const char *s,
|
||||
const char *e) {
|
||||
if (i >= ms->level) {
|
||||
if (i == 0) /* ms->level == 0, too */
|
||||
if (l_likely(i == 0)) /* ms->level == 0, too */
|
||||
lua_pushlstring(ms->L, s, e - s); /* add whole match */
|
||||
else
|
||||
luaL_error(ms->L, "invalid capture index");
|
||||
}
|
||||
else {
|
||||
ptrdiff_t l = ms->capture[i].len;
|
||||
if (l == CAP_UNFINISHED) luaL_error(ms->L, "unfinished capture");
|
||||
if (l_unlikely(l == CAP_UNFINISHED))
|
||||
luaL_error(ms->L, "unfinished capture");
|
||||
if (l == CAP_POSITION)
|
||||
lua_pushinteger(ms->L, ms->capture[i].init - ms->src_init + 1);
|
||||
else
|
||||
@@ -637,7 +639,7 @@ static void add_value (MatchState *ms, luaL_Buffer *b, const char *s,
|
||||
lua_pop(L, 1);
|
||||
lua_pushlstring(L, s, e - s); /* keep original text */
|
||||
}
|
||||
else if (!lua_isstring(L, -1))
|
||||
else if (l_unlikely(!lua_isstring(L, -1)))
|
||||
luaL_error(L, "invalid replacement value (a %s)", luaL_typename(L, -1));
|
||||
luaL_addvalue(b); /* add result to accumulator */
|
||||
}
|
||||
@@ -727,7 +729,7 @@ static void addquoted (lua_State *L, luaL_Buffer *b, int arg) {
|
||||
static const char *scanformat (lua_State *L, const char *strfrmt, char *form) {
|
||||
const char *p = strfrmt;
|
||||
while (*p != '\0' && strchr(FLAGS, *p) != NULL) p++; /* skip flags */
|
||||
if ((size_t)(p - strfrmt) >= sizeof(FLAGS))
|
||||
if (l_unlikely((size_t)(p - strfrmt) >= sizeof(FLAGS)))
|
||||
luaL_error(L, "invalid format (repeated flags)");
|
||||
if (isdigit(uchar(*p))) p++; /* skip width */
|
||||
if (isdigit(uchar(*p))) p++; /* (2 digits at most) */
|
||||
@@ -736,7 +738,7 @@ static const char *scanformat (lua_State *L, const char *strfrmt, char *form) {
|
||||
if (isdigit(uchar(*p))) p++; /* skip precision */
|
||||
if (isdigit(uchar(*p))) p++; /* (2 digits at most) */
|
||||
}
|
||||
if (isdigit(uchar(*p)))
|
||||
if (l_unlikely(isdigit(uchar(*p))))
|
||||
luaL_error(L, "invalid format (width or precision too long)");
|
||||
*(form++) = '%';
|
||||
strncpy(form, strfrmt, p - strfrmt + 1);
|
||||
|
||||
+4
-3
@@ -278,7 +278,7 @@ static void setnodevector (lua_State *L, Table *t, int size) {
|
||||
else {
|
||||
int i;
|
||||
lsize = ceillog2(size);
|
||||
if (lsize > MAXBITS)
|
||||
if (l_unlikely(lsize > MAXBITS))
|
||||
luaG_runerror(L, "table overflow");
|
||||
size = twoto(lsize);
|
||||
t->node = luaM_newvector(L, size, Node);
|
||||
@@ -498,8 +498,9 @@ TValue *luaH_set (lua_State *L, Table *t, const TValue *key) {
|
||||
if (p != luaO_nilobject)
|
||||
return cast(TValue *, p);
|
||||
else {
|
||||
if (ttisnil(key)) luaG_runerror(L, "table index is nil");
|
||||
else if (ttisnumber(key) && luai_numisnan(nvalue(key)))
|
||||
if (l_unlikely(ttisnil(key)))
|
||||
luaG_runerror(L, "table index is nil");
|
||||
else if (l_unlikely(ttisnumber(key) && luai_numisnan(nvalue(key))))
|
||||
luaG_runerror(L, "table index is NaN");
|
||||
return newkey(L, t, key);
|
||||
}
|
||||
|
||||
+5
-3
@@ -134,7 +134,7 @@ static int tremove (lua_State *L) {
|
||||
|
||||
static void addfield (lua_State *L, luaL_Buffer *b, int i) {
|
||||
lua_rawgeti(L, 1, i);
|
||||
if (!lua_isstring(L, -1))
|
||||
if (l_unlikely(!lua_isstring(L, -1)))
|
||||
luaL_error(L, "invalid value (%s) at index %d in table for "
|
||||
LUA_QL("concat"), luaL_typename(L, -1), i);
|
||||
luaL_addvalue(b);
|
||||
@@ -224,12 +224,14 @@ static void auxsort (lua_State *L, int l, int u) {
|
||||
for (;;) { /* invariant: a[l..i] <= P <= a[j..u] */
|
||||
/* repeat ++i until a[i] >= P */
|
||||
while (lua_rawgeti(L, 1, ++i), sort_comp(L, -1, -2)) {
|
||||
if (i>u) luaL_error(L, "invalid order function for sorting");
|
||||
if (l_unlikely(i>u))
|
||||
luaL_error(L, "invalid order function for sorting");
|
||||
lua_pop(L, 1); /* remove a[i] */
|
||||
}
|
||||
/* repeat --j until a[j] <= P */
|
||||
while (lua_rawgeti(L, 1, --j), sort_comp(L, -3, -1)) {
|
||||
if (j<l) luaL_error(L, "invalid order function for sorting");
|
||||
if (l_unlikely(j<l))
|
||||
luaL_error(L, "invalid order function for sorting");
|
||||
lua_pop(L, 1); /* remove a[j] */
|
||||
}
|
||||
if (j<i) {
|
||||
|
||||
@@ -773,6 +773,23 @@ union luai_Cast { double l_d; long l_l; };
|
||||
|
||||
/* =================================================================== */
|
||||
|
||||
/*
|
||||
* * macros to improve jump prediction, used mostly for error handling
|
||||
** and debug facilities.
|
||||
*/
|
||||
#if !defined(l_likely)
|
||||
|
||||
#include <stdio.h>
|
||||
#if defined(__GNUC__)
|
||||
#define l_likely(x) (__builtin_expect(((x) != 0), 1))
|
||||
#define l_unlikely(x) (__builtin_expect(((x) != 0), 0))
|
||||
#else
|
||||
#define l_likely(x) (x)
|
||||
#define l_unlikely(x) (x)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Local configuration. You can use this space to add your redefinitions
|
||||
** without modifying the main part of the file.
|
||||
|
||||
+12
-11
@@ -119,7 +119,7 @@ void luaV_gettable (lua_State *L, TValue *t, TValue *key, StkId val) {
|
||||
}
|
||||
/* else will try the tag method */
|
||||
}
|
||||
else if (ttisnil(tm = luaT_gettmbyobj(L, t, TM_INDEX)))
|
||||
else if (l_unlikely(ttisnil(tm = luaT_gettmbyobj(L, t, TM_INDEX))))
|
||||
luaG_typeerror(L, t, "index");
|
||||
if (ttisfunction(tm)) {
|
||||
callTMres(L, val, tm, t, key);
|
||||
@@ -147,7 +147,7 @@ void luaV_settable (lua_State *L, TValue *t, TValue *key, StkId val) {
|
||||
}
|
||||
/* else will try the tag method */
|
||||
}
|
||||
else if (ttisnil(tm = luaT_gettmbyobj(L, t, TM_NEWINDEX)))
|
||||
else if (l_unlikely(ttisnil(tm = luaT_gettmbyobj(L, t, TM_NEWINDEX))))
|
||||
luaG_typeerror(L, t, "index");
|
||||
if (ttisfunction(tm)) {
|
||||
callTM(L, tm, t, key, val);
|
||||
@@ -293,7 +293,8 @@ void luaV_concat (lua_State *L, int total, int last) {
|
||||
/* collect total length */
|
||||
for (n = 1; n < total && tostring(L, top-n-1); n++) {
|
||||
size_t l = tsvalue(top-n-1)->len;
|
||||
if (l >= MAX_SIZET - tl) luaG_runerror(L, "string length overflow");
|
||||
if (l_unlikely(l >= MAX_SIZET - tl))
|
||||
luaG_runerror(L, "string length overflow");
|
||||
tl += l;
|
||||
}
|
||||
buffer = luaZ_openspace(L, &G(L)->buff, tl);
|
||||
@@ -322,8 +323,8 @@ static void Arith (lua_State *L, StkId ra, TValue *rb,
|
||||
case TM_ADD: setnvalue(ra, luai_numadd(nb, nc)); break;
|
||||
case TM_SUB: setnvalue(ra, luai_numsub(nb, nc)); break;
|
||||
case TM_MUL: setnvalue(ra, luai_nummul(nb, nc)); break;
|
||||
case TM_DIV: if (nc == 0) { luaG_runerror(L, "divide by zero error"); } else setnvalue(ra, luai_numdiv(nb, nc)); break;
|
||||
case TM_MOD: if (nc == 0) { luaG_runerror(L, "modulo by zero error"); } else setnvalue(ra, luai_nummod(nb, nc)); break;
|
||||
case TM_DIV: if (l_unlikely(nc == 0)) { luaG_runerror(L, "divide by zero error"); } else setnvalue(ra, luai_numdiv(nb, nc)); break;
|
||||
case TM_MOD: if (l_unlikely(nc == 0)) { luaG_runerror(L, "modulo by zero error"); } else setnvalue(ra, luai_nummod(nb, nc)); break;
|
||||
case TM_POW: setnvalue(ra, luai_numpow(nb, nc)); break;
|
||||
case TM_UNM: setnvalue(ra, luai_numunm(nb)); break;
|
||||
case TM_AND: setnvalue(ra, luai_numand(nb, nc)); break;
|
||||
@@ -491,7 +492,7 @@ void luaV_execute (lua_State *L, int nexeccalls) {
|
||||
TValue *rc = RKC(i);
|
||||
if (ttisnumber(rb) && ttisnumber(rc)) {
|
||||
lua_Number nb = nvalue(rb), nc = nvalue(rc);
|
||||
if (nc == 0) {
|
||||
if (l_unlikely(nc == 0)) {
|
||||
luaG_runerror(L, "divide by zero error");
|
||||
}
|
||||
else
|
||||
@@ -506,7 +507,7 @@ void luaV_execute (lua_State *L, int nexeccalls) {
|
||||
TValue *rc = RKC(i);
|
||||
if (ttisnumber(rb) && ttisnumber(rc)) {
|
||||
lua_Number nb = nvalue(rb), nc = nvalue(rc);
|
||||
if (nc == 0) {
|
||||
if (l_unlikely(nc == 0)) {
|
||||
luaG_runerror(L, "modulo by zero error");
|
||||
}
|
||||
else
|
||||
@@ -580,7 +581,7 @@ void luaV_execute (lua_State *L, int nexeccalls) {
|
||||
}
|
||||
default: { /* try metamethod */
|
||||
Protect(
|
||||
if (!call_binTM(L, rb, luaO_nilobject, ra, TM_LEN))
|
||||
if (l_unlikely(!call_binTM(L, rb, luaO_nilobject, ra, TM_LEN)))
|
||||
luaG_typeerror(L, rb, "get length of");
|
||||
)
|
||||
}
|
||||
@@ -724,11 +725,11 @@ void luaV_execute (lua_State *L, int nexeccalls) {
|
||||
const TValue *plimit = ra+1;
|
||||
const TValue *pstep = ra+2;
|
||||
L->savedpc = pc; /* next steps may throw errors */
|
||||
if (!tonumber(init, ra))
|
||||
if (l_unlikely(!tonumber(init, ra)))
|
||||
luaG_runerror(L, LUA_QL("for") " initial value must be a number");
|
||||
else if (!tonumber(plimit, ra+1))
|
||||
else if (l_unlikely(!tonumber(plimit, ra+1)))
|
||||
luaG_runerror(L, LUA_QL("for") " limit must be a number");
|
||||
else if (!tonumber(pstep, ra+2))
|
||||
else if (l_unlikely(!tonumber(pstep, ra+2)))
|
||||
luaG_runerror(L, LUA_QL("for") " step must be a number");
|
||||
if (ra && pstep)
|
||||
setnvalue(ra, luai_numsub(nvalue(ra), nvalue(pstep)));
|
||||
|
||||
+11
-140
@@ -90,9 +90,12 @@ char motd[254], server_context[8]; // Message of the Day, Unique Context (even w
|
||||
plrinfo playerinfo[MAXPLAYERS];
|
||||
SINT8 joinnode = 0; // used for CL_VIEWSERVER
|
||||
|
||||
boolean player_muted[MAXPLAYERS] = {0};
|
||||
|
||||
// Server specific vars
|
||||
UINT8 playernode[MAXPLAYERS];
|
||||
|
||||
|
||||
// Minimum timeout for sending the savegame
|
||||
// The actual timeout will be longer depending on the savegame length
|
||||
tic_t jointimeout = (3*TICRATE);
|
||||
@@ -567,58 +570,7 @@ void SendKick(UINT8 playernum, UINT8 msg)
|
||||
// end of extra data function
|
||||
// -----------------------------------------------------------------
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
// extra data function for lmps
|
||||
// -----------------------------------------------------------------
|
||||
|
||||
// if extradatabit is set, after the ziped tic you find this:
|
||||
//
|
||||
// type | description
|
||||
// ---------+--------------
|
||||
// byte | size of the extradata
|
||||
// byte | the extradata (xd) bits: see XD_...
|
||||
// with this byte you know what parameter folow
|
||||
// if (xd & XDNAMEANDCOLOR)
|
||||
// byte | color
|
||||
// char[MAXPLAYERNAME] | name of the player
|
||||
// endif
|
||||
// if (xd & XD_WEAPON_PREF)
|
||||
// byte | original weapon switch: boolean, true if use the old
|
||||
// | weapon switch methode
|
||||
// char[NUMWEAPONS] | the weapon switch priority
|
||||
// byte | autoaim: true if use the old autoaim system
|
||||
// endif
|
||||
/*boolean AddLmpExtradata(UINT8 **demo_point, INT32 playernum)
|
||||
{
|
||||
UINT8 *textcmd = D_GetExistingTextcmd(gametic, playernum);
|
||||
|
||||
if (!textcmd)
|
||||
return false;
|
||||
|
||||
M_Memcpy(*demo_point, textcmd, textcmd[0]+1);
|
||||
*demo_point += textcmd[0]+1;
|
||||
return true;
|
||||
}
|
||||
|
||||
void ReadLmpExtraData(UINT8 **demo_pointer, INT32 playernum)
|
||||
{
|
||||
UINT8 nextra;
|
||||
UINT8 *textcmd;
|
||||
|
||||
if (!demo_pointer)
|
||||
return;
|
||||
|
||||
textcmd = D_GetTextcmd(gametic, playernum);
|
||||
nextra = **demo_pointer;
|
||||
M_Memcpy(textcmd, *demo_pointer, nextra + 1);
|
||||
// increment demo pointer
|
||||
*demo_pointer += nextra + 1;
|
||||
}*/
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
// end extra data function for lmps
|
||||
// -----------------------------------------------------------------
|
||||
|
||||
// can we get rid of this finally lmao
|
||||
// -----------------------------------------------------------------
|
||||
// resynch player data
|
||||
// -----------------------------------------------------------------
|
||||
@@ -1580,70 +1532,6 @@ static boolean CL_SendJoin(void)
|
||||
return HSendPacket(servernode, false, 0, sizeof (clientconfig_pak));
|
||||
}
|
||||
|
||||
static void
|
||||
CopyCaretColors (char *p, const char *s, int n)
|
||||
{
|
||||
char *t;
|
||||
int m;
|
||||
int c;
|
||||
if (!n)
|
||||
return;
|
||||
while (( t = strchr(s, '^') ))
|
||||
{
|
||||
m = ( t - s );
|
||||
|
||||
if (m >= n)
|
||||
{
|
||||
memcpy(p, s, n);
|
||||
return;
|
||||
}
|
||||
else
|
||||
memcpy(p, s, m);
|
||||
|
||||
p += m;
|
||||
n -= m;
|
||||
s += m;
|
||||
|
||||
if (!n)
|
||||
return;
|
||||
|
||||
if (s[1])
|
||||
{
|
||||
c = toupper(s[1]);
|
||||
if (isdigit(c))
|
||||
c = 0x80 + ( c - '0' );
|
||||
else if (c >= 'A' && c <= 'F')
|
||||
c = 0x80 + ( c - 'A' );
|
||||
else
|
||||
c = 0;
|
||||
|
||||
if (c)
|
||||
{
|
||||
*p++ = c;
|
||||
n--;
|
||||
|
||||
if (!n)
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (n < 2)
|
||||
break;
|
||||
|
||||
memcpy(p, s, 2);
|
||||
|
||||
p += 2;
|
||||
n -= 2;
|
||||
}
|
||||
|
||||
s += 2;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
strncpy(p, s, n);
|
||||
}
|
||||
|
||||
static void SV_SendServerInfo(INT32 node, tic_t servertime)
|
||||
{
|
||||
UINT8 *p;
|
||||
@@ -2126,7 +2014,7 @@ static void CL_ReloadReceivedSavegame(void)
|
||||
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
camera[i].subsector = R_PointInSubsector(camera[i].x, camera[i].y);
|
||||
camera[i].subsector = R_PointInSubsectorFast(camera[i].x, camera[i].y);
|
||||
}
|
||||
|
||||
cl_redownloadinggamestate = false;
|
||||
@@ -3488,6 +3376,8 @@ void CL_Reset(void)
|
||||
#endif
|
||||
G_ResetAllDeviceRumbles();
|
||||
|
||||
memset(player_muted, 0, sizeof(player_muted));
|
||||
|
||||
// D_StartTitle should get done now, but the calling function will handle it
|
||||
}
|
||||
|
||||
@@ -3508,31 +3398,12 @@ static void Command_GetPlayerNum(void)
|
||||
|
||||
SINT8 nametonum(const char *name)
|
||||
{
|
||||
INT32 playernum, i;
|
||||
INT32 playernum = D_LookupPlayer(name);
|
||||
|
||||
if (!strcmp(name, "0"))
|
||||
return 0;
|
||||
if (playernum == -1)
|
||||
CONS_Printf(M_GetText("There is no player named \"%s\"\n"), name);
|
||||
|
||||
playernum = (SINT8)atoi(name);
|
||||
|
||||
if (playernum < 0 || playernum >= MAXPLAYERS)
|
||||
return -1;
|
||||
|
||||
if (playernum)
|
||||
{
|
||||
if (playeringame[playernum])
|
||||
return (SINT8)playernum;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
if (playeringame[i] && !stricmp(player_names[i], name))
|
||||
return (SINT8)i;
|
||||
|
||||
CONS_Printf(M_GetText("There is no player named \"%s\"\n"), name);
|
||||
|
||||
return -1;
|
||||
return playernum;
|
||||
}
|
||||
|
||||
/** Lists all players and their player numbers.
|
||||
|
||||
@@ -671,6 +671,8 @@ SINT8 nametonum(const char *name);
|
||||
extern char motd[254], server_context[8];
|
||||
extern UINT8 playernode[MAXPLAYERS];
|
||||
|
||||
extern boolean player_muted[MAXPLAYERS];
|
||||
|
||||
INT32 D_NumPlayers(void);
|
||||
|
||||
void D_ResetTiccmds(void);
|
||||
|
||||
+1
-1
@@ -1478,7 +1478,7 @@ static void D_CheckSaturnExtraFiles(void)
|
||||
}
|
||||
|
||||
// extra round joystick inputdisplay sprites
|
||||
if (W_CheckMultipleLumps("JOYBCK","JOYKNB","JOYSHD", NULL))
|
||||
if (W_CheckMultipleLumps("JOYBCK", "JOYKNB", "JOYSHD", NULL))
|
||||
{
|
||||
joystickicon = true;
|
||||
PUSHCONS(inputdisplay_cons_temp, last_inputdisplay_i, 3, "StickGFX");
|
||||
|
||||
+4
-4
@@ -1026,6 +1026,7 @@ void D_RegisterClientCommands(void)
|
||||
CV_RegisterVar(&cv_scr_height);
|
||||
|
||||
CV_RegisterVar(&cv_parallelsoftware);
|
||||
CV_RegisterVar(&cv_paralleldrawmasked);
|
||||
|
||||
CV_RegisterVar(&cv_soundtest);
|
||||
|
||||
@@ -2082,7 +2083,7 @@ static void Command_ResetCamera_f(void)
|
||||
}
|
||||
|
||||
/* Consider replacing nametonum with this */
|
||||
static INT32 LookupPlayer(const char *s)
|
||||
INT32 D_LookupPlayer(const char *s)
|
||||
{
|
||||
INT32 playernum;
|
||||
|
||||
@@ -2098,8 +2099,7 @@ static INT32 LookupPlayer(const char *s)
|
||||
for (playernum = 0; playernum < MAXPLAYERS; ++playernum)
|
||||
{
|
||||
/* Match name case-insensitively: fully, or partially the start. */
|
||||
if (playeringame[playernum])
|
||||
if (strnicmp(player_names[playernum], s, strlen(s)) == 0)
|
||||
if (playeringame[playernum] && (strnicmp(player_names[playernum], s, strlen(s)) == 0))
|
||||
{
|
||||
return playernum;
|
||||
}
|
||||
@@ -2210,7 +2210,7 @@ static void Command_View_f(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (( playernum = LookupPlayer(COM_Argv(1)) ) == -1)
|
||||
if (( playernum = D_LookupPlayer(COM_Argv(1)) ) == -1)
|
||||
{
|
||||
CONS_Alert(CONS_WARNING, "There is no player by that name!\n");
|
||||
return;
|
||||
|
||||
@@ -323,6 +323,7 @@ void ClearAdminPlayers(void);
|
||||
void RemoveAdminPlayer(INT32 playernum);
|
||||
void ItemFinder_OnChange(void);
|
||||
void D_SetPassword(const char *pw);
|
||||
INT32 D_LookupPlayer(const char *s);
|
||||
|
||||
// used for the player setup menu
|
||||
UINT8 CanChangeSkin(INT32 playernum);
|
||||
|
||||
+13
-13
@@ -446,19 +446,19 @@ extern UINT16 spacetimetics;
|
||||
extern UINT16 extralifetics;
|
||||
|
||||
// SRB2kart
|
||||
extern tic_t introtime;
|
||||
extern tic_t starttime;
|
||||
extern tic_t raceexittime;
|
||||
extern tic_t battleexittime;
|
||||
extern INT32 hyudorotime;
|
||||
extern INT32 stealtime;
|
||||
extern INT32 sneakertime;
|
||||
extern INT32 itemtime;
|
||||
extern INT32 comebacktime;
|
||||
extern INT32 bumptime;
|
||||
extern INT32 wipeoutslowtime;
|
||||
extern INT32 wantedreduce;
|
||||
extern INT32 wantedfrequency;
|
||||
extern const tic_t introtime;
|
||||
extern const tic_t starttime;
|
||||
extern const tic_t raceexittime;
|
||||
extern const tic_t battleexittime;
|
||||
extern const INT32 hyudorotime;
|
||||
extern const INT32 stealtime;
|
||||
extern const INT32 sneakertime;
|
||||
extern const INT32 itemtime;
|
||||
extern const INT32 comebacktime;
|
||||
extern const INT32 bumptime;
|
||||
extern const INT32 wipeoutslowtime;
|
||||
extern const INT32 wantedreduce;
|
||||
extern const INT32 wantedfrequency;
|
||||
|
||||
extern UINT8 introtoplay;
|
||||
extern UINT8 creditscutscene;
|
||||
|
||||
@@ -540,6 +540,8 @@ static const char *credits[] = {
|
||||
"\"Jin\"",
|
||||
"\"riomccloud\"",
|
||||
"\"chromaticpipe\"",
|
||||
"\"PAS\"",
|
||||
"\"$HOME\"",
|
||||
"\"Achii\"",
|
||||
"\"Anonimus\"",
|
||||
"\"scizor300\"",
|
||||
|
||||
+13
-13
@@ -196,19 +196,19 @@ UINT16 spacetimetics = 11*TICRATE + (TICRATE/2);
|
||||
UINT16 extralifetics = 4*TICRATE;
|
||||
|
||||
// SRB2kart
|
||||
tic_t introtime = 108+5; // plus 5 for white fade
|
||||
tic_t starttime = 6*TICRATE + (3*TICRATE/4);
|
||||
tic_t raceexittime = 5*TICRATE + (2*TICRATE/3);
|
||||
tic_t battleexittime = 8*TICRATE;
|
||||
INT32 hyudorotime = 7*TICRATE;
|
||||
INT32 stealtime = TICRATE/2;
|
||||
INT32 sneakertime = TICRATE + (TICRATE/3);
|
||||
INT32 itemtime = 8*TICRATE;
|
||||
INT32 comebacktime = 10*TICRATE;
|
||||
INT32 bumptime = 6;
|
||||
INT32 wipeoutslowtime = 20;
|
||||
INT32 wantedreduce = 5*TICRATE;
|
||||
INT32 wantedfrequency = 10*TICRATE;
|
||||
const tic_t introtime = 108+5; // plus 5 for white fade
|
||||
const tic_t starttime = 6*TICRATE + (3*TICRATE/4);
|
||||
const tic_t raceexittime = 5*TICRATE + (2*TICRATE/3);
|
||||
const tic_t battleexittime = 8*TICRATE;
|
||||
const INT32 hyudorotime = 7*TICRATE;
|
||||
const INT32 stealtime = TICRATE/2;
|
||||
const INT32 sneakertime = TICRATE + (TICRATE/3);
|
||||
const INT32 itemtime = 8*TICRATE;
|
||||
const INT32 comebacktime = 10*TICRATE;
|
||||
const INT32 bumptime = 6;
|
||||
const INT32 wipeoutslowtime = 20;
|
||||
const INT32 wantedreduce = 5*TICRATE;
|
||||
const INT32 wantedfrequency = 10*TICRATE;
|
||||
|
||||
INT32 gameovertics = 15*TICRATE;
|
||||
|
||||
|
||||
+2665
-612
File diff suppressed because it is too large.
Load diff
@@ -121,7 +121,7 @@ static clipnode_t * gld_clipnode_NewRange(angle_t start, angle_t end)
|
||||
|
||||
boolean gld_clipper_SafeCheckRange(angle_t startAngle, angle_t endAngle)
|
||||
{
|
||||
if(startAngle > endAngle)
|
||||
if (startAngle > endAngle)
|
||||
{
|
||||
return (gld_clipper_IsRangeVisible(startAngle, ANGLE_MAX) || gld_clipper_IsRangeVisible(0, endAngle));
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ typedef struct
|
||||
typedef struct
|
||||
{
|
||||
poly_t *planepoly; // the generated convex polygon
|
||||
} extrasubsector_t;
|
||||
} poly_subsector_t;
|
||||
|
||||
// Vanilla features
|
||||
//#define USE_MODEL_NEXTFRAME
|
||||
|
||||
@@ -52,10 +52,11 @@ void HWR_ObjectLightLevelPost(gl_vissprite_t *spr, const sector_t *sector, INT32
|
||||
// --------
|
||||
// hw_bsp.c
|
||||
// --------
|
||||
extern extrasubsector_t *extrasubsectors;
|
||||
extern size_t addsubsector;
|
||||
extern poly_subsector_t *poly_subsectors;
|
||||
extern size_t num_poly_subsector;
|
||||
|
||||
void HWR_FreeExtraSubsectors(void);
|
||||
void HWR_Init_PolyPool(void);
|
||||
void HWR_Free_PolyPool(void);
|
||||
|
||||
// --------
|
||||
// hw_cache.c
|
||||
|
||||
+138
-112
@@ -128,7 +128,7 @@ ps_metric_t ps_hw_batchdrawtime = {};
|
||||
static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum, boolean noencore, FSurfaceInfo* Surf, INT32 cutflag, ffloor_t *pfloor, FBITFIELD polyflags);
|
||||
static void HWR_RenderWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, FBITFIELD blend, boolean fogwall, INT32 lightlevel, extracolormap_t *wallcolormap);
|
||||
|
||||
static void HWR_AddTransparentFloor(lumpnum_t lumpnum, extrasubsector_t *xsub, boolean isceiling, fixed_t fixedheight, INT32 lightlevel, INT32 alpha, sector_t *FOFSector, FBITFIELD blend, boolean fogplane, extracolormap_t *planecolormap);
|
||||
static void HWR_AddTransparentFloor(lumpnum_t lumpnum, poly_subsector_t *xsub, boolean isceiling, fixed_t fixedheight, INT32 lightlevel, INT32 alpha, sector_t *FOFSector, FBITFIELD blend, boolean fogplane, extracolormap_t *planecolormap);
|
||||
static void HWR_AddTransparentWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, INT32 texnum, boolean noencore, FBITFIELD blend, boolean fogwall, INT32 lightlevel, extracolormap_t *wallcolormap);
|
||||
static void HWR_AddTransparentPolyobjectFloor(lumpnum_t lumpnum, polyobj_t *polysector, boolean isceiling, fixed_t fixedheight, INT32 lightlevel, INT32 alpha, sector_t *FOFSector, FBITFIELD blend, extracolormap_t *planecolormap);
|
||||
|
||||
@@ -226,6 +226,17 @@ consvar_t cv_glanisotropicmode = {"gr_anisotropicmode", "1", CV_CALL|CV_SAVE, gl
|
||||
|
||||
consvar_t cv_glsolvetjoin = {"gr_solvetjoin", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_glpolytile = {"gr_polytile", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
CV_PossibleValue_t grpolyshape_cons_t[] = {
|
||||
{0, "Subsector"},
|
||||
{1, "Fat"},
|
||||
{2, "Trim"},
|
||||
{3, "NotConvex"},
|
||||
{0, NULL}
|
||||
};
|
||||
consvar_t cv_glpolyshape = {"gr_polygon_shape", "Trim", CV_SAVE, grpolyshape_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_glbatching = {"gr_batching", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_glwireframe = {"gr_wireframe", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
@@ -532,7 +543,7 @@ static FUINT HWR_CalcSlopeLight(FUINT lightnum, pslope_t *slope, const sector_t
|
||||
|
||||
// HWR_RenderPlane
|
||||
// Render a floor or ceiling convex polygon
|
||||
static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, boolean isceiling, fixed_t fixedheight, FBITFIELD PolyFlags, INT32 lightlevel, lumpnum_t lumpnum, sector_t *FOFsector, UINT8 alpha, extracolormap_t *planecolormap)
|
||||
static void HWR_RenderPlane(subsector_t *subsector, poly_subsector_t *xsub, boolean isceiling, fixed_t fixedheight, FBITFIELD PolyFlags, INT32 lightlevel, lumpnum_t lumpnum, sector_t *FOFsector, UINT8 alpha, extracolormap_t *planecolormap)
|
||||
{
|
||||
FSurfaceInfo Surf;
|
||||
FOutVector *v3d;
|
||||
@@ -746,7 +757,8 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
|
||||
|
||||
for (i = 0; i < subsector->numlines; i++, line++)
|
||||
{
|
||||
if (line->linedef->special != HORIZONSPECIAL)
|
||||
// this check sucks and is a hotspot lel
|
||||
if (LIKELY(line->linedef->special != HORIZONSPECIAL))
|
||||
continue;
|
||||
|
||||
if (R_PointOnSegSide(viewx, viewy, line) != 0)
|
||||
@@ -762,8 +774,7 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
|
||||
}
|
||||
else
|
||||
{
|
||||
x1 = FixedToFloat(line->v1->x);
|
||||
y1 = FixedToFloat(line->v1->x);
|
||||
x1 = y1 = FixedToFloat(line->v1->x);
|
||||
}
|
||||
|
||||
if (line->pv2)
|
||||
@@ -1049,7 +1060,7 @@ static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum,
|
||||
if ((endtop < endrealbot) && (top < realbot))
|
||||
return;
|
||||
|
||||
lightlist_t *list = sector->lightlist;
|
||||
const lightlist_t *list = sector->lightlist;
|
||||
|
||||
if (!(list[i].flags & FF_NOSHADE))
|
||||
{
|
||||
@@ -1387,9 +1398,9 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
wallVerts[2].z = wallVerts[1].z = ve.y;
|
||||
|
||||
// x offset the texture
|
||||
fixed_t texturehpeg = gl_sidedef->textureoffset + gl_curline->offset;
|
||||
float cliplow = (float)texturehpeg;
|
||||
float cliphigh = (float)(texturehpeg + (gl_curline->flength*FRACUNIT));
|
||||
const fixed_t texturehpeg = gl_sidedef->textureoffset + gl_curline->offset;
|
||||
const float cliplow = (float)texturehpeg;
|
||||
const float cliphigh = (float)(texturehpeg + (gl_curline->flength*FRACUNIT));
|
||||
|
||||
FUINT lightnum = gl_frontsector->lightlevel;
|
||||
extracolormap_t *colormap = gl_frontsector->extra_colormap;
|
||||
@@ -1400,7 +1411,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
if (gl_frontsector)
|
||||
Surf.PolyColor.s.alpha = 255;
|
||||
|
||||
INT32 gl_midtexture = R_GetTextureNum(gl_sidedef->midtexture);
|
||||
const INT32 gl_midtexture = R_GetTextureNum(gl_sidedef->midtexture);
|
||||
GLMapTexture_t *glTex = NULL;
|
||||
|
||||
// two sided line
|
||||
@@ -1678,7 +1689,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
}
|
||||
|
||||
// Find the wall's coordinates
|
||||
fixed_t midtexheight = textureheight[gl_midtexture] * repeats;
|
||||
const fixed_t midtexheight = textureheight[gl_midtexture] * repeats;
|
||||
|
||||
if (gl_linedef->flags & ML_EFFECT2)
|
||||
{
|
||||
@@ -2004,6 +2015,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
wallVerts[0].s = wallVerts[3].s = cliplow * glTex->scaleX;
|
||||
wallVerts[2].s = wallVerts[1].s = cliphigh * glTex->scaleX;
|
||||
}
|
||||
|
||||
FBITFIELD blendmode;
|
||||
|
||||
if (roverflags & FF_FOG)
|
||||
@@ -2759,7 +2771,7 @@ static void HWR_AddPolyObjectPlanes(void)
|
||||
sector_t *polyobjsector;
|
||||
INT32 light = 0;
|
||||
|
||||
// Polyobject Planes need their own function for drawing because they don't have extrasubsectors by themselves
|
||||
// Polyobject Planes need their own function for drawing because they don't have poly_subsectors by themselves
|
||||
// It should be okay because polyobjects should always be convex anyway
|
||||
|
||||
for (i = 0; i < numpolys; i++)
|
||||
@@ -2889,9 +2901,9 @@ static void HWR_Subsector(size_t num)
|
||||
ffloor_t *rover;
|
||||
|
||||
#ifdef PARANOIA //no risk while developing, enough debugging nights!
|
||||
if (num >= addsubsector)
|
||||
if (num >= num_poly_subsector)
|
||||
I_Error("HWR_Subsector: ss %s with numss = %s, addss = %s\n",
|
||||
sizeu1(num), sizeu2(numsubsectors), sizeu3(addsubsector));
|
||||
sizeu1(num), sizeu2(numsubsectors), sizeu3(num_poly_subsector));
|
||||
#endif
|
||||
|
||||
if (num < numsubsectors)
|
||||
@@ -2985,7 +2997,7 @@ static void HWR_Subsector(size_t num)
|
||||
if (sub->validcount != validcount)
|
||||
{
|
||||
HWR_GetFlat(levelflats[gl_frontsector->floorpic].lumpnum, R_NoEncore(gl_frontsector, false));
|
||||
HWR_RenderPlane(sub, &extrasubsectors[num], false,
|
||||
HWR_RenderPlane(sub, &poly_subsectors[num], false,
|
||||
// Hack to make things continue to work around slopes.
|
||||
locFloorHeight == cullFloorHeight ? locFloorHeight : gl_frontsector->floorheight,
|
||||
// We now return you to your regularly scheduled rendering.
|
||||
@@ -3001,7 +3013,7 @@ static void HWR_Subsector(size_t num)
|
||||
if (sub->validcount != validcount)
|
||||
{
|
||||
HWR_GetFlat(levelflats[gl_frontsector->ceilingpic].lumpnum, R_NoEncore(gl_frontsector, true));
|
||||
HWR_RenderPlane(sub, &extrasubsectors[num], true,
|
||||
HWR_RenderPlane(sub, &poly_subsectors[num], true,
|
||||
// Hack to make things continue to work around slopes.
|
||||
locCeilingHeight == cullCeilingHeight ? locCeilingHeight : gl_frontsector->ceilingheight,
|
||||
// We now return you to your regularly scheduled rendering.
|
||||
@@ -3049,7 +3061,7 @@ static void HWR_Subsector(size_t num)
|
||||
alpha = HWR_FogBlockAlpha(*gl_frontsector->lightlist[light].lightlevel, rover->master->frontsector->extra_colormap);
|
||||
|
||||
HWR_AddTransparentFloor(0,
|
||||
&extrasubsectors[num],
|
||||
&poly_subsectors[num],
|
||||
false,
|
||||
*rover->bottomheight,
|
||||
*gl_frontsector->lightlist[light].lightlevel,
|
||||
@@ -3061,7 +3073,7 @@ static void HWR_Subsector(size_t num)
|
||||
light = R_GetPlaneLight(gl_frontsector, centerHeight, (viewz < bottomCullHeight));
|
||||
|
||||
HWR_AddTransparentFloor(levelflats[*rover->bottompic].lumpnum,
|
||||
&extrasubsectors[num],
|
||||
&poly_subsectors[num],
|
||||
false,
|
||||
*rover->bottomheight,
|
||||
*gl_frontsector->lightlist[light].lightlevel,
|
||||
@@ -3073,7 +3085,7 @@ static void HWR_Subsector(size_t num)
|
||||
HWR_GetFlat(levelflats[*rover->bottompic].lumpnum, R_NoEncore(gl_frontsector, false));
|
||||
light = R_GetPlaneLight(gl_frontsector, centerHeight, (viewz < bottomCullHeight));
|
||||
|
||||
HWR_RenderPlane(sub, &extrasubsectors[num], false, *rover->bottomheight, HWR_RippleBlend(gl_frontsector, rover, false)|PF_Occlude, *gl_frontsector->lightlist[light].lightlevel, levelflats[*rover->bottompic].lumpnum,
|
||||
HWR_RenderPlane(sub, &poly_subsectors[num], false, *rover->bottomheight, HWR_RippleBlend(gl_frontsector, rover, false)|PF_Occlude, *gl_frontsector->lightlist[light].lightlevel, levelflats[*rover->bottompic].lumpnum,
|
||||
rover->master->frontsector, 255, gl_frontsector->lightlist[light].extra_colormap);
|
||||
}
|
||||
}
|
||||
@@ -3095,7 +3107,7 @@ static void HWR_Subsector(size_t num)
|
||||
alpha = HWR_FogBlockAlpha(*gl_frontsector->lightlist[light].lightlevel, rover->master->frontsector->extra_colormap);
|
||||
|
||||
HWR_AddTransparentFloor(0,
|
||||
&extrasubsectors[num],
|
||||
&poly_subsectors[num],
|
||||
true,
|
||||
*rover->topheight,
|
||||
*gl_frontsector->lightlist[light].lightlevel,
|
||||
@@ -3107,7 +3119,7 @@ static void HWR_Subsector(size_t num)
|
||||
light = R_GetPlaneLight(gl_frontsector, centerHeight, (viewz < topCullHeight));
|
||||
|
||||
HWR_AddTransparentFloor(levelflats[*rover->toppic].lumpnum,
|
||||
&extrasubsectors[num],
|
||||
&poly_subsectors[num],
|
||||
true,
|
||||
*rover->topheight,
|
||||
*gl_frontsector->lightlist[light].lightlevel,
|
||||
@@ -3119,7 +3131,7 @@ static void HWR_Subsector(size_t num)
|
||||
HWR_GetFlat(levelflats[*rover->toppic].lumpnum, R_NoEncore(gl_frontsector, true));
|
||||
light = R_GetPlaneLight(gl_frontsector, centerHeight, (viewz < topCullHeight));
|
||||
|
||||
HWR_RenderPlane(sub, &extrasubsectors[num], true, *rover->topheight, HWR_RippleBlend(gl_frontsector, rover, false)|PF_Occlude, *gl_frontsector->lightlist[light].lightlevel, levelflats[*rover->toppic].lumpnum,
|
||||
HWR_RenderPlane(sub, &poly_subsectors[num], true, *rover->topheight, HWR_RippleBlend(gl_frontsector, rover, false)|PF_Occlude, *gl_frontsector->lightlist[light].lightlevel, levelflats[*rover->toppic].lumpnum,
|
||||
rover->master->frontsector, 255, gl_frontsector->lightlist[light].extra_colormap);
|
||||
}
|
||||
}
|
||||
@@ -3296,7 +3308,7 @@ static gl_vissprite_t gl_overflowsprite;
|
||||
|
||||
static gl_vissprite_t *HWR_GetVisSprite(UINT32 num)
|
||||
{
|
||||
UINT32 chunk = num >> VISSPRITECHUNKBITS;
|
||||
const UINT32 chunk = num >> VISSPRITECHUNKBITS;
|
||||
|
||||
// Allocate chunk if necessary
|
||||
if (!gl_visspritechunks[chunk])
|
||||
@@ -3316,7 +3328,7 @@ static gl_vissprite_t *HWR_NewVisSprite(void)
|
||||
// Finds a floor through which light does not pass.
|
||||
static fixed_t HWR_OpaqueFloorAtPos(fixed_t x, fixed_t y, fixed_t z, fixed_t height)
|
||||
{
|
||||
const sector_t *sec = R_PointInSubsector(x, y)->sector;
|
||||
const sector_t *sec = R_PointInSubsectorFast(x, y)->sector;
|
||||
fixed_t floorz = sec->floorheight;
|
||||
|
||||
if (sec->ffloors)
|
||||
@@ -3358,13 +3370,6 @@ static void HWR_DrawSpriteShadow(gl_vissprite_t *spr, patch_t *gpatch, GLPatch_t
|
||||
fixed_t slopez;
|
||||
float offset = 0;
|
||||
|
||||
// technically this_scale gets multiplied and added to sprite y/x scale, but this thing needs it for some crap so ill just throw it in here again
|
||||
const boolean hires = (spr->mobj && spr->mobj->skin && K_GetMobjSkin(spr->mobj)->flags & SF_HIRES);
|
||||
if (spr->mobj)
|
||||
this_scale = FixedToFloat(spr->mobj->scale);
|
||||
if (hires)
|
||||
this_scale = this_scale * FixedToFloat(K_GetMobjSkin(spr->mobj)->highresscale);
|
||||
|
||||
R_GetShadowZ(spr->mobj, &floorslope);
|
||||
|
||||
mobjfloor = HWR_OpaqueFloorAtPos(
|
||||
@@ -3415,6 +3420,14 @@ static void HWR_DrawSpriteShadow(gl_vissprite_t *spr, patch_t *gpatch, GLPatch_t
|
||||
else
|
||||
floorheight = FixedInt(spr->mobj->z - mobjfloor);
|
||||
|
||||
// technically this_scale gets multiplied and added to sprite y/x scale, but this thing needs it for some crap so ill just throw it in here again
|
||||
const boolean hires = (spr->mobj && spr->mobj->skin && K_GetMobjSkin(spr->mobj)->flags & SF_HIRES);
|
||||
|
||||
if (spr->mobj)
|
||||
this_scale = FixedToFloat(spr->mobj->scale);
|
||||
if (hires)
|
||||
this_scale = this_scale * FixedToFloat(K_GetMobjSkin(spr->mobj)->highresscale);
|
||||
|
||||
// create the sprite billboard
|
||||
//
|
||||
// 3--2
|
||||
@@ -3732,6 +3745,9 @@ static void HWR_SplitSprite(gl_vissprite_t *spr, const boolean papersprite)
|
||||
blend = HWR_GetBlendModeFlag(blendmode)|PF_Occlude;
|
||||
}
|
||||
|
||||
if (cv_playerfade.value && spr->mobj->player)
|
||||
Surf.PolyColor.s.alpha = FixedMul(R_DoPlayerFade(spr->mobj), Surf.PolyColor.s.alpha);
|
||||
|
||||
if (HWR_UseShader())
|
||||
{
|
||||
shader = SHADER_SPRITE;
|
||||
@@ -3886,11 +3902,13 @@ static void HWR_DrawSprite(gl_vissprite_t *spr)
|
||||
|
||||
INT32 shader = SHADER_NONE;
|
||||
|
||||
if (!spr->mobj || !spr->mobj->subsector)
|
||||
const mobj_t *sprmo = spr->mobj;
|
||||
|
||||
if (UNLIKELY(!sprmo || !sprmo->subsector))
|
||||
return;
|
||||
|
||||
const boolean papersprite = (spr->mobj->frame & FF_PAPERSPRITE);
|
||||
const sector_t *sector = spr->mobj->subsector->sector;
|
||||
const boolean papersprite = (sprmo->frame & FF_PAPERSPRITE);
|
||||
const sector_t *sector = sprmo->subsector->sector;
|
||||
|
||||
if (sector->numlights)
|
||||
{
|
||||
@@ -3956,9 +3974,9 @@ static void HWR_DrawSprite(gl_vissprite_t *spr)
|
||||
|
||||
// Draw shadow BEFORE sprite
|
||||
if (UNLIKELY(cv_shadow.value // Shadows enabled
|
||||
&& (spr->mobj->flags & (MF_SCENERY|MF_SPAWNCEILING|MF_NOGRAVITY)) != (MF_SCENERY|MF_SPAWNCEILING|MF_NOGRAVITY) // Ceiling scenery have no shadow.
|
||||
&& !(spr->mobj->flags2 & MF2_DEBRIS) // Debris have no corona or shadow.
|
||||
&& (spr->mobj->z >= spr->mobj->floorz))) // Without this, your shadow shows on the floor, even after you die and fall through the ground.
|
||||
&& (sprmo->flags & (MF_SCENERY|MF_SPAWNCEILING|MF_NOGRAVITY)) != (MF_SCENERY|MF_SPAWNCEILING|MF_NOGRAVITY) // Ceiling scenery have no shadow.
|
||||
&& !(sprmo->flags2 & MF2_DEBRIS) // Debris have no corona or shadow.
|
||||
&& (sprmo->z >= sprmo->floorz))) // Without this, your shadow shows on the floor, even after you die and fall through the ground.
|
||||
{
|
||||
////////////////////
|
||||
// SHADOW SPRITE! //
|
||||
@@ -3988,24 +4006,24 @@ static void HWR_DrawSprite(gl_vissprite_t *spr)
|
||||
HWR_Lighting(&Surf, lightlevel, colormap, P_SectorUsesDirectionalLighting(sector) && !fullbright);
|
||||
|
||||
INT32 blendmode;
|
||||
if (spr->mobj->frame & FF_BLENDMASK)
|
||||
blendmode = ((spr->mobj->frame & FF_BLENDMASK) >> FF_BLENDSHIFT) + 1;
|
||||
if (sprmo->frame & FF_BLENDMASK)
|
||||
blendmode = ((sprmo->frame & FF_BLENDMASK) >> FF_BLENDSHIFT) + 1;
|
||||
else
|
||||
blendmode = spr->mobj->blendmode;
|
||||
blendmode = sprmo->blendmode;
|
||||
|
||||
if (UNLIKELY(!cv_translucency.value)) // translucency disabled
|
||||
{
|
||||
Surf.PolyColor.s.alpha = 0xFF;
|
||||
blend = PF_Translucent|PF_Occlude;
|
||||
}
|
||||
else if (spr->mobj->flags2 & MF2_SHADOW)
|
||||
else if (sprmo->flags2 & MF2_SHADOW)
|
||||
{
|
||||
Surf.PolyColor.s.alpha = 0x40;
|
||||
blend = HWR_GetBlendModeFlag(blendmode);
|
||||
}
|
||||
else if (spr->mobj->frame & FF_TRANSMASK)
|
||||
else if (sprmo->frame & FF_TRANSMASK)
|
||||
{
|
||||
INT32 trans = (spr->mobj->frame & FF_TRANSMASK)>>FF_TRANSSHIFT;
|
||||
INT32 trans = (sprmo->frame & FF_TRANSMASK)>>FF_TRANSSHIFT;
|
||||
blend = HWR_SurfaceBlend(blendmode, trans, &Surf);
|
||||
}
|
||||
else
|
||||
@@ -4018,6 +4036,9 @@ static void HWR_DrawSprite(gl_vissprite_t *spr)
|
||||
blend = HWR_GetBlendModeFlag(blendmode)|PF_Occlude;
|
||||
}
|
||||
|
||||
if (cv_playerfade.value && sprmo->player)
|
||||
Surf.PolyColor.s.alpha = FixedMul(R_DoPlayerFade(spr->mobj), Surf.PolyColor.s.alpha);
|
||||
|
||||
if (HWR_UseShader())
|
||||
{
|
||||
shader = SHADER_SPRITE;
|
||||
@@ -4038,7 +4059,9 @@ static void HWR_DrawPrecipitationSprite(gl_vissprite_t *spr)
|
||||
|
||||
INT32 shader = SHADER_NONE;
|
||||
|
||||
if (!spr->mobj || !spr->mobj->subsector)
|
||||
const mobj_t *sprmo = spr->mobj;
|
||||
|
||||
if (UNLIKELY(!sprmo || !sprmo->subsector))
|
||||
return;
|
||||
|
||||
// cache sprite graphics
|
||||
@@ -4076,7 +4099,7 @@ static void HWR_DrawPrecipitationSprite(gl_vissprite_t *spr)
|
||||
wallVerts[0].t = wallVerts[1].t = hwrpatch->max_t;
|
||||
|
||||
// colormap test
|
||||
sector_t *sector = spr->mobj->subsector->sector;
|
||||
sector_t *sector = sprmo->subsector->sector;
|
||||
UINT8 lightlevel = 255;
|
||||
extracolormap_t *colormap = sector->extra_colormap;
|
||||
|
||||
@@ -4084,9 +4107,9 @@ static void HWR_DrawPrecipitationSprite(gl_vissprite_t *spr)
|
||||
{
|
||||
INT32 light;
|
||||
|
||||
light = R_GetPlaneLight(sector, spr->mobj->z + spr->mobj->height, false); // Always use the light at the top instead of whatever I was doing before
|
||||
light = R_GetPlaneLight(sector, sprmo->z + sprmo->height, false); // Always use the light at the top instead of whatever I was doing before
|
||||
|
||||
if (!(spr->mobj->frame & FF_FULLBRIGHT))
|
||||
if (!(sprmo->frame & FF_FULLBRIGHT))
|
||||
lightlevel = static_cast<UINT8>(CLAMP(*sector->lightlist[light].lightlevel, 0, 255));
|
||||
|
||||
if (sector->lightlist[light].extra_colormap)
|
||||
@@ -4094,7 +4117,7 @@ static void HWR_DrawPrecipitationSprite(gl_vissprite_t *spr)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(spr->mobj->frame & FF_FULLBRIGHT))
|
||||
if (!(sprmo->frame & FF_FULLBRIGHT))
|
||||
lightlevel = static_cast<UINT8>(CLAMP(sector->lightlevel, 0, 255));
|
||||
|
||||
if (sector->extra_colormap)
|
||||
@@ -4103,9 +4126,9 @@ static void HWR_DrawPrecipitationSprite(gl_vissprite_t *spr)
|
||||
|
||||
HWR_Lighting(&Surf, lightlevel, colormap, P_SectorUsesDirectionalLighting(sector));
|
||||
|
||||
if (spr->mobj->frame & FF_TRANSMASK)
|
||||
if (sprmo->frame & FF_TRANSMASK)
|
||||
{
|
||||
INT32 trans = (spr->mobj->frame & FF_TRANSMASK)>>FF_TRANSSHIFT;
|
||||
INT32 trans = (sprmo->frame & FF_TRANSMASK)>>FF_TRANSSHIFT;
|
||||
blend = HWR_SurfaceBlend(AST_TRANSLUCENT, trans, &Surf);
|
||||
}
|
||||
else
|
||||
@@ -4137,8 +4160,8 @@ gl_vissprite_t* gl_vsprorder[MAXVISSPRITES];
|
||||
// sorted and drawn together with transparent surfaces.
|
||||
static int CompareVisSprites(const void *p1, const void *p2)
|
||||
{
|
||||
gl_vissprite_t* spr1 = *(gl_vissprite_t*const*)p1;
|
||||
gl_vissprite_t* spr2 = *(gl_vissprite_t*const*)p2;
|
||||
const gl_vissprite_t* spr1 = *(gl_vissprite_t*const*)p1;
|
||||
const gl_vissprite_t* spr2 = *(gl_vissprite_t*const*)p2;
|
||||
int idiff;
|
||||
float fdiff;
|
||||
|
||||
@@ -4188,7 +4211,7 @@ typedef struct
|
||||
|
||||
typedef struct
|
||||
{
|
||||
extrasubsector_t *xsub;
|
||||
poly_subsector_t *xsub;
|
||||
boolean isceiling;
|
||||
fixed_t fixedheight;
|
||||
INT32 lightlevel;
|
||||
@@ -4281,7 +4304,7 @@ static void HWR_AddTransparentWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, I
|
||||
wallinfo->wallcolormap = wallcolormap;
|
||||
}
|
||||
|
||||
static void HWR_AddTransparentFloor(lumpnum_t lumpnum, extrasubsector_t *xsub, boolean isceiling, fixed_t fixedheight, INT32 lightlevel, INT32 alpha, sector_t *FOFSector, FBITFIELD blend, boolean fogplane, extracolormap_t *planecolormap)
|
||||
static void HWR_AddTransparentFloor(lumpnum_t lumpnum, poly_subsector_t *xsub, boolean isceiling, fixed_t fixedheight, INT32 lightlevel, INT32 alpha, sector_t *FOFSector, FBITFIELD blend, boolean fogplane, extracolormap_t *planecolormap)
|
||||
{
|
||||
planeinfo_t *planeinfo = static_cast<planeinfo_t*>(HWR_CreateDrawNode(DRAWNODE_PLANE));
|
||||
|
||||
@@ -4316,8 +4339,8 @@ static void HWR_AddTransparentPolyobjectFloor(lumpnum_t lumpnum, polyobj_t *poly
|
||||
|
||||
static int CompareDrawNodePlanes(const void *p1, const void *p2)
|
||||
{
|
||||
INT32 n1 = *(const INT32*)p1;
|
||||
INT32 n2 = *(const INT32*)p2;
|
||||
const INT32 n1 = *(const INT32*)p1;
|
||||
const INT32 n2 = *(const INT32*)p2;
|
||||
|
||||
return ABS(drawnodes[n2].u.plane.fixedheight - viewz) - ABS(drawnodes[n1].u.plane.fixedheight - viewz);
|
||||
}
|
||||
@@ -4450,6 +4473,15 @@ static void HWR_RenderDrawNodes(void)
|
||||
// --------------------------------------------------------------------------
|
||||
// Draw all vissprites
|
||||
// --------------------------------------------------------------------------
|
||||
namespace
|
||||
{
|
||||
enum class DrawSpritesType
|
||||
{
|
||||
kSprites,
|
||||
kModels,
|
||||
};
|
||||
|
||||
template <DrawSpritesType Type>
|
||||
static void HWR_DrawSprites(void)
|
||||
{
|
||||
UINT32 i;
|
||||
@@ -4464,56 +4496,44 @@ static void HWR_DrawSprites(void)
|
||||
continue;
|
||||
}
|
||||
|
||||
HWR_DrawSprite(spr);
|
||||
}
|
||||
}
|
||||
|
||||
static void HWR_DrawModels(void)
|
||||
{
|
||||
UINT32 i;
|
||||
|
||||
for (i = 0; i < gl_visspritecount; i++)
|
||||
{
|
||||
gl_vissprite_t *spr = gl_vsprorder[i];
|
||||
|
||||
if (spr->precip)
|
||||
if constexpr (Type == DrawSpritesType::kModels)
|
||||
{
|
||||
HWR_DrawPrecipitationSprite(spr);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!spr->mobj)
|
||||
continue;
|
||||
|
||||
if (spr->mobj->skin && spr->mobj->sprite == SPR_PLAY)
|
||||
{
|
||||
md2_t *md2;
|
||||
|
||||
if (spr->mobj->localskin)
|
||||
if (spr->mobj && spr->mobj->skin && spr->mobj->sprite == SPR_PLAY)
|
||||
{
|
||||
if (spr->mobj->skinlocal)
|
||||
md2 = &md2_localplayermodels[(skin_t *)spr->mobj->localskin - localskins];
|
||||
md2_t *md2;
|
||||
|
||||
if (spr->mobj->localskin)
|
||||
{
|
||||
if (spr->mobj->skinlocal)
|
||||
md2 = &md2_localplayermodels[(skin_t *)spr->mobj->localskin - localskins];
|
||||
else
|
||||
md2 = &md2_playermodels [(skin_t *)spr->mobj->localskin - skins];
|
||||
}
|
||||
else
|
||||
md2 = &md2_playermodels [(skin_t *)spr->mobj->localskin - skins];
|
||||
md2 = &md2_playermodels[(skin_t *)spr->mobj->skin - skins];
|
||||
|
||||
// 8/1/19: Only don't display player models if no default SPR_PLAY is found.
|
||||
if (((md2->notfound || md2->scale < 0.0f) && ((!cv_glfallbackplayermodel.value) || md2_models[SPR_PLAY].notfound || md2_models[SPR_PLAY].scale < 0.0f)) || spr->mobj->state == &states[S_PLAY_SIGN])
|
||||
HWR_DrawSprite(spr);
|
||||
else
|
||||
HWR_DrawMD2(spr);
|
||||
}
|
||||
else
|
||||
md2 = &md2_playermodels[(skin_t *)spr->mobj->skin - skins];
|
||||
|
||||
// 8/1/19: Only don't display player models if no default SPR_PLAY is found.
|
||||
if (((md2->notfound || md2->scale < 0.0f) && ((!cv_glfallbackplayermodel.value) || md2_models[SPR_PLAY].notfound || md2_models[SPR_PLAY].scale < 0.0f)) || spr->mobj->state == &states[S_PLAY_SIGN])
|
||||
HWR_DrawSprite(spr);
|
||||
else
|
||||
HWR_DrawMD2(spr);
|
||||
{
|
||||
if (md2_models[spr->mobj->sprite].notfound || md2_models[spr->mobj->sprite].scale < 0.0f)
|
||||
HWR_DrawSprite(spr);
|
||||
else
|
||||
HWR_DrawMD2(spr);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
if constexpr (Type == DrawSpritesType::kSprites)
|
||||
{
|
||||
if (md2_models[spr->mobj->sprite].notfound || md2_models[spr->mobj->sprite].scale < 0.0f)
|
||||
HWR_DrawSprite(spr);
|
||||
else
|
||||
HWR_DrawMD2(spr);
|
||||
HWR_DrawSprite(spr);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// HWR_AddSprites
|
||||
@@ -4666,8 +4686,6 @@ static void HWR_ProjectSprite(mobj_t *thing)
|
||||
if (interp.spritexscale < 1 || interp.spriteyscale < 1)
|
||||
return;
|
||||
|
||||
const boolean papersprite = (thing->frame & FF_PAPERSPRITE);
|
||||
|
||||
INT32 blendmode;
|
||||
if (thing->frame & FF_BLENDMASK)
|
||||
blendmode = ((thing->frame & FF_BLENDMASK) >> FF_BLENDSHIFT) + 1;
|
||||
@@ -4681,6 +4699,8 @@ static void HWR_ProjectSprite(mobj_t *thing)
|
||||
return;
|
||||
}
|
||||
|
||||
const boolean papersprite = (thing->frame & FF_PAPERSPRITE);
|
||||
|
||||
// transform the origin point
|
||||
tr_x = FixedToFloat(interp.x);
|
||||
tr_y = FixedToFloat(interp.y);
|
||||
@@ -4708,12 +4728,6 @@ static void HWR_ProjectSprite(mobj_t *thing)
|
||||
|
||||
rot = (thing->frame & FF_FRAMEMASK);
|
||||
|
||||
#ifdef ROTSPRITE
|
||||
// determine here if sprite should rotate for optimization
|
||||
const boolean sliprollrotate = (cv_sliptideroll.value && (thing->player && thing->player->sliproll));
|
||||
const boolean shouldrotate = (interp.sloperoll || interp.slopepitch || interp.roll || interp.pitch || thing->rollangle || sliprollrotate);
|
||||
#endif
|
||||
|
||||
//Fab : 02-08-98: 'skin' override spritedef currently used for skin
|
||||
if ((thing->skin || thing->localskin) && thing->sprite == SPR_PLAY)
|
||||
{
|
||||
@@ -4752,6 +4766,12 @@ static void HWR_ProjectSprite(mobj_t *thing)
|
||||
I_Error("sprframes NULL for sprite %d\n", thing->sprite);
|
||||
#endif
|
||||
|
||||
#ifdef ROTSPRITE
|
||||
// determine here if sprite should rotate for optimization
|
||||
const boolean sliprollrotate = (cv_sliptideroll.value && (thing->player && thing->player->sliproll));
|
||||
const boolean shouldrotate = (interp.sloperoll || interp.slopepitch || interp.roll || interp.pitch || thing->rollangle || sliprollrotate);
|
||||
#endif
|
||||
|
||||
if (sprframe->rotate != SRF_SINGLE || papersprite
|
||||
#ifdef ROTSPRITE
|
||||
|| (shouldrotate)
|
||||
@@ -5195,13 +5215,13 @@ void HWR_BuildSkyDome(void)
|
||||
{
|
||||
int c, r;
|
||||
signed char yflip;
|
||||
int row_count = 4;
|
||||
static constexpr int row_count = 4;
|
||||
int col_count = 4;
|
||||
float delta;
|
||||
|
||||
gl_sky_t *sky = &gl_sky;
|
||||
gl_skyvertex_t *vertex_p;
|
||||
texture_t *texture = textures[texturetranslation[skytexture]];
|
||||
const texture_t *texture = textures[texturetranslation[skytexture]];
|
||||
|
||||
sky->detail = 16;
|
||||
col_count *= sky->detail;
|
||||
@@ -5410,7 +5430,7 @@ void HWR_SetTransform(float fpov)
|
||||
|
||||
void HWR_ClearClipper(void)
|
||||
{
|
||||
angle_t a1 = gld_FrustumAngle(gl_aimingangle);
|
||||
const angle_t a1 = gld_FrustumAngle(gl_aimingangle);
|
||||
gld_clipper_Clear();
|
||||
gld_clipper_SafeAddClipRange(viewangle + a1, viewangle - a1);
|
||||
#ifdef HAVE_SPHEREFRUSTRUM
|
||||
@@ -5563,10 +5583,10 @@ void HWR_RenderViewpoint(gl_portal_t *rootportal, player_t *player, int stencil_
|
||||
HWR_SortVisSprites();
|
||||
PS_STOP_TIMING(ps_hw_spritesorttime);
|
||||
PS_START_TIMING(ps_hw_spritedrawtime);
|
||||
if (LIKELY(!cv_glmdls.value))
|
||||
HWR_DrawSprites();
|
||||
if (UNLIKELY(cv_glmdls.value))
|
||||
HWR_DrawSprites<DrawSpritesType::kModels>();
|
||||
else
|
||||
HWR_DrawModels();
|
||||
HWR_DrawSprites<DrawSpritesType::kSprites>();
|
||||
PS_STOP_TIMING(ps_hw_spritedrawtime);
|
||||
|
||||
ps_numdrawnodes.value.i = 0;
|
||||
@@ -5716,6 +5736,8 @@ void HWR_RenderPlayerView(void)
|
||||
HWR_RenderFrame(player, false);
|
||||
}
|
||||
|
||||
// Determine on mapload if current map has any Horizonlines present
|
||||
// so we can avoid rather hot checks in HWR_Subsector
|
||||
static void HWR_CheckForHorizonLines(void)
|
||||
{
|
||||
size_t i;
|
||||
@@ -5839,6 +5861,8 @@ void HWR_AddCommands(void)
|
||||
CV_RegisterVar(&cv_glanisotropicmode);
|
||||
|
||||
CV_RegisterVar(&cv_glsolvetjoin);
|
||||
CV_RegisterVar(&cv_glpolytile);
|
||||
CV_RegisterVar(&cv_glpolyshape);
|
||||
|
||||
CV_RegisterVar(&cv_glbatching);
|
||||
|
||||
@@ -5867,6 +5891,8 @@ void HWR_Startup(void)
|
||||
CONS_Printf("HWR_Startup()...\n");
|
||||
textureformat = patchformat = GL_TEXFMT_RGBA;
|
||||
|
||||
HWR_Init_PolyPool();
|
||||
|
||||
HWR_InitMapTextures();
|
||||
HWR_InitMD2();
|
||||
|
||||
@@ -5958,7 +5984,7 @@ static void COM_HWR_glinfo(void)
|
||||
void HWR_Shutdown(void)
|
||||
{
|
||||
CONS_Printf("HWR_Shutdown()\n");
|
||||
HWR_FreeExtraSubsectors();
|
||||
HWR_Free_PolyPool();
|
||||
HWR_FreeMapTextures();
|
||||
GL_FlushScreenTextures();
|
||||
#ifdef USE_FBO_OGL
|
||||
@@ -5969,7 +5995,7 @@ void HWR_Shutdown(void)
|
||||
static void HWR_RenderWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, FBITFIELD blend, boolean fogwall, INT32 lightlevel, extracolormap_t *wallcolormap)
|
||||
{
|
||||
FBITFIELD blendmode = blend;
|
||||
UINT8 alpha = pSurf->PolyColor.s.alpha; // retain the alpha
|
||||
const UINT8 alpha = pSurf->PolyColor.s.alpha; // retain the alpha
|
||||
|
||||
INT32 shader = SHADER_NONE;
|
||||
|
||||
|
||||
@@ -203,7 +203,7 @@ extern consvar_t cv_glsecbright;
|
||||
extern consvar_t cv_glfiltermode;
|
||||
extern consvar_t cv_glanisotropicmode;
|
||||
|
||||
extern consvar_t cv_glsolvetjoin;
|
||||
extern consvar_t cv_glsolvetjoin, cv_glpolytile, cv_glpolyshape;
|
||||
|
||||
extern consvar_t cv_glbatching;
|
||||
|
||||
|
||||
@@ -1227,6 +1227,9 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
|
||||
Surf.PolyFlags = HWR_GetBlendModeFlag(blendmode);
|
||||
}
|
||||
|
||||
if (cv_playerfade.value && spr->mobj->player)
|
||||
Surf.PolyColor.s.alpha = FixedMul(R_DoPlayerFade(spr->mobj), Surf.PolyColor.s.alpha);
|
||||
|
||||
// dont forget to enabled the depth test because we can't do this like
|
||||
// before: polygons models are not sorted
|
||||
|
||||
@@ -1241,7 +1244,7 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
|
||||
else
|
||||
{
|
||||
md2s = md2_playermodels;
|
||||
skinnum = (skin_t *)spr->mobj->localskin - skins;
|
||||
skinnum = (skin_t *)spr->mobj->localskin - skins;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1266,6 +1269,7 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
|
||||
|
||||
if (md2->error)
|
||||
return; // we already failed loading this before :(
|
||||
|
||||
if (!md2->model)
|
||||
{
|
||||
CONS_Debug(DBG_RENDER, "Loading model... (%s, %s)", sprnames[spr->mobj->sprite], md2->filename);
|
||||
@@ -1284,6 +1288,7 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//Hurdler: arf, I don't like that implementation at all... too much crappy
|
||||
gpatch = md2->glpatch;
|
||||
if (gpatch)
|
||||
|
||||
@@ -132,7 +132,7 @@ void HWR_PortalFrame(gl_portal_t* portal)
|
||||
{
|
||||
portalclipline = NULL;
|
||||
portalcullsector = NULL;
|
||||
viewsector = R_PointInSubsector(viewx, viewy)->sector;
|
||||
viewsector = R_PointInSubsectorFast(viewx, viewy)->sector;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -689,7 +689,7 @@ typedef enum
|
||||
gluniform_leveltime,
|
||||
|
||||
gluniform_scr_resolution,
|
||||
|
||||
|
||||
gluniform_max,
|
||||
} gluniform_t;
|
||||
|
||||
@@ -1729,6 +1729,114 @@ static void GL_AllocTextureBuffer(GLMipmap_t *pTexInfo)
|
||||
}
|
||||
}
|
||||
|
||||
#define PADDING_CHECK(offset, alphaCheck) { from = to + (offset); if ((alphaCheck)) from = NULL; else goto foundFrom; }
|
||||
|
||||
static void PadRGBABitmap(RGBA_t *tex, UINT16 w, UINT16 h)
|
||||
{
|
||||
INT32 i;
|
||||
boolean notLeft, notRight, notTop, notBottom;
|
||||
RGBA_t *to = tex - 1, *from;
|
||||
|
||||
for (i = 0; i < w * h; i++)
|
||||
{
|
||||
to++;
|
||||
if (to->rgba != 0)
|
||||
continue;
|
||||
from = NULL;
|
||||
|
||||
notLeft = i % w != 0;
|
||||
notRight = i % w != w - 1;
|
||||
notTop = i / w != 0;
|
||||
notBottom = i / w != h - 1;
|
||||
|
||||
if (notRight) PADDING_CHECK(1, from->s.alpha == 0) // Check +X
|
||||
if (notBottom) PADDING_CHECK(w, from->s.alpha == 0) // Check +Y
|
||||
if (notLeft) PADDING_CHECK(-1, from->s.alpha == 0) // Check -X
|
||||
if (notTop) PADDING_CHECK(-w, from->s.alpha == 0) // Check -Y
|
||||
if (notRight && notBottom) PADDING_CHECK(1 + w, from->s.alpha == 0) // Check +X+Y
|
||||
if (notLeft && notBottom) PADDING_CHECK(-1 + w, from->s.alpha == 0) // Check -X+Y
|
||||
if (notLeft && notTop) PADDING_CHECK(-1 - w, from->s.alpha == 0) // Check -X-Y
|
||||
if (notRight && notTop) PADDING_CHECK(1 - w, from->s.alpha == 0) // Check +X-Y
|
||||
|
||||
foundFrom:
|
||||
if (from != NULL)
|
||||
{
|
||||
*to = *from;
|
||||
to->s.alpha = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#undef PADDING_CHECK
|
||||
|
||||
static void GenerateMipmaps(INT32 w, INT32 h, RGBA_t *tex, INT32 maxLOD)
|
||||
{
|
||||
if (tex == NULL)
|
||||
{
|
||||
GL_MSG_Warning("GenerateMipmaps: attempted to generate mipmaps without texture data");
|
||||
return;
|
||||
}
|
||||
|
||||
RGBA_t samplePoint[4];
|
||||
boolean padTexture;
|
||||
INT32 pointsSampled = 0;
|
||||
INT32 m, j, i, p;
|
||||
UINT16 sumR, sumG, sumB, sumA;
|
||||
|
||||
for (m = 0; m < maxLOD; m++)
|
||||
{
|
||||
if (w <= 1 || h <= 1)
|
||||
return;
|
||||
|
||||
padTexture = false;
|
||||
|
||||
for (j = 0; j < h / 2; j++)
|
||||
{
|
||||
for (i = 0; i < w / 2; i++)
|
||||
{
|
||||
samplePoint[0] = tex[w*j*2 + i*2];
|
||||
samplePoint[1] = tex[w*j*2 + i*2+1];
|
||||
samplePoint[2] = tex[w*(j*2+1) + i*2];
|
||||
samplePoint[3] = tex[w*(j*2+1) + i*2+1];
|
||||
|
||||
pointsSampled = sumR = sumG = sumB = sumA = 0;
|
||||
|
||||
for (p = 0; p < 4; p++)
|
||||
{
|
||||
if (samplePoint[p].s.alpha == 0)
|
||||
continue;
|
||||
sumR += samplePoint[p].s.red;
|
||||
sumG += samplePoint[p].s.green;
|
||||
sumB += samplePoint[p].s.blue;
|
||||
sumA += samplePoint[p].s.alpha;
|
||||
pointsSampled++;
|
||||
}
|
||||
|
||||
if (pointsSampled > 0)
|
||||
{
|
||||
tex[(w/2)*j+i].s.red = sumR / pointsSampled;
|
||||
tex[(w/2)*j+i].s.green = sumG / pointsSampled;
|
||||
tex[(w/2)*j+i].s.blue = sumB / pointsSampled;
|
||||
tex[(w/2)*j+i].s.alpha = sumA / pointsSampled;
|
||||
}
|
||||
else
|
||||
{
|
||||
tex[(w/2)*j+i].rgba = 0;
|
||||
padTexture = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
w /= 2;
|
||||
h /= 2;
|
||||
|
||||
if (padTexture)
|
||||
PadRGBABitmap(tex, w, h);
|
||||
|
||||
pglTexSubImage2D(GL_TEXTURE_2D, m + 1, 0, 0, w, h, GL_RGBA, GL_UNSIGNED_BYTE, tex);
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------+
|
||||
// UpdateTexture : Updates texture data.
|
||||
// -----------------+
|
||||
@@ -1737,6 +1845,7 @@ void GL_UpdateTexture(GLMipmap_t *pTexInfo)
|
||||
// Upload a texture
|
||||
GLuint num = pTexInfo->downloaded;
|
||||
boolean update = true;
|
||||
const boolean applyPadding = mag_filter == GL_LINEAR || min_filter == GL_LINEAR;
|
||||
|
||||
INT32 w = pTexInfo->width, h = pTexInfo->height;
|
||||
INT32 i, j;
|
||||
@@ -1795,15 +1904,32 @@ void GL_UpdateTexture(GLMipmap_t *pTexInfo)
|
||||
pImgData++;
|
||||
}
|
||||
}
|
||||
|
||||
if (applyPadding)
|
||||
PadRGBABitmap(tex, w, h);
|
||||
|
||||
break;
|
||||
case GL_TEXFMT_RGBA:
|
||||
// Directly upload the texture data without any kind of conversion.
|
||||
ptex = pImgData;
|
||||
|
||||
// However, it does need to be copied to a buffer for generating mipmaps and padding
|
||||
if (MipMap || applyPadding)
|
||||
{
|
||||
GL_AllocTextureBuffer(pTexInfo);
|
||||
tex = textureBuffer;
|
||||
memcpy(tex, ptex, w * h * 4);
|
||||
ptex = tex;
|
||||
|
||||
if (applyPadding)
|
||||
PadRGBABitmap(tex, w, h);
|
||||
}
|
||||
|
||||
break;
|
||||
case GL_TEXFMT_ALPHA_INTENSITY_88:
|
||||
GL_AllocTextureBuffer(pTexInfo);
|
||||
ptex = tex = textureBuffer;
|
||||
texformat = GL_LUMINANCE_ALPHA;
|
||||
texformat = GL_RGBA;
|
||||
|
||||
for (idx = 0, j = 0; j < h; j++)
|
||||
{
|
||||
@@ -1821,7 +1947,7 @@ void GL_UpdateTexture(GLMipmap_t *pTexInfo)
|
||||
case GL_TEXFMT_ALPHA_8: // Used for fade masks
|
||||
GL_AllocTextureBuffer(pTexInfo);
|
||||
ptex = tex = textureBuffer;
|
||||
texformat = GL_ALPHA;
|
||||
texformat = GL_RGBA;
|
||||
|
||||
memset(&tex->s, 255, sizeof(byteColor_t)*w*h); // 255 because the fade mask is modulated with the screen texture, so alpha affects it while the colours don't
|
||||
|
||||
@@ -1857,8 +1983,6 @@ void GL_UpdateTexture(GLMipmap_t *pTexInfo)
|
||||
|
||||
if (MipMap && !transparent) // No mipmaps on transparent stuff
|
||||
{
|
||||
int maxlod = (texformat == GL_LUMINANCE_ALPHA || texformat == GL_ALPHA) ? 4 : 5;
|
||||
|
||||
pglTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE);
|
||||
|
||||
if (update)
|
||||
@@ -1868,7 +1992,8 @@ void GL_UpdateTexture(GLMipmap_t *pTexInfo)
|
||||
|
||||
// Control the mipmap level of detail
|
||||
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_LOD, 0);
|
||||
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, maxlod);
|
||||
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, 5);
|
||||
GenerateMipmaps(w, h, tex, 5);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1892,7 +2017,6 @@ void GL_UpdateTexture(GLMipmap_t *pTexInfo)
|
||||
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, anisotropic_filter);
|
||||
}
|
||||
|
||||
|
||||
// -----------------+
|
||||
// SetTexture : The mipmap becomes the current texture source
|
||||
// -----------------+
|
||||
@@ -2735,7 +2859,7 @@ void GL_DrawModelEx(model_t *model, INT32 frameIndex, float duration, float tics
|
||||
poly.green = byte2float[Surface->PolyColor.s.green];
|
||||
poly.blue = byte2float[Surface->PolyColor.s.blue];
|
||||
poly.alpha = byte2float[Surface->PolyColor.s.alpha];
|
||||
|
||||
|
||||
pglColor4ubv((GLubyte*)&Surface->PolyColor.s);
|
||||
|
||||
GL_SetBlend(((poly.alpha < 1) ? Surface->PolyFlags : (PF_Masked|PF_Occlude))|PF_Modulated);
|
||||
@@ -2749,7 +2873,7 @@ void GL_DrawModelEx(model_t *model, INT32 frameIndex, float duration, float tics
|
||||
fade.green = byte2float[Surface->FadeColor.s.green];
|
||||
fade.blue = byte2float[Surface->FadeColor.s.blue];
|
||||
fade.alpha = byte2float[Surface->FadeColor.s.alpha];
|
||||
|
||||
|
||||
if (Surface->LightTableId && Surface->LightTableId != lt_downloaded)
|
||||
{
|
||||
pglActiveTexture(GL_TEXTURE2);
|
||||
|
||||
+34
-2
@@ -701,7 +701,7 @@ static void Command_Sayto_f(void)
|
||||
return;
|
||||
}
|
||||
|
||||
target = nametonum(COM_Argv(1));
|
||||
target = D_LookupPlayer(COM_Argv(1));
|
||||
if (target == -1)
|
||||
{
|
||||
CONS_Alert(CONS_NOTICE, M_GetText("No player with that name!\n"));
|
||||
@@ -949,6 +949,9 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum)
|
||||
else
|
||||
stop_spamming[playernum] = 4; // you can hold off for 4 tics, can you?
|
||||
|
||||
if (player_muted[playernum])
|
||||
spam_eatmsg = 1; // Let lua know we're skipping this message
|
||||
|
||||
// run the lua hook even if we were supposed to eat the msg, netgame consistency goes first.
|
||||
|
||||
if (LUA_HookPlayerMsg(playernum, target, flags, msg, spam_eatmsg))
|
||||
@@ -1179,6 +1182,23 @@ static boolean HU_clearChatSpaces(void)
|
||||
return nothingbutspaces;
|
||||
}
|
||||
|
||||
static void DoMute(const char *name)
|
||||
{
|
||||
INT32 pnum = D_LookupPlayer(name);
|
||||
|
||||
if (pnum < 0)
|
||||
{
|
||||
HU_AddChatText("\x85""ERROR: \x80Player not found.", false);
|
||||
return;
|
||||
}
|
||||
|
||||
player_muted[pnum] = !player_muted[pnum];
|
||||
|
||||
HU_AddChatText(va("Player '%s' has been %smuted.", player_names[pnum], player_muted[pnum] ? "" : "un"), false);
|
||||
if (player_muted[pnum])
|
||||
HU_AddChatText("Use same command to unmute them.", false);
|
||||
}
|
||||
|
||||
static void HU_SendChatMessage(void)
|
||||
{
|
||||
char buf[2 + HU_MAXMSGLEN + 1];
|
||||
@@ -1205,7 +1225,19 @@ static void HU_SendChatMessage(void)
|
||||
return;
|
||||
}
|
||||
|
||||
if (strlen(msg) > 4 && strnicmp(msg, "/pm", 3) == 0) // used /pm
|
||||
size_t len = strlen(msg);
|
||||
|
||||
if (len >= 5 && strnicmp(msg, "/mute", 5) == 0) // Used /mute
|
||||
{
|
||||
if (len > 6)
|
||||
DoMute(msg+6);
|
||||
else
|
||||
HU_AddChatText("\x82NOTICE: \x80Usage: /mute <name|node>", false);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (len > 4 && strnicmp(msg, "/pm", 3) == 0) // used /pm
|
||||
{
|
||||
INT32 spc = 1; // used if nodenum[1] is a space.
|
||||
char *nodenum = (char*) malloc(3);
|
||||
|
||||
+1
-7
@@ -1475,13 +1475,7 @@ static void AddBannedIndex(void)
|
||||
banned_size *= 2;
|
||||
}
|
||||
|
||||
banned = Z_ReallocAlign(
|
||||
(void*) banned,
|
||||
sizeof(banned_t) * banned_size,
|
||||
PU_STATIC,
|
||||
NULL,
|
||||
sizeof(banned_t) * 8
|
||||
);
|
||||
banned = Z_Realloc((void*) banned, sizeof(banned_t) * banned_size, PU_STATIC, NULL);
|
||||
}
|
||||
|
||||
numbans++;
|
||||
|
||||
+14
-3
@@ -96,8 +96,9 @@ consvar_t cv_showminimapnames = {"showminimapnames", "Off", CV_SAVE, CV_OnOff, N
|
||||
CV_PossibleValue_t minimapdot_cons_t[NUMMINIMAPDOTSTUFF];
|
||||
consvar_t cv_showminimapangle = {"showminimapangle", "Off", CV_SAVE, minimapdot_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_posanim = {"postitionanimation", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_smallposnum = {"smallpositionnumber", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
static CV_PossibleValue_t posanim_cons_t[] = {{0, "Off"}, {1, "On"}, {2, "Smooth"}, {0, NULL}};
|
||||
consvar_t cv_posanim = {"postitionanimation", "On", CV_SAVE, posanim_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_smallposnum = {"smallpositionnumber", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_showlapemblem = {"showlapemblem", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
@@ -1948,6 +1949,8 @@ void K_drawKartTimestamp(tic_t drawtime, INT32 TX, INT32 TY, INT16 emblemmap, UI
|
||||
}
|
||||
}
|
||||
|
||||
#define POS_DELAY_TIME 10
|
||||
|
||||
static void K_DrawKartPositionNum(INT32 num)
|
||||
{
|
||||
// POSI_X = BASEVIDWIDTH - 51; // 269
|
||||
@@ -1966,7 +1969,15 @@ static void K_DrawKartPositionNum(INT32 num)
|
||||
|
||||
if ((cv_posanim.value && stplyr->kartstuff[k_positiondelay]) || stplyr->exiting)
|
||||
{
|
||||
scale *= 2;
|
||||
if (cv_posanim.value == 2)
|
||||
{
|
||||
const UINT8 delay = (stplyr->exiting) ? POS_DELAY_TIME : stplyr->kartstuff[k_positiondelay];
|
||||
const fixed_t add = (scale * 3) >> ((splitscreen == 1) ? 1 : 2);
|
||||
scale = (scale + min((add * (delay * delay)) / (POS_DELAY_TIME * POS_DELAY_TIME), add));
|
||||
}
|
||||
else
|
||||
scale *= 2;
|
||||
|
||||
overtake = true; // this is used for splitscreen stuff in conjunction with flipdraw.
|
||||
}
|
||||
|
||||
|
||||
+38
-23
@@ -4600,7 +4600,7 @@ static void K_CalculateBananaSlope(mobj_t *mobj, fixed_t x, fixed_t y, fixed_t z
|
||||
//sec = R_PointInSubsector(x, y)->sector;
|
||||
|
||||
if (mobj->x != x || mobj->y != y || mobj->subsector == NULL)
|
||||
sec = R_PointInSubsector(x, y)->sector;
|
||||
sec = R_PointInSubsectorFast(x, y)->sector;
|
||||
else
|
||||
sec = mobj->subsector->sector;
|
||||
|
||||
@@ -6062,32 +6062,47 @@ void K_KartUpdatePosition(player_t *player)
|
||||
// This checks every thing on the map, and looks for MT_BOSS3WAYPOINT (the thing we're using for checkpoint wp's, for now)
|
||||
for (mo = waypointcap; mo != NULL; mo = mo->tracer)
|
||||
{
|
||||
pmo = P_AproxDistance(P_AproxDistance( mo->x - player->mo->x,
|
||||
mo->y - player->mo->y),
|
||||
mo->z - player->mo->z) / FRACUNIT;
|
||||
imo = P_AproxDistance(P_AproxDistance( mo->x - players[i].mo->x,
|
||||
mo->y - players[i].mo->y),
|
||||
mo->z - players[i].mo->z) / FRACUNIT;
|
||||
const boolean isprevcheckpointp = mo->health == player->starpostnum;
|
||||
const boolean isnextcheckpointp = mo->health == (player->starpostnum + 1);
|
||||
|
||||
if (mo->health == player->starpostnum && (!mo->movecount || mo->movecount == player->laps+1))
|
||||
if ((isprevcheckpointp || isnextcheckpointp) && (!mo->movecount || mo->movecount == player->laps+1))
|
||||
{
|
||||
player->kartstuff[k_prevcheck] += pmo;
|
||||
ppcd++;
|
||||
pmo = P_AproxDistance(P_AproxDistance( mo->x - player->mo->x,
|
||||
mo->y - player->mo->y),
|
||||
mo->z - player->mo->z) / FRACUNIT;
|
||||
|
||||
if (isprevcheckpointp)
|
||||
{
|
||||
player->kartstuff[k_prevcheck] += pmo;
|
||||
ppcd++;
|
||||
}
|
||||
|
||||
if (isnextcheckpointp)
|
||||
{
|
||||
player->kartstuff[k_nextcheck] += pmo;
|
||||
pncd++;
|
||||
}
|
||||
}
|
||||
if (mo->health == (player->starpostnum + 1) && (!mo->movecount || mo->movecount == player->laps+1))
|
||||
|
||||
const boolean isprevcheckpointi = mo->health == players[i].starpostnum;
|
||||
const boolean isnextcheckpointi = mo->health == (players[i].starpostnum + 1);
|
||||
|
||||
if ((isprevcheckpointi || isnextcheckpointi) && (!mo->movecount || mo->movecount == players[i].laps+1))
|
||||
{
|
||||
player->kartstuff[k_nextcheck] += pmo;
|
||||
pncd++;
|
||||
}
|
||||
if (mo->health == players[i].starpostnum && (!mo->movecount || mo->movecount == players[i].laps+1))
|
||||
{
|
||||
players[i].kartstuff[k_prevcheck] += imo;
|
||||
ipcd++;
|
||||
}
|
||||
if (mo->health == (players[i].starpostnum + 1) && (!mo->movecount || mo->movecount == players[i].laps+1))
|
||||
{
|
||||
players[i].kartstuff[k_nextcheck] += imo;
|
||||
incd++;
|
||||
imo = P_AproxDistance(P_AproxDistance( mo->x - players[i].mo->x,
|
||||
mo->y - players[i].mo->y),
|
||||
mo->z - players[i].mo->z) / FRACUNIT;
|
||||
|
||||
if (isprevcheckpointi)
|
||||
{
|
||||
players[i].kartstuff[k_prevcheck] += imo;
|
||||
ipcd++;
|
||||
}
|
||||
if (isnextcheckpointi )
|
||||
{
|
||||
players[i].kartstuff[k_nextcheck] += imo;
|
||||
incd++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+274
-185
@@ -107,7 +107,7 @@
|
||||
#define SMALLLINEHEIGHT 8
|
||||
#define SLIDER_RANGE 10
|
||||
#define SLIDER_WIDTH (8*SLIDER_RANGE+6)
|
||||
#define SERVERS_PER_PAGE 11
|
||||
#define SERVERS_PER_PAGE 10
|
||||
#define MAXSTAT 9 //Max number a stat can have
|
||||
|
||||
typedef enum
|
||||
@@ -183,6 +183,8 @@ static char joystickInfo[8][29];
|
||||
static UINT32 serverlistpage;
|
||||
static UINT32 oldserverlistpage;
|
||||
static float serverlistslidex;
|
||||
static INT32 serverlistsearched[MAXSERVERLIST] = {0};
|
||||
static UINT32 serverlistsearchedcount = 0;
|
||||
#endif
|
||||
|
||||
//static saveinfo_t savegameinfo[MAXSAVEGAMES]; // Extra info about the save games.
|
||||
@@ -211,6 +213,8 @@ static void M_StopMessage(INT32 choice);
|
||||
|
||||
#ifndef NONET
|
||||
static void M_HandleServerPage(INT32 choice);
|
||||
static void M_HandleServerSearch(INT32 choice);
|
||||
static void M_SearchServerList(void);
|
||||
#endif
|
||||
|
||||
// Prototyping is fun, innit?
|
||||
@@ -1110,11 +1114,11 @@ static menuitem_t MP_PlayerSetupMenu[] =
|
||||
#ifndef NONET
|
||||
static menuitem_t MP_ConnectMenu[] =
|
||||
{
|
||||
{IT_STRING | IT_CVAR, NULL, "Sort By", &cv_serversort, 4},
|
||||
{IT_STRING | IT_KEYHANDLER, NULL, "Page", M_HandleServerPage, 12},
|
||||
{IT_STRING | IT_CALL, NULL, "Refresh", M_Refresh, 20},
|
||||
{IT_STRING | IT_KEYHANDLER, NULL, "", M_HandleServerSearch,0},
|
||||
{IT_STRING | IT_CVAR, NULL, "Sort By", &cv_serversort, 16},
|
||||
{IT_STRING | IT_KEYHANDLER, NULL, "Page", M_HandleServerPage, 24},
|
||||
{IT_STRING | IT_CALL, NULL, "Refresh", M_Refresh, 32},
|
||||
|
||||
{IT_STRING | IT_SPACE, NULL, "", M_Connect, 36},
|
||||
{IT_STRING | IT_SPACE, NULL, "", M_Connect, 48},
|
||||
{IT_STRING | IT_SPACE, NULL, "", M_Connect, 60},
|
||||
{IT_STRING | IT_SPACE, NULL, "", M_Connect, 72},
|
||||
@@ -1129,6 +1133,7 @@ static menuitem_t MP_ConnectMenu[] =
|
||||
|
||||
enum
|
||||
{
|
||||
mp_connect_search,
|
||||
mp_connect_sort,
|
||||
mp_connect_page,
|
||||
mp_connect_refresh,
|
||||
@@ -1522,6 +1527,7 @@ enum
|
||||
//op_exp_dirlight,
|
||||
op_exp_skybox,
|
||||
op_exp_accuratefps,
|
||||
op_exp_votescrn,
|
||||
#ifdef HWRENDER
|
||||
op_exp_glscrtx,
|
||||
#ifdef USE_FBO_OGL
|
||||
@@ -2471,9 +2477,13 @@ static menuitem_t OP_HudOffsetMenu[] =
|
||||
{IT_STRING | IT_CVAR, NULL, "Vertical Offset", &cv_stat_yoffset, 185},
|
||||
};
|
||||
|
||||
// FIXME: WE EFFECTIVELY HAVE NO MORE SPACE FOR GREEN RES
|
||||
// i had to put multiple names into single lines at this point
|
||||
// we ought to really do something better for this at this point
|
||||
// absolutely crazy how many people put work into this at this point <3
|
||||
static menuitem_t OP_SaturnCreditsMenu[] =
|
||||
{
|
||||
{IT_HEADER, NULL, "Thanks to all contributers <3", NULL, 0},
|
||||
{IT_HEADER, NULL, "Thanks to all contributers <3", NULL, 0},
|
||||
|
||||
{IT_STRING2+IT_SPACE, NULL, "Alug", NULL, 10},
|
||||
{IT_STRING2+IT_SPACE, NULL, "Indev", NULL, 20},
|
||||
@@ -2482,20 +2492,21 @@ static menuitem_t OP_SaturnCreditsMenu[] =
|
||||
{IT_STRING2+IT_SPACE, NULL, "GenericHeroGuy", NULL, 50},
|
||||
{IT_STRING2+IT_SPACE, NULL, "xyzzy", NULL, 60},
|
||||
{IT_STRING2+IT_SPACE, NULL, "Chearii", NULL, 70},
|
||||
{IT_STRING2+IT_SPACE, NULL, "riomccloud", NULL, 80},
|
||||
{IT_STRING2+IT_SPACE, NULL, "chromaticpipe", NULL, 90},
|
||||
{IT_STRING2+IT_SPACE, NULL, "PAS", NULL, 100},
|
||||
{IT_STRING2+IT_SPACE, NULL, "$HOME", NULL, 110},
|
||||
{IT_STRING2+IT_SPACE, NULL, "Achii", NULL, 120},
|
||||
{IT_STRING2+IT_SPACE, NULL, "Anonimus", NULL, 130},
|
||||
{IT_STRING2+IT_SPACE, NULL, "scizor300", NULL, 140},
|
||||
{IT_STRING2+IT_SPACE, NULL, "Lugent", NULL, 150},
|
||||
|
||||
{IT_STRING2+IT_SPACE, NULL, "Sunflower", NULL, 80},
|
||||
{IT_STRING2+IT_SPACE, NULL, "Yuz", NULL, 90},
|
||||
{IT_STRING2+IT_SPACE, NULL, "Democrab", NULL, 100},
|
||||
{IT_STRING2+IT_SPACE, NULL, "EXpand", NULL, 110},
|
||||
{IT_STRING2+IT_SPACE, NULL, "Nexit", NULL, 120},
|
||||
{IT_STRING2+IT_SPACE, NULL, "Spee", NULL, 130},
|
||||
{IT_STRING2+IT_SPACE, NULL, "jin", NULL, 140},
|
||||
{IT_STRING2+IT_SPACE, NULL, "riomccloud", NULL, 150},
|
||||
{IT_STRING2+IT_SPACE, NULL, "chromaticpipe", NULL, 160},
|
||||
{IT_STRING2+IT_SPACE, NULL, "Achii", NULL, 170},
|
||||
{IT_STRING2+IT_SPACE, NULL, "Anonimus", NULL, 180},
|
||||
{IT_STRING2+IT_SPACE, NULL, "scizor300", NULL, 190},
|
||||
{IT_STRING2+IT_SPACE, NULL, "Lugent", NULL, 200},
|
||||
{IT_HEADER, NULL, "", NULL, 124},
|
||||
|
||||
{IT_STRING2+IT_SPACE, NULL, "Sunflower Yuz", NULL, 180},
|
||||
{IT_STRING2+IT_SPACE, NULL, "Democrab EXpand", NULL, 190},
|
||||
{IT_STRING2+IT_SPACE, NULL, "Nexit Spee", NULL, 200},
|
||||
{IT_STRING2+IT_SPACE, NULL, "jin", NULL, 210},
|
||||
|
||||
{IT_HEADER, NULL, "Special Thanks <3", NULL, 168},
|
||||
|
||||
@@ -2507,7 +2518,7 @@ static menuitem_t OP_SaturnCreditsMenu[] =
|
||||
{IT_STRING, NULL, "", NULL, 258}, // dummy text II
|
||||
};
|
||||
|
||||
// sry we dont have space for this anymore :/
|
||||
// sry we dont have space for this anymore :c
|
||||
/*static const char* OP_CreditTooltips[] =
|
||||
{
|
||||
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
|
||||
@@ -2731,7 +2742,7 @@ menu_t MISC_AddonsDef =
|
||||
50, 28,
|
||||
0,
|
||||
NULL,
|
||||
{NULL}
|
||||
NULL
|
||||
};
|
||||
|
||||
menu_t MISC_ReplayHutDef =
|
||||
@@ -2744,7 +2755,7 @@ menu_t MISC_ReplayHutDef =
|
||||
30, 80,
|
||||
0,
|
||||
M_QuitReplayHut,
|
||||
{NULL}
|
||||
NULL
|
||||
};
|
||||
|
||||
menu_t MISC_ReplayOptionsDef =
|
||||
@@ -2757,7 +2768,7 @@ menu_t MISC_ReplayOptionsDef =
|
||||
27, 40,
|
||||
0,
|
||||
NULL,
|
||||
{NULL}
|
||||
NULL
|
||||
};
|
||||
|
||||
menu_t MISC_ReplayStartDef =
|
||||
@@ -2770,7 +2781,7 @@ menu_t MISC_ReplayStartDef =
|
||||
30, 90,
|
||||
0,
|
||||
NULL,
|
||||
{NULL}
|
||||
NULL
|
||||
};
|
||||
|
||||
menu_t PlaybackMenuDef = {
|
||||
@@ -2783,12 +2794,12 @@ menu_t PlaybackMenuDef = {
|
||||
BASEVIDWIDTH/2 - 88, 2,
|
||||
0,
|
||||
NULL,
|
||||
{NULL}
|
||||
NULL
|
||||
};
|
||||
|
||||
menu_t MAPauseDef = PAUSEMENUSTYLE(MAPauseMenu, 40, 72);
|
||||
menu_t SPauseDef = PAUSEMENUSTYLE(SPauseMenu, 40, 72);
|
||||
menu_t MPauseDef = PAUSEMENUSTYLE(MPauseMenu, 40, 72);
|
||||
menu_t SPauseDef = PAUSEMENUSTYLE(SPauseMenu, 40, 72);
|
||||
menu_t MPauseDef = PAUSEMENUSTYLE(MPauseMenu, 40, 72);
|
||||
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
menu_t MISC_DiscordRequestsDef = {
|
||||
@@ -2800,16 +2811,16 @@ menu_t MISC_DiscordRequestsDef = {
|
||||
0, 0,
|
||||
0,
|
||||
NULL,
|
||||
{NULL}
|
||||
NULL
|
||||
};
|
||||
#endif
|
||||
|
||||
// Misc Main Menu
|
||||
menu_t MISC_ScrambleTeamDef = DEFAULTMENUSTYLE(NULL, MISC_ScrambleTeamMenu, &MPauseDef, 27, 40);
|
||||
menu_t MISC_ChangeTeamDef = DEFAULTMENUSTYLE(NULL, MISC_ChangeTeamMenu, &MPauseDef, 27, 40);
|
||||
menu_t MISC_ChangeSpectateDef = DEFAULTMENUSTYLE(NULL, MISC_ChangeSpectateMenu, &MPauseDef, 27, 40);
|
||||
menu_t MISC_ChangeLevelDef = MAPICONMENUSTYLE(NULL, MISC_ChangeLevelMenu, &MPauseDef);
|
||||
menu_t MISC_HelpDef = IMAGEDEF(MISC_HelpMenu);
|
||||
menu_t MISC_ScrambleTeamDef = DEFAULTMENUSTYLE(NULL, MISC_ScrambleTeamMenu, &MPauseDef, 27, 40, NULL);
|
||||
menu_t MISC_ChangeTeamDef = DEFAULTMENUSTYLE(NULL, MISC_ChangeTeamMenu, &MPauseDef, 27, 40, NULL);
|
||||
menu_t MISC_ChangeSpectateDef = DEFAULTMENUSTYLE(NULL, MISC_ChangeSpectateMenu, &MPauseDef, 27, 40, NULL);
|
||||
menu_t MISC_ChangeLevelDef = MAPICONMENUSTYLE(NULL, MISC_ChangeLevelMenu, &MPauseDef);
|
||||
menu_t MISC_HelpDef = IMAGEDEF(MISC_HelpMenu);
|
||||
|
||||
//
|
||||
// M_GetGametypeColor
|
||||
@@ -2896,7 +2907,7 @@ menu_t SR_PandoraDef =
|
||||
60, 40,
|
||||
0,
|
||||
M_ExitPandorasBox,
|
||||
{NULL}
|
||||
NULL
|
||||
};
|
||||
menu_t SR_MainDef = CENTERMENUSTYLE(NULL, SR_MainMenu, &MainDef, 72);
|
||||
|
||||
@@ -2912,7 +2923,7 @@ menu_t SR_UnlockChecklistDef =
|
||||
280, 185,
|
||||
0,
|
||||
NULL,
|
||||
{NULL}
|
||||
NULL
|
||||
};
|
||||
|
||||
menu_t SR_MusicTestDef =
|
||||
@@ -2925,7 +2936,7 @@ menu_t SR_MusicTestDef =
|
||||
60, 150,
|
||||
0,
|
||||
NULL,
|
||||
{NULL}
|
||||
NULL
|
||||
};
|
||||
|
||||
menu_t SR_EmblemHintDef =
|
||||
@@ -2938,7 +2949,7 @@ menu_t SR_EmblemHintDef =
|
||||
60, 150,
|
||||
0,
|
||||
NULL,
|
||||
{NULL}
|
||||
NULL
|
||||
};
|
||||
|
||||
// Single Player
|
||||
@@ -2954,7 +2965,7 @@ menu_t SP_LevelStatsDef =
|
||||
280, 185,
|
||||
0,
|
||||
NULL,
|
||||
{NULL}
|
||||
NULL
|
||||
};
|
||||
|
||||
static menu_t SP_TimeAttackDef =
|
||||
@@ -2967,7 +2978,7 @@ static menu_t SP_TimeAttackDef =
|
||||
34, 40,
|
||||
0,
|
||||
M_QuitTimeAttackMenu,
|
||||
{NULL}
|
||||
NULL
|
||||
};
|
||||
static menu_t SP_ReplayDef =
|
||||
{
|
||||
@@ -2979,7 +2990,7 @@ static menu_t SP_ReplayDef =
|
||||
34, 40,
|
||||
0,
|
||||
NULL,
|
||||
{NULL}
|
||||
NULL
|
||||
};
|
||||
static menu_t SP_GuestReplayDef =
|
||||
{
|
||||
@@ -2991,7 +3002,7 @@ static menu_t SP_GuestReplayDef =
|
||||
34, 40,
|
||||
0,
|
||||
NULL,
|
||||
{NULL}
|
||||
NULL
|
||||
};
|
||||
static menu_t SP_GhostDef =
|
||||
{
|
||||
@@ -3003,7 +3014,7 @@ static menu_t SP_GhostDef =
|
||||
34, 40,
|
||||
0,
|
||||
NULL,
|
||||
{NULL}
|
||||
NULL
|
||||
};
|
||||
|
||||
// Multiplayer
|
||||
@@ -3021,7 +3032,7 @@ menu_t MP_MainDef =
|
||||
#else
|
||||
NULL,
|
||||
#endif
|
||||
{NULL}
|
||||
NULL
|
||||
};
|
||||
|
||||
menu_t MP_OfflineServerDef = MAPICONMENUSTYLE("M_MULTI", MP_OfflineServerMenu, &MP_MainDef);
|
||||
@@ -3039,7 +3050,7 @@ menu_t MP_ConnectDef =
|
||||
27,24,
|
||||
0,
|
||||
M_CancelConnect,
|
||||
{NULL}
|
||||
NULL
|
||||
};
|
||||
#endif
|
||||
menu_t MP_PlayerSetupDef =
|
||||
@@ -3052,7 +3063,7 @@ menu_t MP_PlayerSetupDef =
|
||||
36, 14,
|
||||
0,
|
||||
M_QuitMultiPlayerMenu,
|
||||
{NULL}
|
||||
NULL
|
||||
};
|
||||
|
||||
// Options
|
||||
@@ -3066,18 +3077,18 @@ menu_t OP_MainDef =
|
||||
60, 25,
|
||||
0,
|
||||
NULL,
|
||||
{NULL}
|
||||
NULL
|
||||
};
|
||||
|
||||
menu_t OP_ControlsDef = DEFAULTMENUSTYLE("M_CONTRO", OP_ControlsMenu, &OP_MainDef, 60, 30);
|
||||
menu_t OP_ControlsDef = DEFAULTMENUSTYLE("M_CONTRO", OP_ControlsMenu, &OP_MainDef, 60, 30, OP_ControlsTooltips);
|
||||
//WTF
|
||||
menu_t OP_MouseOptionsDef = DEFAULTMENUSTYLE("M_CONTRO", OP_MouseOptionsMenu, &OP_ControlsDef, 60, 30);
|
||||
menu_t OP_AllControlsDef = CONTROLMENUSTYLE(OP_AllControlsMenu, &OP_ControlsDef);
|
||||
menu_t OP_Joystick1Def = DEFAULTSCROLLSTYLE("M_CONTRO", OP_Joystick1Menu, &OP_AllControlsDef, 30, 36);
|
||||
menu_t OP_Joystick2Def = DEFAULTSCROLLSTYLE("M_CONTRO", OP_Joystick2Menu, &OP_AllControlsDef, 30, 36);
|
||||
menu_t OP_Joystick3Def = DEFAULTSCROLLSTYLE("M_CONTRO", OP_Joystick3Menu, &OP_AllControlsDef, 30, 36);
|
||||
menu_t OP_Joystick4Def = DEFAULTSCROLLSTYLE("M_CONTRO", OP_Joystick4Menu, &OP_AllControlsDef, 30, 36);
|
||||
menu_t OP_JoystickSetDef =
|
||||
menu_t OP_MouseOptionsDef = DEFAULTMENUSTYLE("M_CONTRO", OP_MouseOptionsMenu, &OP_ControlsDef, 60, 30, OP_MouseTooltips);
|
||||
menu_t OP_AllControlsDef = CONTROLMENUSTYLE(OP_AllControlsMenu, &OP_ControlsDef);
|
||||
menu_t OP_Joystick1Def = DEFAULTSCROLLSTYLE("M_CONTRO", OP_Joystick1Menu, &OP_AllControlsDef, 30, 36, NULL);
|
||||
menu_t OP_Joystick2Def = DEFAULTSCROLLSTYLE("M_CONTRO", OP_Joystick2Menu, &OP_AllControlsDef, 30, 36, NULL);
|
||||
menu_t OP_Joystick3Def = DEFAULTSCROLLSTYLE("M_CONTRO", OP_Joystick3Menu, &OP_AllControlsDef, 30, 36, NULL);
|
||||
menu_t OP_Joystick4Def = DEFAULTSCROLLSTYLE("M_CONTRO", OP_Joystick4Menu, &OP_AllControlsDef, 30, 36, NULL);
|
||||
menu_t OP_JoystickSetDef =
|
||||
{
|
||||
"M_CONTRO",
|
||||
sizeof (OP_JoystickSetMenu)/sizeof (menuitem_t),
|
||||
@@ -3087,7 +3098,7 @@ menu_t OP_JoystickSetDef =
|
||||
50, 40,
|
||||
0,
|
||||
NULL,
|
||||
{NULL}
|
||||
NULL
|
||||
};
|
||||
|
||||
menu_t OP_VideoOptionsDef =
|
||||
@@ -3100,7 +3111,7 @@ menu_t OP_VideoOptionsDef =
|
||||
30, 15,
|
||||
0,
|
||||
NULL,
|
||||
{NULL}
|
||||
OP_VideoTooltips
|
||||
};
|
||||
|
||||
menu_t OP_VideoModeDef =
|
||||
@@ -3113,7 +3124,7 @@ menu_t OP_VideoModeDef =
|
||||
48, 26,
|
||||
0,
|
||||
NULL,
|
||||
{NULL}
|
||||
NULL
|
||||
};
|
||||
|
||||
menu_t OP_ColorOptionsDef =
|
||||
@@ -3126,7 +3137,7 @@ menu_t OP_ColorOptionsDef =
|
||||
30, 30,
|
||||
0,
|
||||
NULL,
|
||||
{NULL}
|
||||
NULL
|
||||
};
|
||||
|
||||
menu_t OP_SoundOptionsDef =
|
||||
@@ -3139,7 +3150,7 @@ menu_t OP_SoundOptionsDef =
|
||||
30, 20,
|
||||
0,
|
||||
NULL,
|
||||
{NULL}
|
||||
OP_SoundTooltips
|
||||
};
|
||||
|
||||
|
||||
@@ -3153,25 +3164,25 @@ menu_t OP_HUDOptionsDef =
|
||||
30, 20,
|
||||
0,
|
||||
NULL,
|
||||
{NULL}
|
||||
NULL
|
||||
};
|
||||
|
||||
menu_t OP_CamOptionsDef = DEFAULTMENUSTYLE(NULL, OP_CamOptionsMenu, &OP_MainDef, 30, 30);
|
||||
menu_t OP_Player1CamOptionsDef = DEFAULTMENUSTYLE(NULL, OP_Player1CamOptionsMenu, &OP_CamOptionsDef, 30, 30);
|
||||
menu_t OP_Player2CamOptionsDef = DEFAULTMENUSTYLE(NULL, OP_Player2CamOptionsMenu, &OP_CamOptionsDef, 30, 30);
|
||||
menu_t OP_Player3CamOptionsDef = DEFAULTMENUSTYLE(NULL, OP_Player3CamOptionsMenu, &OP_CamOptionsDef, 30, 30);
|
||||
menu_t OP_Player4CamOptionsDef = DEFAULTMENUSTYLE(NULL, OP_Player4CamOptionsMenu, &OP_CamOptionsDef, 30, 30);
|
||||
menu_t OP_CamOptionsDef = DEFAULTMENUSTYLE(NULL, OP_CamOptionsMenu, &OP_MainDef, 30, 30, OP_CamOptionsTooltips);
|
||||
menu_t OP_Player1CamOptionsDef = DEFAULTMENUSTYLE(NULL, OP_Player1CamOptionsMenu, &OP_CamOptionsDef, 30, 30, OP_PlayerCamOptionsTooltips);
|
||||
menu_t OP_Player2CamOptionsDef = DEFAULTMENUSTYLE(NULL, OP_Player2CamOptionsMenu, &OP_CamOptionsDef, 30, 30, OP_PlayerCamOptionsTooltips);
|
||||
menu_t OP_Player3CamOptionsDef = DEFAULTMENUSTYLE(NULL, OP_Player3CamOptionsMenu, &OP_CamOptionsDef, 30, 30, OP_PlayerCamOptionsTooltips);
|
||||
menu_t OP_Player4CamOptionsDef = DEFAULTMENUSTYLE(NULL, OP_Player4CamOptionsMenu, &OP_CamOptionsDef, 30, 30, OP_PlayerCamOptionsTooltips);
|
||||
|
||||
menu_t OP_ChatOptionsDef = DEFAULTMENUSTYLE("M_HUD", OP_ChatOptionsMenu, &OP_HUDOptionsDef, 30, 30);
|
||||
menu_t OP_ChatOptionsDef = DEFAULTMENUSTYLE("M_HUD", OP_ChatOptionsMenu, &OP_HUDOptionsDef, 30, 30, OP_ChatOptionsTooltips);
|
||||
|
||||
menu_t OP_SoundAdvancedDef = DEFAULTSCROLLSTYLE("M_SOUND", OP_SoundAdvancedMenu, &OP_SoundOptionsDef, 30, 30);
|
||||
menu_t OP_SoundAdvancedDef = DEFAULTSCROLLSTYLE("M_SOUND", OP_SoundAdvancedMenu, &OP_SoundOptionsDef, 30, 30, OP_SoundAdvancedTooltips);
|
||||
|
||||
menu_t OP_FocusOptionsDef = DEFAULTMENUSTYLE(NULL, OP_FocusOptionsMenu, &OP_MainDef, 17, 30);
|
||||
menu_t OP_FocusOptionsDef = DEFAULTMENUSTYLE(NULL, OP_FocusOptionsMenu, &OP_MainDef, 17, 30, OP_FocusOptionsTooltips);
|
||||
|
||||
menu_t OP_GameOptionsDef = DEFAULTMENUSTYLE("M_GAME", OP_GameOptionsMenu, &OP_MainDef, 30, 20);
|
||||
menu_t OP_ServerOptionsDef = DEFAULTMENUSTYLE("M_SERVER", OP_ServerOptionsMenu, &OP_MainDef, 24, 20);
|
||||
menu_t OP_GameOptionsDef = DEFAULTMENUSTYLE("M_GAME", OP_GameOptionsMenu, &OP_MainDef, 30, 20, OP_GameTooltips);
|
||||
menu_t OP_ServerOptionsDef = DEFAULTMENUSTYLE("M_SERVER", OP_ServerOptionsMenu, &OP_MainDef, 24, 20, OP_ServerOptionsTooltips);
|
||||
#ifndef NONET
|
||||
menu_t OP_AdvServerOptionsDef = DEFAULTSCROLLSTYLE("M_SERVER", OP_AdvServerOptionsMenu, &OP_ServerOptionsDef, 24, 30);
|
||||
menu_t OP_AdvServerOptionsDef = DEFAULTSCROLLSTYLE("M_SERVER", OP_AdvServerOptionsMenu, &OP_ServerOptionsDef, 24, 30, OP_AdvServerOptionsTooltips);
|
||||
#endif
|
||||
|
||||
//menu_t OP_NetgameOptionsDef = DEFAULTMENUSTYLE("M_SERVER", OP_NetgameOptionsMenu, &OP_ServerOptionsDef, 30, 30);
|
||||
@@ -3187,38 +3198,38 @@ menu_t OP_MonitorToggleDef =
|
||||
47, 30,
|
||||
0,
|
||||
NULL,
|
||||
{NULL}
|
||||
NULL
|
||||
};
|
||||
|
||||
#ifdef HWRENDER
|
||||
menu_t OP_OpenGLOptionsDef = DEFAULTSCROLLSTYLE("M_VIDEO", OP_OpenGLOptionsMenu, &OP_VideoOptionsDef, 30, 30);
|
||||
menu_t OP_OpenGLOptionsDef = DEFAULTSCROLLSTYLE("M_VIDEO", OP_OpenGLOptionsMenu, &OP_VideoOptionsDef, 30, 30, OP_OpenGLTooltips);
|
||||
#endif
|
||||
|
||||
menu_t OP_ExpOptionsDef = DEFAULTSCROLLSTYLE("M_VIDEO", OP_ExpOptionsMenu, &OP_VideoOptionsDef, 30, 25);
|
||||
menu_t OP_ExpOptionsDef = DEFAULTSCROLLSTYLE("M_VIDEO", OP_ExpOptionsMenu, &OP_VideoOptionsDef, 30, 25, OP_ExpTooltips);
|
||||
|
||||
menu_t OP_DataOptionsDef = DEFAULTMENUSTYLE("M_DATA", OP_DataOptionsMenu, &OP_MainDef, 60, 30);
|
||||
menu_t OP_ScreenshotOptionsDef = DEFAULTSCROLLSTYLE("M_SCSHOT", OP_ScreenshotOptionsMenu, &OP_DataOptionsDef, 30, 30);
|
||||
menu_t OP_AddonsOptionsDef = DEFAULTMENUSTYLE("M_ADDONS", OP_AddonsOptionsMenu, &OP_DataOptionsDef, 30, 30);
|
||||
menu_t OP_ProtocolDef = DEFAULTMENUSTYLE(NULL, OP_ProtocolMenu, &OP_DataOptionsDef, 30, 30);
|
||||
menu_t OP_DataOptionsDef = DEFAULTMENUSTYLE("M_DATA", OP_DataOptionsMenu, &OP_MainDef, 60, 30, NULL);
|
||||
menu_t OP_ScreenshotOptionsDef = DEFAULTSCROLLSTYLE("M_SCSHOT", OP_ScreenshotOptionsMenu, &OP_DataOptionsDef, 30, 30, NULL);
|
||||
menu_t OP_AddonsOptionsDef = DEFAULTMENUSTYLE("M_ADDONS", OP_AddonsOptionsMenu, &OP_DataOptionsDef, 30, 30, NULL);
|
||||
menu_t OP_ProtocolDef = DEFAULTMENUSTYLE(NULL, OP_ProtocolMenu, &OP_DataOptionsDef, 30, 30, NULL);
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
menu_t OP_DiscordOptionsDef = DEFAULTMENUSTYLE(NULL, OP_DiscordOptionsMenu, &OP_DataOptionsDef, 30, 30);
|
||||
menu_t OP_DiscordOptionsDef = DEFAULTMENUSTYLE(NULL, OP_DiscordOptionsMenu, &OP_DataOptionsDef, 30, 30, NULL);
|
||||
#endif
|
||||
menu_t OP_EraseDataDef = DEFAULTMENUSTYLE("M_DATA", OP_EraseDataMenu, &OP_DataOptionsDef, 30, 30);
|
||||
menu_t OP_EraseDataDef = DEFAULTMENUSTYLE("M_DATA", OP_EraseDataMenu, &OP_DataOptionsDef, 30, 30, NULL);
|
||||
|
||||
menu_t OP_SaturnDef = DEFAULTSCROLLSTYLE(NULL, OP_SaturnMenu, &OP_MainDef, 30, 30);
|
||||
menu_t OP_PlayerDistortDef = DEFAULTSCROLLSTYLE("M_VIDEO", OP_PlayerDistortMenu, &OP_SaturnDef, 30, 30);
|
||||
menu_t OP_HudOffsetDef = DEFAULTSCROLLSTYLE(NULL, OP_HudOffsetMenu, &OP_SaturnHudDef, 30, 30);
|
||||
menu_t OP_SaturnHudDef = DEFAULTSCROLLSTYLE(NULL, OP_SaturnHudMenu, &OP_SaturnDef, 30, 30);
|
||||
menu_t OP_SaturnDef = DEFAULTSCROLLSTYLE(NULL, OP_SaturnMenu, &OP_MainDef, 30, 30, OP_SaturnTooltips);
|
||||
menu_t OP_SaturnCreditsDef = DEFAULTMENUSTYLE(NULL, OP_SaturnCreditsMenu, &OP_SaturnDef, 30, 0, NULL); // OP_CreditTooltips no space :c
|
||||
|
||||
menu_t OP_SaturnCreditsDef = DEFAULTMENUSTYLE(NULL, OP_SaturnCreditsMenu, &OP_SaturnDef, 30, 0);
|
||||
menu_t OP_SaturnHudDef = DEFAULTSCROLLSTYLE(NULL, OP_SaturnHudMenu, &OP_SaturnDef, 30, 30, OP_SaturnHudTooltips);
|
||||
menu_t OP_PlayerDistortDef = DEFAULTSCROLLSTYLE("M_VIDEO", OP_PlayerDistortMenu, &OP_SaturnDef, 30, 30, OP_PlayerDistortTooltips);
|
||||
menu_t OP_HudOffsetDef = DEFAULTSCROLLSTYLE(NULL, OP_HudOffsetMenu, &OP_SaturnHudDef, 30, 30, NULL);
|
||||
|
||||
menu_t OP_BirdDef = DEFAULTMENUSTYLE(NULL, OP_BirdMenu, &OP_MainDef, 30, 30);
|
||||
menu_t OP_BirdDef = DEFAULTMENUSTYLE(NULL, OP_BirdMenu, &OP_MainDef, 30, 30, OP_BirdTooltips);
|
||||
|
||||
menu_t OP_NametagDef = DEFAULTMENUSTYLE(NULL, OP_NametagMenu, &OP_SaturnHudDef, 30, 40);
|
||||
menu_t OP_DriftGaugeDef = DEFAULTMENUSTYLE(NULL, OP_DriftGaugeMenu, &OP_SaturnHudDef, 30, 40);
|
||||
menu_t OP_NametagDef = DEFAULTMENUSTYLE(NULL, OP_NametagMenu, &OP_SaturnHudDef, 30, 40, OP_NametagTooltips);
|
||||
menu_t OP_DriftGaugeDef = DEFAULTMENUSTYLE(NULL, OP_DriftGaugeMenu, &OP_SaturnHudDef, 30, 40, OP_DriftGaugeTooltips);
|
||||
|
||||
menu_t OP_TiltDef = DEFAULTMENUSTYLE(NULL, OP_TiltMenu, &OP_BirdDef, 30, 60);
|
||||
menu_t OP_AdvancedBirdDef = DEFAULTMENUSTYLE(NULL, OP_AdvancedBirdMenu, &OP_BirdDef, 30, 60);
|
||||
menu_t OP_TiltDef = DEFAULTMENUSTYLE(NULL, OP_TiltMenu, &OP_BirdDef, 30, 60, OP_TiltTooltips);
|
||||
menu_t OP_AdvancedBirdDef = DEFAULTMENUSTYLE(NULL, OP_AdvancedBirdMenu, &OP_BirdDef, 30, 60, OP_AdvancedBirdTooltips);
|
||||
|
||||
INT16 ccvarposition = 0;
|
||||
|
||||
@@ -3235,7 +3246,7 @@ static void M_CustomCvarMenu(INT32 choice)
|
||||
/*menu_t OP_CustomCvarMenuDef = DEFAULTSCROLLMENUSTYLE(
|
||||
MTREE3(MN_OP_MAIN, MN_OP_DATA, MN_OP_ADDONS),
|
||||
"M_ADDONS", OP_CustomCvarMenu, &OP_MainDef, 30, 30);*/
|
||||
menu_t OP_CustomCvarMenuDef = DEFAULTSCROLLSTYLE("M_ADDONS", OP_CustomCvarMenu, &OP_MainDef, 10, 30);
|
||||
menu_t OP_CustomCvarMenuDef = DEFAULTSCROLLSTYLE("M_ADDONS", OP_CustomCvarMenu, &OP_MainDef, 10, 30, NULL);
|
||||
|
||||
menu_t OP_ForkedBirdDef = {
|
||||
NULL,
|
||||
@@ -3246,10 +3257,10 @@ menu_t OP_ForkedBirdDef = {
|
||||
30, 6,
|
||||
0,
|
||||
NULL,
|
||||
{NULL}
|
||||
NULL
|
||||
};
|
||||
|
||||
menu_t OP_LocalSkinDef = DEFAULTMENUSTYLE(NULL, OP_TiltMenu, &OP_ForkedBirdDef, 30, 60);
|
||||
menu_t OP_LocalSkinDef = DEFAULTMENUSTYLE(NULL, OP_TiltMenu, &OP_ForkedBirdDef, 30, 60, NULL);
|
||||
|
||||
|
||||
// ==========================================================================
|
||||
@@ -4870,6 +4881,9 @@ void M_Init(void)
|
||||
|
||||
//todo put this somewhere better...
|
||||
CV_RegisterVar(&cv_allcaps);
|
||||
|
||||
memset(menu_text_input_buf, 0, sizeof menu_text_input_buf);
|
||||
M_TextInputInit(&menuinput, menu_text_input_buf, sizeof menu_text_input_buf);
|
||||
}
|
||||
|
||||
void M_InitCharacterTables(void)
|
||||
@@ -5186,6 +5200,16 @@ static void M_DrawSplitText(INT32 x, INT32 y, INT32 option, const char* str, INT
|
||||
free(clines);
|
||||
}
|
||||
|
||||
static void M_DoToolTips(menu_t* menu)
|
||||
{
|
||||
if (!menu->tooltips || itemOn == -1 || !menu->tooltips[itemOn])
|
||||
return;
|
||||
|
||||
M_DrawSplitText(BASEVIDWIDTH / 2, BASEVIDHEIGHT-50, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, menu->tooltips[itemOn], coolalphatimer);
|
||||
|
||||
if ((coolalphatimer > 0) && interpTimerHackAllow)
|
||||
coolalphatimer--;
|
||||
}
|
||||
|
||||
static void M_DrawGenericMenu(void)
|
||||
{
|
||||
@@ -5332,23 +5356,7 @@ static void M_DrawGenericMenu(void)
|
||||
|
||||
// dumb hack
|
||||
// tooltips
|
||||
// replaced with macro so it doesent look as terrible anymore lol
|
||||
DoToolTips(OP_ControlsDef, OP_ControlsTooltips);
|
||||
DoToolTips(OP_MouseOptionsDef, OP_MouseTooltips);
|
||||
DoToolTips(OP_VideoOptionsDef, OP_VideoTooltips);
|
||||
DoToolTips(OP_SoundOptionsDef, OP_SoundTooltips);
|
||||
DoToolTips(OP_FocusOptionsDef, OP_FocusOptionsTooltips);
|
||||
DoToolTips(OP_ChatOptionsDef, OP_ChatOptionsTooltips);
|
||||
DoToolTips(OP_GameOptionsDef, OP_GameTooltips);
|
||||
DoToolTips(OP_ServerOptionsDef, OP_ServerOptionsTooltips);
|
||||
//DoToolTips(OP_SaturnCreditsDef, OP_CreditTooltips); // C:
|
||||
DoToolTips(OP_BirdDef, OP_BirdTooltips);
|
||||
DoToolTips(OP_TiltDef, OP_TiltTooltips);
|
||||
DoToolTips(OP_AdvancedBirdDef, OP_AdvancedBirdTooltips);
|
||||
DoToolTips(OP_NametagDef, OP_NametagTooltips);
|
||||
DoToolTips(OP_DriftGaugeDef, OP_DriftGaugeTooltips);
|
||||
DoToolTips(OP_CamOptionsDef, OP_CamOptionsTooltips);
|
||||
DoToolTips(OP_Player1CamOptionsDef || currentMenu == &OP_Player2CamOptionsDef || currentMenu == &OP_Player3CamOptionsDef || currentMenu == &OP_Player4CamOptionsDef, OP_PlayerCamOptionsTooltips); // god this one is still terrible lmao
|
||||
M_DoToolTips(currentMenu);
|
||||
}
|
||||
|
||||
static void M_DrawGenericBackgroundMenu(void)
|
||||
@@ -5479,16 +5487,7 @@ static void M_DrawGenericScrollMenu(void)
|
||||
|
||||
// dumb hack
|
||||
// tooltips
|
||||
// same macro here
|
||||
DoToolTips(OP_ExpOptionsDef, OP_ExpTooltips);
|
||||
#ifdef HWRENDER
|
||||
DoToolTips(OP_OpenGLOptionsDef, OP_OpenGLTooltips);
|
||||
#endif
|
||||
DoToolTips(OP_SaturnDef, OP_SaturnTooltips);
|
||||
DoToolTips(OP_SaturnHudDef, OP_SaturnHudTooltips);
|
||||
DoToolTips(OP_AdvServerOptionsDef, OP_AdvServerOptionsTooltips);
|
||||
DoToolTips(OP_SoundAdvancedDef, OP_SoundAdvancedTooltips);
|
||||
DoToolTips(OP_PlayerDistortDef, OP_PlayerDistortTooltips);
|
||||
M_DoToolTips(currentMenu);
|
||||
}
|
||||
|
||||
static void M_DrawPauseMenu(void)
|
||||
@@ -5722,8 +5721,16 @@ boolean M_CanShowLevelInList(INT32 mapnum, INT32 gt)
|
||||
{
|
||||
case LLM_CREATESERVER:
|
||||
// Should the map be hidden? <-- well imma wanna toggle it, its just annoying being unable to select hell maps in mapselect
|
||||
if ((mapheaderinfo[mapnum]->menuflags & LF2_HIDEINMENU && mapnum+1 != gamemap) && (gt == GT_RACE && (mapheaderinfo[mapnum]->typeoflevel & TOL_RACE))) // map hell
|
||||
return cv_showallmaps.value;
|
||||
|
||||
if (mapheaderinfo[mapnum]->menuflags & LF2_HIDEINMENU && mapnum+1 != gamemap)
|
||||
{
|
||||
if (cv_showallmaps.value &&
|
||||
((gt == GT_RACE && (mapheaderinfo[mapnum]->typeoflevel & TOL_RACE)) || // race map hell
|
||||
((gt == GT_MATCH || gt == GT_TEAMMATCH) && (mapheaderinfo[mapnum]->typeoflevel & TOL_MATCH)))) // battle map hell
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
// same goes here, just show every map if i want to
|
||||
if (M_MapLocked(mapnum+1)) // not unlocked
|
||||
@@ -5803,7 +5810,7 @@ menu_t MessageDef =
|
||||
0, 0, // x, y (TO HACK)
|
||||
0, // lastOn, flags (TO HACK)
|
||||
NULL,
|
||||
{0},
|
||||
NULL,
|
||||
};
|
||||
|
||||
|
||||
@@ -6296,6 +6303,8 @@ static boolean M_AddonsRefresh(void)
|
||||
return false;
|
||||
}
|
||||
|
||||
static tic_t addons_scrolltic = 0; // maybe not the best place but e
|
||||
|
||||
static void M_DrawAddons(void)
|
||||
{
|
||||
INT32 x, y;
|
||||
@@ -6303,6 +6312,8 @@ static void M_DrawAddons(void)
|
||||
const UINT8 *flashcol = NULL;
|
||||
UINT8 hilicol;
|
||||
|
||||
if (renderisnewtic) addons_scrolltic++;
|
||||
|
||||
// hack - need to refresh at end of frame to handle addfile...
|
||||
if (refreshdirmenu & M_AddonsRefresh())
|
||||
{
|
||||
@@ -6386,6 +6397,9 @@ static void M_DrawAddons(void)
|
||||
for (; i < m; i++)
|
||||
{
|
||||
UINT32 flags = V_ALLOWLOWERCASE;
|
||||
#define MAXADDONNAME 31
|
||||
char scrollbuf[MAXADDONNAME+1] = {0};
|
||||
|
||||
if (y > BASEVIDHEIGHT) break;
|
||||
if (dirmenu[i])
|
||||
#define type (UINT8)(dirmenu[i][DIR_TYPE])
|
||||
@@ -6406,11 +6420,22 @@ static void M_DrawAddons(void)
|
||||
}
|
||||
|
||||
#define charsonside 14
|
||||
if (dirmenu[i][DIR_LEN] > (charsonside*2 + 3))
|
||||
V_DrawString(x, y+4, flags, va("%.*s...%s", charsonside, dirmenu[i]+DIR_STRING, dirmenu[i]+DIR_STRING+dirmenu[i][DIR_LEN]-(charsonside+1)));
|
||||
if (dirmenu[i][DIR_LEN] > MAXADDONNAME)
|
||||
{
|
||||
if ((size_t)i == dir_on[menudepthleft])
|
||||
{
|
||||
M_ScrollString(dirmenu[i]+DIR_STRING, dirmenu[i][DIR_LEN]-1, scrollbuf, MAXADDONNAME, addons_scrolltic);
|
||||
}
|
||||
else
|
||||
strncpy(scrollbuf, va("%.*s...%s", charsonside, dirmenu[i]+DIR_STRING, dirmenu[i]+DIR_STRING+dirmenu[i][DIR_LEN]-(charsonside+1)), MAXADDONNAME);
|
||||
|
||||
V_DrawString(x, y+4, flags, scrollbuf);
|
||||
}
|
||||
#undef charsonside
|
||||
else
|
||||
V_DrawString(x, y+4, flags, dirmenu[i]+DIR_STRING);
|
||||
|
||||
#undef MAXADDONNAME
|
||||
}
|
||||
#undef type
|
||||
y += 16;
|
||||
@@ -6535,11 +6560,13 @@ static void M_HandleAddons(INT32 choice)
|
||||
case KEY_DOWNARROW:
|
||||
if (dir_on[menudepthleft] < sizedirmenu-1)
|
||||
dir_on[menudepthleft]++;
|
||||
addons_scrolltic = 0;
|
||||
S_StartSound(NULL, sfx_menu1);
|
||||
break;
|
||||
case KEY_UPARROW:
|
||||
if (dir_on[menudepthleft])
|
||||
dir_on[menudepthleft]--;
|
||||
addons_scrolltic = 0;
|
||||
S_StartSound(NULL, sfx_menu1);
|
||||
break;
|
||||
case KEY_PGDN:
|
||||
@@ -6548,6 +6575,7 @@ static void M_HandleAddons(INT32 choice)
|
||||
for (i = numaddonsshown; i && (dir_on[menudepthleft] < sizedirmenu-1); i--)
|
||||
dir_on[menudepthleft]++;
|
||||
}
|
||||
addons_scrolltic = 0;
|
||||
S_StartSound(NULL, sfx_menu1);
|
||||
break;
|
||||
case KEY_PGUP:
|
||||
@@ -6556,6 +6584,7 @@ static void M_HandleAddons(INT32 choice)
|
||||
for (i = numaddonsshown; i && (dir_on[menudepthleft]); i--)
|
||||
dir_on[menudepthleft]--;
|
||||
}
|
||||
addons_scrolltic = 0;
|
||||
S_StartSound(NULL, sfx_menu1);
|
||||
break;
|
||||
case KEY_ENTER:
|
||||
@@ -6695,6 +6724,7 @@ static void M_HandleAddons(INT32 choice)
|
||||
|
||||
case KEY_ESCAPE:
|
||||
exitmenu = true;
|
||||
addons_scrolltic = 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -6867,6 +6897,32 @@ static void M_HutCheckReplays(size_t maxnum)
|
||||
}
|
||||
}
|
||||
|
||||
static int ReplayListSortComparator(const void *entry1, const void *entry2)
|
||||
{
|
||||
const menudemo_t *demo1 = (const menudemo_t*)entry1;
|
||||
const menudemo_t *demo2 = (const menudemo_t*)entry2;
|
||||
|
||||
char filepath1[sizeof(demo1->filepath)];
|
||||
char filepath2[sizeof(demo2->filepath)];
|
||||
|
||||
// First check for directories, they always should be at the top
|
||||
if (demo1->type == MD_SUBDIR && demo2->type != MD_SUBDIR)
|
||||
return -1;
|
||||
else if (demo2->type == MD_SUBDIR && demo1->type != MD_SUBDIR)
|
||||
return 1;
|
||||
else if (demo1->type == MD_SUBDIR && demo2->type == MD_SUBDIR)
|
||||
return 0;
|
||||
|
||||
memcpy(filepath1, demo1->filepath, sizeof(filepath1));
|
||||
memcpy(filepath2, demo2->filepath, sizeof(filepath2));
|
||||
|
||||
nameonly(filepath1);
|
||||
nameonly(filepath2);
|
||||
|
||||
// Comparing in opposite order to move new replays to the top
|
||||
return strncmp(filepath2, filepath1, sizeof(filepath1));
|
||||
}
|
||||
|
||||
static void PrepReplayList(boolean reset)
|
||||
{
|
||||
size_t i;
|
||||
@@ -6910,6 +6966,8 @@ static void PrepReplayList(boolean reset)
|
||||
}
|
||||
}
|
||||
|
||||
qs22j(demolist_all, sizedirmenu, sizeof(menudemo_t), ReplayListSortComparator);
|
||||
|
||||
Unlock_search_state();
|
||||
|
||||
LoadReplayNames();
|
||||
@@ -8433,51 +8491,6 @@ static musicdef_t *curplaying = NULL;
|
||||
static INT32 st_sel = 0;
|
||||
static tic_t st_musictime = 0;
|
||||
|
||||
static void scrollMusicName(const char name[], size_t len, size_t maxlen, char result[])
|
||||
{
|
||||
// How much should we scroll. Not sure why +1 is needed, but without it this function skips 2
|
||||
// characters at once sometimes
|
||||
const size_t amount = len - maxlen + 1;
|
||||
|
||||
// Note: anything above 17 will cause zero division
|
||||
const size_t MAXSPEED = 6;
|
||||
const size_t t = st_musictime / (35/min(amount, MAXSPEED));
|
||||
|
||||
const size_t state = (t / amount) % 4;
|
||||
|
||||
switch (state)
|
||||
{
|
||||
// Show beginning of the name
|
||||
case 0:
|
||||
memcpy(result, name, maxlen-1);
|
||||
break;
|
||||
|
||||
// Scroll towards end of the name
|
||||
case 1:
|
||||
{
|
||||
const size_t advance = t % amount;
|
||||
memcpy(result, name+advance, maxlen-1);
|
||||
}
|
||||
break;
|
||||
|
||||
// Show end of the name
|
||||
case 2:
|
||||
memcpy(result, name+len+1-maxlen, maxlen-1);
|
||||
break;
|
||||
|
||||
// Scroll towards start of the name
|
||||
case 3:
|
||||
{
|
||||
const size_t advance = t % amount;
|
||||
memcpy(result, name+len+1-maxlen-advance, maxlen-1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// Technically not necessary, since it gets set again after function call, but just in case
|
||||
result[maxlen] = 0;
|
||||
}
|
||||
|
||||
static void M_MusicTest(INT32 choice)
|
||||
{
|
||||
(void)choice;
|
||||
@@ -8619,7 +8632,7 @@ static void M_DrawMusicTest(void)
|
||||
char buf[MAXLENGTH+1];
|
||||
|
||||
if (t == st_sel && namelength > MAXLENGTH)
|
||||
scrollMusicName(songname, namelength, MAXLENGTH, buf);
|
||||
M_ScrollString(songname, namelength, buf, MAXLENGTH, st_musictime);
|
||||
else
|
||||
strncpy(buf, songname, MAXLENGTH);
|
||||
buf[MAXLENGTH] = 0;
|
||||
@@ -9596,7 +9609,7 @@ Fetch_servers_thread (int *id)
|
||||
}
|
||||
#endif/*MASTERSERVER*/
|
||||
|
||||
#define SERVERHEADERHEIGHT 36
|
||||
#define SERVERHEADERHEIGHT 48
|
||||
#define SERVERLINEHEIGHT 12
|
||||
|
||||
#define S_LINEY(n) currentMenu->y + SERVERHEADERHEIGHT + (n * SERVERLINEHEIGHT)
|
||||
@@ -9604,6 +9617,57 @@ Fetch_servers_thread (int *id)
|
||||
#ifndef NONET
|
||||
static UINT32 localservercount;
|
||||
|
||||
static void M_SearchServerList(void)
|
||||
{
|
||||
char servername[MAXSERVERNAME+1] = {0};
|
||||
serverlistsearchedcount = 0;
|
||||
|
||||
for (UINT32 i = 0; i < serverlistcount; ++i)
|
||||
{
|
||||
StripColors(servername, serverlist[i].info.servername, MAXSERVERNAME);
|
||||
if (menuinput.length == 0 || strcasestr(servername, menuinput.buffer) != NULL)
|
||||
serverlistsearched[serverlistsearchedcount++] = i;
|
||||
}
|
||||
|
||||
if (menuinput.length > 0)
|
||||
serverlistpage = 0;
|
||||
}
|
||||
|
||||
static void M_HandleServerSearch(INT32 choice)
|
||||
{
|
||||
boolean exitmenu = false; // exit to previous menu
|
||||
|
||||
switch (choice)
|
||||
{
|
||||
case KEY_DOWNARROW:
|
||||
M_NextOpt();
|
||||
S_StartSound(NULL, sfx_menu1);
|
||||
break;
|
||||
case KEY_UPARROW:
|
||||
M_PrevOpt();
|
||||
S_StartSound(NULL, sfx_menu1);
|
||||
break;
|
||||
case KEY_ESCAPE:
|
||||
exitmenu = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
if (M_TextInputHandle(&menuinput, choice))
|
||||
{
|
||||
S_StartSound(NULL, sfx_menu1);
|
||||
M_SearchServerList();
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (exitmenu)
|
||||
{
|
||||
if (currentMenu->prevMenu)
|
||||
M_SetupNextMenu(currentMenu->prevMenu);
|
||||
else
|
||||
M_ClearMenus(true);
|
||||
}
|
||||
}
|
||||
|
||||
static void M_HandleServerPage(INT32 choice)
|
||||
{
|
||||
boolean exitmenu = false; // exit to previous menu
|
||||
@@ -9626,7 +9690,7 @@ static void M_HandleServerPage(INT32 choice)
|
||||
case KEY_ENTER:
|
||||
case KEY_RIGHTARROW:
|
||||
S_StartSound(NULL, sfx_menu1);
|
||||
if ((serverlistpage + 1) * SERVERS_PER_PAGE < serverlistcount)
|
||||
if ((serverlistpage + 1) * SERVERS_PER_PAGE < serverlistsearchedcount)
|
||||
{
|
||||
oldserverlistpage = serverlistpage++;
|
||||
serverlistslidex = BASEVIDWIDTH;
|
||||
@@ -9657,7 +9721,7 @@ static void M_Connect(INT32 choice)
|
||||
{
|
||||
// do not call menuexitfunc
|
||||
M_ClearMenus(false);
|
||||
COM_BufAddText(va("connect node %d\n", serverlist[choice-FIRSTSERVERLINE + serverlistpage * SERVERS_PER_PAGE].node));
|
||||
COM_BufAddText(va("connect node %d\n", serverlist[serverlistsearched[choice-FIRSTSERVERLINE + serverlistpage * SERVERS_PER_PAGE]].node));
|
||||
}
|
||||
|
||||
static void M_Refresh(INT32 choice)
|
||||
@@ -9715,11 +9779,11 @@ static void M_DrawServerCountAndHorizontalBar(void)
|
||||
|
||||
radius = V_StringWidth(text, 0) / 2;
|
||||
|
||||
V_DrawCenteredString(center, currentMenu->y+28, 0, text);
|
||||
V_DrawCenteredString(center, currentMenu->y+40, 0, text);
|
||||
|
||||
// Horizontal line!
|
||||
V_DrawFill(1, currentMenu->y+32, center - radius - 2, 1, 0);
|
||||
V_DrawFill(center + radius + 2, currentMenu->y+32, BASEVIDWIDTH - 1, 1, 0);
|
||||
V_DrawFill(1, currentMenu->y+44, center - radius - 2, 1, 0);
|
||||
V_DrawFill(center + radius + 2, currentMenu->y+44, BASEVIDWIDTH - 1, 1, 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -9729,9 +9793,9 @@ static void M_DrawServerLines(INT32 x, INT32 page)
|
||||
const char *gt = "Unknown";
|
||||
const char *spd = "";
|
||||
|
||||
for (i = 0; i < min(serverlistcount - page * SERVERS_PER_PAGE, SERVERS_PER_PAGE); i++)
|
||||
for (i = 0; i < min(serverlistsearchedcount - page * SERVERS_PER_PAGE, SERVERS_PER_PAGE); i++)
|
||||
{
|
||||
INT32 slindex = i + page * SERVERS_PER_PAGE;
|
||||
INT32 slindex = serverlistsearched[i + page * SERVERS_PER_PAGE];
|
||||
UINT32 globalflags = ((serverlist[slindex].info.numberofplayer >= serverlist[slindex].info.maxplayer) ? V_TRANSLUCENT : 0)
|
||||
|((itemOn == FIRSTSERVERLINE+i) ? highlightflags : 0)|V_ALLOWLOWERCASE;
|
||||
|
||||
@@ -9770,7 +9834,7 @@ static void M_DrawServerLines(INT32 x, INT32 page)
|
||||
static void M_DrawConnectMenu(void)
|
||||
{
|
||||
UINT16 i;
|
||||
INT32 numPages = (serverlistcount+(SERVERS_PER_PAGE-1))/SERVERS_PER_PAGE;
|
||||
INT32 numPages = (serverlistsearchedcount+(SERVERS_PER_PAGE-1))/SERVERS_PER_PAGE;
|
||||
INT32 mservflags = V_ALLOWLOWERCASE;
|
||||
|
||||
for (i = FIRSTSERVERLINE; i < min(localservercount, SERVERS_PER_PAGE)+FIRSTSERVERLINE; i++)
|
||||
@@ -9820,6 +9884,16 @@ static void M_DrawConnectMenu(void)
|
||||
M_DrawServerLines(currentMenu->x, serverlistpage);
|
||||
}
|
||||
|
||||
V_DrawFill(currentMenu->x, currentMenu->y, MAXSTRINGLENGTH*8+6, 8+6, 239);
|
||||
|
||||
const INT32 xoff = 3, yoff = 3;
|
||||
|
||||
|
||||
if (itemOn != 0)
|
||||
V_DrawString(currentMenu->x+xoff, currentMenu->y+yoff, V_ALLOWLOWERCASE, menuinput.buffer);
|
||||
else
|
||||
M_DrawTextInput(currentMenu->x+xoff, currentMenu->y+yoff, &menuinput, 0);
|
||||
|
||||
localservercount = serverlistcount;
|
||||
|
||||
M_DrawGenericMenu();
|
||||
@@ -9899,6 +9973,7 @@ void M_SortServerList(void)
|
||||
qs22j(serverlist, serverlistcount, sizeof(serverelem_t), ServerListEntryComparator_gametype);
|
||||
break;
|
||||
}
|
||||
M_SearchServerList();
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -9957,6 +10032,9 @@ static void M_ConnectMenu(INT32 choice)
|
||||
|
||||
CL_UpdateServerList();
|
||||
|
||||
// Reset
|
||||
M_TextInputSetString(&menuinput, "");
|
||||
|
||||
M_SetupNextMenu(&MP_ConnectDef);
|
||||
itemOn = 0;
|
||||
|
||||
@@ -10212,17 +10290,28 @@ static void M_DrawLevelSelectOnly(boolean leftfade, boolean rightfade)
|
||||
|
||||
if (cv_nextmap.value && cv_showtrackaddon.value)
|
||||
{
|
||||
static tic_t namescroll = 0;
|
||||
static INT32 namescrollmap = 0;
|
||||
char namescrollbuf[64]= {0};
|
||||
|
||||
if (cv_nextmap.value != namescrollmap)
|
||||
{
|
||||
namescrollmap = cv_nextmap.value;
|
||||
namescroll = 0;
|
||||
}
|
||||
|
||||
if (renderisnewtic) namescroll++;
|
||||
|
||||
char *addonname = wadfiles[mapwads[cv_nextmap.value-1]]->filename;
|
||||
INT32 len;
|
||||
INT32 charlimit = 21 + (dupadjust/5);
|
||||
INT32 charlimit = min((size_t)(21 + (dupadjust/5)), sizeof(namescrollbuf)-1);
|
||||
nameonly(addonname);
|
||||
len = strlen(addonname);
|
||||
#define charsonside 14
|
||||
if (len > charlimit)
|
||||
V_DrawThinString(x+w+5, y+i-8, V_TRANSLUCENT|MENUCAPS, va("%.*s...%s", charsonside, addonname, addonname+((len-charlimit) + charsonside))); // variable reuse...
|
||||
#undef charsonside
|
||||
M_ScrollString(addonname, len, namescrollbuf, charlimit, namescroll);
|
||||
else
|
||||
V_DrawThinString(x+w+5, y+i-8, V_TRANSLUCENT|MENUCAPS, addonname); // variable reuse...
|
||||
strncpy(namescrollbuf, addonname, sizeof(namescrollbuf));
|
||||
V_DrawThinString(x+w+5, y+i-8, V_TRANSLUCENT|MENUCAPS, namescrollbuf); // variable reuse...
|
||||
}
|
||||
|
||||
if (!cv_kartencore.value || gamestate == GS_TIMEATTACK || cv_newgametype.value != GT_RACE)
|
||||
|
||||
+17
-28
@@ -212,14 +212,14 @@ extern menuitem_t PlayerMenu[MAXSKINS];
|
||||
typedef struct menu_s
|
||||
{
|
||||
const char *menutitlepic;
|
||||
INT16 numitems; // # of menu items
|
||||
struct menu_s *prevMenu; // previous menu
|
||||
menuitem_t *menuitems; // menu items
|
||||
void (*drawroutine)(void); // draw routine
|
||||
INT16 x, y; // x, y of menu
|
||||
INT16 lastOn; // last item user was on in menu
|
||||
boolean (*quitroutine)(void); // called before quit a menu return true if we can
|
||||
const char* tooltips[MAXTOOLTIPS]; // tooltips! give me that info bitch
|
||||
INT16 numitems; // # of menu items
|
||||
struct menu_s *prevMenu; // previous menu
|
||||
menuitem_t *menuitems; // menu items
|
||||
void (*drawroutine)(void); // draw routine
|
||||
INT16 x, y; // x, y of menu
|
||||
INT16 lastOn; // last item user was on in menu
|
||||
boolean (*quitroutine)(void); // called before quit a menu return true if we can
|
||||
const char* *tooltips; // tooltips! give me that info bitch
|
||||
} menu_t;
|
||||
|
||||
void M_SetupNextMenu(menu_t *menudef);
|
||||
@@ -335,7 +335,7 @@ void M_PopupMasterServerConnectError(void);
|
||||
void M_SlotCvarIntoModMenu(consvar_t* cvar, const char* category, const char* name);
|
||||
|
||||
// These defines make it a little easier to make menus
|
||||
#define DEFAULTMENUSTYLE(header, source, prev, x, y)\
|
||||
#define DEFAULTMENUSTYLE(header, source, prev, x, y, tooltip)\
|
||||
{\
|
||||
header,\
|
||||
sizeof(source)/sizeof(menuitem_t),\
|
||||
@@ -345,10 +345,10 @@ void M_SlotCvarIntoModMenu(consvar_t* cvar, const char* category, const char* na
|
||||
x, y,\
|
||||
0,\
|
||||
NULL,\
|
||||
{NULL}\
|
||||
tooltip\
|
||||
}
|
||||
|
||||
#define DEFAULTSCROLLSTYLE(header, source, prev, x, y)\
|
||||
#define DEFAULTSCROLLSTYLE(header, source, prev, x, y, tooltip)\
|
||||
{\
|
||||
header,\
|
||||
sizeof(source)/sizeof(menuitem_t),\
|
||||
@@ -358,7 +358,7 @@ void M_SlotCvarIntoModMenu(consvar_t* cvar, const char* category, const char* na
|
||||
x, y,\
|
||||
0,\
|
||||
NULL,\
|
||||
{NULL}\
|
||||
tooltip\
|
||||
}
|
||||
|
||||
|
||||
@@ -372,7 +372,7 @@ void M_SlotCvarIntoModMenu(consvar_t* cvar, const char* category, const char* na
|
||||
x, y,\
|
||||
0,\
|
||||
NULL,\
|
||||
{NULL}\
|
||||
NULL\
|
||||
}
|
||||
|
||||
#define CENTERMENUSTYLE(header, source, prev, y)\
|
||||
@@ -385,7 +385,7 @@ void M_SlotCvarIntoModMenu(consvar_t* cvar, const char* category, const char* na
|
||||
BASEVIDWIDTH/2, y,\
|
||||
0,\
|
||||
NULL,\
|
||||
{NULL}\
|
||||
NULL\
|
||||
}
|
||||
|
||||
#define MAPICONMENUSTYLE(header, source, prev)\
|
||||
@@ -398,7 +398,7 @@ void M_SlotCvarIntoModMenu(consvar_t* cvar, const char* category, const char* na
|
||||
24,40,\
|
||||
0,\
|
||||
NULL,\
|
||||
{NULL}\
|
||||
NULL\
|
||||
}
|
||||
|
||||
#define CONTROLMENUSTYLE(source, prev)\
|
||||
@@ -411,7 +411,7 @@ void M_SlotCvarIntoModMenu(consvar_t* cvar, const char* category, const char* na
|
||||
26, 40,\
|
||||
0,\
|
||||
NULL,\
|
||||
{NULL}\
|
||||
NULL\
|
||||
}
|
||||
|
||||
#define IMAGEDEF(source)\
|
||||
@@ -424,18 +424,7 @@ void M_SlotCvarIntoModMenu(consvar_t* cvar, const char* category, const char* na
|
||||
0, 0,\
|
||||
0,\
|
||||
NULL,\
|
||||
{NULL}\
|
||||
}
|
||||
|
||||
#define DoToolTips(menu, tooltip)\
|
||||
if (currentMenu == &menu)\
|
||||
{\
|
||||
if (!(tooltip[itemOn] == NULL))\
|
||||
{\
|
||||
M_DrawSplitText(BASEVIDWIDTH / 2, BASEVIDHEIGHT-50, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, tooltip[itemOn], coolalphatimer);\
|
||||
if (coolalphatimer > 0 && interpTimerHackAllow)\
|
||||
coolalphatimer--;\
|
||||
}\
|
||||
NULL\
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
+127
@@ -1604,6 +1604,52 @@ boolean M_ScreenshotResponder(event_t *ev)
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void M_ScrollString(const char name[], size_t len, char result[], size_t maxlen, tic_t timer)
|
||||
{
|
||||
// How much should we scroll. Not sure why +1 is needed, but without it this function skips 2
|
||||
// characters at once sometimes
|
||||
const size_t amount = len - maxlen + 1;
|
||||
|
||||
// Note: anything above 17 will cause zero division
|
||||
const size_t MAXSPEED = 6;
|
||||
const tic_t t = timer / (35/min(amount, MAXSPEED));
|
||||
|
||||
const size_t state = (t / amount) % 4;
|
||||
|
||||
switch (state)
|
||||
{
|
||||
// Show beginning of the name
|
||||
case 0:
|
||||
memcpy(result, name, maxlen-1);
|
||||
break;
|
||||
|
||||
// Scroll towards end of the name
|
||||
case 1:
|
||||
{
|
||||
const size_t advance = t % amount;
|
||||
memcpy(result, name+advance, maxlen-1);
|
||||
}
|
||||
break;
|
||||
|
||||
// Show end of the name
|
||||
case 2:
|
||||
memcpy(result, name+len+1-maxlen, maxlen-1);
|
||||
break;
|
||||
|
||||
// Scroll towards start of the name
|
||||
case 3:
|
||||
{
|
||||
const size_t advance = t % amount;
|
||||
memcpy(result, name+len+1-maxlen-advance, maxlen-1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// Technically not necessary, since it gets set again after function call, but just in case
|
||||
result[maxlen] = 0;
|
||||
}
|
||||
|
||||
void M_MinimapGenerate(void)
|
||||
{
|
||||
#ifdef USE_PNG
|
||||
@@ -1762,6 +1808,87 @@ INT32 axtoi(const char *hexStg)
|
||||
return intValue;
|
||||
}
|
||||
|
||||
void CopyCaretColors(char *p, const char *s, int n)
|
||||
{
|
||||
char *t;
|
||||
int m;
|
||||
int c;
|
||||
|
||||
if (!n)
|
||||
return;
|
||||
|
||||
while (( t = strchr(s, '^') ))
|
||||
{
|
||||
m = ( t - s );
|
||||
|
||||
if (m >= n)
|
||||
{
|
||||
memcpy(p, s, n);
|
||||
return;
|
||||
}
|
||||
else
|
||||
memcpy(p, s, m);
|
||||
|
||||
p += m;
|
||||
n -= m;
|
||||
s += m;
|
||||
|
||||
if (!n)
|
||||
return;
|
||||
|
||||
if (s[1])
|
||||
{
|
||||
c = toupper(s[1]);
|
||||
if (isdigit(c))
|
||||
c = 0x80 + ( c - '0' );
|
||||
else if (c >= 'A' && c <= 'F')
|
||||
c = 0x80 + ( c - 'A' );
|
||||
else
|
||||
c = 0;
|
||||
|
||||
if (c)
|
||||
{
|
||||
*p++ = c;
|
||||
n--;
|
||||
|
||||
if (!n)
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (n < 2)
|
||||
break;
|
||||
|
||||
memcpy(p, s, 2);
|
||||
|
||||
p += 2;
|
||||
n -= 2;
|
||||
}
|
||||
|
||||
s += 2;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
strncpy(p, s, n);
|
||||
}
|
||||
|
||||
void StripColors(char *dst, char *src, size_t n)
|
||||
{
|
||||
size_t j = 0;
|
||||
|
||||
for (size_t i = 0; j < n && src[i] != 0; ++i)
|
||||
{
|
||||
char c = src[i];
|
||||
|
||||
if ((c & 0x80) == 0)
|
||||
dst[j++] = c;
|
||||
}
|
||||
|
||||
dst[j] = 0;
|
||||
}
|
||||
|
||||
/** Token parser for TEXTURES, ANIMDEFS, and potentially other lumps later down the line.
|
||||
* Was originally R_GetTexturesToken when I was coding up the TEXTURES parser, until I realized I needed it for ANIMDEFS too.
|
||||
* Parses up to the next whitespace character or comma. When finding the start of the next token, whitespace is skipped.
|
||||
|
||||
@@ -73,6 +73,8 @@ void M_ScreenShot(void);
|
||||
void M_DoScreenShot(void);
|
||||
boolean M_ScreenshotResponder(event_t *ev);
|
||||
|
||||
void M_ScrollString(const char name[], size_t len, char result[], size_t maxlen, tic_t timer);
|
||||
|
||||
void M_MinimapGenerate(void);
|
||||
|
||||
void Command_SaveConfig_f(void);
|
||||
@@ -85,6 +87,11 @@ void M_SaveConfig(const char *filename);
|
||||
|
||||
INT32 axtoi(const char *hexStg);
|
||||
|
||||
void CopyCaretColors(char *p, const char *s, int n);
|
||||
|
||||
// Remove color codes from string
|
||||
void StripColors(char *dst, char *src, size_t n);
|
||||
|
||||
const char *GetRevisionString(void);
|
||||
|
||||
// Vector/matrix math
|
||||
|
||||
+3
-1
@@ -1542,15 +1542,17 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source)
|
||||
{
|
||||
if (target->target->hnext)
|
||||
K_KillBananaChain(target->target->hnext, inflictor, source);
|
||||
|
||||
target->target->player->kartstuff[k_itemamount] = 0;
|
||||
}
|
||||
else if (target->target->player->kartstuff[k_itemamount])
|
||||
else
|
||||
target->target->player->kartstuff[k_itemamount]--;
|
||||
}
|
||||
else if ((target->type == MT_ORBINAUT_SHIELD && target->target->player->kartstuff[k_itemtype] == KITEM_ORBINAUT) // orbit items
|
||||
|| (target->type == MT_JAWZ_SHIELD && target->target->player->kartstuff[k_itemtype] == KITEM_JAWZ))
|
||||
{
|
||||
target->target->player->kartstuff[k_itemamount]--;
|
||||
|
||||
if (target->lastlook != 0)
|
||||
{
|
||||
K_RepairOrbitChain(target);
|
||||
|
||||
@@ -158,6 +158,8 @@ extern consvar_t cv_tiltsmoothing;
|
||||
|
||||
extern consvar_t cv_actionmovie;
|
||||
|
||||
extern consvar_t cv_screenquake;
|
||||
|
||||
extern consvar_t cv_lookbackmom[MAXSPLITSCREENPLAYERS];
|
||||
|
||||
extern consvar_t cv_verticallook[MAXSPLITSCREENPLAYERS];
|
||||
|
||||
+37
-35
@@ -1691,7 +1691,7 @@ static boolean PIT_CheckLine(line_t *ld)
|
||||
boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
|
||||
{
|
||||
INT32 xl, xh, yl, yh, bx, by;
|
||||
subsector_t *newsubsec;
|
||||
sector_t *newsec;
|
||||
boolean blockval = true;
|
||||
|
||||
ps_checkposition_calls.value.i++;
|
||||
@@ -1714,9 +1714,9 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
|
||||
tmbbox[BOXLEFT] = x - tmthing->radius;
|
||||
|
||||
if (thing->x != x || thing->y != y || thing->subsector == NULL)
|
||||
newsubsec = R_PointInSubsector(x, y);
|
||||
newsec = R_PointInSubsector(x, y)->sector;
|
||||
else
|
||||
newsubsec = thing->subsector;
|
||||
newsec = thing->subsector->sector;
|
||||
|
||||
ceilingline = blockingline = NULL;
|
||||
|
||||
@@ -1724,33 +1724,34 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
|
||||
// that contains the point.
|
||||
// Any contacted lines the step closer together
|
||||
// will adjust them.
|
||||
tmfloorz = tmdropoffz = P_GetFloorZ(thing, newsubsec->sector, x, y, NULL); //newsubsec->sector->floorheight;
|
||||
tmceilingz = P_GetCeilingZ(thing, newsubsec->sector, x, y, NULL); //newsubsec->sector->ceilingheight;
|
||||
tmfloorslope = newsubsec->sector->f_slope;
|
||||
tmceilingslope = newsubsec->sector->c_slope;
|
||||
tmfloorz = tmdropoffz = P_GetFloorZ(thing, newsec, x, y, NULL); //newsec->floorheight;
|
||||
tmceilingz = P_GetCeilingZ(thing, newsec, x, y, NULL); //newsec->ceilingheight;
|
||||
tmfloorslope = newsec->f_slope;
|
||||
tmceilingslope = newsec->c_slope;
|
||||
|
||||
// Check list of fake floors and see if tmfloorz/tmceilingz need to be altered.
|
||||
if (newsubsec->sector->ffloors)
|
||||
if (newsec->ffloors)
|
||||
{
|
||||
ffloor_t *rover;
|
||||
fixed_t delta1, delta2;
|
||||
INT32 thingtop = thing->z + thing->height;
|
||||
|
||||
for (rover = newsubsec->sector->ffloors; rover; rover = rover->next)
|
||||
for (rover = newsec->ffloors; rover; rover = rover->next)
|
||||
{
|
||||
fixed_t topheight, bottomheight, midheight;
|
||||
|
||||
if (!(rover->flags & FF_EXISTS))
|
||||
continue;
|
||||
|
||||
topheight = P_GetFOFTopZ(thing, newsubsec->sector, rover, x, y, NULL);
|
||||
bottomheight = P_GetFOFBottomZ(thing, newsubsec->sector, rover, x, y, NULL);
|
||||
topheight = P_GetFOFTopZ(thing, newsec, rover, x, y, NULL);
|
||||
bottomheight = P_GetFOFBottomZ(thing, newsec, rover, x, y, NULL);
|
||||
|
||||
if ((rover->flags & (FF_SWIMMABLE|FF_GOOWATER)) == (FF_SWIMMABLE|FF_GOOWATER) && !(thing->flags & MF_NOGRAVITY))
|
||||
{
|
||||
// If you're inside goowater and slowing down
|
||||
fixed_t sinklevel = FixedMul(thing->info->height/6, thing->scale);
|
||||
fixed_t minspeed = FixedMul(thing->info->height/9, thing->scale);
|
||||
|
||||
if (thing->z < topheight && bottomheight < thingtop
|
||||
&& abs(thing->momz) < minspeed)
|
||||
{
|
||||
@@ -1984,7 +1985,7 @@ void P_CheckHoopPosition(mobj_t *hoopthing, fixed_t x, fixed_t y, fixed_t z, fix
|
||||
boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam)
|
||||
{
|
||||
INT32 xl, xh, yl, yh, bx, by;
|
||||
subsector_t *newsubsec;
|
||||
sector_t *newsec;
|
||||
|
||||
tmx = x;
|
||||
tmy = y;
|
||||
@@ -1995,15 +1996,15 @@ boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam)
|
||||
tmbbox[BOXLEFT] = x - thiscam->radius;
|
||||
|
||||
if (thiscam->x != x || thiscam->y != y || thiscam->subsector == NULL)
|
||||
newsubsec = R_PointInSubsector(x, y);
|
||||
newsec = R_PointInSubsectorFast(x, y)->sector;
|
||||
else
|
||||
newsubsec = thiscam->subsector;
|
||||
newsec = thiscam->subsector->sector;
|
||||
|
||||
ceilingline = blockingline = NULL;
|
||||
|
||||
mapcampointer = thiscam;
|
||||
|
||||
if (GETSECSPECIAL(newsubsec->sector->special, 4) == 12)
|
||||
if (GETSECSPECIAL(newsec->special, 4) == 12)
|
||||
{ // Camera noclip on entire sector.
|
||||
tmfloorz = tmdropoffz = thiscam->z;
|
||||
tmceilingz = tmdrpoffceilz = thiscam->z + thiscam->height;
|
||||
@@ -2014,45 +2015,47 @@ boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam)
|
||||
// that contains the point.
|
||||
// Any contacted lines the step closer together
|
||||
// will adjust them.
|
||||
tmfloorz = tmdropoffz = P_CameraGetFloorZ(thiscam, newsubsec->sector, x, y, NULL);
|
||||
tmfloorz = tmdropoffz = P_CameraGetFloorZ(thiscam, newsec, x, y, NULL);
|
||||
|
||||
tmceilingz = P_CameraGetCeilingZ(thiscam, newsubsec->sector, x, y, NULL);
|
||||
tmceilingz = P_CameraGetCeilingZ(thiscam, newsec, x, y, NULL);
|
||||
|
||||
// Cameras use the heightsec's heights rather then the actual sector heights.
|
||||
// If you can see through it, why not move the camera through it too?
|
||||
if (newsubsec->sector->heightsec >= 0)
|
||||
if (newsec->heightsec >= 0)
|
||||
{
|
||||
tmfloorz = tmdropoffz = sectors[newsubsec->sector->heightsec].floorheight;
|
||||
tmceilingz = tmdrpoffceilz = sectors[newsubsec->sector->heightsec].ceilingheight;
|
||||
tmfloorz = tmdropoffz = sectors[newsec->heightsec].floorheight;
|
||||
tmceilingz = tmdrpoffceilz = sectors[newsec->heightsec].ceilingheight;
|
||||
}
|
||||
|
||||
// Use preset camera clipping heights if set with Sector Special Parameters whose control sector has Camera Intangible special -Red
|
||||
if (newsubsec->sector->camsec >= 0)
|
||||
if (newsec->camsec >= 0)
|
||||
{
|
||||
tmfloorz = tmdropoffz = sectors[newsubsec->sector->camsec].floorheight;
|
||||
tmceilingz = tmdrpoffceilz = sectors[newsubsec->sector->camsec].ceilingheight;
|
||||
tmfloorz = tmdropoffz = sectors[newsec->camsec].floorheight;
|
||||
tmceilingz = tmdrpoffceilz = sectors[newsec->camsec].ceilingheight;
|
||||
}
|
||||
|
||||
// Check list of fake floors and see if tmfloorz/tmceilingz need to be altered.
|
||||
if (newsubsec->sector->ffloors)
|
||||
if (newsec->ffloors)
|
||||
{
|
||||
ffloor_t *rover;
|
||||
fixed_t delta1, delta2;
|
||||
INT32 thingtop = thiscam->z + thiscam->height;
|
||||
|
||||
for (rover = newsubsec->sector->ffloors; rover; rover = rover->next)
|
||||
for (rover = newsec->ffloors; rover; rover = rover->next)
|
||||
{
|
||||
fixed_t topheight, bottomheight;
|
||||
|
||||
if (!(rover->flags & FF_BLOCKOTHERS) || !(rover->flags & FF_EXISTS) || !(rover->flags & FF_RENDERALL) || GETSECSPECIAL(rover->master->frontsector->special, 4) == 12)
|
||||
continue;
|
||||
|
||||
topheight = P_CameraGetFOFTopZ(thiscam, newsubsec->sector, rover, x, y, NULL);
|
||||
bottomheight = P_CameraGetFOFBottomZ(thiscam, newsubsec->sector, rover, x, y, NULL);
|
||||
topheight = P_CameraGetFOFTopZ(thiscam, newsec, rover, x, y, NULL);
|
||||
bottomheight = P_CameraGetFOFBottomZ(thiscam, newsec, rover, x, y, NULL);
|
||||
|
||||
delta1 = thiscam->z - (bottomheight
|
||||
+ ((topheight - bottomheight)/2));
|
||||
delta2 = thingtop - (bottomheight
|
||||
+ ((topheight - bottomheight)/2));
|
||||
|
||||
if (topheight > tmfloorz && abs(delta1) < abs(delta2))
|
||||
{
|
||||
tmfloorz = tmdropoffz = topheight;
|
||||
@@ -2171,8 +2174,6 @@ boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam)
|
||||
boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam)
|
||||
{
|
||||
subsector_t *s;
|
||||
|
||||
boolean retval = true;
|
||||
UINT8 i;
|
||||
|
||||
floatok = false;
|
||||
@@ -2181,7 +2182,7 @@ boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam)
|
||||
return false;
|
||||
|
||||
if (thiscam->x != x || thiscam->y != y || thiscam->subsector == NULL)
|
||||
s = R_PointInSubsector(x, y);
|
||||
s = R_PointInSubsectorFast(x, y);
|
||||
else
|
||||
s = thiscam->subsector;
|
||||
|
||||
@@ -2222,12 +2223,12 @@ boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam)
|
||||
else
|
||||
tryy = y;
|
||||
|
||||
if (!P_CheckCameraPosition(tryx, tryy, thiscam))
|
||||
return false; // solid wall or thing
|
||||
|
||||
if (tmceilingz - tmfloorz < thiscam->height)
|
||||
return false; // doesn't fit
|
||||
|
||||
if (!P_CheckCameraPosition(tryx, tryy, thiscam))
|
||||
return false; // solid wall or thing
|
||||
|
||||
floatok = true;
|
||||
|
||||
if (tmceilingz - thiscam->z < thiscam->height)
|
||||
@@ -2248,7 +2249,8 @@ boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam)
|
||||
|
||||
if ((tmfloorz - thiscam->z > MAXCAMERASTEPMOVE))
|
||||
return false; // too big a step up
|
||||
} while(tryx != x || tryy != y);
|
||||
|
||||
} while (tryx != x || tryy != y);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2265,7 +2267,7 @@ boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam)
|
||||
thiscam->y = y;
|
||||
thiscam->subsector = s;
|
||||
|
||||
return retval;
|
||||
return true;
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
+1
-1
@@ -908,7 +908,7 @@ void P_SetUnderlayPosition(mobj_t *thing)
|
||||
|
||||
void P_SetPrecipitationThingPosition(precipmobj_t *thing)
|
||||
{
|
||||
thing->subsector = R_PointInSubsector(thing->x, thing->y);
|
||||
thing->subsector = R_PointInSubsectorFast(thing->x, thing->y);
|
||||
|
||||
// NOTE: this works because bnext/bprev are at the same
|
||||
// offsets in precipmobj_t and mobj_t
|
||||
|
||||
+67
-86
@@ -178,7 +178,7 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state)
|
||||
// Set animation state
|
||||
// The pflags version of this was just as convoluted.
|
||||
// Rewriten for SRB2kart ... though I don't know what this is.
|
||||
switch(state)
|
||||
switch (state)
|
||||
{
|
||||
case S_KART_STND1...S_KART_STND2_R:
|
||||
case S_KART_SQUISH:
|
||||
@@ -203,7 +203,7 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state)
|
||||
|
||||
do
|
||||
{
|
||||
if (state == S_NULL)
|
||||
if (UNLIKELY(state == S_NULL))
|
||||
{ // Bad SOC!
|
||||
CONS_Alert(CONS_ERROR, "Cannot remove player mobj by setting its state to S_NULL.\n");
|
||||
//P_RemoveMobj(mobj);
|
||||
@@ -239,7 +239,7 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state)
|
||||
state = st->nextstate;
|
||||
} while (!mobj->tics && !seenstate[state]);
|
||||
|
||||
if (!mobj->tics)
|
||||
if (UNLIKELY(!mobj->tics))
|
||||
CONS_Alert(CONS_WARNING, M_GetText("State cycle detected, exiting.\n"));
|
||||
|
||||
if (!--recursion)
|
||||
@@ -306,7 +306,7 @@ boolean P_SetMobjState(mobj_t *mobj, statenum_t state)
|
||||
state = st->nextstate;
|
||||
} while (!mobj->tics && !seenstate[state]);
|
||||
|
||||
if (!mobj->tics)
|
||||
if (UNLIKELY(!mobj->tics))
|
||||
CONS_Alert(CONS_WARNING, M_GetText("State cycle detected, exiting.\n"));
|
||||
|
||||
if (!--recursion)
|
||||
@@ -777,7 +777,7 @@ fixed_t P_CameraFloorZ(camera_t *mobj, sector_t *sector, sector_t *boundsec, fix
|
||||
testy += y;
|
||||
|
||||
// If the highest point is in the sector, then we have it easy! Just get the Z at that point
|
||||
if (R_PointInSubsector(testx, testy)->sector == (boundsec ? boundsec : sector))
|
||||
if (R_PointInSubsectorFast(testx, testy)->sector == (boundsec ? boundsec : sector))
|
||||
return P_GetSlopeZAt(slope, testx, testy);
|
||||
|
||||
// If boundsec is set, we're looking for specials. In that case, iterate over every line in this sector to find the TRUE highest/lowest point
|
||||
@@ -856,7 +856,7 @@ fixed_t P_CameraCeilingZ(camera_t *mobj, sector_t *sector, sector_t *boundsec, f
|
||||
testy += y;
|
||||
|
||||
// If the highest point is in the sector, then we have it easy! Just get the Z at that point
|
||||
if (R_PointInSubsector(testx, testy)->sector == (boundsec ? boundsec : sector))
|
||||
if (R_PointInSubsectorFast(testx, testy)->sector == (boundsec ? boundsec : sector))
|
||||
return P_GetSlopeZAt(slope, testx, testy);
|
||||
|
||||
// If boundsec is set, we're looking for specials. In that case, iterate over every line in this sector to find the TRUE highest/lowest point
|
||||
@@ -1916,11 +1916,9 @@ boolean P_CheckSolidLava(mobj_t *mo, ffloor_t *rover)
|
||||
I_Assert(mo != NULL);
|
||||
I_Assert(!P_MobjWasRemoved(mo));
|
||||
|
||||
fixed_t topheight = P_GetFFloorTopZAt(rover, mo->x, mo->y);
|
||||
|
||||
if (rover->flags & FF_SWIMMABLE && GETSECSPECIAL(rover->master->frontsector->special, 1) == 3
|
||||
&& !(rover->master->flags & ML_BLOCKMONSTERS)
|
||||
&& ((rover->master->flags & ML_EFFECT3) || mo->z-mo->momz > topheight - FixedMul(16*FRACUNIT, mo->scale)))
|
||||
&& ((rover->master->flags & ML_EFFECT3) || mo->z-mo->momz > P_GetFFloorTopZAt(rover, mo->x, mo->y) - FixedMul(16*FRACUNIT, mo->scale)))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@@ -3308,7 +3306,7 @@ boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled
|
||||
}
|
||||
}
|
||||
|
||||
thiscam->subsector = R_PointInSubsector(thiscam->x, thiscam->y);
|
||||
thiscam->subsector = R_PointInSubsectorFast(thiscam->x, thiscam->y);
|
||||
thiscam->floorz = tmfloorz;
|
||||
thiscam->ceilingz = tmceilingz;
|
||||
|
||||
@@ -3367,6 +3365,7 @@ boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled
|
||||
thiscam->ceilingz = thiscam->z + thiscam->height;
|
||||
thiscam->floorz = thiscam->z;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -3392,7 +3391,7 @@ static void P_PlayerMobjThinker(mobj_t *mobj)
|
||||
mobj->eflags &= ~MFE_JUSTSTEPPEDDOWN;
|
||||
|
||||
// Zoom tube
|
||||
if (mobj->tracer && mobj->tracer->type == MT_TUBEWAYPOINT)
|
||||
if (UNLIKELY(mobj->tracer && mobj->tracer->type == MT_TUBEWAYPOINT))
|
||||
{
|
||||
P_UnsetThingPosition(mobj);
|
||||
mobj->x += mobj->momx;
|
||||
@@ -3402,7 +3401,7 @@ static void P_PlayerMobjThinker(mobj_t *mobj)
|
||||
P_CheckPosition(mobj, mobj->x, mobj->y);
|
||||
goto animonly;
|
||||
}
|
||||
else if (mobj->player->pflags & PF_MACESPIN && mobj->tracer)
|
||||
else if (UNLIKELY(mobj->player->pflags & PF_MACESPIN && mobj->tracer))
|
||||
{
|
||||
P_CheckPosition(mobj, mobj->x, mobj->y);
|
||||
goto animonly;
|
||||
@@ -3421,7 +3420,7 @@ static void P_PlayerMobjThinker(mobj_t *mobj)
|
||||
else
|
||||
P_TryMove(mobj, mobj->x, mobj->y, true);
|
||||
|
||||
if (!(netgame && mobj->player->spectator))
|
||||
if (LIKELY(!(netgame && mobj->player->spectator)))
|
||||
{
|
||||
// Crumbling platforms
|
||||
for (node = mobj->touching_sectorlist; node; node = node->m_sectorlist_next)
|
||||
@@ -3468,6 +3467,7 @@ static void P_PlayerMobjThinker(mobj_t *mobj)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (thereiswater)
|
||||
{
|
||||
for (node = mobj->touching_sectorlist; node; node = node->m_sectorlist_next)
|
||||
@@ -6015,7 +6015,8 @@ angle_t P_MobjPitchAndRoll(mobj_t *mobj)
|
||||
return 0;
|
||||
|
||||
// if mobj doesent have any of those, no need to do the rest
|
||||
if (mobj->roll == 0 && mobj->pitch == 0 && mobj->sloperoll == 0 && mobj->slopepitch == 0)
|
||||
if (mobj->roll == 0 && mobj->pitch == 0
|
||||
&& mobj->sloperoll == 0 && mobj->slopepitch == 0)
|
||||
return 0;
|
||||
|
||||
size_t rot = (mobj->frame & FF_FRAMEMASK);
|
||||
@@ -6041,7 +6042,8 @@ angle_t P_MobjPitchAndRoll(mobj_t *mobj)
|
||||
sprframe = &sprdef->spriteframes[rot];
|
||||
|
||||
// No sprite frame? I guess it is possible
|
||||
if (!sprframe) return 0;
|
||||
if (!sprframe)
|
||||
return 0;
|
||||
|
||||
if (sprframe->rotate != SRF_SINGLE || (mobj->frame & FF_PAPERSPRITE))
|
||||
{
|
||||
@@ -6050,9 +6052,9 @@ angle_t P_MobjPitchAndRoll(mobj_t *mobj)
|
||||
}
|
||||
|
||||
return_angle = FixedMul(FINECOSINE((ang) >> ANGLETOFINESHIFT), mobj->roll)
|
||||
+ FixedMul(FINESINE((ang) >> ANGLETOFINESHIFT), mobj->pitch)
|
||||
+ FixedMul(FINECOSINE((camang) >> ANGLETOFINESHIFT), mobj->sloperoll)
|
||||
+ FixedMul(FINESINE((camang) >> ANGLETOFINESHIFT), mobj->slopepitch);
|
||||
+ FixedMul(FINESINE((ang) >> ANGLETOFINESHIFT), mobj->pitch)
|
||||
+ FixedMul(FINECOSINE((camang) >> ANGLETOFINESHIFT), mobj->sloperoll)
|
||||
+ FixedMul(FINESINE((camang) >> ANGLETOFINESHIFT), mobj->slopepitch);
|
||||
|
||||
return return_angle;
|
||||
}
|
||||
@@ -6065,7 +6067,7 @@ void P_MobjThinker(mobj_t *mobj)
|
||||
I_Assert(mobj != NULL);
|
||||
I_Assert(!P_MobjWasRemoved(mobj));
|
||||
|
||||
if (mobj->flags & MF_NOTHINK)
|
||||
if (UNLIKELY(mobj->flags & MF_NOTHINK))
|
||||
return;
|
||||
|
||||
// Remove dead target/tracer.
|
||||
@@ -6084,11 +6086,12 @@ void P_MobjThinker(mobj_t *mobj)
|
||||
|
||||
tmfloorthing = tmhitthing = NULL;
|
||||
|
||||
const sector_t *sec1 = mobj->subsector ? mobj->subsector->sector : NULL;
|
||||
|
||||
// 970 allows ANY mobj to trigger a linedef exec
|
||||
if (mobj->subsector && GETSECSPECIAL(mobj->subsector->sector->special, 2) == 8)
|
||||
if (UNLIKELY(sec1 && GETSECSPECIAL(sec1->special, 2) == 8))
|
||||
{
|
||||
sector_t *sec2;
|
||||
|
||||
sec2 = P_ThingOnSpecial3DFloor(mobj);
|
||||
if (sec2 && GETSECSPECIAL(sec2->special, 2) == 1)
|
||||
P_LinedefExecute(sec2->tag, mobj, sec2);
|
||||
@@ -8808,7 +8811,7 @@ void P_MobjThinker(mobj_t *mobj)
|
||||
mobj->angle = R_PointToAngle2(mobj->x, mobj->y, mobj->target->x, mobj->target->y);
|
||||
}
|
||||
|
||||
if (mobj->flags & MF_AMBIENT)
|
||||
if (UNLIKELY(mobj->flags & MF_AMBIENT))
|
||||
{
|
||||
if (!(leveltime % mobj->health) && mobj->info->seesound)
|
||||
S_StartSound(mobj, mobj->info->seesound);
|
||||
@@ -9049,21 +9052,21 @@ void P_MobjThinker(mobj_t *mobj)
|
||||
mobj->eflags &= ~MFE_JUSTHITFLOOR;
|
||||
}
|
||||
|
||||
if (mobj->type == MT_FLINGRING
|
||||
if (UNLIKELY(mobj->type == MT_FLINGRING
|
||||
|| mobj->type == MT_FLINGCOIN
|
||||
|| P_WeaponOrPanel(mobj->type)
|
||||
|| mobj->type == MT_FLINGEMERALD
|
||||
|| mobj->type == MT_BIGTUMBLEWEED
|
||||
|| mobj->type == MT_LITTLETUMBLEWEED
|
||||
|| mobj->type == MT_CANNONBALLDECOR
|
||||
|| mobj->type == MT_FALLINGROCK) {
|
||||
|| mobj->type == MT_CANNONBALLDECOR)
|
||||
|| mobj->type == MT_FALLINGROCK)
|
||||
{
|
||||
P_TryMove(mobj, mobj->x, mobj->y, true); // Sets mo->standingslope correctly
|
||||
//if (mobj->standingslope) CONS_Printf("slope physics on mobj\n");
|
||||
P_ButteredSlope(mobj);
|
||||
}
|
||||
|
||||
if (mobj->flags & (MF_ENEMY|MF_BOSS) && mobj->health
|
||||
&& P_CheckDeathPitCollide(mobj)) // extra pit check in case these didn't have momz
|
||||
if (UNLIKELY(mobj->flags & (MF_ENEMY|MF_BOSS) && mobj->health
|
||||
&& P_CheckDeathPitCollide(mobj))) // extra pit check in case these didn't have momz
|
||||
{
|
||||
P_KillMobj(mobj, NULL, NULL);
|
||||
return;
|
||||
@@ -9072,10 +9075,10 @@ void P_MobjThinker(mobj_t *mobj)
|
||||
// Crush enemies!
|
||||
if (mobj->ceilingz - mobj->floorz < mobj->height)
|
||||
{
|
||||
if ((
|
||||
if (UNLIKELY((
|
||||
(mobj->flags & (MF_ENEMY|MF_BOSS)
|
||||
&& mobj->flags & MF_SHOOTABLE)
|
||||
|| mobj->type == MT_EGGSHIELD)
|
||||
|| mobj->type == MT_EGGSHIELD))
|
||||
&& !(mobj->flags & MF_NOCLIPHEIGHT)
|
||||
&& mobj->health > 0)
|
||||
{
|
||||
@@ -9093,30 +9096,21 @@ void P_MobjThinker(mobj_t *mobj)
|
||||
if (P_MobjWasRemoved(mobj))
|
||||
return;
|
||||
|
||||
switch (mobj->type)
|
||||
if (UNLIKELY(P_WeaponOrPanel(mobj->type)))
|
||||
{
|
||||
case MT_BOUNCEPICKUP:
|
||||
case MT_RAILPICKUP:
|
||||
case MT_AUTOPICKUP:
|
||||
case MT_EXPLODEPICKUP:
|
||||
case MT_SCATTERPICKUP:
|
||||
case MT_GRENADEPICKUP:
|
||||
if (mobj->health == 0) // Fading tile
|
||||
{
|
||||
INT32 value = mobj->info->damage/10;
|
||||
value = mobj->fuse/value;
|
||||
value = 10-value;
|
||||
value--;
|
||||
if (mobj->health == 0) // Fading tile
|
||||
{
|
||||
INT32 value = mobj->info->damage/10;
|
||||
value = mobj->fuse/value;
|
||||
value = 10-value;
|
||||
value--;
|
||||
|
||||
if (value <= 0)
|
||||
value = 1;
|
||||
if (value <= 0)
|
||||
value = 1;
|
||||
|
||||
mobj->frame &= ~FF_TRANSMASK;
|
||||
mobj->frame |= value << FF_TRANSSHIFT;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
mobj->frame &= ~FF_TRANSMASK;
|
||||
mobj->frame |= value << FF_TRANSSHIFT;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9931,8 +9925,7 @@ static precipmobj_t *P_SpawnPrecipMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype
|
||||
mobj->precipflags |= PCF_FOF;
|
||||
else
|
||||
{
|
||||
INT32 special = GETSECSPECIAL(mobj->subsector->sector->special, 1);
|
||||
|
||||
const INT32 special = GETSECSPECIAL(mobj->subsector->sector->special, 1);
|
||||
if (special == 7 || special == 6 || mobj->subsector->sector->floorpic == skyflatnum)
|
||||
mobj->precipflags |= PCF_PIT;
|
||||
}
|
||||
@@ -9964,14 +9957,14 @@ void P_RemoveMobj(mobj_t *mobj)
|
||||
mobj->thinker.function.acp1 = (actionf_p1)P_MobjThinker; // needed for P_UnsetThingPosition, etc. to work.
|
||||
|
||||
// Rings only, please!
|
||||
if (mobj->spawnpoint &&
|
||||
if (UNLIKELY(mobj->spawnpoint &&
|
||||
(mobj->type == MT_RING
|
||||
|| mobj->type == MT_COIN
|
||||
|| mobj->type == MT_BLUEBALL
|
||||
|| mobj->type == MT_REDTEAMRING
|
||||
|| mobj->type == MT_BLUETEAMRING
|
||||
|| P_WeaponOrPanel(mobj->type))
|
||||
&& !(mobj->flags2 & MF2_DONTRESPAWN))
|
||||
&& !(mobj->flags2 & MF2_DONTRESPAWN)))
|
||||
{
|
||||
itemrespawnque[iquehead] = mobj->spawnpoint;
|
||||
itemrespawntime[iquehead] = leveltime;
|
||||
@@ -9993,13 +9986,13 @@ void P_RemoveMobj(mobj_t *mobj)
|
||||
}
|
||||
}
|
||||
|
||||
if (mobj->type == MT_OVERLAY)
|
||||
if (UNLIKELY(mobj->type == MT_OVERLAY))
|
||||
P_RemoveOverlay(mobj);
|
||||
|
||||
if (mobj->type == MT_SHADOW)
|
||||
if (UNLIKELY(mobj->type == MT_SHADOW))
|
||||
P_RemoveShadow(mobj);
|
||||
|
||||
if (mobj->type == MT_SPB)
|
||||
if (UNLIKELY(mobj->type == MT_SPB))
|
||||
spbplace = -1;
|
||||
|
||||
mobj->health = 0; // Just because
|
||||
@@ -10011,6 +10004,7 @@ void P_RemoveMobj(mobj_t *mobj)
|
||||
P_DelSeclist(sector_list);
|
||||
sector_list = NULL;
|
||||
}
|
||||
|
||||
mobj->flags |= MF_NOSECTOR|MF_NOBLOCKMAP;
|
||||
mobj->subsector = NULL;
|
||||
mobj->state = NULL;
|
||||
@@ -10046,46 +10040,33 @@ void P_RemoveMobj(mobj_t *mobj)
|
||||
R_RemoveMobjInterpolator(mobj);
|
||||
|
||||
// free block
|
||||
// DBG: set everything in mobj_t to 0xFF instead of leaving it. debug memory error.
|
||||
if (mobj->flags & MF_NOTHINK && !mobj->thinker.next)
|
||||
{ // Uh-oh, the mobj doesn't think, P_RemoveThinker would never go through!
|
||||
if (!mobj->thinker.references)
|
||||
{
|
||||
#ifdef SCRAMBLE_REMOVED
|
||||
// Invalidate mobj_t data to cause crashes if accessed!
|
||||
memset(mobj, 0xff, sizeof(mobj_t));
|
||||
#endif
|
||||
// no references, dump it directly in the mobj cache
|
||||
mobj->hnext = mobjcache;
|
||||
mobjcache = mobj;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{ // Add thinker just to delay removing it until refrences are gone.
|
||||
mobj->flags &= ~MF_NOTHINK;
|
||||
P_AddThinker((thinker_t *)mobj);
|
||||
#ifdef PARANOIA
|
||||
// Saved to avoid being scrambled like below...
|
||||
mobj->thinker.debug_mobjtype = mobj->type;
|
||||
#endif
|
||||
#ifdef SCRAMBLE_REMOVED
|
||||
// Invalidate mobj_t data to cause crashes if accessed!
|
||||
memset((UINT8 *)mobj + sizeof(thinker_t), 0xff, sizeof(mobj_t) - sizeof(thinker_t));
|
||||
#endif
|
||||
P_RemoveThinker((thinker_t *)mobj);
|
||||
}
|
||||
|
||||
// Add thinker just to delay removing it until refrences are gone.
|
||||
mobj->flags &= ~MF_NOTHINK;
|
||||
P_AddThinker((thinker_t *)mobj);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
P_RemoveThinker((thinker_t *)mobj);
|
||||
|
||||
#ifdef PARANOIA
|
||||
// Saved to avoid being scrambled like below...
|
||||
mobj->thinker.debug_mobjtype = mobj->type;
|
||||
// Saved to avoid being scrambled like below...
|
||||
mobj->thinker.debug_mobjtype = mobj->type;
|
||||
#endif
|
||||
|
||||
// DBG: set everything in mobj_t to 0xFF instead of leaving it. debug memory error.
|
||||
#ifdef SCRAMBLE_REMOVED
|
||||
// Invalidate mobj_t data to cause crashes if accessed!
|
||||
memset((UINT8 *)mobj + sizeof(thinker_t), 0xff, sizeof(mobj_t) - sizeof(thinker_t));
|
||||
// Invalidate mobj_t data to cause crashes if accessed!
|
||||
memset((UINT8 *)mobj + sizeof(thinker_t), 0xff, sizeof(mobj_t) - sizeof(thinker_t));
|
||||
#endif
|
||||
P_RemoveThinker((thinker_t *)mobj);
|
||||
}
|
||||
}
|
||||
|
||||
void P_FreePrecipMobj(precipmobj_t *mobj)
|
||||
@@ -10319,7 +10300,7 @@ void P_PrecipitationEffects(void)
|
||||
for (y = yl; y <= yh; y += RADIUSSTEP)
|
||||
for (x = xl; x <= xh; x += RADIUSSTEP)
|
||||
{
|
||||
if (R_PointInSubsector((fixed_t)x, (fixed_t)y)->sector->ceilingpic != skyflatnum) // Found the outdoors!
|
||||
if (R_PointInSubsectorFast((fixed_t)x, (fixed_t)y)->sector->ceilingpic != skyflatnum) // Found the outdoors!
|
||||
continue;
|
||||
|
||||
newdist = S_CalculateSoundDistance(players[displayplayers[0]].mo->x, players[displayplayers[0]].mo->y, 0, (fixed_t)x, (fixed_t)y, 0);
|
||||
|
||||
+2
-3
@@ -2510,7 +2510,6 @@ static void P_SetupCamera(UINT8 pnum, camera_t *cam)
|
||||
cam->y = players[pnum].mo->y;
|
||||
cam->z = players[pnum].mo->z;
|
||||
cam->angle = players[pnum].mo->angle;
|
||||
cam->subsector = R_PointInSubsector(cam->x, cam->y); // make sure camera has a subsector set -- Monster Iestyn (12/11/18)
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2535,9 +2534,10 @@ static void P_SetupCamera(UINT8 pnum, camera_t *cam)
|
||||
cam->y = thing->y;
|
||||
cam->z = thing->z;
|
||||
cam->angle = FixedAngle((fixed_t)thing->angle << FRACBITS);
|
||||
cam->subsector = R_PointInSubsector(cam->x, cam->y); // make sure camera has a subsector set -- Monster Iestyn (12/11/18)
|
||||
}
|
||||
|
||||
cam->subsector = R_PointInSubsectorFast(cam->x, cam->y); // make sure camera has a subsector set -- Monster Iestyn (12/11/18)
|
||||
|
||||
cam->chase = false; // tell camera to reset its position next tic
|
||||
}
|
||||
|
||||
@@ -3008,7 +3008,6 @@ boolean P_SetupLevel(boolean fromnetsave, boolean reloadinggamestate)
|
||||
#ifdef HWRENDER // not win32 only 19990829 by Kin
|
||||
if (rendermode == render_opengl)
|
||||
{
|
||||
HWR_FreeExtraSubsectors();
|
||||
// Create plane polygons.
|
||||
HWR_LoadLevel(reloadinggamestate);
|
||||
}
|
||||
|
||||
+1
-1
@@ -2022,7 +2022,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
|
||||
camera[i].y += y;
|
||||
camera[i].z += z;
|
||||
camera[i].reset = true;
|
||||
camera[i].subsector = R_PointInSubsector(camera[i].x, camera[i].y);
|
||||
camera[i].subsector = R_PointInSubsectorFast(camera[i].x, camera[i].y);
|
||||
R_RelativeTeleportViewInterpolation(i, x, y, z, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
+3
-3
@@ -573,7 +573,7 @@ static void P_RunQuakes(void)
|
||||
{
|
||||
fixed_t ir;
|
||||
|
||||
if (quake.time <= 0)
|
||||
if (!cv_screenquake.value || quake.time <= 0)
|
||||
{
|
||||
quake.x = quake.y = quake.z = quake.roll = 0;
|
||||
return;
|
||||
@@ -618,8 +618,8 @@ static inline void P_ResetSpriteStuff(void)
|
||||
if (!mo || (mo->sprite == SPR_NULL) || (mo->flags2 & MF2_DONTDRAW) || (mo->type == MT_SHADOW))
|
||||
continue;
|
||||
|
||||
mo->spritexscale = mo->realxscale;
|
||||
mo->spriteyscale = mo->realyscale;
|
||||
mo->spritexscale = mo->realxscale;
|
||||
mo->spriteyscale = mo->realyscale;
|
||||
mo->spritexoffset = mo->realxoffset;
|
||||
mo->spriteyoffset = mo->realyoffset;
|
||||
}
|
||||
|
||||
+5
-3
@@ -3044,6 +3044,8 @@ consvar_t cv_tiltsmoothing = {"tiltsmoothing", "32", CV_SAVE, CV_Natural, NULL,
|
||||
|
||||
consvar_t cv_actionmovie = {"actionmovie", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_screenquake = {"quakescreenshake", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
static CV_PossibleValue_t lookbackmom_cons_t[] = {{0, "Off"}, {1, "On"}, {2, "Double"}, {0, NULL}};
|
||||
|
||||
consvar_t cv_lookbackmom[MAXSPLITSCREENPLAYERS] = {
|
||||
@@ -3402,7 +3404,7 @@ static void P_DemoCameraMovement(camera_t *cam, UINT8 num)
|
||||
}
|
||||
|
||||
// update subsector to avoid crashes;
|
||||
cam->subsector = R_PointInSubsector(cam->x, cam->y);
|
||||
cam->subsector = R_PointInSubsectorFast(cam->x, cam->y);
|
||||
}
|
||||
|
||||
void P_ResetCamera(player_t *player, camera_t *thiscam)
|
||||
@@ -3446,7 +3448,7 @@ void P_ResetCamera(player_t *player, camera_t *thiscam)
|
||||
|
||||
thiscam->relativex = 0;
|
||||
|
||||
thiscam->subsector = R_PointInSubsector(thiscam->x,thiscam->y);
|
||||
thiscam->subsector = R_PointInSubsectorFast(thiscam->x,thiscam->y);
|
||||
|
||||
thiscam->radius = 20*FRACUNIT;
|
||||
thiscam->height = 16*FRACUNIT;
|
||||
@@ -3682,7 +3684,7 @@ static void P_MoveCameraToSpawn(UINT8 playernum)
|
||||
thiscam->angle = player->mo->angle;
|
||||
thiscam->aiming = 0;
|
||||
|
||||
thiscam->subsector = R_PointInSubsector(thiscam->x,thiscam->y);
|
||||
thiscam->subsector = R_PointInSubsectorFast(thiscam->x,thiscam->y);
|
||||
|
||||
thiscam->reset_aiming = true;
|
||||
|
||||
|
||||
+5
-5
@@ -196,12 +196,12 @@ sector_t *R_FakeFlat(sector_t *sec, sector_t *tempsec, INT32 *floorlightlevel,
|
||||
mobj_t *pviewmobj = viewplayer->mo;
|
||||
INT32 heightsec;
|
||||
boolean underwater;
|
||||
UINT8 i = R_GetViewNumber();
|
||||
camera_t *thiscam = &camera[R_GetViewNumber()];
|
||||
|
||||
if (viewplayer == &players[displayplayers[i]] && camera[i].chase)
|
||||
heightsec = R_PointInSubsector(camera[i].x, camera[i].y)->sector->heightsec;
|
||||
else if (i > splitscreen && viewmobj)
|
||||
heightsec = R_PointInSubsector(pviewmobj->x, pviewmobj->y)->sector->heightsec;
|
||||
if (thiscam->chase)
|
||||
heightsec = thiscam->subsector->sector->heightsec;
|
||||
else if (viewmobj)
|
||||
heightsec = pviewmobj->subsector->sector->heightsec;
|
||||
else
|
||||
return sec;
|
||||
|
||||
|
||||
+37
-7
@@ -103,7 +103,7 @@ static UINT32 **texturecolumnofs; // column offset lookup table for each texture
|
||||
UINT8 **texturecache; // graphics data for each generated full-size texture
|
||||
|
||||
// texture width is a power of 2, so it can easily repeat along sidedefs using a simple mask
|
||||
INT32 *texturewidthmask;
|
||||
static INT32 *texturewidthmask;
|
||||
|
||||
fixed_t *textureheight; // needed for texture pegging
|
||||
|
||||
@@ -473,11 +473,28 @@ UINT8 *R_GetColumn(fixed_t tex, INT32 col)
|
||||
{
|
||||
UINT8 *data;
|
||||
|
||||
col &= texturewidthmask[tex];
|
||||
data = texturecache[tex];
|
||||
|
||||
if (texturewidthmask[tex])
|
||||
col &= texturewidthmask[tex]; // set by load textures
|
||||
else
|
||||
{
|
||||
const INT16 texwidth = textures[tex]->width;
|
||||
|
||||
// Odd width texture, cannot just mask.
|
||||
// Sometime gets colnum = -1 or = width, even without tiling.
|
||||
// Test LostCiv, Map 20, crates.
|
||||
col = ( col < 0 ) ?
|
||||
texwidth - (((-col - 1) % texwidth) + 1)
|
||||
: col % texwidth;
|
||||
}
|
||||
|
||||
if (!data)
|
||||
{
|
||||
// This must be here because cache can be freed by other operations.
|
||||
// To prevent must lock individual texture cache on every draw.
|
||||
data = R_GenerateTexture(tex);
|
||||
}
|
||||
|
||||
return data + LONG(texturecolumnofs[tex][col]);
|
||||
}
|
||||
@@ -662,9 +679,23 @@ void R_LoadTextures(void)
|
||||
|
||||
Z_Free(patchlump);
|
||||
|
||||
// determine width power of 2
|
||||
#if 1
|
||||
// [WDJ] only need to determine if exact power of 2.
|
||||
k = 1;
|
||||
while (k < texture->width)
|
||||
k<<=1;
|
||||
#else
|
||||
// Largest power of 2 that fits within width.
|
||||
k = 1;
|
||||
while (k << 1 <= texture->width)
|
||||
k <<= 1;
|
||||
#endif
|
||||
if (k != texture->width)
|
||||
{
|
||||
// Odd width
|
||||
k = 1; // make texturewidthmask = 0
|
||||
}
|
||||
|
||||
texturewidthmask[i] = k - 1;
|
||||
textureheight[i] = texture->height << FRACBITS;
|
||||
@@ -1223,8 +1254,7 @@ static void R_InitColormaps(void)
|
||||
|
||||
// Load in the light tables
|
||||
lump = W_GetNumForName("COLORMAP");
|
||||
//Z_MallocAlign(W_LumpLength (lump), PU_STATIC, NULL, 8);
|
||||
colormaps = Z_MallocAlign((256 * 64), PU_STATIC, NULL, 8);
|
||||
colormaps = Z_Malloc((256 * 64), PU_STATIC, NULL);
|
||||
W_ReadLump(lump, colormaps);
|
||||
// no need to init encoremap at this stage
|
||||
|
||||
@@ -1265,7 +1295,7 @@ void R_ReInitColormaps(UINT16 num, lumpnum_t newencoremap)
|
||||
lighttable_t *colormap_p, *colormap_p2;
|
||||
size_t p, i;
|
||||
|
||||
encoremap = Z_MallocAlign(256 + 10, PU_LEVEL, NULL, 8);
|
||||
encoremap = Z_Malloc(256 + 10, PU_LEVEL, NULL);
|
||||
W_ReadLump(newencoremap, encoremap);
|
||||
colormap_p = colormap_p2 = colormaps;
|
||||
colormap_p += (256 * 32);
|
||||
@@ -1324,7 +1354,7 @@ void R_ClearColormaps(void)
|
||||
foundcolormaps[num_extra_colormaps] = lump;
|
||||
|
||||
// aligned on 8 bit for asm code
|
||||
extra_colormaps[num_extra_colormaps].colormap = Z_MallocAlign(W_LumpLength(lump), PU_LEVEL, NULL, 16);
|
||||
extra_colormaps[num_extra_colormaps].colormap = Z_Malloc(W_LumpLength(lump), PU_LEVEL, NULL);
|
||||
W_ReadLump(lump, extra_colormaps[num_extra_colormaps].colormap);
|
||||
|
||||
// We set all params of the colormap to normal because there
|
||||
@@ -1520,7 +1550,7 @@ INT32 R_CreateColormap(char *p1, char *p2, char *p3)
|
||||
}
|
||||
|
||||
// Now allocate memory for the actual colormap array itself!
|
||||
colormap_p = Z_MallocAlign((256 * (encoremap ? 64 : 32)) + 10, PU_LEVEL, NULL, 8);
|
||||
colormap_p = Z_Malloc((256 * (encoremap ? 64 : 32)) + 10, PU_LEVEL, NULL);
|
||||
extra_colormaps[mapnum].colormap = (UINT8 *)colormap_p;
|
||||
|
||||
// Calculate the palette index for each palette index, for each light level
|
||||
|
||||
@@ -55,7 +55,6 @@ typedef struct
|
||||
UINT8 type; // TEXTURETYPE_
|
||||
INT16 width, height;
|
||||
boolean holes;
|
||||
|
||||
// All the patches[patchcount] are drawn back to front into the cached texture.
|
||||
INT16 patchcount;
|
||||
texpatch_t patches[0];
|
||||
@@ -65,9 +64,6 @@ typedef struct
|
||||
extern texture_t **textures;
|
||||
extern UINT8 **texturecache; // graphics data for each generated full-size texture
|
||||
|
||||
// texture width is a power of 2, so it can easily repeat along sidedefs using a simple mask
|
||||
extern INT32 *texturewidthmask;
|
||||
|
||||
extern fixed_t *textureheight; // needed for texture pegging
|
||||
|
||||
UINT32 ASTBlendPixel(RGBA_t background, RGBA_t foreground, int style, UINT8 alpha);
|
||||
|
||||
+3
-3
@@ -119,7 +119,7 @@ void R_InitTranslucencyTables(void)
|
||||
// Load here the transparency lookup tables 'TRANSx0'
|
||||
// NOTE: the TRANSx0 resources MUST BE aligned on 64k for the asm
|
||||
// optimised code (in other words, transtables pointer low word is 0)
|
||||
transtables = static_cast<UINT8*>(Z_MallocAlign(NUMTRANSTABLES*0x10000, PU_STATIC, NULL, 16));
|
||||
transtables = static_cast<UINT8*>(Z_Malloc(NUMTRANSTABLES*0x10000, PU_STATIC, NULL));
|
||||
|
||||
W_ReadLump(W_GetNumForName("TRANS10"), transtables);
|
||||
W_ReadLump(W_GetNumForName("TRANS20"), transtables+0x10000);
|
||||
@@ -246,7 +246,7 @@ static void R_GenerateBlendTables(void)
|
||||
INT32 i;
|
||||
|
||||
for (i = 0; i < NUMBLENDMAPS; i++)
|
||||
blendtables[i] = static_cast<UINT8*>(Z_MallocAlign(BlendTab_Count[i] * 0x10000, PU_STATIC, NULL, 16));
|
||||
blendtables[i] = static_cast<UINT8*>(Z_Malloc(BlendTab_Count[i] * 0x10000, PU_STATIC, NULL));
|
||||
|
||||
InitColorLUT(&transtab_lut, pLocalPalette, false);
|
||||
|
||||
@@ -365,7 +365,7 @@ static UINT8* RGetTranslationColormap(INT32 skinnum, skincolors_t color, UINT8 f
|
||||
// Generate the colormap if necessary
|
||||
if (!ret)
|
||||
{
|
||||
ret = static_cast<UINT8*>(Z_MallocAlign(NUM_PALETTE_ENTRIES, (flags & GTC_CACHE) ? PU_LEVEL : PU_STATIC, NULL, 8));
|
||||
ret = static_cast<UINT8*>(Z_Malloc(NUM_PALETTE_ENTRIES, (flags & GTC_CACHE) ? PU_LEVEL : PU_STATIC, NULL));
|
||||
K_GenerateKartColormap(ret, skinnum, color, local); //R_GenerateTranslationColormap(ret, skinnum, color); // SRB2kart
|
||||
|
||||
// Cache the colormap if desired
|
||||
|
||||
+14
-1
@@ -46,10 +46,23 @@ enum DrawSpanType
|
||||
DS_RIPPLE = 0x0008,
|
||||
};
|
||||
|
||||
template<DrawSpanType Type>
|
||||
static constexpr UINT8 R_GetSpanTranslated(drawspandata_t* ds, UINT8 col)
|
||||
{
|
||||
if constexpr (Type & DrawSpanType::DS_COLORMAP)
|
||||
{
|
||||
return ds->translation[col];
|
||||
}
|
||||
else
|
||||
{
|
||||
return col;
|
||||
}
|
||||
}
|
||||
|
||||
template<DrawSpanType Type>
|
||||
static constexpr UINT8 R_GetSpanTranslucent(drawspandata_t* ds, UINT8 *dsrc, const UINT8 *colormap, UINT8 col)
|
||||
{
|
||||
col = colormap[col];
|
||||
col = colormap[R_GetSpanTranslated<Type>(ds, col)];
|
||||
|
||||
if constexpr (Type & DrawSpanType::DS_TRANSMAP)
|
||||
{
|
||||
|
||||
+1
-1
@@ -232,7 +232,7 @@ void R_InterpolateView(fixed_t frac, boolean forceinvalid)
|
||||
viewcos = FINECOSINE(viewangle>>ANGLETOFINESHIFT);
|
||||
|
||||
viewplayer = newview->player;
|
||||
viewsector = R_PointInSubsector(viewx, viewy)->sector;
|
||||
viewsector = R_PointInSubsectorFast(viewx, viewy)->sector;
|
||||
|
||||
R_SetupFreelook();
|
||||
}
|
||||
|
||||
+46
-17
@@ -141,10 +141,10 @@ static CV_PossibleValue_t drawdist_precip_cons_t[] = {
|
||||
#endif
|
||||
|
||||
static CV_PossibleValue_t maxinterpdist_cons_t[] = {
|
||||
/*{256, "256"},*/ {512, "512"}, {768, "768"},
|
||||
{1024, "1024"}, {1536, "1536"}, {2048, "2048"},
|
||||
{3072, "3072"}, {4096, "4096"}, {6144, "6144"},
|
||||
{8192, "8192"}, {0, "Infinite"}, {0, NULL}};
|
||||
/*{256, "256"},*/ {512, "512"}, {768, "768"},
|
||||
{1024, "1024"}, {1536, "1536"}, {2048, "2048"},
|
||||
{3072, "3072"}, {4096, "4096"}, {6144, "6144"},
|
||||
{8192, "8192"}, {0, "Infinite"}, {0, NULL}};
|
||||
|
||||
static CV_PossibleValue_t fov_cons_t[] = {{MINFOV*FRACUNIT, "MIN"}, {MAXFOV*FRACUNIT, "MAX"}, {0, NULL}};
|
||||
|
||||
@@ -170,14 +170,14 @@ consvar_t cv_tailspickup = {"tailspickup", "On", CV_NETVAR|CV_NOSHOWHELP, CV_OnO
|
||||
consvar_t cv_precachetextures = {"precachetextures", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_chasecam[MAXSPLITSCREENPLAYERS] = {
|
||||
{"chasecam", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"chasecam", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"chasecam2", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"chasecam3", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"chasecam4", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}
|
||||
};
|
||||
|
||||
consvar_t cv_flipcam[MAXSPLITSCREENPLAYERS] = {
|
||||
{"flipcam", "No", CV_SAVE|CV_CALL|CV_NOINIT, CV_YesNo, FlipCam_OnChange, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"flipcam", "No", CV_SAVE|CV_CALL|CV_NOINIT, CV_YesNo, FlipCam_OnChange, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"flipcam2", "No", CV_SAVE|CV_CALL|CV_NOINIT, CV_YesNo, FlipCam2_OnChange, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"flipcam3", "No", CV_SAVE|CV_CALL|CV_NOINIT, CV_YesNo, FlipCam3_OnChange, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"flipcam4", "No", CV_SAVE|CV_CALL|CV_NOINIT, CV_YesNo, FlipCam4_OnChange, 0, NULL, NULL, 0, 0, NULL}
|
||||
@@ -195,6 +195,7 @@ consvar_t cv_drawdist_precip = {"drawdist_precip", "1024", CV_SAVE|CV_CALL|CV_NO
|
||||
consvar_t cv_lessprecip = {"lessweathereffects", "Off", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, Precipstuff_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_mobjscaleprecip = {"scaleprecipmobjscale", "Off", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, Precipstuff_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_maxinterpdist = {"maxinterpdist", "Infinite", CV_SAVE, maxinterpdist_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_playerfade = {"playerfade", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_ripplewater = {"waterripples", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
// Okay, whoever said homremoval causes a performance hit should be shot.
|
||||
@@ -211,6 +212,7 @@ consvar_t cv_randomdirlight = {"randomdirectionallight", "Off", CV_SAVE|CV_CALL
|
||||
|
||||
consvar_t cv_showhud = {"showhud", "Yes", CV_CALL, CV_YesNo, R_SetViewSize, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_translucenthud = {"translucenthud", "10", CV_SAVE, translucenthud_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_uncappedhud = {"uncappedhud", "Yes", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_soniccd = {"soniccd", "Off", CV_NETVAR|CV_NOSHOWHELP, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_allowmlook = {"allowmlook", "Yes", CV_NETVAR, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
@@ -400,7 +402,8 @@ angle_t R_PlayerSliptideAngle(player_t *player)
|
||||
sprframe = &sprdef->spriteframes[rot];
|
||||
|
||||
// No sprite frame? I guess it is possible
|
||||
if (!sprframe) return 0;
|
||||
if (!sprframe)
|
||||
return 0;
|
||||
|
||||
if (sprframe->rotate != SRF_SINGLE || (mo->frame & FF_PAPERSPRITE))
|
||||
ang = R_PointToAngle(mo->x, mo->y) - mo->angle;
|
||||
@@ -460,6 +463,7 @@ boolean R_DoCulling(line_t *cullheight, line_t *viewcullheight, fixed_t vz, fixe
|
||||
return false;
|
||||
|
||||
cullplane = cullheight->frontsector->floorheight;
|
||||
|
||||
if (cullheight->flags & ML_NOCLIMB) // Group culling
|
||||
{
|
||||
if (!viewcullheight)
|
||||
@@ -579,8 +583,6 @@ static void R_InitTextureMapping(void)
|
||||
doubleclipangle = clipangle*2;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// R_InitLightTables
|
||||
// Only inits the zlight table,
|
||||
@@ -1047,6 +1049,33 @@ void R_Init(void)
|
||||
framecount = 0;
|
||||
}
|
||||
|
||||
//
|
||||
// R_IsPointInSubsector, same as above but returns 0 if not in subsector
|
||||
//
|
||||
subsector_t *R_IsPointInSubsector(fixed_t x, fixed_t y)
|
||||
{
|
||||
node_t *node;
|
||||
INT32 side, i;
|
||||
size_t nodenum;
|
||||
subsector_t *ret;
|
||||
|
||||
nodenum = numnodes - 1;
|
||||
|
||||
while (!(nodenum & NF_SUBSECTOR))
|
||||
{
|
||||
node = &nodes[nodenum];
|
||||
side = R_PointOnSide(x, y, node);
|
||||
nodenum = node->children[side];
|
||||
}
|
||||
|
||||
ret = &subsectors[nodenum & ~NF_SUBSECTOR];
|
||||
for (i = 0; i < ret->numlines; i++)
|
||||
if (P_PointOnLineSide(x, y, segs[ret->firstline + i].linedef) != segs[ret->firstline + i].side)
|
||||
return 0;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
//
|
||||
// R_SetupFrame
|
||||
//
|
||||
@@ -1066,7 +1095,7 @@ static void R_SetupCommonFrame(player_t * player, sector_t * sector)
|
||||
if (sector != NULL)
|
||||
newview->sector = sector;
|
||||
else
|
||||
newview->sector = R_PointInSubsector(newview->x, newview->y)->sector;
|
||||
newview->sector = R_PointInSubsectorFast(newview->x, newview->y)->sector;
|
||||
|
||||
R_InterpolateView(rendertimefrac_unpaused, false);
|
||||
}
|
||||
@@ -1167,7 +1196,7 @@ void R_SkyboxFrame(int s)
|
||||
{
|
||||
player_t *player = &players[displayplayers[s]];
|
||||
camera_t *thiscam = &camera[s];
|
||||
subsector_t * subsector = NULL;
|
||||
subsector_t *subsector = NULL;
|
||||
mapheader_t *mh = mapheaderinfo[gamemap-1];
|
||||
|
||||
R_SetViewContext(static_cast<viewcontext_e>(VIEWCONTEXT_SKY1 + s));
|
||||
@@ -1306,7 +1335,7 @@ static void R_PortalFrame(portal_t *portal)
|
||||
{
|
||||
portalclipline = NULL;
|
||||
portalcullsector = NULL;
|
||||
viewsector = R_PointInSubsector(viewx, viewy)->sector;
|
||||
viewsector = R_PointInSubsectorFast(viewx, viewy)->sector;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1522,11 +1551,6 @@ void R_RegisterEngineStuff(void)
|
||||
CV_RegisterVar(&cv_fovchange);
|
||||
CV_RegisterVar(&cv_fov);
|
||||
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
CV_RegisterVar(&cv_chasecam[i]);
|
||||
}
|
||||
|
||||
CV_RegisterVar(&cv_shadow);
|
||||
CV_RegisterVar(&cv_shadowoffs);
|
||||
CV_RegisterVar(&cv_skybox);
|
||||
@@ -1536,6 +1560,8 @@ void R_RegisterEngineStuff(void)
|
||||
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
CV_RegisterVar(&cv_chasecam[i]);
|
||||
|
||||
CV_RegisterVar(&cv_cam_dist[i]);
|
||||
CV_RegisterVar(&cv_cam_still[i]);
|
||||
CV_RegisterVar(&cv_cam_height[i]);
|
||||
@@ -1552,6 +1578,8 @@ void R_RegisterEngineStuff(void)
|
||||
CV_RegisterVar(&cv_tiltsmoothing);
|
||||
CV_RegisterVar(&cv_actionmovie);
|
||||
|
||||
CV_RegisterVar(&cv_screenquake);
|
||||
|
||||
CV_RegisterVar(&cv_driftsparkpulse);
|
||||
CV_RegisterVar(&cv_gravstretch);
|
||||
CV_RegisterVar(&cv_sloperoll);
|
||||
@@ -1569,6 +1597,7 @@ void R_RegisterEngineStuff(void)
|
||||
CV_RegisterVar(&cv_randomdirlight);
|
||||
|
||||
CV_RegisterVar(&cv_maxinterpdist);
|
||||
CV_RegisterVar(&cv_playerfade);
|
||||
|
||||
CV_RegisterVar(&cv_ripplewater);
|
||||
|
||||
|
||||
+16
-38
@@ -88,7 +88,7 @@ extern lighttable_t *zlight[LIGHTLEVELS][MAXLIGHTZ];
|
||||
//
|
||||
// killough 5/2/98: reformatted
|
||||
//
|
||||
FUNCINLINE static ATTRINLINE PUREFUNC INT32 R_PointOnSide(fixed_t x, fixed_t y, const node_t * restrict node)
|
||||
FUNCINLINE static ATTRINLINE PUREFUNC INT32 R_PointOnSide(fixed_t x, fixed_t y, const node_t* restrict node)
|
||||
{
|
||||
if (!node->dx)
|
||||
return x <= node->x ? node->dy > 0 : node->dy < 0;
|
||||
@@ -117,10 +117,10 @@ FUNCINLINE static ATTRINLINE PUREFUNC INT32 R_PointOnSideFast(fixed_t x, fixed_t
|
||||
|
||||
FUNCINLINE static ATTRINLINE PUREFUNC INT32 R_PointOnSegSide(fixed_t x, fixed_t y, const seg_t *line)
|
||||
{
|
||||
fixed_t lx = line->v1->x;
|
||||
fixed_t ly = line->v1->y;
|
||||
fixed_t ldx = line->v2->x - lx;
|
||||
fixed_t ldy = line->v2->y - ly;
|
||||
fixed_t lx = line->v1->x;
|
||||
fixed_t ly = line->v1->y;
|
||||
fixed_t ldx = line->v2->x - lx;
|
||||
fixed_t ldy = line->v2->y - ly;
|
||||
|
||||
// use cross product to determine side quickly
|
||||
INT64 v = ((INT64)y - ly) * ldx - ((INT64)x - lx) * ldy;
|
||||
@@ -137,42 +137,19 @@ fixed_t R_ScaleFromGlobalAngle(angle_t visangle);
|
||||
//
|
||||
// R_PointInSubsector
|
||||
//
|
||||
FUNCINLINE static ATTRINLINE subsector_t *R_PointInSubsector(fixed_t x, fixed_t y)
|
||||
{
|
||||
size_t nodenum = numnodes-1;
|
||||
|
||||
while (!(nodenum & NF_SUBSECTOR))
|
||||
nodenum = nodes[nodenum].children[R_PointOnSide(x, y, nodes+nodenum)];
|
||||
|
||||
return &subsectors[nodenum & ~NF_SUBSECTOR];
|
||||
#define R_POINTINSUBSECTOR(FUNCNAME, SIDEFUNC)\
|
||||
FUNCINLINE static ATTRINLINE subsector_t *FUNCNAME(fixed_t x, fixed_t y)\
|
||||
{\
|
||||
size_t nodenum = numnodes-1;\
|
||||
while (!(nodenum & NF_SUBSECTOR))\
|
||||
nodenum = nodes[nodenum].children[SIDEFUNC(x, y, nodes+nodenum)];\
|
||||
return &subsectors[nodenum & ~NF_SUBSECTOR];\
|
||||
}
|
||||
|
||||
//
|
||||
// R_IsPointInSubsector, same as above but returns 0 if not in subsector
|
||||
//
|
||||
FUNCINLINE static ATTRINLINE subsector_t *R_IsPointInSubsector(fixed_t x, fixed_t y)
|
||||
{
|
||||
node_t *node;
|
||||
INT32 side, i;
|
||||
size_t nodenum;
|
||||
subsector_t *ret;
|
||||
R_POINTINSUBSECTOR(R_PointInSubsector, R_PointOnSide)
|
||||
R_POINTINSUBSECTOR(R_PointInSubsectorFast, R_PointOnSideFast)
|
||||
|
||||
nodenum = numnodes - 1;
|
||||
|
||||
while (!(nodenum & NF_SUBSECTOR))
|
||||
{
|
||||
node = &nodes[nodenum];
|
||||
side = R_PointOnSide(x, y, node);
|
||||
nodenum = node->children[side];
|
||||
}
|
||||
|
||||
ret = &subsectors[nodenum & ~NF_SUBSECTOR];
|
||||
for (i = 0; i < ret->numlines; i++)
|
||||
if (P_PointOnLineSide(x, y, segs[ret->firstline + i].linedef) != segs[ret->firstline + i].side)
|
||||
return 0;
|
||||
|
||||
return ret;
|
||||
}
|
||||
subsector_t *R_IsPointInSubsector(fixed_t x, fixed_t y);
|
||||
|
||||
#define R_PointToDist(x, y) R_PointToDist2(viewx, viewy, x, y)
|
||||
#define R_PointToDist2(px2, py2, px1, py1) FixedHypot((px1) - (px2), (py1) - (py2))
|
||||
@@ -218,6 +195,7 @@ extern consvar_t cv_fov, cv_fovchange;
|
||||
extern consvar_t cv_skybox;
|
||||
extern consvar_t cv_tailspickup;
|
||||
extern consvar_t cv_maxinterpdist;
|
||||
extern consvar_t cv_playerfade;
|
||||
extern consvar_t cv_ripplewater;
|
||||
|
||||
extern consvar_t cv_randomdirlight;
|
||||
|
||||
+51
-49
@@ -247,9 +247,7 @@ static void R_MapPlane(drawspandata_t *ds, spandrawfunc_t *localspanfunc, INT32
|
||||
ds->bgofs = -y;
|
||||
}
|
||||
|
||||
pindex = distance >> LIGHTZSHIFT;
|
||||
if (pindex >= MAXLIGHTZ)
|
||||
pindex = MAXLIGHTZ - 1;
|
||||
pindex = std::min<size_t>(distance >> LIGHTZSHIFT, MAXLIGHTZ - 1);
|
||||
|
||||
ds->colormap = ds->planezlight[pindex];
|
||||
|
||||
@@ -352,8 +350,8 @@ void R_ClearPlanes(void)
|
||||
angle = (viewangle-ANGLE_90)>>ANGLETOFINESHIFT;
|
||||
|
||||
// scale will be unit scale at SCREENWIDTH/2 distance
|
||||
basexscale = FixedDiv (FINECOSINE(angle), centerxfrac);
|
||||
baseyscale = -FixedDiv (FINESINE(angle), centerxfrac);
|
||||
basexscale = FixedDiv (FINECOSINE(angle), centerxfrac);
|
||||
baseyscale = -FixedDiv (FINESINE(angle), centerxfrac);
|
||||
}
|
||||
|
||||
static visplane_t *new_visplane(unsigned hash)
|
||||
@@ -442,26 +440,20 @@ visplane_t *R_FindPlane(fixed_t height, INT32 picnum, INT32 lightlevel,
|
||||
}
|
||||
}
|
||||
|
||||
// This appears to fix the Nimbus Ruins sky bug.
|
||||
if (picnum == skyflatnum && pfloor)
|
||||
{
|
||||
height = 0; // all skies map together
|
||||
lightlevel = 0;
|
||||
}
|
||||
else if (slope != NULL && P_ApplyLightOffset(lightlevel >> LIGHTSEGSHIFT, lighting_sector))
|
||||
{
|
||||
if (reverseLight)
|
||||
{
|
||||
lightlevel -= slope->lightOffset * 8;
|
||||
}
|
||||
else
|
||||
{
|
||||
lightlevel += slope->lightOffset * 8;
|
||||
}
|
||||
}
|
||||
|
||||
if (!pfloor)
|
||||
{
|
||||
if (slope != NULL && P_ApplyLightOffset(lightlevel >> LIGHTSEGSHIFT, lighting_sector))
|
||||
{
|
||||
if (reverseLight)
|
||||
{
|
||||
lightlevel -= slope->lightOffset * 8;
|
||||
}
|
||||
else
|
||||
{
|
||||
lightlevel += slope->lightOffset * 8;
|
||||
}
|
||||
}
|
||||
|
||||
hash = visplane_hash(picnum, lightlevel, height);
|
||||
|
||||
for (check = visplanes[hash]; check; check = check->next)
|
||||
@@ -485,6 +477,13 @@ visplane_t *R_FindPlane(fixed_t height, INT32 picnum, INT32 lightlevel,
|
||||
}
|
||||
else
|
||||
{
|
||||
// This appears to fix the Nimbus Ruins sky bug.
|
||||
if (picnum == skyflatnum)
|
||||
{
|
||||
height = 0; // all skies map together
|
||||
lightlevel = 0;
|
||||
}
|
||||
|
||||
hash = MAXVISPLANES - 1;
|
||||
}
|
||||
|
||||
@@ -592,6 +591,7 @@ visplane_t *R_CheckPlane(visplane_t *pl, INT32 start, INT32 stop)
|
||||
memset(pl->top, 0xff, sizeof(*pl->top) * viewwidth);
|
||||
memset(pl->bottom, 0x00, sizeof(*pl->bottom) * viewwidth);
|
||||
}
|
||||
|
||||
return pl;
|
||||
}
|
||||
|
||||
@@ -628,14 +628,13 @@ static void R_MakeSpans(void (*mapfunc)(drawspandata_t* ds, void(*spanfunc)(draw
|
||||
if (b2 >= vidheight) b2 = vidheight-1;
|
||||
if (x-1 >= vid.width) x = vid.width;
|
||||
|
||||
drawspandata_t dc_copy = *ds;
|
||||
|
||||
#ifdef HAVE_THREADS
|
||||
// We want to draw N spans per subtask to ensure the work is
|
||||
// coarse enough to not be too slow due to task scheduling overhead.
|
||||
// To safely do this, we need to copy part of spanstart to a local.
|
||||
// This is essentially loop unrolling across threads.
|
||||
constexpr const int kSpanTaskGranularity = 8;
|
||||
drawspandata_t ds_copy = *ds;
|
||||
while (t1 < t2 && t1 <= b1)
|
||||
{
|
||||
INT32 spanstartcopy[kSpanTaskGranularity] = {0};
|
||||
@@ -652,7 +651,7 @@ static void R_MakeSpans(void (*mapfunc)(drawspandata_t* ds, void(*spanfunc)(draw
|
||||
auto task = [=]() mutable -> void {
|
||||
for (int i = 0; i < taskspans; i++)
|
||||
{
|
||||
mapfunc(&dc_copy, localspanfunc, t1 + i, spanstartcopy[i], x - 1, false);
|
||||
mapfunc(&ds_copy, localspanfunc, t1 + i, spanstartcopy[i], x - 1, false);
|
||||
}
|
||||
};
|
||||
if (allow_parallel)
|
||||
@@ -681,7 +680,7 @@ static void R_MakeSpans(void (*mapfunc)(drawspandata_t* ds, void(*spanfunc)(draw
|
||||
auto task = [=]() mutable -> void {
|
||||
for (int i = 0; i < taskspans; i++)
|
||||
{
|
||||
mapfunc(&dc_copy, localspanfunc, b1 - i, spanstartcopy[i], x - 1, false);
|
||||
mapfunc(&ds_copy, localspanfunc, b1 - i, spanstartcopy[i], x - 1, false);
|
||||
}
|
||||
};
|
||||
if (allow_parallel)
|
||||
@@ -699,12 +698,12 @@ static void R_MakeSpans(void (*mapfunc)(drawspandata_t* ds, void(*spanfunc)(draw
|
||||
|
||||
while (t1 < t2 && t1 <= b1)
|
||||
{
|
||||
mapfunc(&dc_copy, localspanfunc, t1, spanstart[t1], x - 1, false);
|
||||
mapfunc(ds, localspanfunc, t1, spanstart[t1], x - 1, false);
|
||||
t1++;
|
||||
}
|
||||
while (b1 > b2 && b1 >= t1)
|
||||
{
|
||||
mapfunc(&dc_copy, localspanfunc, b1, spanstart[b1], x - 1, false);
|
||||
mapfunc(ds, localspanfunc, b1, spanstart[b1], x - 1, false);
|
||||
b1--;
|
||||
}
|
||||
#endif
|
||||
@@ -1020,13 +1019,12 @@ void R_DrawSinglePlane(drawspandata_t* ds, visplane_t *pl, boolean allow_paralle
|
||||
size_t size;
|
||||
INT32 spanfunctype = BASEDRAWFUNC;
|
||||
ffloor_t *rover;
|
||||
levelflat_t *levelflat;
|
||||
void (*mapfunc)(drawspandata_t*, void(*)(drawspandata_t*), INT32, INT32, INT32, boolean) = R_MapPlane;
|
||||
|
||||
if (!(pl->minx <= pl->maxx))
|
||||
if (pl->minx > pl->maxx)
|
||||
return;
|
||||
|
||||
R_UpdatePlaneRipple(ds);
|
||||
|
||||
// sky flat
|
||||
if (pl->picnum == skyflatnum)
|
||||
{
|
||||
@@ -1039,6 +1037,8 @@ void R_DrawSinglePlane(drawspandata_t* ds, visplane_t *pl, boolean allow_paralle
|
||||
return;
|
||||
}
|
||||
|
||||
R_UpdatePlaneRipple(ds);
|
||||
|
||||
ds->planeripple.active = false;
|
||||
R_SetSpanFunc(BASEDRAWFUNC);
|
||||
|
||||
@@ -1175,16 +1175,17 @@ void R_DrawSinglePlane(drawspandata_t* ds, visplane_t *pl, boolean allow_paralle
|
||||
else light = (pl->lightlevel >> LIGHTSEGSHIFT);
|
||||
}
|
||||
|
||||
// Don't mess with angle on slopes! We'll handle this ourselves later
|
||||
if (!pl->slope && viewangle != pl->viewangle+pl->plangle)
|
||||
{
|
||||
viewangle = pl->viewangle+pl->plangle;
|
||||
}
|
||||
|
||||
ds->currentplane = pl;
|
||||
|
||||
ds->source = (UINT8 *)W_CacheLumpNum(levelflats[pl->picnum].lumpnum, PU_STATIC); // Stay here until Z_ChangeTag
|
||||
size = W_LumpLength(levelflats[pl->picnum].lumpnum);
|
||||
levelflat = &levelflats[pl->picnum];
|
||||
|
||||
// Get the texture
|
||||
ds->source = (UINT8 *)W_CacheLumpNum(levelflat->lumpnum, PU_STATIC); // Stay here until Z_ChangeTag
|
||||
|
||||
if (ds->source == NULL)
|
||||
return;
|
||||
|
||||
size = W_LumpLength(levelflat->lumpnum);
|
||||
|
||||
switch (size)
|
||||
{
|
||||
@@ -1235,11 +1236,7 @@ void R_DrawSinglePlane(drawspandata_t* ds, visplane_t *pl, boolean allow_paralle
|
||||
ds->xoffs = pl->xoffs;
|
||||
ds->yoffs = pl->yoffs;
|
||||
|
||||
if (light >= LIGHTLEVELS)
|
||||
light = LIGHTLEVELS-1;
|
||||
|
||||
if (light < 0)
|
||||
light = 0;
|
||||
light = CLAMP(light, 0, LIGHTLEVELS-1);
|
||||
|
||||
if (pl->slope)
|
||||
{
|
||||
@@ -1292,6 +1289,12 @@ void R_DrawSinglePlane(drawspandata_t* ds, visplane_t *pl, boolean allow_paralle
|
||||
}
|
||||
else
|
||||
{
|
||||
// Don't mess with angle on slopes! We'll handle this ourselves later
|
||||
if (viewangle != pl->viewangle + pl->plangle)
|
||||
{
|
||||
viewangle = pl->viewangle + pl->plangle;
|
||||
}
|
||||
|
||||
ds->planeheight = abs(pl->height - pl->viewz);
|
||||
ds->planezlight = zlight[light];
|
||||
}
|
||||
@@ -1299,10 +1302,8 @@ void R_DrawSinglePlane(drawspandata_t* ds, visplane_t *pl, boolean allow_paralle
|
||||
R_SetSpanFunc(spanfunctype);
|
||||
|
||||
// set the maximum value for unsigned
|
||||
pl->top[pl->maxx+1] = 0xffff;
|
||||
pl->top[pl->minx-1] = 0xffff;
|
||||
pl->bottom[pl->maxx+1] = 0x0000;
|
||||
pl->bottom[pl->minx-1] = 0x0000;
|
||||
pl->top[pl->maxx+1] = pl->top[pl->minx-1] = 0xffff;
|
||||
pl->bottom[pl->maxx+1] = pl->bottom[pl->minx-1] = 0x0000;
|
||||
|
||||
stop = pl->maxx + 1;
|
||||
|
||||
@@ -1403,6 +1404,7 @@ void R_PlaneBounds(visplane_t *plane)
|
||||
if (plane->bottom[i] > low)
|
||||
low = plane->bottom[i];
|
||||
}
|
||||
|
||||
plane->high = hi;
|
||||
plane->low = low;
|
||||
}
|
||||
+9
-5
@@ -306,8 +306,10 @@ static void R_RenderMaskedSegLoop(drawcolumndata_t* dc, drawseg_t *drawseg, INT3
|
||||
else
|
||||
dc->texturemid -= (textureheight[texnum])*times;
|
||||
|
||||
const INT16 colnum = maskedtexturecol[dc->x];
|
||||
|
||||
// calculate lighting
|
||||
if (maskedtexturecol[dc->x] != INT16_MAX)
|
||||
if (colnum != INT16_MAX)
|
||||
{
|
||||
// Check for overflows first
|
||||
if (R_OverflowTest(dc))
|
||||
@@ -337,7 +339,7 @@ static void R_RenderMaskedSegLoop(drawcolumndata_t* dc, drawseg_t *drawseg, INT3
|
||||
dc->iscale = 0xffffffffu / (unsigned)spryscale;
|
||||
|
||||
// draw the texture
|
||||
col = (column_t *)((UINT8 *)R_GetColumn(texnum, maskedtexturecol[dc->x]) - 3);
|
||||
col = (column_t *)((UINT8 *)R_GetColumn(texnum, colnum) - 3);
|
||||
|
||||
auto set_light_vars = [&](INT32 k)
|
||||
{
|
||||
@@ -434,7 +436,7 @@ static void R_RenderMaskedSegLoop(drawcolumndata_t* dc, drawseg_t *drawseg, INT3
|
||||
dc->iscale = 0xffffffffu / (unsigned)spryscale;
|
||||
|
||||
// draw the texture
|
||||
col = (column_t *)((UINT8 *)R_GetColumn(texnum, maskedtexturecol[dc->x]) - 3);
|
||||
col = (column_t *)((UINT8 *)R_GetColumn(texnum, colnum) - 3);
|
||||
|
||||
colfunc_2s(dc, col);
|
||||
}
|
||||
@@ -1164,7 +1166,7 @@ static void R_DrawWallColumn(drawcolumndata_t* dc, INT32 yl, INT32 yh, fixed_t m
|
||||
dc->source = R_GetColumn(texture, texturecolumn);
|
||||
dc->texheight = textureheight[texture] >> FRACBITS;
|
||||
dc->sourcelength = dc->texheight;
|
||||
R_SetColumnFunc(colfunctype);
|
||||
//R_SetColumnFunc(colfunctype);
|
||||
coldrawfunc_t* colfunccopy = colfunc;
|
||||
drawcolumndata_t dc_copy = *dc;
|
||||
if (remap)
|
||||
@@ -1190,6 +1192,7 @@ static void R_RenderSegLoop(drawcolumndata_t* dc)
|
||||
INT32 bottom;
|
||||
INT32 i;
|
||||
|
||||
// Loop over width
|
||||
for (; rw_x < rw_stopx; rw_x++)
|
||||
{
|
||||
// mark floor / ceiling areas
|
||||
@@ -1563,6 +1566,7 @@ static void R_MarkSegBounds(void)
|
||||
INT32 top, bottom;
|
||||
INT16 topclip, bottomclip;
|
||||
|
||||
// Loop over width
|
||||
for (; rw_x < rw_stopx; rw_x++)
|
||||
{
|
||||
// mark floor / ceiling areas
|
||||
@@ -2884,7 +2888,7 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||
|
||||
didsolidcol = false;
|
||||
|
||||
if (!segtextured && !numffloors)
|
||||
if (!segtextured && !numffloors && !numbackffloors)
|
||||
{
|
||||
if (markfloor || markceiling)
|
||||
R_MarkSegBounds();
|
||||
|
||||
+51
-2
@@ -737,6 +737,13 @@ static void R_DrawFlippedMaskedColumn(drawcolumndata_t* dc, column_t *column)
|
||||
dc->texturemid = basetexturemid;
|
||||
}
|
||||
|
||||
|
||||
// Based off of R_GetLinedefTransTable
|
||||
transnum_t R_GetThingTransTable(fixed_t alpha, transnum_t transmap)
|
||||
{
|
||||
return static_cast<transnum_t>((20*(FRACUNIT - ((alpha * (10 - transmap))/10) - 1) + FRACUNIT) >> (FRACBITS+1));
|
||||
}
|
||||
|
||||
//
|
||||
// R_DrawVisSprite
|
||||
// mfloorclip and mceilingclip should also be set.
|
||||
@@ -1596,6 +1603,9 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||
else
|
||||
trans = 0;
|
||||
|
||||
if (cv_playerfade.value && oldthing->player)
|
||||
trans = static_cast<INT32>(R_GetThingTransTable(R_DoPlayerFade(oldthing), static_cast<transnum_t>(trans)));
|
||||
|
||||
//SoM: 3/17/2000: Disregard sprites that are out of view..
|
||||
if (vflip)
|
||||
{
|
||||
@@ -2931,6 +2941,32 @@ boolean R_ThingWithinDist(mobj_t *thing, INT32 limit_dist)
|
||||
return true;
|
||||
}
|
||||
|
||||
fixed_t R_DoPlayerFade(mobj_t *thing)
|
||||
{
|
||||
fixed_t fadealpha = FRACUNIT;
|
||||
static constexpr tic_t countdownstarttime = (15 * TICRATE) / 4; // starttime - (3*TICRATE)
|
||||
|
||||
if (thing->player == viewplayer || viewplayer->exiting || camera[R_GetViewNumber()].freecam || leveltime < countdownstarttime)
|
||||
return fadealpha;
|
||||
|
||||
const INT32 playerdist = (FixedMul((thing->x - viewx), viewcos) + FixedMul((thing->y - viewy), viewsin)) >> FRACBITS;
|
||||
const INT32 viewplayerdist = (FixedMul((viewplayer->mo->x - viewx), viewcos) + FixedMul((viewplayer->mo->y - viewy), viewsin)) >> FRACBITS;
|
||||
|
||||
if (playerdist < viewplayerdist)
|
||||
{
|
||||
if (playerdist < viewplayerdist / 2) // stronger fade when very close
|
||||
{
|
||||
fadealpha = (playerdist * FRACUNIT) / (viewplayerdist / 2) / 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
fadealpha = (playerdist * FRACUNIT) / viewplayerdist;
|
||||
}
|
||||
}
|
||||
|
||||
return fadealpha;
|
||||
}
|
||||
|
||||
boolean R_CheckInterpDist(mobj_t *thing)
|
||||
{
|
||||
if (!cv_maxinterpdist.value)
|
||||
@@ -2970,8 +3006,21 @@ static void R_DrawMaskedList(drawnode_t* head)
|
||||
{
|
||||
drawspandata_t ds = {};
|
||||
next = r2->prev;
|
||||
// Force disable multithreading since it is usually slower because of waiting for each plane to render
|
||||
R_DrawSinglePlane(&ds, r2->plane, false);
|
||||
boolean parallel = cv_parallelsoftware.value && cv_paralleldrawmasked.value;
|
||||
#ifdef HAVE_THREADS
|
||||
srb2::ThreadPool::Sema tp_sema;
|
||||
if (parallel)
|
||||
srb2::g_main_threadpool->begin_sema();
|
||||
#endif
|
||||
R_DrawSinglePlane(&ds, r2->plane, parallel);
|
||||
#ifdef HAVE_THREADS
|
||||
if (parallel)
|
||||
{
|
||||
tp_sema = srb2::g_main_threadpool->end_sema();
|
||||
srb2::g_main_threadpool->notify_sema(tp_sema);
|
||||
srb2::g_main_threadpool->wait_sema(tp_sema);
|
||||
}
|
||||
#endif
|
||||
R_DoneWithNode(r2);
|
||||
r2 = next;
|
||||
}
|
||||
|
||||
@@ -87,9 +87,12 @@ typedef struct
|
||||
|
||||
void R_DrawMasked(maskcount_t* masks, INT32 nummasks);
|
||||
|
||||
transnum_t R_GetThingTransTable(fixed_t alpha, transnum_t transmap);
|
||||
|
||||
boolean R_ThingVisible(mobj_t *thing);
|
||||
boolean R_ThingWithinDist(mobj_t *thing, INT32 limit_dist);
|
||||
boolean R_CheckInterpDist(mobj_t *thing);
|
||||
fixed_t R_DoPlayerFade(mobj_t *thing);
|
||||
|
||||
boolean R_ThingIsFullBright(mobj_t *thing);
|
||||
boolean R_ThingIsSemiBright(mobj_t *thing);
|
||||
|
||||
+15
-14
@@ -957,7 +957,7 @@ boolean S_AdjustSoundParams(const mobj_t *listener, const mobj_t *source, INT32
|
||||
INT64 x, y, yl, yh, xl, xh;
|
||||
fixed_t newdist;
|
||||
|
||||
if (R_PointInSubsector(listensource.x, listensource.y)->sector->ceilingpic == skyflatnum)
|
||||
if (R_PointInSubsectorFast(listensource.x, listensource.y)->sector->ceilingpic == skyflatnum)
|
||||
approx_dist = 0;
|
||||
else
|
||||
{
|
||||
@@ -970,7 +970,7 @@ boolean S_AdjustSoundParams(const mobj_t *listener, const mobj_t *source, INT32
|
||||
for (y = yl; y <= yh; y += FRACUNIT*64)
|
||||
for (x = xl; x <= xh; x += FRACUNIT*64)
|
||||
{
|
||||
if (R_PointInSubsector(x, y)->sector->ceilingpic == skyflatnum)
|
||||
if (R_PointInSubsectorFast(x, y)->sector->ceilingpic == skyflatnum)
|
||||
{
|
||||
// Found the outdoors!
|
||||
newdist = S_CalculateSoundDistance(listensource.x, listensource.y, 0, x, y, 0);
|
||||
@@ -1718,15 +1718,15 @@ static boolean S_PlayMusic(boolean looping, UINT32 fadeinms)
|
||||
static void S_QueueMusic(const char *mmusic, UINT16 mflags, boolean looping, UINT32 position, UINT32 fadeinms)
|
||||
{
|
||||
strncpy(queue.name, mmusic, 7);
|
||||
queue.flags = mflags;
|
||||
queue.looping = looping;
|
||||
queue.flags = mflags;
|
||||
queue.looping = looping;
|
||||
queue.position = position;
|
||||
queue.fadeinms = fadeinms;
|
||||
}
|
||||
|
||||
static void S_ClearQueue(void)
|
||||
{
|
||||
queue.name[0] = queue.flags = queue.looping = queue.position = queue.fadeinms = 0;
|
||||
memset(&queue, 0, sizeof(music_t));
|
||||
}
|
||||
|
||||
static void S_ChangeMusicToQueue(void)
|
||||
@@ -1757,7 +1757,7 @@ void S_ChangeMusicEx(const char *mmusic, UINT16 mflags, boolean looping, UINT32
|
||||
|| demo.title) // SRB2Kart: Demos don't interrupt title screen music
|
||||
return;
|
||||
|
||||
strncpy(newmusic, mmusic, 6);
|
||||
strncpy(newmusic, mmusic, 6);
|
||||
strncpy(checkmusic, mmusic, 6);
|
||||
|
||||
if (LUA_HookMusicChange(music.name, &hook_param))
|
||||
@@ -2030,7 +2030,7 @@ void S_KeepMusic(void)
|
||||
}
|
||||
|
||||
// Sets up the map music in case it should be reloaded
|
||||
// Special case for keep music
|
||||
// Special case for keepmusic
|
||||
void S_HandleReloadResetMusic(void)
|
||||
{
|
||||
if (!(mapmusic.flags & MUSIC_RELOADRESET))
|
||||
@@ -2055,23 +2055,24 @@ void S_HandleReloadResetMusic(void)
|
||||
|
||||
static boolean S_SkipIntroMusic(void)
|
||||
{
|
||||
boolean skip = cv_skipintromusic.value;
|
||||
if (!cv_skipintromusic.value)
|
||||
return false;
|
||||
|
||||
if (!skip)
|
||||
// check if menu music is playing, otherwise it may continue playing
|
||||
if (!stricmp(music.name, "titles"))
|
||||
return false;
|
||||
|
||||
char *maptitle = G_BuildMapTitle(gamemap); // Zzz...
|
||||
|
||||
if (maptitle)
|
||||
if (maptitle && !stricmp(maptitle, "Wandering Falls")) // wandering balls changes its song when the race starts Zzz...
|
||||
{
|
||||
// check if menu music is playing, otherwise it may continue playing
|
||||
if (!stricmp(music.name, "titles") || (maptitle && (!stricmp(maptitle, "Wandering Falls")))) // wandering balls changes its song when the race starts Zzz...
|
||||
skip = false;
|
||||
Z_Free(maptitle);
|
||||
return false;
|
||||
}
|
||||
|
||||
Z_Free(maptitle);
|
||||
|
||||
return skip;
|
||||
return true;
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
+2
-1
@@ -49,6 +49,7 @@ consvar_t cv_vhseffect = {"vhspause", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NU
|
||||
consvar_t cv_shittyscreen = {"televisionsignal", "Okay", CV_NOSHOWHELP, shittyscreen_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_parallelsoftware = {"parallelsoftware", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_paralleldrawmasked = {"paralleldrawmasked", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
static CV_PossibleValue_t votescale_cons_t[] = {{0, "Vanilla"}, {1, "Adaptive"}, {2, "VerticalFill"}, {3, "HorizontalFill"}, {0, NULL}};
|
||||
consvar_t cv_votebgscaling = {"votebgscaling", "Adaptive", CV_SAVE, votescale_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
@@ -349,7 +350,7 @@ double averageFPS = 0.0f;
|
||||
|
||||
#ifdef USE_FPS_SAMPLES
|
||||
#define MAX_FRAME_TIME (0.05)
|
||||
#define NUM_FPS_SAMPLES (16) // Number of samples to store
|
||||
#define NUM_FPS_SAMPLES (32) // Number of samples to store
|
||||
|
||||
static double total_frame_time = 0.0;
|
||||
static int frame_index;
|
||||
|
||||
@@ -88,6 +88,7 @@ extern UINT8 *scr_borderpatch; // patch used to fill the view borders
|
||||
|
||||
extern consvar_t cv_scr_width, cv_scr_height, cv_renderview, cv_fullscreen, cv_vhseffect, cv_shittyscreen;
|
||||
extern consvar_t cv_parallelsoftware;
|
||||
extern consvar_t cv_paralleldrawmasked;
|
||||
|
||||
extern consvar_t cv_highreshudscale;
|
||||
// wait for page flipping to end or not
|
||||
|
||||
+391
-512
File diff suppressed because it is too large.
Load diff
@@ -1037,6 +1037,7 @@ sfxenum_t S_AddSoundFx(const char *name, boolean singular, INT32 flags, boolean
|
||||
S_sfx[i].data = I_GetSfx(&S_sfx[i]);
|
||||
else
|
||||
S_sfx[i].data = NULL;
|
||||
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -611,7 +611,7 @@ static lumpinfo_t* ResGetLumpsZip (FILE* handle, UINT16* nlmp)
|
||||
|
||||
fseek(handle, LONG(zend.cdiroffset), SEEK_SET);
|
||||
|
||||
char *cdir = (Z_MallocAlign(LONG(zend.cdirsize), PU_STATIC, &cdir, 7));
|
||||
char *cdir = Z_Malloc(LONG(zend.cdirsize), PU_STATIC, &cdir);
|
||||
|
||||
if (fread(cdir, 1, LONG(zend.cdirsize), handle) < (UINT32)(LONG(zend.cdirsize)))
|
||||
{
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
#include <winuser.h>
|
||||
|
||||
//Microsoft Developer Studio generated resource script.
|
||||
//
|
||||
#include "resource.h"
|
||||
|
||||
+85
-37
@@ -149,9 +149,12 @@ void Z_Free(void *ptr)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef ZDEBUG
|
||||
#ifdef ZDEBUG2
|
||||
// Write every Z_Free call to a debug file.
|
||||
CONS_Debug(DBG_MEMORY, "Z_Free at %s:%d\n", file, line);
|
||||
#elif defined(ZDEBUG)
|
||||
(void)file;
|
||||
(void)line;
|
||||
#endif
|
||||
|
||||
// anything that isn't by lua gets passed to lua just in case.
|
||||
@@ -202,7 +205,7 @@ static void *xm(size_t size)
|
||||
return p;
|
||||
}
|
||||
|
||||
/** The Z_MallocAlign function.
|
||||
/** The Z_Malloc function.
|
||||
* Allocates a block of memory, adds it to a linked list so we can keep track of it.
|
||||
*
|
||||
* \param size Amount of memory to be allocated, in bytes.
|
||||
@@ -210,22 +213,19 @@ static void *xm(size_t size)
|
||||
* \param user The address of a pointer to the memory to be allocated.
|
||||
* When the memory is freed by Z_Free later,
|
||||
* the pointer at this address will then be automatically set to NULL.
|
||||
* \param alignbits The alignment of the memory to be allocated, in bits. Can be 0.
|
||||
* \note You can pass Z_Malloc() a NULL user if the tag is less than PU_PURGELEVEL.
|
||||
* \sa Z_CallocAlign, Z_ReallocAlign
|
||||
* \sa Z_Calloc, Z_Realloc
|
||||
*/
|
||||
#ifdef ZDEBUG
|
||||
void *Z_Malloc2(size_t size, INT32 tag, void *user, INT32 alignbits,
|
||||
void *Z_Malloc2(size_t size, INT32 tag, void *user,
|
||||
const char *file, INT32 line)
|
||||
#else
|
||||
void *Z_MallocAlign(size_t size, INT32 tag, void *user, INT32 alignbits)
|
||||
void *Z_Malloc(size_t size, INT32 tag, void *user)
|
||||
#endif
|
||||
{
|
||||
memblock_t *block;
|
||||
void *ptr;
|
||||
|
||||
(void)(alignbits); // no longer used, so silence warnings. TODO we should figure out a solution for this
|
||||
|
||||
#ifdef ZDEBUG2
|
||||
CONS_Debug(DBG_MEMORY, "Z_Malloc %s:%d\n", file, line);
|
||||
#endif
|
||||
@@ -270,55 +270,53 @@ void *Z_MallocAlign(size_t size, INT32 tag, void *user, INT32 alignbits)
|
||||
return ptr;
|
||||
}
|
||||
|
||||
/** The Z_CallocAlign function.
|
||||
/** The Z_Calloc function.
|
||||
* Allocates a block of memory, adds it to a linked list so we can keep track of it.
|
||||
* Unlike Z_MallocAlign, this also initialises the bytes to zero.
|
||||
* Unlike Z_Malloc, this also initialises the bytes to zero.
|
||||
*
|
||||
* \param size Amount of memory to be allocated, in bytes.
|
||||
* \param tag Purge tag.
|
||||
* \param user The address of a pointer to the memory to be allocated.
|
||||
* When the memory is freed by Z_Free later,
|
||||
* the pointer at this address will then be automatically set to NULL.
|
||||
* \param alignbits The alignment of the memory to be allocated, in bits. Can be 0.
|
||||
* \note You can pass Z_Calloc() a NULL user if the tag is less than PU_PURGELEVEL.
|
||||
* \sa Z_MallocAlign, Z_ReallocAlign
|
||||
* \sa Z_Malloc, Z_Realloc
|
||||
*/
|
||||
#ifdef ZDEBUG
|
||||
void *Z_Calloc2(size_t size, INT32 tag, void *user, INT32 alignbits, const char *file, INT32 line)
|
||||
void *Z_Calloc2(size_t size, INT32 tag, void *user, const char *file, INT32 line)
|
||||
#else
|
||||
void *Z_CallocAlign(size_t size, INT32 tag, void *user, INT32 alignbits)
|
||||
void *Z_Calloc(size_t size, INT32 tag, void *user)
|
||||
#endif
|
||||
{
|
||||
#ifdef VALGRIND_MEMPOOL_ALLOC
|
||||
Z_calloc = true;
|
||||
#endif
|
||||
#ifdef ZDEBUG
|
||||
return memset(Z_Malloc2 (size, tag, user, alignbits, file, line), 0, size);
|
||||
return memset(Z_Malloc2(size, tag, user, file, line), 0, size);
|
||||
#else
|
||||
return memset(Z_MallocAlign(size, tag, user, alignbits ), 0, size);
|
||||
return memset(Z_Malloc (size, tag, user ), 0, size);
|
||||
#endif
|
||||
}
|
||||
|
||||
/** The Z_ReallocAlign function.
|
||||
/** The Z_Realloc function.
|
||||
* Reallocates a block of memory with a new size.
|
||||
*
|
||||
* \param ptr A pointer to allocated memory,
|
||||
* assumed to have been allocated with Z_Malloc/Z_Calloc.
|
||||
* If NULL, this function instead acts as a wrapper for Z_CallocAlign.
|
||||
* If NULL, this function instead acts as a wrapper for Z_Calloc.
|
||||
* \param size New size of memory block, in bytes.
|
||||
* If zero, then the memory is freed and NULL is returned.
|
||||
* \param tag New purge tag.
|
||||
* \param user The address of a pointer to the memory to be reallocated.
|
||||
* This can be a different user to the one originally assigned to the memory block.
|
||||
* \param alignbits The alignment of the memory to be allocated, in bits. Can be 0.
|
||||
* \return A pointer to the reallocated memory. Can be NULL if memory was freed.
|
||||
* \note You can pass Z_Realloc() a NULL user if the tag is less than PU_PURGELEVEL.
|
||||
* \sa Z_MallocAlign, Z_CallocAlign
|
||||
* \sa Z_Malloc, Z_Calloc
|
||||
*/
|
||||
#ifdef ZDEBUG
|
||||
void *Z_Realloc2(void *ptr, size_t size, INT32 tag, void *user, INT32 alignbits, const char *file, INT32 line)
|
||||
void *Z_Realloc2(void *ptr, size_t size, INT32 tag, void *user, const char *file, INT32 line)
|
||||
#else
|
||||
void *Z_ReallocAlign(void *ptr, size_t size, INT32 tag, void *user, INT32 alignbits)
|
||||
void *Z_Realloc(void *ptr, size_t size, INT32 tag, void *user)
|
||||
#endif
|
||||
{
|
||||
void *rez;
|
||||
@@ -338,9 +336,9 @@ void *Z_ReallocAlign(void *ptr, size_t size, INT32 tag, void *user, INT32 alignb
|
||||
if (!ptr)
|
||||
{
|
||||
#ifdef ZDEBUG
|
||||
return Z_Calloc2(size, tag, user, alignbits, file , line);
|
||||
return Z_Calloc2(size, tag, user, file, line);
|
||||
#else
|
||||
return Z_CallocAlign(size, tag, user, alignbits);
|
||||
return Z_Calloc(size, tag, user);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -348,9 +346,9 @@ void *Z_ReallocAlign(void *ptr, size_t size, INT32 tag, void *user, INT32 alignb
|
||||
#ifdef PARANOIA
|
||||
if (block->id != ZONEID)
|
||||
#ifdef ZDEBUG
|
||||
I_Error("Z_ReallocAlign at %s:%d: wrong id", file, line);
|
||||
I_Error("Z_Realloc at %s:%d: wrong id", file, line);
|
||||
#else
|
||||
I_Error("Z_ReallocAlign: wrong id");
|
||||
I_Error("Z_Realloc: wrong id");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -358,11 +356,13 @@ void *Z_ReallocAlign(void *ptr, size_t size, INT32 tag, void *user, INT32 alignb
|
||||
return NULL;
|
||||
|
||||
#ifdef ZDEBUG
|
||||
#ifdef ZDEBUG2
|
||||
// Write every Z_Realloc call to a debug file.
|
||||
DEBFILE(va("Z_Realloc at %s:%d\n", file, line));
|
||||
rez = Z_Malloc2(size, tag, user, alignbits, file, line);
|
||||
#endif
|
||||
rez = Z_Malloc2(size, tag, user, file, line);
|
||||
#else
|
||||
rez = Z_MallocAlign(size, tag, user, alignbits);
|
||||
rez = Z_Malloc(size, tag, user);
|
||||
#endif
|
||||
|
||||
if (size < block->realsize)
|
||||
@@ -394,11 +394,19 @@ void *Z_ReallocAlign(void *ptr, size_t size, INT32 tag, void *user, INT32 alignb
|
||||
* \param lowtag The lowest tag to consider.
|
||||
* \param hightag The highest tag to consider.
|
||||
*/
|
||||
#ifdef ZDEBUG
|
||||
void Z_FreeTags2(INT32 lowtag, INT32 hightag, const char *file, INT32 line)
|
||||
#else
|
||||
void Z_FreeTags(INT32 lowtag, INT32 hightag)
|
||||
#endif
|
||||
{
|
||||
memblock_t *block, *next;
|
||||
|
||||
#ifdef ZDEBUG
|
||||
Z_CheckHeap2(file, line);
|
||||
#else
|
||||
Z_CheckHeap(420);
|
||||
#endif
|
||||
for (block = head.next; block != &head; block = next)
|
||||
{
|
||||
next = block->next; // get link before freeing
|
||||
@@ -468,12 +476,20 @@ void Z_CheckMemCleanup(void)
|
||||
* \param i Identifies from where in the code Z_CheckHeap was called.
|
||||
* \author Graue <graue@oceanbase.org>
|
||||
*/
|
||||
void Z_CheckHeap(INT32 i)
|
||||
#ifdef ZDEBUG
|
||||
void Z_CheckHeap2(const char *file, INT32 line)
|
||||
#else
|
||||
void Z_CheckHeap(INT32 tag)
|
||||
#endif
|
||||
{
|
||||
memblock_t *block;
|
||||
UINT32 blocknumon = 0;
|
||||
void *given;
|
||||
|
||||
#ifndef ZDEBUG
|
||||
(void)tag;
|
||||
#endif
|
||||
|
||||
for (block = head.next; block != &head; block = block->next)
|
||||
{
|
||||
blocknumon++;
|
||||
@@ -498,11 +514,19 @@ void Z_CheckHeap(INT32 i)
|
||||
#endif
|
||||
if (block->user != NULL && *(block->user) != given)
|
||||
{
|
||||
I_Error("Z_CheckHeap %d: block %u"
|
||||
I_Error("Z_CheckHeap"
|
||||
#ifdef ZDEBUG
|
||||
"at %s %d :"
|
||||
#endif
|
||||
"block %u"
|
||||
#ifdef ZDEBUG
|
||||
"(owned by %s:%d)"
|
||||
#endif
|
||||
" doesn't have a proper user", i, blocknumon
|
||||
" doesn't have a proper user"
|
||||
#ifdef ZDEBUG
|
||||
, file, line
|
||||
#endif
|
||||
, blocknumon
|
||||
#ifdef ZDEBUG
|
||||
, block->ownerfile, block->ownerline
|
||||
#endif
|
||||
@@ -510,11 +534,19 @@ void Z_CheckHeap(INT32 i)
|
||||
}
|
||||
if (block->next->prev != block)
|
||||
{
|
||||
I_Error("Z_CheckHeap %d: block %u"
|
||||
I_Error("Z_CheckHeap"
|
||||
#ifdef ZDEBUG
|
||||
"at %s %d :"
|
||||
#endif
|
||||
"block %u"
|
||||
#ifdef ZDEBUG
|
||||
"(owned by %s:%d)"
|
||||
#endif
|
||||
" lacks proper backlink", i, blocknumon
|
||||
" lacks proper backlink"
|
||||
#ifdef ZDEBUG
|
||||
, file, line
|
||||
#endif
|
||||
, blocknumon
|
||||
#ifdef ZDEBUG
|
||||
, block->ownerfile, block->ownerline
|
||||
#endif
|
||||
@@ -522,11 +554,19 @@ void Z_CheckHeap(INT32 i)
|
||||
}
|
||||
if (block->prev->next != block)
|
||||
{
|
||||
I_Error("Z_CheckHeap %d: block %u"
|
||||
I_Error("Z_CheckHeap"
|
||||
#ifdef ZDEBUG
|
||||
"at %s %d :"
|
||||
#endif
|
||||
"block %u"
|
||||
#ifdef ZDEBUG
|
||||
"(owned by %s:%d)"
|
||||
#endif
|
||||
" lacks proper forward link", i, blocknumon
|
||||
" lacks proper forward link"
|
||||
#ifdef ZDEBUG
|
||||
, file, line
|
||||
#endif
|
||||
, blocknumon
|
||||
#ifdef ZDEBUG
|
||||
, block->ownerfile, block->ownerline
|
||||
#endif
|
||||
@@ -534,11 +574,19 @@ void Z_CheckHeap(INT32 i)
|
||||
}
|
||||
if (block->id != ZONEID)
|
||||
{
|
||||
I_Error("Z_CheckHeap %d: block %u"
|
||||
I_Error("Z_CheckHeap"
|
||||
#ifdef ZDEBUG
|
||||
"at %s %d :"
|
||||
#endif
|
||||
"block %u"
|
||||
#ifdef ZDEBUG
|
||||
"(owned by %s:%d)"
|
||||
#endif
|
||||
" have the wrong ID", i, blocknumon
|
||||
" have the wrong ID"
|
||||
#ifdef ZDEBUG
|
||||
, file, line
|
||||
#endif
|
||||
, blocknumon
|
||||
#ifdef ZDEBUG
|
||||
, block->ownerfile, block->ownerline
|
||||
#endif
|
||||
|
||||
+23
-16
@@ -32,7 +32,7 @@ extern "C" {
|
||||
#define FUNCALLOC(x)
|
||||
#endif
|
||||
|
||||
//#define ZDEBUG
|
||||
#define ZDEBUG
|
||||
|
||||
//
|
||||
// Purge tags
|
||||
@@ -92,30 +92,31 @@ void Z_Init(void);
|
||||
// Z_Free and alloc with alignment
|
||||
#ifdef ZDEBUG
|
||||
#define Z_Free(p) Z_Free2(p, __FILE__, __LINE__)
|
||||
#define Z_MallocAlign(s,t,u,a) Z_Malloc2(s, t, u, a, __FILE__, __LINE__)
|
||||
#define Z_CallocAlign(s,t,u,a) Z_Calloc2(s, t, u, a, __FILE__, __LINE__)
|
||||
#define Z_ReallocAlign(p,s,t,u,a) Z_Realloc2(p,s, t, u, a, __FILE__, __LINE__)
|
||||
#define Z_Malloc(s,t,u) Z_Malloc2(s, t, u, __FILE__, __LINE__)
|
||||
#define Z_Calloc(s,t,u) Z_Calloc2(s, t, u, __FILE__, __LINE__)
|
||||
#define Z_Realloc(p,s,t,u) Z_Realloc2(p,s, t, u, __FILE__, __LINE__)
|
||||
void Z_Free2(void *ptr, const char *file, INT32 line);
|
||||
void *Z_Malloc2(size_t size, INT32 tag, void *user, INT32 alignbits, const char *file, INT32 line) FUNCALLOC(1);
|
||||
void *Z_Calloc2(size_t size, INT32 tag, void *user, INT32 alignbits, const char *file, INT32 line) FUNCALLOC(1);
|
||||
void *Z_Realloc2(void *ptr, size_t size, INT32 tag, void *user, INT32 alignbits, const char *file, INT32 line) FUNCALLOC(2);
|
||||
void *Z_Malloc2(size_t size, INT32 tag, void *user, const char *file, INT32 line) FUNCALLOC(1);
|
||||
void *Z_Calloc2(size_t size, INT32 tag, void *user, const char *file, INT32 line) FUNCALLOC(1);
|
||||
void *Z_Realloc2(void *ptr, size_t size, INT32 tag, void *user, const char *file, INT32 line) FUNCALLOC(2);
|
||||
#else
|
||||
void Z_Free(void *ptr);
|
||||
void *Z_MallocAlign(size_t size, INT32 tag, void *user, INT32 alignbits) FUNCALLOC(1);
|
||||
void *Z_CallocAlign(size_t size, INT32 tag, void *user, INT32 alignbits) FUNCALLOC(1);
|
||||
void *Z_ReallocAlign(void *ptr, size_t size, INT32 tag, void *user, INT32 alignbits) FUNCALLOC(2);
|
||||
void *Z_Malloc(size_t size, INT32 tag, void *user) FUNCALLOC(1);
|
||||
void *Z_Calloc(size_t size, INT32 tag, void *user) FUNCALLOC(1);
|
||||
void *Z_Realloc(void *ptr, size_t size, INT32 tag, void *user) FUNCALLOC(2);
|
||||
#endif
|
||||
|
||||
// Alloc with standard alignment
|
||||
#define Z_Malloc(s,t,u) Z_MallocAlign(s, t, u, sizeof(void *))
|
||||
#define Z_Calloc(s,t,u) Z_CallocAlign(s, t, u, sizeof(void *))
|
||||
#define Z_Realloc(p,s,t,u) Z_ReallocAlign(p, s, t, u, sizeof(void *))
|
||||
|
||||
// Free all memory by tag
|
||||
// these don't give line numbers for ZDEBUG currently though
|
||||
// (perhaps this should be changed in future?)
|
||||
#ifdef ZDEBUG
|
||||
#define Z_FreeTag(tagnum) Z_FreeTags2(tagnum, tagnum, __FILE__, __LINE__)
|
||||
#define Z_FreeTags(tagnum, tagnum2) Z_FreeTags2(tagnum, tagnum2, __FILE__, __LINE__)
|
||||
void Z_FreeTags2(INT32 lowtag, INT32 hightag, const char *file, INT32 line);
|
||||
#else
|
||||
#define Z_FreeTag(tagnum) Z_FreeTags(tagnum, tagnum)
|
||||
void Z_FreeTags(INT32 lowtag, INT32 hightag);
|
||||
#endif
|
||||
|
||||
// Iterate memory by tag
|
||||
#define Z_IterateTag(tagnum, func) Z_IterateTags(tagnum, tagnum, func)
|
||||
@@ -125,7 +126,13 @@ void Z_IterateTags(INT32 lowtag, INT32 hightag, boolean (*iterfunc)(void *));
|
||||
// Utility functions
|
||||
//
|
||||
void Z_CheckMemCleanup(void);
|
||||
void Z_CheckHeap(INT32 i);
|
||||
|
||||
#ifdef ZDEBUG
|
||||
#define Z_CheckHeap(tag) Z_CheckHeap2(__FILE__, __LINE__)
|
||||
void Z_CheckHeap2(const char *file, INT32 line);
|
||||
#else
|
||||
void Z_CheckHeap(INT32 tag);
|
||||
#endif
|
||||
|
||||
//
|
||||
// Zone memory modification
|
||||
|
||||
Reference in new issue
Block a user