Compare commits
95
Commits
v8
...
votebgstuff
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e13ba89f1a | ||
|
|
d8b2134aef | ||
|
|
c168832f8e | ||
|
|
448a603a56 | ||
|
|
2a95201c6d | ||
|
|
a73de55f96 | ||
|
|
e4a4496be6 | ||
|
|
a8f3a8dfb0 | ||
|
|
e19b9d1c60 | ||
|
|
e28ec4e7cb | ||
|
|
d0f09b467b | ||
|
|
6617382f54 | ||
|
|
7d68c0598c | ||
|
|
201c725dc7 | ||
|
|
57b2316c42 | ||
|
|
fe682a8071 | ||
|
|
bf44a054a1 | ||
|
|
eca9c60d9b | ||
|
|
cf42c35b9f | ||
|
|
a364068abb | ||
|
|
e88093d9cf | ||
|
|
5e532a76cf | ||
|
|
fb9c459269 | ||
|
|
a6898bd1cd | ||
|
|
ff474d18ee | ||
|
|
f15d3be263 | ||
|
|
19e5366c5b | ||
|
|
346dee019c | ||
|
|
18914f22f2 | ||
|
|
1219ecf818 | ||
|
|
b6923d0d0d | ||
|
|
e8969b0645 | ||
|
|
7932c1af6f | ||
|
|
95b4228d3c | ||
|
|
a0ff44043f | ||
|
|
1e15816057 | ||
|
|
a4566e9496 | ||
|
|
18f88c28dd | ||
|
|
b8dc1b13df | ||
|
|
33c03f1e7a | ||
|
|
7e5ae71714 | ||
|
|
b574ed0b1b | ||
|
|
01c621832b | ||
|
|
608cc66d78 | ||
|
|
35103ad810 | ||
|
|
5ac0262654 | ||
|
|
c361285790 | ||
|
|
a168b5e2b9 | ||
|
|
f70c38a853 | ||
|
|
4c05c063a9 | ||
|
|
ed05a909cb | ||
|
|
e1e45ad3ad | ||
|
|
ca9b001c9f | ||
|
|
3976d80867 | ||
|
|
1ee10457f8 | ||
|
|
116bcd0cb1 | ||
|
|
fcdccb96aa | ||
|
|
723286826b | ||
|
|
b190f09aea | ||
|
|
ff6358b031 | ||
|
|
5899a0c453 | ||
|
|
db4d9a330a | ||
|
|
03264e760f | ||
|
|
224e3b25e5 | ||
|
|
03c624a77b | ||
|
|
1ed76de58a | ||
|
|
5f40ff5a03 | ||
|
|
b1baa90b19 | ||
|
|
f0579de244 | ||
|
|
044836b026 | ||
|
|
c2a761c895 | ||
|
|
5b6e7abd91 | ||
|
|
c47c6aa6e4 | ||
|
|
5a6a954d4f | ||
|
|
92bf8c0788 | ||
|
|
058139f52b | ||
|
|
612d01a8ce | ||
|
|
bc130ce1f9 | ||
|
|
8abab58a5c | ||
|
|
740de2babe | ||
|
|
9d54baf544 | ||
|
|
c68c61975e | ||
|
|
6f7947dd5f | ||
|
|
cb8930fef6 | ||
|
|
93d87e1132 | ||
|
|
d5583ba040 | ||
|
|
7bb3e4445e | ||
|
|
001a38bbd2 | ||
|
|
463778cd88 | ||
|
|
f263585a72 | ||
|
|
ec0ca0d1ab | ||
|
|
121540f428 | ||
|
|
8b5fd5f646 | ||
|
|
23a9afb727 | ||
|
|
38b862ff16 |
No files matched your search
@@ -1,5 +1,5 @@
|
||||
/* backtrace.h -- Public header file for stack backtrace library.
|
||||
Copyright (C) 2012-2020 Free Software Foundation, Inc.
|
||||
Copyright (C) 2012-2024 Free Software Foundation, Inc.
|
||||
Written by Ian Lance Taylor, Google.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@@ -54,13 +54,14 @@ struct backtrace_state;
|
||||
invalid after this function returns.
|
||||
|
||||
As a special case, the ERRNUM argument will be passed as -1 if no
|
||||
debug info can be found for the executable, but the function
|
||||
requires debug info (e.g., backtrace_full, backtrace_pcinfo). The
|
||||
MSG in this case will be something along the lines of "no debug
|
||||
info". Similarly, ERRNUM will be passed as -1 if there is no
|
||||
symbol table, but the function requires a symbol table (e.g.,
|
||||
backtrace_syminfo). This may be used as a signal that some other
|
||||
approach should be tried. */
|
||||
debug info can be found for the executable, or if the debug info
|
||||
exists but has an unsupported version, but the function requires
|
||||
debug info (e.g., backtrace_full, backtrace_pcinfo). The MSG in
|
||||
this case will be something along the lines of "no debug info".
|
||||
Similarly, ERRNUM will be passed as -1 if there is no symbol table,
|
||||
but the function requires a symbol table (e.g., backtrace_syminfo).
|
||||
This may be used as a signal that some other approach should be
|
||||
tried. */
|
||||
|
||||
typedef void (*backtrace_error_callback) (void *data, const char *msg,
|
||||
int errnum);
|
||||
|
||||
Binary file not shown.
@@ -1,4 +1,3 @@
|
||||
/cscope.out
|
||||
/srb2wii
|
||||
*.json
|
||||
*.idx
|
||||
+1
-19
@@ -68,7 +68,6 @@ ALL_SYSTEMS=\
|
||||
LINUX64\
|
||||
MINGW64\
|
||||
HAIKU\
|
||||
DUMMY\
|
||||
MINGW\
|
||||
UNIX\
|
||||
LINUX\
|
||||
@@ -158,17 +157,6 @@ endif
|
||||
|
||||
include Makefile.cfg
|
||||
|
||||
ifdef DUMMY
|
||||
NOPNG=1
|
||||
NOZLIB=1
|
||||
NONET=1
|
||||
NOHW=1
|
||||
NOIPX=1
|
||||
EXENAME?=srb2dummy
|
||||
OBJS=$(OBJDIR)/i_video.o
|
||||
LIBS=-lm
|
||||
endif
|
||||
|
||||
ifdef HAIKU
|
||||
NOIPX=1
|
||||
ifndef NONET
|
||||
@@ -610,10 +598,6 @@ ifdef SDL
|
||||
all: pre-build $(BIN)/$(EXENAME)
|
||||
endif
|
||||
|
||||
ifdef DUMMY
|
||||
all: $(BIN)/$(EXENAME)
|
||||
endif
|
||||
|
||||
cleandep:
|
||||
$(REMOVE) $(OBJDIR)/depend.dep
|
||||
$(REMOVE) comptime.h
|
||||
@@ -625,7 +609,7 @@ else
|
||||
-$(.)../comptime.sh .
|
||||
endif
|
||||
|
||||
clean:
|
||||
clean: cleandep
|
||||
$(REMOVE) *~ *.flc
|
||||
$(REMOVE) $(OBJDIR)/*.o
|
||||
|
||||
@@ -734,9 +718,7 @@ endif
|
||||
|
||||
#dependecy made by gcc itself !
|
||||
$(OBJS):
|
||||
ifndef DUMMY
|
||||
-include $(OBJDIR)/depend.dep
|
||||
endif
|
||||
|
||||
$(OBJDIR)/depend.dep:
|
||||
@echo "Creating dependency file, depend.dep"
|
||||
|
||||
@@ -489,7 +489,6 @@ ifndef CYGWIN32
|
||||
ifndef MINGW
|
||||
ifndef MINGW64
|
||||
ifndef SDL
|
||||
ifndef DUMMY
|
||||
$(error No interface or platform flag defined)
|
||||
endif
|
||||
endif
|
||||
@@ -497,7 +496,6 @@ endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
#determine the interface directory (where you put all i_*.c)
|
||||
i_net_o=$(OBJDIR)/i_net.o
|
||||
@@ -522,11 +520,6 @@ UPX_OPTS+=-q
|
||||
endif
|
||||
|
||||
#Interface Setup
|
||||
ifdef DUMMY
|
||||
INTERFACE=dummy
|
||||
OBJDIR:=$(OBJDIR)/dummy
|
||||
BIN:=$(BIN)/dummy
|
||||
else
|
||||
ifdef LINUX
|
||||
SDL=1
|
||||
ifdef LINUX64
|
||||
@@ -573,7 +566,6 @@ endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef ARCHNAME
|
||||
OBJDIR:=$(OBJDIR)/$(ARCHNAME)
|
||||
@@ -588,7 +580,6 @@ ifdef SDL
|
||||
OBJDIR:=$(OBJDIR)/SDL
|
||||
endif
|
||||
|
||||
ifndef DUMMY
|
||||
ifdef DEBUGMODE
|
||||
OBJDIR:=$(OBJDIR)/Debug
|
||||
BIN:=$(BIN)/Debug
|
||||
@@ -596,4 +587,3 @@ else
|
||||
OBJDIR:=$(OBJDIR)/Release
|
||||
BIN:=$(BIN)/Release
|
||||
endif
|
||||
endif
|
||||
+7
-3
@@ -197,7 +197,7 @@ static fixed_t scale_mtof = (fixed_t)INITSCALEMTOF;
|
||||
// used by FTOM to scale from frame-buffer-to-map coords (=1/scale_mtof)
|
||||
static fixed_t scale_ftom;
|
||||
|
||||
static player_t *plr; // the player represented by an arrow
|
||||
static player_t *plr = NULL; // the player represented by an arrow
|
||||
|
||||
static boolean followplayer = true; // specifies whether to follow the player around
|
||||
|
||||
@@ -237,7 +237,7 @@ static inline void AM_restoreScaleAndLoc(void)
|
||||
m_x = old_m_x;
|
||||
m_y = old_m_y;
|
||||
}
|
||||
else
|
||||
else if (plr && plr->mo)
|
||||
{
|
||||
m_x = (plr->mo->x >> FRACTOMAPBITS) - m_w/2;
|
||||
m_y = (plr->mo->y >> FRACTOMAPBITS) - m_h/2;
|
||||
@@ -318,7 +318,8 @@ static void AM_initVariables(void)
|
||||
break;
|
||||
|
||||
plr = &players[pnum];
|
||||
if (plr != NULL && plr->mo != NULL)
|
||||
|
||||
if (plr && plr->mo)
|
||||
{
|
||||
m_x = (plr->mo->x >> FRACTOMAPBITS) - m_w/2;
|
||||
m_y = (plr->mo->y >> FRACTOMAPBITS) - m_h/2;
|
||||
@@ -597,6 +598,9 @@ static inline void AM_changeWindowScale(void)
|
||||
|
||||
static inline void AM_doFollowPlayer(void)
|
||||
{
|
||||
if (!plr || !plr->mo)
|
||||
return;
|
||||
|
||||
if (f_oldloc.x != plr->mo->x || f_oldloc.y != plr->mo->y)
|
||||
{
|
||||
m_x = FTOM(MTOF(plr->mo->x >> FRACTOMAPBITS)) - m_w/2;
|
||||
|
||||
+1
-11
@@ -240,7 +240,6 @@ void COM_ImmedExecute(const char *ptext)
|
||||
|
||||
while (i < strlen(ptext))
|
||||
{
|
||||
|
||||
quotes = 0;
|
||||
for (j = 0; i < strlen(ptext); i++,j++)
|
||||
{
|
||||
@@ -1984,7 +1983,7 @@ static boolean CV_FilterJoyAxisVars(consvar_t *v, const char *valstr)
|
||||
return true;
|
||||
}
|
||||
|
||||
// Block the Xbox DInput default axes and reset to the current defaults
|
||||
// Block the Xbox DInput default axes and reset to the current defaults
|
||||
static boolean CV_FilterJoyAxisVars2(consvar_t *v, const char *valstr)
|
||||
{
|
||||
if (!stricmp(v->name, "joyaxis_turn") && !stricmp(valstr, "X-Axis"))
|
||||
@@ -2041,15 +2040,6 @@ static boolean CV_FilterVarByVersion(consvar_t *v, const char *valstr)
|
||||
|
||||
if (GETMAJOREXECVERSION(cv_execversion.value) < 2) // 2 = 1.0.2
|
||||
{
|
||||
#if 0
|
||||
// We don't have changed saved cvars yet
|
||||
if (!stricmp(v->name, "alwaysmlook")
|
||||
|| !stricmp(v->name, "alwaysmlook2")
|
||||
|| !stricmp(v->name, "mousemove")
|
||||
|| !stricmp(v->name, "mousemove2"))
|
||||
return false;
|
||||
#endif
|
||||
|
||||
// axis defaults were changed to be friendly to 360 controllers
|
||||
// if ALL axis settings are defaults, then change them to new values
|
||||
if (!CV_FilterJoyAxisVars(v, valstr))
|
||||
|
||||
+20
-21
@@ -275,29 +275,28 @@ void CON_SetupBackColormap(void)
|
||||
|
||||
switch (cons_backcolor.value)
|
||||
{
|
||||
case 0: palindex = 15; break; // White
|
||||
case 1: palindex = 31; break; // Gray
|
||||
case 2: palindex = 47; break; // Sepia
|
||||
case 3: palindex = 63; break; // Brown
|
||||
case 4: palindex = 150; shift = 7; break; // Pink
|
||||
case 5: palindex = 127; shift = 7; break; // Raspberry
|
||||
case 6: palindex = 143; break; // Red
|
||||
case 7: palindex = 86; shift = 7; break; // Creamsicle
|
||||
case 8: palindex = 95; break; // Orange
|
||||
case 9: palindex = 119; shift = 7; break; // Gold
|
||||
case 10: palindex = 111; break; // Yellow
|
||||
case 11: palindex = 191; shift = 7; break; // Emerald
|
||||
case 12: palindex = 175; break; // Green
|
||||
case 13: palindex = 219; break; // Cyan
|
||||
case 14: palindex = 207; shift = 7; break; // Steel
|
||||
case 15: palindex = 230; shift = 7; break; // Periwinkle
|
||||
case 16: palindex = 239; break; // Blue
|
||||
case 17: palindex = 199; shift = 7; break; // Purple
|
||||
case 18: palindex = 255; shift = 7; break; // Lavender
|
||||
case 0: palindex = 15; break; // White
|
||||
case 1: palindex = 31; break; // Gray
|
||||
case 2: palindex = 47; break; // Sepia
|
||||
case 3: palindex = 63; break; // Brown
|
||||
case 4: palindex = 150; shift = 7; break; // Pink
|
||||
case 5: palindex = 127; shift = 7; break; // Raspberry
|
||||
case 6: palindex = 143; break; // Red
|
||||
case 7: palindex = 86; shift = 7; break; // Creamsicle
|
||||
case 8: palindex = 95; break; // Orange
|
||||
case 9: palindex = 119; shift = 7; break; // Gold
|
||||
case 10: palindex = 111; break; // Yellow
|
||||
case 11: palindex = 191; shift = 7; break; // Emerald
|
||||
case 12: palindex = 175; break; // Green
|
||||
case 13: palindex = 219; break; // Cyan
|
||||
case 14: palindex = 207; shift = 7; break; // Steel
|
||||
case 15: palindex = 230; shift = 7; break; // Periwinkle
|
||||
case 16: palindex = 239; break; // Blue
|
||||
case 17: palindex = 199; shift = 7; break; // Purple
|
||||
case 18: palindex = 255; shift = 7; break; // Lavender
|
||||
// Default green
|
||||
default: palindex = 175; break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// setup background colormap
|
||||
for (i = 0, j = 0; i < 768; i += 3, j++)
|
||||
|
||||
+45
-68
@@ -238,6 +238,18 @@ static boolean UseLocalDelay(void)
|
||||
return (cv_mindelay.value || (server && !server_lagless));
|
||||
}
|
||||
|
||||
#ifdef SATURNPAK
|
||||
static inline boolean UseSaturnSynch(INT32 node)
|
||||
{
|
||||
return (is_client_saturn[node] && cv_gamestateattempts.value);
|
||||
}
|
||||
|
||||
static inline boolean UseVanillaSynch(INT32 node)
|
||||
{
|
||||
return (!UseSaturnSynch(node) && cv_resynchattempts.value);
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline void *G_DcpyTiccmd(void* dest, const ticcmd_t* src, const size_t n)
|
||||
{
|
||||
const size_t d = n / sizeof(ticcmd_t);
|
||||
@@ -1056,6 +1068,7 @@ static void SV_RequireResynch(INT32 node)
|
||||
|
||||
// Initial setup
|
||||
memset(resynch_sent[node], 0, MAXPLAYERS);
|
||||
|
||||
for (i = 0; i < MAXPLAYERS; ++i)
|
||||
{
|
||||
if (!playeringame[i]) // Player not in game so just drop it from required synch
|
||||
@@ -1675,13 +1688,7 @@ static void SV_SendPlayerInfo(INT32 node)
|
||||
|
||||
for (i = 0; i < MSCOMPAT_MAXPLAYERS; i++)
|
||||
{
|
||||
if (i >= MAXPLAYERS)
|
||||
{
|
||||
netbuffer->u.playerinfo[i].node = 255;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (playeringame[i] == UINT8_MAX || !playeringame[i])
|
||||
if ((i >= MAXPLAYERS) || !playeringame[i])
|
||||
{
|
||||
netbuffer->u.playerinfo[i].node = 255; // This slot is empty.
|
||||
continue;
|
||||
@@ -1766,8 +1773,6 @@ static boolean SV_SendServerConfig(INT32 node)
|
||||
memset(netbuffer->u.servercfg.playerskins, 0xFF, sizeof(netbuffer->u.servercfg.playerskins));
|
||||
memset(netbuffer->u.servercfg.playercolor, 0xFF, sizeof(netbuffer->u.servercfg.playercolor));
|
||||
|
||||
memset(netbuffer->u.servercfg.adminplayers, -1, sizeof(netbuffer->u.servercfg.adminplayers));
|
||||
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
netbuffer->u.servercfg.adminplayers[i] = (SINT8)adminplayers[i];
|
||||
@@ -2278,7 +2283,7 @@ static void M_ConfirmConnect(event_t *ev)
|
||||
#endif
|
||||
}
|
||||
|
||||
static void AbortConnection(void)
|
||||
void CL_AbortConnection(void)
|
||||
{
|
||||
#ifdef HAVE_CURL
|
||||
CURLAbortFile();
|
||||
@@ -2291,7 +2296,6 @@ static void AbortConnection(void)
|
||||
cl_mode = CL_ABORTED;
|
||||
}
|
||||
|
||||
|
||||
static boolean CL_FinishedFileList(void)
|
||||
{
|
||||
INT32 i;
|
||||
@@ -2304,7 +2308,7 @@ static boolean CL_FinishedFileList(void)
|
||||
}
|
||||
else if (i == 3) // too many files
|
||||
{
|
||||
AbortConnection();
|
||||
CL_AbortConnection();
|
||||
M_StartMessage(M_GetText(
|
||||
"You have too many WAD files loaded\n"
|
||||
"to add ones the server is using.\n"
|
||||
@@ -2315,7 +2319,7 @@ static boolean CL_FinishedFileList(void)
|
||||
}
|
||||
else if (i == 2) // cannot join for some reason
|
||||
{
|
||||
AbortConnection();
|
||||
CL_AbortConnection();
|
||||
M_StartMessage(M_GetText(
|
||||
"You have the wrong addons loaded.\n\n"
|
||||
"To play on this server, restart\n"
|
||||
@@ -2352,7 +2356,7 @@ static boolean CL_FinishedFileList(void)
|
||||
{
|
||||
if (!CL_CheckDownloadable()) // nope!
|
||||
{
|
||||
AbortConnection();
|
||||
CL_AbortConnection();
|
||||
M_StartMessage(M_GetText(
|
||||
"An error occured when trying to\n"
|
||||
"download missing addons.\n"
|
||||
@@ -2617,7 +2621,7 @@ static boolean CL_ServerConnectionTicker(const char *tmpsave, tic_t *oldtic, tic
|
||||
{
|
||||
CONS_Printf(M_GetText("Legacy downloader request packet failed.\n"));
|
||||
CONS_Printf(M_GetText("Network game synchronization aborted.\n"));
|
||||
AbortConnection();
|
||||
CL_AbortConnection();
|
||||
M_StartMessage(M_GetText(
|
||||
"The direct download encountered an error.\n"
|
||||
"See the logfile for more info.\n"
|
||||
@@ -2644,7 +2648,7 @@ static boolean CL_ServerConnectionTicker(const char *tmpsave, tic_t *oldtic, tic
|
||||
{
|
||||
CONS_Printf("%d minute wait time exceeded.\n", cv_connectawaittime.value);
|
||||
CONS_Printf(M_GetText("Network game synchronization aborted.\n"));
|
||||
AbortConnection();
|
||||
CL_AbortConnection();
|
||||
M_StartMessage(va(
|
||||
"%d minute wait time exceeded.\n"
|
||||
"You may retry connection.\n"
|
||||
@@ -2715,7 +2719,7 @@ static boolean CL_ServerConnectionTicker(const char *tmpsave, tic_t *oldtic, tic
|
||||
if (!modeattacking && (key == KEY_ESCAPE || key == KEY_JOY1+1 || cl_mode == CL_ABORTED))
|
||||
{
|
||||
CONS_Printf(M_GetText("Network game synchronization aborted.\n"));
|
||||
AbortConnection();
|
||||
CL_AbortConnection();
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -3264,7 +3268,7 @@ void CL_ClearPlayer(INT32 playernum)
|
||||
P_RemoveMobj(players[playernum].mo);
|
||||
}
|
||||
|
||||
memset(&players[playernum], 0, sizeof (player_t));
|
||||
memset(&players[playernum], 0, sizeof(player_t));
|
||||
}
|
||||
|
||||
//
|
||||
@@ -3302,36 +3306,6 @@ void CL_RemovePlayer(INT32 playernum, INT32 reason)
|
||||
if (gametype == GT_CTF)
|
||||
P_PlayerFlagBurst(&players[playernum], false); // Don't take the flag with you!
|
||||
|
||||
// If in a special stage, redistribute the player's rings across
|
||||
// the remaining players.
|
||||
if (G_IsSpecialStage(gamemap))
|
||||
{
|
||||
INT32 i, count, increment, rings;
|
||||
|
||||
for (i = 0, count = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (playeringame[i])
|
||||
count++;
|
||||
}
|
||||
|
||||
count--;
|
||||
rings = players[playernum].health - 1;
|
||||
increment = rings/count;
|
||||
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (playeringame[i] && i != playernum)
|
||||
{
|
||||
if (rings < increment)
|
||||
P_GivePlayerRings(&players[i], rings);
|
||||
else
|
||||
P_GivePlayerRings(&players[i], increment);
|
||||
|
||||
rings -= increment;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LUA_HookPlayerQuit(&players[playernum], reason); // Lua hook for player quitting
|
||||
|
||||
if (playernum == displayplayers[0] && !demo.playback)
|
||||
@@ -3973,7 +3947,7 @@ static void Got_KickCmd(UINT8 **p, INT32 playernum)
|
||||
#ifdef DUMPCONSISTENCY
|
||||
if (msg == KICK_MSG_CON_FAIL) SV_SavedGame();
|
||||
#endif
|
||||
AbortConnection();
|
||||
CL_AbortConnection();
|
||||
|
||||
if (msg == KICK_MSG_CON_FAIL)
|
||||
M_StartMessage(M_GetText("Server closed connection\n(Synch failure)\nPress ESC\n"), NULL, MM_NOTHING);
|
||||
@@ -4303,14 +4277,14 @@ void SV_ResetServer(void)
|
||||
sprintf(player_names[i], "Player %d", i + 1);
|
||||
}
|
||||
|
||||
memset(player_name_changes, 0, sizeof player_name_changes);
|
||||
memset(player_name_changes, 0, sizeof(player_name_changes));
|
||||
|
||||
memset(playeringame, false, sizeof playeringame);
|
||||
memset(playernode, UINT8_MAX, sizeof playernode);
|
||||
memset(playeringame, false, sizeof(playeringame));
|
||||
memset(playernode, UINT8_MAX, sizeof(playernode));
|
||||
|
||||
pingmeasurecount = 1;
|
||||
memset(realpingtable, 0, sizeof realpingtable);
|
||||
memset(playerpingtable, 0, sizeof playerpingtable);
|
||||
memset(realpingtable, 0, sizeof(realpingtable));
|
||||
memset(playerpingtable, 0, sizeof(playerpingtable));
|
||||
|
||||
ClearAdminPlayers();
|
||||
|
||||
@@ -5343,18 +5317,18 @@ static void HandlePacketFromPlayer(SINT8 node)
|
||||
/// \todo Use a separate cvar for that kind of timeout?
|
||||
freezetimeout[node] = I_GetTime() + connectiontimeout;
|
||||
|
||||
// If we've alredy received a ticcmd for this tic, just submit it for the next one.
|
||||
tic_t faketic = maketic;
|
||||
if ((!!(netcmds[maketic % TICQUEUE][netconsole].angleturn & TICCMD_RECEIVED))
|
||||
&& (maketic - firstticstosend < TICQUEUE - 1))
|
||||
faketic++;
|
||||
|
||||
// Don't do anything for packets of type NODEKEEPALIVE?
|
||||
// Sryder 2018/07/01: Update the freezetimeout still!
|
||||
if (netbuffer->packettype == PT_NODEKEEPALIVE
|
||||
|| netbuffer->packettype == PT_NODEKEEPALIVEMIS)
|
||||
break;
|
||||
|
||||
// If we've alredy received a ticcmd for this tic, just submit it for the next one.
|
||||
tic_t faketic = maketic;
|
||||
if ((!!(netcmds[maketic % TICQUEUE][netconsole].angleturn & TICCMD_RECEIVED))
|
||||
&& (maketic - firstticstosend < TICQUEUE - 1))
|
||||
faketic++;
|
||||
|
||||
// Copy ticcmd
|
||||
G_MoveTiccmd(&netcmds[faketic%TICQUEUE][netconsole], &netbuffer->u.clientpak.cmd, 1);
|
||||
|
||||
@@ -5414,27 +5388,28 @@ static void HandlePacketFromPlayer(SINT8 node)
|
||||
|
||||
// Check player consistancy during the level
|
||||
if (gamestate == GS_LEVEL
|
||||
&& (realstart > gametic - TICQUEUE+1 && realstart <= gametic)
|
||||
&& (realstart <= gametic && realstart + TICQUEUE - 1 > gametic)
|
||||
&& consistancy[realstart%TICQUEUE] != SHORT(netbuffer->u.clientpak.consistancy)
|
||||
&& (!is_client_saturn[node] || (!resendingsavegame[node] && savegameresendcooldown[node] <= I_GetTime() && !SV_ResendingSavegameToAnyone())))
|
||||
&& (!UseSaturnSynch(node) || (!resendingsavegame[node] && savegameresendcooldown[node] <= I_GetTime() && !SV_ResendingSavegameToAnyone())))
|
||||
{
|
||||
resendingsavegame[node] = false; // reset this before just in case
|
||||
|
||||
// Check if a client is saturn before sending ANYTHING!
|
||||
// this way we only send stuff to clients we know can use the gamestate resend
|
||||
// and dont have to wait for a response from clients that never would send a response back
|
||||
if (is_client_saturn[node])
|
||||
if (UseSaturnSynch(node))
|
||||
{
|
||||
// Tell the client we are about to resend them the gamestate
|
||||
netbuffer->packettype = PT_WILLRESENDGAMESTATE;
|
||||
HSendPacket(node, true, 0, 0);
|
||||
resendingsavegame[node] = true;
|
||||
}
|
||||
else
|
||||
else if (UseVanillaSynch(node))
|
||||
{
|
||||
SV_RequireResynch(node);
|
||||
resendingsavegame[node] = false;
|
||||
}
|
||||
|
||||
if ((!is_client_saturn[node] && (cv_resynchattempts.value && resynch_score[node] <= (unsigned)cv_resynchattempts.value*250)) || (is_client_saturn[node] && (gamestate_resend_counter[node] < cv_gamestateattempts.value)))
|
||||
if ((UseVanillaSynch(node) && (resynch_score[node] <= (unsigned)cv_resynchattempts.value*250)) || (UseSaturnSynch(node) && (gamestate_resend_counter[node] < cv_gamestateattempts.value)))
|
||||
{
|
||||
if (is_client_saturn[node] && resendingsavegame[node])
|
||||
{
|
||||
@@ -5443,10 +5418,13 @@ static void HandlePacketFromPlayer(SINT8 node)
|
||||
}
|
||||
|
||||
if (cv_blamecfail.value)
|
||||
{
|
||||
CONS_Printf(M_GetText("Synch failure for player %d (%s); expected %hd, got %hd\n"),
|
||||
netconsole+1, player_names[netconsole],
|
||||
consistancy[realstart%TICQUEUE],
|
||||
SHORT(netbuffer->u.clientpak.consistancy));
|
||||
}
|
||||
|
||||
DEBFILE(va("Restoring player %d (synch failure) [%update] %d!=%d\n",
|
||||
netconsole, realstart, consistancy[realstart%TICQUEUE],
|
||||
SHORT(netbuffer->u.clientpak.consistancy)));
|
||||
@@ -5718,7 +5696,7 @@ static void HandlePacketFromPlayer(SINT8 node)
|
||||
break;
|
||||
}
|
||||
|
||||
//Update client ping table from the server.
|
||||
// Update client ping table from the server.
|
||||
if (client)
|
||||
{
|
||||
UINT8 i;
|
||||
@@ -6528,7 +6506,6 @@ static inline void PingUpdate(void)
|
||||
if (pingtimeout[i] > 0)
|
||||
pingtimeout[i]--;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//kick lagging players... unless everyone but the server's ping sucks.
|
||||
|
||||
@@ -635,6 +635,9 @@ void CL_RemovePlayer(INT32 playernum, INT32 reason);
|
||||
void CL_QueryServerList(msg_server_t *list);
|
||||
void CL_UpdateServerList(void);
|
||||
void CL_TimeoutServerList(void);
|
||||
|
||||
void CL_AbortConnection(void);
|
||||
|
||||
// Is there a game running
|
||||
boolean Playing(void);
|
||||
|
||||
|
||||
+128
-124
@@ -197,12 +197,10 @@ static void D_PadMenuScrollInput(UINT8 input)
|
||||
// and pass it to the eventlist
|
||||
static void D_GamePadMenuScrollTicker(void)
|
||||
{
|
||||
UINT8 i;
|
||||
static UINT8 menuInputDelayTimer = 0;
|
||||
|
||||
if (dedicated)
|
||||
return;
|
||||
|
||||
for (UINT8 i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
if (dpadscrollstate[i])
|
||||
{
|
||||
@@ -222,10 +220,10 @@ static void D_GamePadMenuScrollTicker(void)
|
||||
static void D_DeviceLEDTick(void)
|
||||
{
|
||||
UINT8 i;
|
||||
static UINT16 color[MAXSPLITSCREENPLAYERS] = {0, 0, 0, 0};
|
||||
static UINT16 curcolor[MAXSPLITSCREENPLAYERS] = {0, 0, 0, 0};
|
||||
static UINT16 color[MAXSPLITSCREENPLAYERS] = {0};
|
||||
static UINT16 curcolor[MAXSPLITSCREENPLAYERS] = {0};
|
||||
|
||||
if (dedicated || numcontrollers == 0)
|
||||
if (numcontrollers == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -252,7 +250,6 @@ static void D_DeviceLEDTick(void)
|
||||
void D_ProcessEvents(void)
|
||||
{
|
||||
event_t *ev;
|
||||
|
||||
boolean eaten;
|
||||
|
||||
for (; eventtail != eventhead; eventtail = (eventtail+1) & (MAXEVENTS-1))
|
||||
@@ -291,8 +288,10 @@ void D_ProcessEvents(void)
|
||||
|
||||
// Demo input:
|
||||
if (demo.playback)
|
||||
{
|
||||
if (M_DemoResponder(ev))
|
||||
continue; // demo ate the event
|
||||
}
|
||||
|
||||
// console input
|
||||
#ifdef HAVE_THREADS
|
||||
@@ -317,6 +316,88 @@ void D_ProcessEvents(void)
|
||||
// draw current display, possibly wiping it from the previous
|
||||
//
|
||||
|
||||
static void D_Renderview(void)
|
||||
{
|
||||
UINT8 i;
|
||||
|
||||
if (automapactive)
|
||||
return;
|
||||
|
||||
R_ApplyLevelInterpolators(rendertimefrac);
|
||||
|
||||
for (i = 0; i <= splitscreen; i++)
|
||||
{
|
||||
const boolean issplitscreen = (i > 0);
|
||||
|
||||
if (!P_MobjWasRemoved(players[displayplayers[i]].mo) || players[displayplayers[i]].playerstate == PST_DEAD)
|
||||
{
|
||||
viewssnum = i;
|
||||
|
||||
if (!issplitscreen) // Initialize for P1
|
||||
{
|
||||
viewwindowy = viewwindowx = 0;
|
||||
topleft = screens[0];
|
||||
objectsdrawn = 0;
|
||||
}
|
||||
|
||||
#ifdef HWRENDER
|
||||
if (rendermode == render_opengl)
|
||||
{
|
||||
HWR_RenderPlayerView();
|
||||
R_RestoreLevelInterpolators();
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
if (issplitscreen) // Splitscreen-specific
|
||||
{
|
||||
const INT32 len = viewheight*sizeof(ylookup[0]);
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case 1:
|
||||
if (splitscreen > 1)
|
||||
{
|
||||
viewwindowx = viewwidth;
|
||||
viewwindowy = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
viewwindowx = 0;
|
||||
viewwindowy = viewheight;
|
||||
}
|
||||
M_Memcpy(ylookup, ylookup2, len);
|
||||
break;
|
||||
case 2:
|
||||
viewwindowx = 0;
|
||||
viewwindowy = viewheight;
|
||||
M_Memcpy(ylookup, ylookup3, len);
|
||||
break;
|
||||
case 3:
|
||||
viewwindowx = viewwidth;
|
||||
viewwindowy = viewheight;
|
||||
M_Memcpy(ylookup, ylookup4, len);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
topleft = screens[0] + viewwindowy*vid.width + viewwindowx;
|
||||
}
|
||||
|
||||
R_RenderPlayerView(&players[displayplayers[i]]);
|
||||
|
||||
if (issplitscreen)
|
||||
M_Memcpy(ylookup, ylookup1, viewheight*sizeof (ylookup[0]));
|
||||
}
|
||||
|
||||
if (!issplitscreen)
|
||||
R_ApplyViewMorph();
|
||||
|
||||
V_DoPostProcessor(i, postimgparam[i]);
|
||||
}
|
||||
|
||||
R_RestoreLevelInterpolators();
|
||||
}
|
||||
|
||||
// wipegamestate can be set to -1 to force a wipe on the next draw
|
||||
// added comment : there is a wipe eatch change of the gamestate
|
||||
gamestate_t wipegamestate = GS_LEVEL;
|
||||
@@ -327,7 +408,6 @@ static boolean D_Display(void)
|
||||
boolean forcerefresh = false;
|
||||
static boolean wipe = false;
|
||||
INT32 wipedefindex = 0;
|
||||
UINT8 i;
|
||||
|
||||
if (!dedicated)
|
||||
{
|
||||
@@ -366,6 +446,7 @@ static boolean D_Display(void)
|
||||
{
|
||||
// set for all later
|
||||
wipedefindex = gamestate; // wipe_xxx_toblack
|
||||
|
||||
if (gamestate == GS_TITLESCREEN && wipegamestate != GS_INTRO)
|
||||
wipedefindex = wipe_timeattack_toblack;
|
||||
else if (gamestate == GS_INTERMISSION)
|
||||
@@ -378,26 +459,28 @@ static boolean D_Display(void)
|
||||
|
||||
if (!dedicated)
|
||||
{
|
||||
// Fade to black first
|
||||
if (gamestate != GS_LEVEL // fades to black on its own timing, always
|
||||
&& wipedefs[wipedefindex] != UINT8_MAX)
|
||||
if (gamestate != GS_LEVEL)
|
||||
{
|
||||
F_WipeStartScreen();
|
||||
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31);
|
||||
F_WipeEndScreen();
|
||||
F_RunWipe(wipedefs[wipedefindex], gamestate != GS_TIMEATTACK);
|
||||
ranwipe = true;
|
||||
}
|
||||
// Fade to black first
|
||||
if (wipedefs[wipedefindex] != UINT8_MAX) // fades to black on its own timing, always
|
||||
{
|
||||
F_WipeStartScreen();
|
||||
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31);
|
||||
F_WipeEndScreen();
|
||||
F_RunWipe(wipedefs[wipedefindex], gamestate != GS_TIMEATTACK);
|
||||
ranwipe = true;
|
||||
}
|
||||
|
||||
if (gamestate != GS_LEVEL && rendermode != render_none)
|
||||
{
|
||||
V_SetPaletteLump("PLAYPAL"); // Reset the palette
|
||||
R_ReInitColormaps(0, LUMPERROR);
|
||||
if (rendermode != render_none)
|
||||
{
|
||||
V_SetPaletteLump("PLAYPAL"); // Reset the palette
|
||||
R_ReInitColormaps(0, LUMPERROR);
|
||||
}
|
||||
}
|
||||
|
||||
F_WipeStartScreen();
|
||||
}
|
||||
else //dedicated servers
|
||||
else // dedicated servers
|
||||
{
|
||||
F_RunWipe(wipedefs[wipedefindex], gamestate != GS_TIMEATTACK);
|
||||
ranwipe = true;
|
||||
@@ -405,7 +488,7 @@ static boolean D_Display(void)
|
||||
}
|
||||
}
|
||||
|
||||
if (dedicated) //bail out after wipe logic
|
||||
if (dedicated) // bail out after wipe logic
|
||||
return false;
|
||||
|
||||
// do buffered drawing
|
||||
@@ -430,9 +513,6 @@ static boolean D_Display(void)
|
||||
HU_Drawer();
|
||||
break;
|
||||
|
||||
case GS_TIMEATTACK:
|
||||
break;
|
||||
|
||||
case GS_INTRO:
|
||||
F_IntroDrawer();
|
||||
if (wipegamestate == (gamestate_t)-1)
|
||||
@@ -472,6 +552,7 @@ static boolean D_Display(void)
|
||||
F_TitleScreenDrawer();
|
||||
if (wipe)
|
||||
wipedefindex = wipe_titlescreen_toblack;
|
||||
HU_DrawSongCredits();
|
||||
break;
|
||||
|
||||
case GS_WAITINGPLAYERS:
|
||||
@@ -483,6 +564,7 @@ static boolean D_Display(void)
|
||||
HU_Erase();
|
||||
HU_Drawer();
|
||||
}
|
||||
case GS_TIMEATTACK:
|
||||
case GS_DEDICATEDSERVER:
|
||||
case GS_NULL:
|
||||
break;
|
||||
@@ -491,89 +573,10 @@ static boolean D_Display(void)
|
||||
if (gamestate == GS_LEVEL)
|
||||
{
|
||||
// draw the view directly
|
||||
if (cv_renderview.value && !automapactive)
|
||||
if (cv_renderview.value)
|
||||
{
|
||||
PS_START_TIMING(ps_rendercalltime);
|
||||
|
||||
R_ApplyLevelInterpolators(rendertimefrac);
|
||||
|
||||
for (i = 0; i <= splitscreen; i++)
|
||||
{
|
||||
if (!P_MobjWasRemoved(players[displayplayers[i]].mo) || players[displayplayers[i]].playerstate == PST_DEAD)
|
||||
{
|
||||
viewssnum = i;
|
||||
|
||||
if (i == 0) // Initialize for P1
|
||||
{
|
||||
viewwindowy = 0;
|
||||
viewwindowx = 0;
|
||||
|
||||
topleft = screens[0] + viewwindowy*vid.width + viewwindowx;
|
||||
objectsdrawn = 0;
|
||||
}
|
||||
|
||||
#ifdef HWRENDER
|
||||
if (rendermode == render_opengl)
|
||||
HWR_RenderPlayerView();
|
||||
else
|
||||
#endif
|
||||
if (rendermode != render_none)
|
||||
{
|
||||
if (i > 0) // Splitscreen-specific
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 1:
|
||||
if (splitscreen > 1)
|
||||
{
|
||||
viewwindowx = viewwidth;
|
||||
viewwindowy = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
viewwindowx = 0;
|
||||
viewwindowy = viewheight;
|
||||
}
|
||||
M_Memcpy(ylookup, ylookup2, viewheight*sizeof (ylookup[0]));
|
||||
break;
|
||||
case 2:
|
||||
viewwindowx = 0;
|
||||
viewwindowy = viewheight;
|
||||
M_Memcpy(ylookup, ylookup3, viewheight*sizeof (ylookup[0]));
|
||||
break;
|
||||
case 3:
|
||||
viewwindowx = viewwidth;
|
||||
viewwindowy = viewheight;
|
||||
M_Memcpy(ylookup, ylookup4, viewheight*sizeof (ylookup[0]));
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
topleft = screens[0] + viewwindowy*vid.width + viewwindowx;
|
||||
}
|
||||
|
||||
R_RenderPlayerView(&players[displayplayers[i]]);
|
||||
|
||||
if (i > 0)
|
||||
M_Memcpy(ylookup, ylookup1, viewheight*sizeof (ylookup[0]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (rendermode == render_soft)
|
||||
{
|
||||
if (!splitscreen)
|
||||
R_ApplyViewMorph();
|
||||
|
||||
for (i = 0; i <= splitscreen; i++)
|
||||
{
|
||||
V_DoPostProcessor(i, postimgparam[i]);
|
||||
}
|
||||
}
|
||||
|
||||
R_RestoreLevelInterpolators();
|
||||
|
||||
D_Renderview();
|
||||
PS_STOP_TIMING(ps_rendercalltime);
|
||||
}
|
||||
|
||||
@@ -583,6 +586,7 @@ static boolean D_Display(void)
|
||||
{
|
||||
VID_BlitLinearScreen(screens[0], screens[1], vid.width*vid.bpp, vid.height, vid.width*vid.bpp, vid.rowbytes);
|
||||
}
|
||||
|
||||
lastdraw = false;
|
||||
}
|
||||
|
||||
@@ -605,13 +609,8 @@ static boolean D_Display(void)
|
||||
// draw pause pic
|
||||
if (paused && cv_showhud.value && !demo.playback)
|
||||
{
|
||||
INT32 py;
|
||||
patch_t *patch;
|
||||
if (automapactive)
|
||||
py = 4;
|
||||
else
|
||||
py = viewwindowy + 4;
|
||||
patch = W_CachePatchName("M_PAUSE", PU_PATCH);
|
||||
INT32 py = (automapactive) ? 4 : (viewwindowy + 4);
|
||||
patch_t *patch = W_CachePatchName("M_PAUSE", PU_PATCH);
|
||||
V_DrawScaledPatch(viewwindowx + (BASEVIDWIDTH - patch->width)/2, py, V_SNAPTOTOP, patch);
|
||||
}
|
||||
|
||||
@@ -753,7 +752,7 @@ void D_SRB2Loop(void)
|
||||
|
||||
// Casting the return value of a function is bad practice (apparently)
|
||||
double budget = ((R_GetFramerateCap() == 0) ? 0.0 : round((1.0 / R_GetFramerateCap()) * I_GetPrecisePrecision()));
|
||||
capbudget = (precise_t) budget;
|
||||
capbudget = (precise_t)budget;
|
||||
|
||||
boolean ranwipe = false;
|
||||
|
||||
@@ -823,12 +822,15 @@ void D_SRB2Loop(void)
|
||||
doDisplay = true;
|
||||
}
|
||||
|
||||
if (menuactive)
|
||||
if (!dedicated)
|
||||
{
|
||||
D_GamePadMenuScrollTicker();
|
||||
}
|
||||
if (menuactive)
|
||||
{
|
||||
D_GamePadMenuScrollTicker();
|
||||
}
|
||||
|
||||
D_DeviceLEDTick();
|
||||
D_DeviceLEDTick();
|
||||
}
|
||||
}
|
||||
|
||||
if (interp)
|
||||
@@ -840,7 +842,9 @@ void D_SRB2Loop(void)
|
||||
ps_interp_frac.value.p = (precise_t)((FIXED_TO_FLOAT(g_time.timefrac)) * 1000.0f);
|
||||
ps_interp_lag.value.p = (precise_t)((deltasecs) * 1000.0f);
|
||||
|
||||
if (!(paused || P_AutoPause()) && deltatics < 1.0 && !hu_stopped)
|
||||
const boolean lagging = ((deltatics >= 1.0) || hu_stopped);
|
||||
|
||||
if (!(paused || P_AutoPause()) && !lagging)
|
||||
{
|
||||
rendertimefrac = g_time.timefrac;
|
||||
}
|
||||
@@ -849,7 +853,7 @@ void D_SRB2Loop(void)
|
||||
rendertimefrac = FRACUNIT;
|
||||
}
|
||||
|
||||
if ((deltatics < 1.0) && !hu_stopped)
|
||||
if (!lagging)
|
||||
{
|
||||
rendertimefrac_unpaused = g_time.timefrac;
|
||||
}
|
||||
@@ -1808,7 +1812,7 @@ void D_SRB2Main(void)
|
||||
{
|
||||
name = lumpinfo->name;
|
||||
|
||||
if (name[0] == 'M' && name[1] == 'A' && name[2] == 'P') // Ignore the headers
|
||||
if (memcmp(name, "MAP", 3) == 0) // Ignore the headers
|
||||
{
|
||||
INT16 num;
|
||||
if (name[5] != '\0')
|
||||
@@ -1838,7 +1842,7 @@ void D_SRB2Main(void)
|
||||
{
|
||||
name = lumpinfo->name;
|
||||
|
||||
if (name[0] == 'M' && name[1] == 'A' && name[2] == 'P') // Ignore the headers
|
||||
if (memcmp(name, "MAP", 3) == 0) // Ignore the headers
|
||||
{
|
||||
INT16 num;
|
||||
if (name[5] != '\0')
|
||||
|
||||
+42
-122
@@ -211,24 +211,13 @@ void SendWeaponPref4(void);
|
||||
|
||||
static CV_PossibleValue_t usemouse_cons_t[] = {{0, "Off"}, {1, "On"}, {2, "Force"}, {0, NULL}};
|
||||
|
||||
#ifdef LJOYSTICK
|
||||
static CV_PossibleValue_t joyport_cons_t[] = {{1, "/dev/js0"}, {2, "/dev/js1"}, {3, "/dev/js2"},
|
||||
{4, "/dev/js3"}, {0, NULL}};
|
||||
#else
|
||||
// accept whatever value - it is in fact the joystick device number
|
||||
#define usejoystick_cons_t NULL
|
||||
#endif
|
||||
|
||||
static CV_PossibleValue_t autobalance_cons_t[] = {{0, "MIN"}, {4, "MAX"}, {0, NULL}};
|
||||
static CV_PossibleValue_t teamscramble_cons_t[] = {{0, "Off"}, {1, "Random"}, {2, "Points"}, {0, NULL}};
|
||||
|
||||
static CV_PossibleValue_t startingliveslimit_cons_t[] = {{1, "MIN"}, {99, "MAX"}, {0, NULL}};
|
||||
static CV_PossibleValue_t sleeping_cons_t[] = {{0, "MIN"}, {1000/TICRATE, "MAX"}, {0, NULL}};
|
||||
static CV_PossibleValue_t competitionboxes_cons_t[] = {{0, "Normal"}, {1, "Random"}, {2, "Teleports"},
|
||||
{3, "None"}, {0, NULL}};
|
||||
|
||||
static CV_PossibleValue_t matchboxes_cons_t[] = {{0, "Normal"}, {1, "Random"}, {2, "Non-Random"},
|
||||
{3, "None"}, {0, NULL}};
|
||||
static CV_PossibleValue_t competitionboxes_cons_t[] = {{0, "Normal"}, {1, "Random"}, {2, "Teleports"}, {3, "None"}, {0, NULL}};
|
||||
static CV_PossibleValue_t matchboxes_cons_t[] = {{0, "Normal"}, {1, "Random"}, {2, "Non-Random"}, {3, "None"}, {0, NULL}};
|
||||
|
||||
//static CV_PossibleValue_t chances_cons_t[] = {{0, "MIN"}, {9, "MAX"}, {0, NULL}};
|
||||
static CV_PossibleValue_t match_scoring_cons_t[] = {{0, "Normal"}, {1, "Classic"}, {0, NULL}};
|
||||
@@ -307,7 +296,7 @@ consvar_t cv_mouseturn = {"mouseturn", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL,
|
||||
consvar_t cv_laglesscam = {"lagless_camera", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_verticallook[MAXSPLITSCREENPLAYERS] = {
|
||||
{"verticallook", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"verticallook", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"verticallook2", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"verticallook3", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"verticallook4", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}
|
||||
@@ -315,28 +304,26 @@ consvar_t cv_verticallook[MAXSPLITSCREENPLAYERS] = {
|
||||
|
||||
#if defined(HAVE_SDL) || defined(_WINDOWS) //joystick 1 and 2
|
||||
consvar_t cv_usejoystick[MAXSPLITSCREENPLAYERS] = {
|
||||
{"use_joystick", "1", CV_SAVE|CV_CALL, usejoystick_cons_t, I_InitJoystick1, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"use_joystick2", "2", CV_SAVE|CV_CALL, usejoystick_cons_t, I_InitJoystick2, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"use_joystick3", "3", CV_SAVE|CV_CALL, usejoystick_cons_t, I_InitJoystick3, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"use_joystick4", "4", CV_SAVE|CV_CALL, usejoystick_cons_t, I_InitJoystick4, 0, NULL, NULL, 0, 0, NULL}
|
||||
{"use_joystick", "1", CV_SAVE|CV_CALL, NULL, I_InitJoystick1, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"use_joystick2", "2", CV_SAVE|CV_CALL, NULL, I_InitJoystick2, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"use_joystick3", "3", CV_SAVE|CV_CALL, NULL, I_InitJoystick3, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"use_joystick4", "4", CV_SAVE|CV_CALL, NULL, I_InitJoystick4, 0, NULL, NULL, 0, 0, NULL}
|
||||
};
|
||||
#endif
|
||||
|
||||
#if (defined (LJOYSTICK) || defined (HAVE_SDL))
|
||||
#ifdef LJOYSTICK
|
||||
consvar_t cv_joyport = {"joyport", "/dev/js0", CV_SAVE, joyport_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_joyport2 = {"joyport2", "/dev/js0", CV_SAVE, joyport_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; //Alam: for later
|
||||
#endif
|
||||
#if defined (HAVE_SDL)
|
||||
consvar_t cv_joyscale[MAXSPLITSCREENPLAYERS] = {
|
||||
{"joyscale", "1", CV_SAVE|CV_CALL, NULL, I_JoyScale, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyscale", "1", CV_SAVE|CV_CALL, NULL, I_JoyScale, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyscale2", "1", CV_SAVE|CV_CALL, NULL, I_JoyScale2, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyscale3", "1", CV_SAVE|CV_CALL, NULL, I_JoyScale3, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyscale4", "1", CV_SAVE|CV_CALL, NULL, I_JoyScale4, 0, NULL, NULL, 0, 0, NULL}
|
||||
};
|
||||
#else
|
||||
consvar_t cv_joyscale[2] = { //Alam: Dummy for save
|
||||
{"joyscale", "1", CV_SAVE|CV_HIDEN, NULL, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyscale", "1", CV_SAVE|CV_HIDEN, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}
|
||||
consvar_t cv_joyscale[MAXSPLITSCREENPLAYERS] = { //Alam: Dummy for save
|
||||
{"joyscale", "1", CV_SAVE|CV_HIDEN, NULL, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyscale2", "1", CV_SAVE|CV_HIDEN, NULL, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyscale3", "1", CV_SAVE|CV_HIDEN, NULL, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyscale4", "1", CV_SAVE|CV_HIDEN, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -344,19 +331,6 @@ consvar_t cv_matchboxes = {"matchboxes", "Normal", CV_NETVAR|CV_CHEAT|CV_NOSHOWH
|
||||
consvar_t cv_specialrings = {"specialrings", "On", CV_NETVAR|CV_NOSHOWHELP, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_powerstones = {"powerstones", "On", CV_NETVAR|CV_NOSHOWHELP, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
/*consvar_t cv_recycler = {"tv_recycler", "5", CV_NETVAR|CV_CHEAT, chances_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_teleporters = {"tv_teleporter", "5", CV_NETVAR|CV_CHEAT, chances_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_superring = {"tv_superring", "5", CV_NETVAR|CV_CHEAT, chances_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_supersneakers = {"tv_supersneaker", "5", CV_NETVAR|CV_CHEAT, chances_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_invincibility = {"tv_invincibility", "5", CV_NETVAR|CV_CHEAT, chances_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_jumpshield = {"tv_jumpshield", "5", CV_NETVAR|CV_CHEAT, chances_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_watershield = {"tv_watershield", "5", CV_NETVAR|CV_CHEAT, chances_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_ringshield = {"tv_ringshield", "5", CV_NETVAR|CV_CHEAT, chances_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_forceshield = {"tv_forceshield", "5", CV_NETVAR|CV_CHEAT, chances_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_bombshield = {"tv_bombshield", "5", CV_NETVAR|CV_CHEAT, chances_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_1up = {"tv_1up", "5", CV_NETVAR|CV_CHEAT, chances_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_eggmanbox = {"tv_eggman", "5", CV_NETVAR|CV_CHEAT, chances_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};*/
|
||||
|
||||
// SRB2kart
|
||||
consvar_t cv_sneaker = {"sneaker", "On", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_rocketsneaker = {"rocketsneaker", "On", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
@@ -472,7 +446,6 @@ consvar_t cv_killingdead = {"killingdead", "Off", CV_NETVAR|CV_NOSHOWHELP, CV_On
|
||||
consvar_t cv_netstat = {"netstat", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; // show bandwidth statistics
|
||||
static CV_PossibleValue_t nettimeout_cons_t[] = {{TICRATE/7, "MIN"}, {60*TICRATE, "MAX"}, {0, NULL}};
|
||||
consvar_t cv_nettimeout = {"nettimeout", "210", CV_CALL|CV_SAVE, nettimeout_cons_t, NetTimeout_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
//static CV_PossibleValue_t jointimeout_cons_t[] = {{5*TICRATE, "MIN"}, {60*TICRATE, "MAX"}, {0, NULL}};
|
||||
consvar_t cv_jointimeout = {"jointimeout", "210", CV_CALL|CV_SAVE, nettimeout_cons_t, JoinTimeout_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_maxping = {"maxdelay", "20", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
@@ -992,7 +965,18 @@ void D_RegisterClientCommands(void)
|
||||
CV_RegisterVar(&cv_showfocuslost);
|
||||
CV_RegisterVar(&cv_pauseifunfocused);
|
||||
|
||||
// filesrch.c
|
||||
CV_RegisterVar(&cv_addons_option);
|
||||
CV_RegisterVar(&cv_addons_folder);
|
||||
CV_RegisterVar(&cv_addons_md5);
|
||||
CV_RegisterVar(&cv_addons_showall);
|
||||
CV_RegisterVar(&cv_addons_search_type);
|
||||
CV_RegisterVar(&cv_addons_search_case);
|
||||
|
||||
// g_input.c
|
||||
CV_RegisterVar(&cv_controlperkey);
|
||||
CV_RegisterVar(&cv_turnsmooth);
|
||||
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
CV_RegisterVar(&cv_turnaxis[i]);
|
||||
@@ -1010,45 +994,17 @@ void D_RegisterClientCommands(void)
|
||||
CV_RegisterVar(&cv_custom3axis[i]);
|
||||
CV_RegisterVar(&cv_xdeadzone[i]);
|
||||
CV_RegisterVar(&cv_ydeadzone[i]);
|
||||
}
|
||||
|
||||
// filesrch.c
|
||||
CV_RegisterVar(&cv_addons_option);
|
||||
CV_RegisterVar(&cv_addons_folder);
|
||||
CV_RegisterVar(&cv_addons_md5);
|
||||
CV_RegisterVar(&cv_addons_showall);
|
||||
CV_RegisterVar(&cv_addons_search_type);
|
||||
CV_RegisterVar(&cv_addons_search_case);
|
||||
|
||||
CV_RegisterVar(&cv_controlperkey);
|
||||
CV_RegisterVar(&cv_turnsmooth);
|
||||
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
CV_RegisterVar(&cv_usejoystick[i]);
|
||||
CV_RegisterVar(&cv_joyscale[i]);
|
||||
CV_RegisterVar(&cv_rumble[i]);
|
||||
CV_RegisterVar(&cv_gamepadled[i]);
|
||||
CV_RegisterVar(&cv_ledpowerup[i]);
|
||||
}
|
||||
|
||||
CV_RegisterVar(&cv_usemouse);
|
||||
CV_RegisterVar(&cv_invertmouse);
|
||||
CV_RegisterVar(&cv_mousesens);
|
||||
CV_RegisterVar(&cv_mouseysens);
|
||||
//CV_RegisterVar(&cv_mousemove);
|
||||
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
CV_RegisterVar(&cv_usejoystick[i]);
|
||||
}
|
||||
#ifdef LJOYSTICK
|
||||
CV_RegisterVar(&cv_joyport);
|
||||
CV_RegisterVar(&cv_joyport2);
|
||||
#endif
|
||||
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
CV_RegisterVar(&cv_joyscale[i]);
|
||||
}
|
||||
|
||||
// s_sound.c
|
||||
CV_RegisterVar(&cv_soundvolume);
|
||||
@@ -1097,6 +1053,7 @@ void D_RegisterClientCommands(void)
|
||||
}
|
||||
|
||||
CV_RegisterVar(&cv_demodateformat);
|
||||
CV_RegisterVar(&cv_showspecstuff);
|
||||
|
||||
// ingame object placing
|
||||
COM_AddCommand("objectplace", Command_ObjectPlace_f);
|
||||
@@ -1131,8 +1088,6 @@ void D_RegisterClientCommands(void)
|
||||
CV_RegisterVar(&cv_discordasks);
|
||||
#endif
|
||||
|
||||
CV_RegisterVar(&cv_showspecstuff);
|
||||
|
||||
COM_AddCommand("listskins", Command_ListSkins);
|
||||
COM_AddCommand("skinsearch", Command_SkinSearch);
|
||||
}
|
||||
@@ -1441,6 +1396,7 @@ static void SetPlayerName(INT32 playernum, char *newname)
|
||||
else
|
||||
{
|
||||
CONS_Printf(M_GetText("Player %d sent a bad name change\n"), playernum+1);
|
||||
|
||||
if (server && netgame)
|
||||
{
|
||||
SendKick(playernum, KICK_MSG_CON_FAIL);
|
||||
@@ -1798,24 +1754,8 @@ static void SendNameAndColor3(void)
|
||||
|
||||
if ((foundskin = R_SkinAvailable(cv_skin3.string)) != -1)
|
||||
{
|
||||
//boolean notsame;
|
||||
|
||||
cv_skin3.value = foundskin;
|
||||
|
||||
//notsame = (cv_skin3.value != players[thirdplaya].skin);
|
||||
|
||||
SetPlayerSkin(thirdplaya, cv_skin3.string);
|
||||
|
||||
// SRB2Kart
|
||||
/*if (notsame)
|
||||
{
|
||||
CV_StealthSetValue(&cv_playercolor3, skins[players[thirdplaya].skin].prefcolor);
|
||||
|
||||
players[thirdplaya].skincolor = (cv_playercolor3.value&0x3F) % MAXSKINCOLORS;
|
||||
|
||||
if (players[thirdplaya].mo)
|
||||
players[thirdplaya].mo->color = players[thirdplaya].skincolor;
|
||||
}*/
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2127,6 +2067,7 @@ void D_SendPlayerConfig(void)
|
||||
SendNameAndColor3();
|
||||
if (splitscreen > 2)
|
||||
SendNameAndColor4();
|
||||
|
||||
SendWeaponPref();
|
||||
if (splitscreen)
|
||||
SendWeaponPref2();
|
||||
@@ -2150,7 +2091,7 @@ static INT32 LookupPlayer(const char *s)
|
||||
if (*s == '0')/* clever way to bypass atoi */
|
||||
return 0;
|
||||
|
||||
if (( playernum = atoi(s) ))
|
||||
if ((playernum = atoi(s)))
|
||||
{
|
||||
playernum = max(min(playernum, MAXPLAYERS-1), 0);/* not out of range */
|
||||
return playernum;
|
||||
@@ -2231,8 +2172,7 @@ static void Command_View_f(void)
|
||||
|
||||
if (viewnum > 1 && !( multiplayer && demo.playback ))
|
||||
{
|
||||
CONS_Alert(CONS_NOTICE,
|
||||
"You must be viewing a multiplayer replay to use this.\n");
|
||||
CONS_Alert(CONS_NOTICE, "You must be viewing a multiplayer replay to use this.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2314,10 +2254,9 @@ static void Command_SetViews_f(void)
|
||||
UINT8 splits;
|
||||
UINT8 newsplits;
|
||||
|
||||
if (!( demo.playback && multiplayer ))
|
||||
if (!(demo.playback && multiplayer))
|
||||
{
|
||||
CONS_Alert(CONS_NOTICE,
|
||||
"You must be viewing a multiplayer replay to use this.\n");
|
||||
CONS_Alert(CONS_NOTICE, "You must be viewing a multiplayer replay to use this.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2536,18 +2475,8 @@ void D_MapChange(INT32 mapnum, INT32 newgametype, boolean pencoremode, boolean r
|
||||
// Kick bot from special stages
|
||||
if (botskin)
|
||||
{
|
||||
if (G_IsSpecialStage(mapnum))
|
||||
if (!botingame)
|
||||
{
|
||||
if (botingame)
|
||||
{
|
||||
//CL_RemoveSplitscreenPlayer();
|
||||
botingame = false;
|
||||
playeringame[1] = false;
|
||||
}
|
||||
}
|
||||
else if (!botingame)
|
||||
{
|
||||
//CL_AddSplitscreenPlayer();
|
||||
botingame = true;
|
||||
displayplayers[1] = 1;
|
||||
playeringame[1] = true;
|
||||
@@ -2845,7 +2774,7 @@ static void Command_Map_f(void)
|
||||
// G_TOLFlag handles both multiplayer gametype and ignores it for !multiplayer
|
||||
else
|
||||
{
|
||||
if (!mapheaderinfo[newmapnum-1] || mapheaderinfo[newmapnum-1] == NULL)
|
||||
if (!mapheaderinfo[newmapnum-1])
|
||||
{
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Invalid mapheaderinfo for Course %s (%s)\n"), realmapname, G_BuildMapName(newmapnum));
|
||||
Z_Free(realmapname);
|
||||
@@ -3099,9 +3028,14 @@ static void Command_ReplayMarker(void)
|
||||
adjustedleveltime = 0;
|
||||
|
||||
char *title = G_BuildMapTitle(gamemap);
|
||||
snprintf(demo.titlename, 64, "%s [%i:%02d/%.5s]", title, G_TicsToMinutes(adjustedleveltime, false), G_TicsToSeconds(adjustedleveltime), modeattacking ? "Record Attack" : connectedservername);
|
||||
|
||||
if (title)
|
||||
{
|
||||
snprintf(demo.titlename, 64, "%s [%i:%02d/%.5s]", title, G_TicsToMinutes(adjustedleveltime, false), G_TicsToSeconds(adjustedleveltime), modeattacking ? "Record Attack" : connectedservername);
|
||||
Z_Free(title);
|
||||
}
|
||||
else
|
||||
snprintf(demo.titlename, 64, "[%i:%02d/%.5s]", G_TicsToMinutes(adjustedleveltime, false), G_TicsToSeconds(adjustedleveltime), modeattacking ? "Record Attack" : connectedservername);
|
||||
|
||||
CONS_Printf("Replay will be saved!\n");
|
||||
}
|
||||
@@ -3133,20 +3067,6 @@ static void Command_Respawn(void)
|
||||
return;
|
||||
}
|
||||
|
||||
/*if (!G_RaceGametype()) // srb2kart: not necessary, respawning makes you lose a bumper in battle, so it's not desirable to use as a way to escape a hit
|
||||
{
|
||||
CONS_Printf(M_GetText("You may only use this in co-op, race, and competition!\n"));
|
||||
return;
|
||||
}*/
|
||||
|
||||
// Retry is quicker. Probably should force people to use it.
|
||||
// nope, this is srb2kart - a complete retry is overkill
|
||||
/*if (!(netgame || multiplayer))
|
||||
{
|
||||
CONS_Printf(M_GetText("You can't use this in Single Player! Use \"retry\" instead.\n"));
|
||||
return;
|
||||
}*/
|
||||
|
||||
SendNetXCmd(XD_RESPAWN, &buf, 4);
|
||||
}
|
||||
|
||||
|
||||
@@ -1306,6 +1306,21 @@ void CURLPrepareFile(const char* url, int dfilenum)
|
||||
|
||||
strcatbf(curl_curfile->filename, downloaddir, "/");
|
||||
curl_curfile->file = fopen(curl_curfile->filename, "wb");
|
||||
|
||||
if (!curl_curfile->file)
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, "Couldnt open %s for writing!\nAborting file download.\nCheck if you have write access to your download folder!\n", curl_curfile->filename);
|
||||
CL_AbortConnection();
|
||||
M_StartMessage(M_GetText(
|
||||
"An error occured when trying to\n"
|
||||
"download missing addons.\n"
|
||||
"See the console or log file\n"
|
||||
"for additional details.\n\n"
|
||||
"Press ESC\n"
|
||||
), NULL, MM_NOTHING);
|
||||
return;
|
||||
}
|
||||
|
||||
curl_easy_setopt(http_handle, CURLOPT_WRITEDATA, curl_curfile->file);
|
||||
curl_easy_setopt(http_handle, CURLOPT_WRITEFUNCTION, curlwrite_data);
|
||||
curl_easy_setopt(http_handle, CURLOPT_NOPROGRESS, 0L);
|
||||
@@ -1366,6 +1381,7 @@ void CURLGetFile(void)
|
||||
CONS_Alert(CONS_WARNING, "curl_multi_wait() failed, code %d.\n", mc);
|
||||
continue;
|
||||
}
|
||||
|
||||
curl_curfile->currentsize = curl_dlnow;
|
||||
curl_curfile->totalsize = curl_dltotal;
|
||||
}
|
||||
|
||||
+10
-4
@@ -388,7 +388,7 @@ static void DRPC_GotServerIP(UINT32 address)
|
||||
--------------------------------------------------*/
|
||||
static const char *DRPC_GetServerIP(void)
|
||||
{
|
||||
const char *address;
|
||||
const char *address;
|
||||
|
||||
// If you're connected
|
||||
if (I_GetNodeAddress && (address = I_GetNodeAddress(servernode)) != NULL)
|
||||
@@ -489,7 +489,7 @@ void DRPC_UpdatePresence(void)
|
||||
{
|
||||
#endif
|
||||
discordPresence.state = "Private";
|
||||
#ifdef MASTERSERVER
|
||||
#ifdef MASTERSERVER
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -571,9 +571,15 @@ void DRPC_UpdatePresence(void)
|
||||
{
|
||||
// Map name on tool tip
|
||||
char *title = G_BuildMapTitle(gamemap);
|
||||
snprintf(mapname, 48, "Map: %s", title);
|
||||
if (title)
|
||||
{
|
||||
snprintf(mapname, 48, "Map: %s", title);
|
||||
Z_Free(title);
|
||||
}
|
||||
else
|
||||
snprintf(mapname, 48, "Map: UNKNOWN");
|
||||
|
||||
discordPresence.largeImageText = mapname;
|
||||
Z_Free(title);
|
||||
}
|
||||
|
||||
if (gamestate == GS_LEVEL && Playing())
|
||||
|
||||
+2
-2
@@ -113,8 +113,8 @@ extern char logfilename[1024];
|
||||
#else
|
||||
#define VERSION 1 // Game version
|
||||
#define SUBVERSION 6 // more precise version number
|
||||
#define VERSIONSTRING "Saturn v8"
|
||||
#define VERSIONSTRINGW L"Saturn v8"
|
||||
#define VERSIONSTRING "Saturn v8.2"
|
||||
#define VERSIONSTRINGW L"Saturn v8.2"
|
||||
// Hey! If you change this, add 1 to the MODVERSION below! Otherwise we can't force updates!
|
||||
// And change CMakeLists.txt (not src/, but in root), for CMake users!
|
||||
// AND appveyor.yml, for the build bots!
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
#include "../doomdef.h"
|
||||
#include "../d_main.h"
|
||||
#include "../m_argv.h"
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
myargc = argc;
|
||||
myargv = argv; /// \todo pull out path to exe from this string
|
||||
|
||||
// startup SRB2
|
||||
CONS_Printf("Setting up SRB2...\n");
|
||||
D_SRB2Main();
|
||||
CONS_Printf("Entering main game loop...\n");
|
||||
// never return
|
||||
D_SRB2Loop();
|
||||
|
||||
// return to OS
|
||||
#ifndef __GNUC__
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
#include "../i_net.h"
|
||||
|
||||
boolean I_InitNetwork(void)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -1,217 +0,0 @@
|
||||
#include "../i_sound.h"
|
||||
|
||||
UINT8 sound_started = 0;
|
||||
|
||||
void *I_GetSfx(sfxinfo_t *sfx)
|
||||
{
|
||||
(void)sfx;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void I_FreeSfx(sfxinfo_t *sfx)
|
||||
{
|
||||
(void)sfx;
|
||||
}
|
||||
|
||||
void I_StartupSound(void){}
|
||||
|
||||
void I_ShutdownSound(void){}
|
||||
|
||||
void I_UpdateSound(void){};
|
||||
|
||||
//
|
||||
// SFX I/O
|
||||
//
|
||||
|
||||
INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority, INT32 channel)
|
||||
{
|
||||
(void)id;
|
||||
(void)vol;
|
||||
(void)sep;
|
||||
(void)pitch;
|
||||
(void)priority;
|
||||
(void)channel;
|
||||
return -1;
|
||||
}
|
||||
|
||||
void I_StopSound(INT32 handle)
|
||||
{
|
||||
(void)handle;
|
||||
}
|
||||
|
||||
boolean I_SoundIsPlaying(INT32 handle)
|
||||
{
|
||||
(void)handle;
|
||||
return false;
|
||||
}
|
||||
|
||||
void I_UpdateSoundParams(INT32 handle, UINT8 vol, UINT8 sep, UINT8 pitch)
|
||||
{
|
||||
(void)handle;
|
||||
(void)vol;
|
||||
(void)sep;
|
||||
(void)pitch;
|
||||
}
|
||||
|
||||
void I_SetSfxVolume(UINT8 volume)
|
||||
{
|
||||
(void)volume;
|
||||
}
|
||||
|
||||
/// ------------------------
|
||||
// MUSIC SYSTEM
|
||||
/// ------------------------
|
||||
|
||||
void I_InitMusic(void){}
|
||||
|
||||
void I_ShutdownMusic(void){}
|
||||
|
||||
/// ------------------------
|
||||
// MUSIC PROPERTIES
|
||||
/// ------------------------
|
||||
|
||||
musictype_t I_SongType(void)
|
||||
{
|
||||
return MU_NONE;
|
||||
}
|
||||
|
||||
boolean I_SongPlaying(void)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean I_SongPaused(void)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/// ------------------------
|
||||
// MUSIC EFFECTS
|
||||
/// ------------------------
|
||||
|
||||
boolean I_SetSongSpeed(float speed)
|
||||
{
|
||||
(void)speed;
|
||||
return false;
|
||||
}
|
||||
|
||||
/// ------------------------
|
||||
// MUSIC SEEKING
|
||||
/// ------------------------
|
||||
|
||||
UINT32 I_GetSongLength(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
boolean I_SetSongLoopPoint(UINT32 looppoint)
|
||||
{
|
||||
(void)looppoint;
|
||||
return false;
|
||||
}
|
||||
|
||||
UINT32 I_GetSongLoopPoint(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
boolean I_SetSongPosition(UINT32 position)
|
||||
{
|
||||
(void)position;
|
||||
return false;
|
||||
}
|
||||
|
||||
UINT32 I_GetSongPosition(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// ------------------------
|
||||
// MUSIC PLAYBACK
|
||||
/// ------------------------
|
||||
|
||||
boolean I_LoadSong(char *data, size_t len)
|
||||
{
|
||||
(void)data;
|
||||
(void)len;
|
||||
return -1;
|
||||
}
|
||||
|
||||
void I_UnloadSong(void)
|
||||
{
|
||||
(void)handle;
|
||||
}
|
||||
|
||||
boolean I_PlaySong(boolean looping)
|
||||
{
|
||||
(void)handle;
|
||||
(void)looping;
|
||||
return false;
|
||||
}
|
||||
|
||||
void I_StopSong(void)
|
||||
{
|
||||
(void)handle;
|
||||
}
|
||||
|
||||
void I_PauseSong(void)
|
||||
{
|
||||
(void)handle;
|
||||
}
|
||||
|
||||
void I_ResumeSong(void)
|
||||
{
|
||||
(void)handle;
|
||||
}
|
||||
|
||||
void I_SetMusicVolume(UINT8 volume)
|
||||
{
|
||||
(void)volume;
|
||||
}
|
||||
|
||||
boolean I_SetSongTrack(INT32 track)
|
||||
{
|
||||
(void)track;
|
||||
return false;
|
||||
}
|
||||
|
||||
/// ------------------------
|
||||
// MUSIC FADING
|
||||
/// ------------------------
|
||||
|
||||
void I_SetInternalMusicVolume(UINT8 volume)
|
||||
{
|
||||
(void)volume;
|
||||
}
|
||||
|
||||
void I_StopFadingSong(void)
|
||||
{
|
||||
}
|
||||
|
||||
boolean I_FadeSongFromVolume(UINT8 target_volume, UINT8 source_volume, UINT32 ms, void (*callback)(void));
|
||||
{
|
||||
(void)target_volume;
|
||||
(void)source_volume;
|
||||
(void)ms;
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean I_FadeSong(UINT8 target_volume, UINT32 ms, void (*callback)(void));
|
||||
{
|
||||
(void)target_volume;
|
||||
(void)ms;
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean I_FadeOutStopSong(UINT32 ms)
|
||||
{
|
||||
(void)ms;
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean I_FadeInPlaySong(UINT32 ms, boolean looping)
|
||||
{
|
||||
(void)ms;
|
||||
(void)looping;
|
||||
return false;
|
||||
}
|
||||
@@ -1,174 +0,0 @@
|
||||
#include "../doomdef.h"
|
||||
#include "../i_system.h"
|
||||
|
||||
UINT8 graphics_started = 0;
|
||||
|
||||
UINT8 keyboard_started = 0;
|
||||
|
||||
size_t I_GetFreeMem(size_t *total)
|
||||
{
|
||||
*total = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void I_Sleep(UINT32 ms){}
|
||||
|
||||
precise_t I_GetPreciseTime(void) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
UINT64 I_GetPrecisePrecision(void) {
|
||||
return 1000000;
|
||||
}
|
||||
|
||||
void I_GetEvent(void){}
|
||||
|
||||
void I_OsPolling(void){}
|
||||
|
||||
ticcmd_t *I_BaseTiccmd(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ticcmd_t *I_BaseTiccmd2(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void I_Quit(void)
|
||||
{
|
||||
exit(0);
|
||||
}
|
||||
|
||||
void I_Error(const char *error, ...)
|
||||
{
|
||||
(void)error;
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
void I_Tactile(FFType Type, const JoyFF_t *Effect)
|
||||
{
|
||||
(void)Type;
|
||||
(void)Effect;
|
||||
}
|
||||
|
||||
void I_Tactile2(FFType Type, const JoyFF_t *Effect)
|
||||
{
|
||||
(void)Type;
|
||||
(void)Effect;
|
||||
}
|
||||
|
||||
void I_JoyScale(void){}
|
||||
|
||||
void I_JoyScale2(void){}
|
||||
|
||||
void I_InitJoystick(void){}
|
||||
|
||||
void I_InitJoystick2(void){}
|
||||
|
||||
INT32 I_NumJoys(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char *I_GetJoyName(INT32 joyindex)
|
||||
{
|
||||
(void)joyindex;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifndef NOMUMBLE
|
||||
void I_UpdateMumble(const mobj_t *mobj, const listener_t listener)
|
||||
{
|
||||
(void)mobj;
|
||||
(void)listener;
|
||||
}
|
||||
#endif
|
||||
|
||||
void I_OutputMsg(const char *error, ...)
|
||||
{
|
||||
(void)error;
|
||||
}
|
||||
|
||||
void I_StartupMouse(void){}
|
||||
|
||||
void I_StartupKeyboard(void){}
|
||||
|
||||
INT32 I_GetKey(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void I_StartupTimer(void){}
|
||||
|
||||
void I_AddExitFunc(void (*func)())
|
||||
{
|
||||
(void)func;
|
||||
}
|
||||
|
||||
void I_RemoveExitFunc(void (*func)())
|
||||
{
|
||||
(void)func;
|
||||
}
|
||||
|
||||
INT32 I_StartupSystem(void)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
void I_ShutdownSystem(void){}
|
||||
|
||||
void I_GetDiskFreeSpace(INT64* freespace)
|
||||
{
|
||||
*freespace = 0;
|
||||
}
|
||||
|
||||
char *I_GetUserName(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
INT32 I_mkdir(const char *dirname, INT32 unixright)
|
||||
{
|
||||
(void)dirname;
|
||||
(void)unixright;
|
||||
return -1;
|
||||
}
|
||||
|
||||
const char *I_LocateWad(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void I_GetJoystickEvents(void){}
|
||||
|
||||
void I_GetJoystick2Events(void){}
|
||||
|
||||
char *I_GetEnv(const char *name)
|
||||
{
|
||||
(void)name;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
INT32 I_PutEnv(char *variable)
|
||||
{
|
||||
(void)variable;
|
||||
return -1;
|
||||
}
|
||||
|
||||
INT32 I_ClipboardCopy(const char *data, size_t size)
|
||||
{
|
||||
(void)data;
|
||||
(void)size;
|
||||
return -1;
|
||||
}
|
||||
|
||||
char *I_ClipboardPaste(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void I_RegisterSysCommands(void) {}
|
||||
|
||||
#include "../sdl/dosstr.c"
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
#include "../doomdef.h"
|
||||
#include "../command.h"
|
||||
#include "../i_video.h"
|
||||
|
||||
rendermode_t rendermode = render_none;
|
||||
|
||||
boolean highcolor = false;
|
||||
|
||||
boolean allow_fullscreen = false;
|
||||
|
||||
consvar_t cv_vidwait = {"vid_wait", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
void I_StartupGraphics(void){}
|
||||
|
||||
void I_ShutdownGraphics(void){}
|
||||
|
||||
void I_SetPalette(RGBA_t *palette)
|
||||
{
|
||||
(void)palette;
|
||||
}
|
||||
|
||||
INT32 VID_NumModes(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
INT32 VID_GetModeForSize(INT32 w, INT32 h)
|
||||
{
|
||||
(void)w;
|
||||
(void)h;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void VID_PrepareModeList(void){}
|
||||
|
||||
INT32 VID_SetMode(INT32 modenum)
|
||||
{
|
||||
(void)modenum;
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char *VID_GetModeName(INT32 modenum)
|
||||
{
|
||||
(void)modenum;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void I_UpdateNoBlit(void){}
|
||||
|
||||
void I_FinishUpdate(void){}
|
||||
|
||||
void I_UpdateNoVsync(void) {}
|
||||
|
||||
void I_WaitVBL(INT32 count)
|
||||
{
|
||||
(void)count;
|
||||
}
|
||||
|
||||
void I_ReadScreen(UINT8 *scr)
|
||||
{
|
||||
(void)scr;
|
||||
}
|
||||
|
||||
void I_BeginRead(void){}
|
||||
|
||||
void I_EndRead(void){}
|
||||
|
||||
+79
-146
@@ -396,7 +396,6 @@ consvar_t cv_growmusic = {"growmusic", "On", CV_SAVE, powermusic_cons_t, NULL,
|
||||
consvar_t cv_supermusic = {"supermusic", "On", CV_SAVE, powermusic_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_invertmouse = {"invertmouse", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
//consvar_t cv_mousemove = {"mousemove", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
static CV_PossibleValue_t joyaxis_cons_t[] = {{0, "None"},
|
||||
{1, "Left X"}, {2, "Left Y"}, {-1, "Left X-"}, {-2, "Left Y-"},
|
||||
@@ -417,105 +416,105 @@ static CV_PossibleValue_t joyaxis_cons_t[] = {{0, "None"},
|
||||
static CV_PossibleValue_t deadzone_cons_t[] = {{FRACUNIT/16, "MIN"}, {FRACUNIT, "MAX"}, {0, NULL}};
|
||||
|
||||
consvar_t cv_turnaxis[MAXSPLITSCREENPLAYERS] = {
|
||||
{"joyaxis_turn", "Left X", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis_turn", "Left X", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis2_turn", "Left X", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis3_turn", "Left X", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis4_turn", "Left X", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}
|
||||
};
|
||||
|
||||
consvar_t cv_moveaxis[MAXSPLITSCREENPLAYERS] = {
|
||||
{"joyaxis_move", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis_move", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis2_move", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis3_move", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis4_move", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}
|
||||
};
|
||||
|
||||
consvar_t cv_camstrafeaxis[MAXSPLITSCREENPLAYERS] = {
|
||||
{"joyaxis_camstrafe", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis_camstrafe", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis2_camstrafe", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis3_camstrafe", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis4_camstrafe", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}
|
||||
};
|
||||
|
||||
consvar_t cv_camturnaxis[MAXSPLITSCREENPLAYERS] = {
|
||||
{"joyaxis_camturn", "Left X", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis_camturn", "Left X", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis2_camturn", "Left X", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis3_camturn", "Left X", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis4_camturn", "Left X", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}
|
||||
};
|
||||
|
||||
consvar_t cv_brakeaxis[MAXSPLITSCREENPLAYERS] = {
|
||||
{"joyaxis_brake", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis_brake", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis2_brake", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis3_brake", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis4_brake", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}
|
||||
};
|
||||
|
||||
consvar_t cv_aimaxis[MAXSPLITSCREENPLAYERS] = {
|
||||
{"joyaxis_aim", "Left Y", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis_aim", "Left Y", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis2_aim", "Left Y", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis3_aim", "Left Y", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis4_aim", "Left Y", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}
|
||||
};
|
||||
|
||||
consvar_t cv_lookaxis[MAXSPLITSCREENPLAYERS] = {
|
||||
{"joyaxis_look", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis_look", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis2_look", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis3_look", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis4_look", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}
|
||||
};
|
||||
|
||||
consvar_t cv_fireaxis[MAXSPLITSCREENPLAYERS] = {
|
||||
{"joyaxis_fire", "L Trigger", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis_fire", "L Trigger", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis2_fire", "L Trigger", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis3_fire", "L Trigger", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis4_fire", "L Trigger", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}
|
||||
};
|
||||
|
||||
consvar_t cv_driftaxis[MAXSPLITSCREENPLAYERS] = {
|
||||
{"joyaxis_drift", "R Trigger", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis_drift", "R Trigger", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis2_drift", "R Trigger", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis3_drift", "R Trigger", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis4_drift", "R Trigger", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}
|
||||
};
|
||||
|
||||
consvar_t cv_lookbackaxis[MAXSPLITSCREENPLAYERS] = {
|
||||
{"joyaxis_lookback", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis_lookback", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis2_lookback", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis3_lookback", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis4_lookback", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}
|
||||
};
|
||||
|
||||
consvar_t cv_custom1axis[MAXSPLITSCREENPLAYERS] = {
|
||||
{"joyaxis_custom1", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis_custom1", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis2_custom1", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis3_custom1", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis4_custom1", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}
|
||||
};
|
||||
|
||||
consvar_t cv_custom2axis[MAXSPLITSCREENPLAYERS] = {
|
||||
{"joyaxis_custom2", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis_custom2", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis2_custom2", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis3_custom2", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis4_custom2", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}
|
||||
};
|
||||
|
||||
consvar_t cv_custom3axis[MAXSPLITSCREENPLAYERS] = {
|
||||
{"joyaxis_custom3", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis_custom3", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis2_custom3", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis3_custom3", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis4_custom3", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}
|
||||
};
|
||||
|
||||
consvar_t cv_xdeadzone[MAXSPLITSCREENPLAYERS] = {
|
||||
{"joy_xdeadzone", "0.3", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joy_xdeadzone", "0.3", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joy2_xdeadzone", "0.3", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joy3_xdeadzone", "0.3", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joy4_xdeadzone", "0.3", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}
|
||||
};
|
||||
|
||||
consvar_t cv_ydeadzone[MAXSPLITSCREENPLAYERS] = {
|
||||
{"joy_ydeadzone", "0.5", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joy_ydeadzone", "0.5", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joy2_ydeadzone", "0.5", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joy3_ydeadzone", "0.5", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joy4_ydeadzone", "0.5", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}
|
||||
@@ -626,6 +625,17 @@ static void G_SetSaveGameModified(void)
|
||||
strcatbf(savegamename, srb2home, PATHSEP);
|
||||
|
||||
G_LoadGameData();
|
||||
|
||||
// unlock EVERYTHING.
|
||||
for (UINT8 i = 0; i < MAXUNLOCKABLES; i++)
|
||||
{
|
||||
if (!unlockables[i].conditionset)
|
||||
continue;
|
||||
if (!unlockables[i].unlocked)
|
||||
{
|
||||
unlockables[i].unlocked = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// for consistency among messages: this modifies the game and removes savemoddata.
|
||||
@@ -1280,7 +1290,7 @@ static void G_DoLoadLevel(boolean resetplayer)
|
||||
|
||||
for (i = 0; i < JOYAXISSET; i++)
|
||||
{
|
||||
joyxmove[i] = joyymove[i] = 0;
|
||||
joyxmove[i] = joyymove[i] = 0;
|
||||
joy2xmove[i] = joy2ymove[i] = 0;
|
||||
joy3xmove[i] = joy3ymove[i] = 0;
|
||||
joy4xmove[i] = joy4ymove[i] = 0;
|
||||
@@ -1572,10 +1582,7 @@ boolean G_CouldView(INT32 playernum)
|
||||
return false;
|
||||
|
||||
// SRB2Kart: Only go through players who are actually playing
|
||||
if (player->exiting)
|
||||
return false;
|
||||
|
||||
if (player->pflags & PF_TIMEOVER)
|
||||
if (player->exiting || (player->pflags & PF_TIMEOVER))
|
||||
return false;
|
||||
|
||||
// I don't know if we want this actually, but I'll humor the suggestion anyway
|
||||
@@ -1837,11 +1844,11 @@ void G_Ticker(boolean run)
|
||||
{
|
||||
switch (gameaction)
|
||||
{
|
||||
case ga_completed: G_DoCompleted(); break;
|
||||
case ga_completed: G_DoCompleted(); break;
|
||||
case ga_startcont: G_DoStartContinue(); break;
|
||||
case ga_continued: G_DoContinued(); break;
|
||||
case ga_worlddone: G_DoWorldDone(); break;
|
||||
case ga_startvote: G_DoStartVote(); break;
|
||||
case ga_continued: G_DoContinued(); break;
|
||||
case ga_worlddone: G_DoWorldDone(); break;
|
||||
case ga_startvote: G_DoStartVote(); break;
|
||||
case ga_nothing: break;
|
||||
default: I_Error("gameaction = %d\n", gameaction);
|
||||
}
|
||||
@@ -1943,6 +1950,7 @@ void G_Ticker(boolean run)
|
||||
|
||||
case GS_TITLESCREEN:
|
||||
F_TitleScreenTicker(run);
|
||||
HU_TickSongCredits();
|
||||
break;
|
||||
case GS_WAITINGPLAYERS:
|
||||
if (netgame)
|
||||
@@ -2560,10 +2568,10 @@ mapthing_t *G_FindRaceStart(INT32 playernum)
|
||||
{
|
||||
if (!playeringame[j] || players[j].spectator)
|
||||
continue;
|
||||
if (j == playernum)
|
||||
continue;
|
||||
if (j == i)
|
||||
|
||||
if ((j == playernum) || (j == i))
|
||||
continue;
|
||||
|
||||
if (players[j].score == players[i].score)
|
||||
num++;
|
||||
}
|
||||
@@ -2661,6 +2669,7 @@ void G_DoReborn(INT32 playernum)
|
||||
}
|
||||
|
||||
B_RespawnBot(playernum);
|
||||
|
||||
if (oldmo)
|
||||
G_ChangePlayerReferences(oldmo, players[playernum].mo);
|
||||
}
|
||||
@@ -2683,6 +2692,7 @@ void G_DoReborn(INT32 playernum)
|
||||
}
|
||||
|
||||
G_SpawnPlayer(playernum, starpost);
|
||||
|
||||
if (oldmo)
|
||||
G_ChangePlayerReferences(oldmo, players[playernum].mo);
|
||||
|
||||
@@ -2751,62 +2761,6 @@ INT32 G_GetGametypeByName(const char *gametypestr)
|
||||
return -1; // unknown gametype
|
||||
}
|
||||
|
||||
//
|
||||
// G_IsSpecialStage
|
||||
//
|
||||
// Returns TRUE if
|
||||
// the given map is a special stage.
|
||||
//
|
||||
boolean G_IsSpecialStage(INT32 mapnum)
|
||||
{
|
||||
(void)mapnum;
|
||||
return false;
|
||||
}
|
||||
|
||||
//
|
||||
// G_GametypeUsesLives
|
||||
//
|
||||
// Returns true if the current gametype uses
|
||||
// the lives system. False otherwise.
|
||||
//
|
||||
boolean G_GametypeUsesLives(void)
|
||||
{
|
||||
// SRB2kart NEEDS no lives
|
||||
return false;
|
||||
}
|
||||
|
||||
//
|
||||
// G_GametypeHasTeams
|
||||
//
|
||||
// Returns true if the current gametype uses
|
||||
// Red/Blue teams. False otherwise.
|
||||
//
|
||||
boolean G_GametypeHasTeams(void)
|
||||
{
|
||||
return (gametype == GT_TEAMMATCH || gametype == GT_CTF);
|
||||
}
|
||||
|
||||
//
|
||||
// G_GametypeHasSpectators
|
||||
//
|
||||
// Returns true if the current gametype supports
|
||||
// spectators. False otherwise.
|
||||
//
|
||||
boolean G_GametypeHasSpectators(void)
|
||||
{
|
||||
return (netgame || (multiplayer && demo.playback)); //true
|
||||
}
|
||||
|
||||
//
|
||||
// G_BattleGametype
|
||||
//
|
||||
// Returns true in Battle gamemodes, previously was G_RingSlingerGametype.
|
||||
//
|
||||
boolean G_BattleGametype(void)
|
||||
{
|
||||
return (gametype == GT_MATCH);
|
||||
}
|
||||
|
||||
//
|
||||
// G_SometimesGetDifferentGametype
|
||||
//
|
||||
@@ -2838,6 +2792,7 @@ UINT8 G_SometimesGetDifferentGametype(UINT8 prefgametype)
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (encoreactual != (boolean)cv_kartencore.value)
|
||||
encoremodifier = 0x80;
|
||||
}
|
||||
@@ -2871,6 +2826,7 @@ UINT8 G_SometimesGetDifferentGametype(UINT8 prefgametype)
|
||||
return (GT_RACE|0x80);
|
||||
return (GT_RACE);
|
||||
}
|
||||
|
||||
// This might appear wrong HERE, but the game will display the Encore possibility on the second voting choice instead.
|
||||
return (GT_MATCH|encoremodifier);
|
||||
}
|
||||
@@ -2893,27 +2849,6 @@ UINT8 G_GetGametypeColor(INT16 gt)
|
||||
return 247; // FALLBACK
|
||||
}
|
||||
|
||||
//
|
||||
// G_RaceGametype
|
||||
//
|
||||
// Returns true in Race gamemodes, previously was G_PlatformGametype.
|
||||
//
|
||||
boolean G_RaceGametype(void)
|
||||
{
|
||||
return (gametype == GT_RACE);
|
||||
}
|
||||
|
||||
//
|
||||
// G_TagGametype
|
||||
//
|
||||
// For Jazz's Tag/HnS modes that have a lot of special cases...
|
||||
// SRB2Kart: do we actually want to add Kart tag later? :V
|
||||
//
|
||||
boolean G_TagGametype(void)
|
||||
{
|
||||
return (gametype == GT_TAG || gametype == GT_HIDEANDSEEK);
|
||||
}
|
||||
|
||||
/** Get the typeoflevel flag needed to indicate support of a gametype.
|
||||
* In single-player, this always returns TOL_SP.
|
||||
* \param gametype The gametype for which support is desired.
|
||||
@@ -2977,7 +2912,8 @@ INT16 G_RandMap(INT16 tolflags, INT16 pprevmap, boolean ignorebuffer, UINT8 maph
|
||||
if (extbuffer != NULL)
|
||||
{
|
||||
bufx = 0;
|
||||
while (extbuffer[bufx]) {
|
||||
while (extbuffer[bufx])
|
||||
{
|
||||
extbufsize++; bufx++;
|
||||
}
|
||||
}
|
||||
@@ -3106,7 +3042,6 @@ void G_AddMapToBuffer(INT16 map)
|
||||
static void G_DoCompleted(void)
|
||||
{
|
||||
INT32 i, j = 0;
|
||||
boolean gottoken = false;
|
||||
|
||||
tokenlist = 0; // Reset the list
|
||||
|
||||
@@ -3155,15 +3090,13 @@ static void G_DoCompleted(void)
|
||||
nextmap = (INT16)(mapheaderinfo[gamemap-1]->nextlevel-1);
|
||||
|
||||
// Remember last map for when you come out of the special stage.
|
||||
if (!G_IsSpecialStage(gamemap))
|
||||
lastmap = nextmap;
|
||||
lastmap = nextmap;
|
||||
|
||||
// If nextmap is actually going to get used, make sure it points to
|
||||
// a map of the proper gametype -- skip levels that don't support
|
||||
// the current gametype. (Helps avoid playing boss levels in Race,
|
||||
// for instance).
|
||||
if (!token && !G_IsSpecialStage(gamemap) && !modeattacking
|
||||
&& (nextmap >= 0 && nextmap < NUMMAPS))
|
||||
if (!token && !modeattacking && (nextmap >= 0 && nextmap < NUMMAPS))
|
||||
{
|
||||
register INT16 cm = nextmap;
|
||||
INT16 tolflag = G_TOLFlag(gametype);
|
||||
@@ -3217,12 +3150,11 @@ static void G_DoCompleted(void)
|
||||
if (gametype == GT_COOP && token)
|
||||
{
|
||||
token--;
|
||||
gottoken = true;
|
||||
|
||||
if (!(emeralds & EMERALD1))
|
||||
nextmap = (INT16)(sstage_start - 1); // Special Stage 1
|
||||
else if (!(emeralds & EMERALD2))
|
||||
nextmap = (INT16)(sstage_start); // Special Stage 2
|
||||
nextmap = (INT16)(sstage_start); // Special Stage 2
|
||||
else if (!(emeralds & EMERALD3))
|
||||
nextmap = (INT16)(sstage_start + 1); // Special Stage 3
|
||||
else if (!(emeralds & EMERALD4))
|
||||
@@ -3233,13 +3165,8 @@ static void G_DoCompleted(void)
|
||||
nextmap = (INT16)(sstage_start + 4); // Special Stage 6
|
||||
else if (!(emeralds & EMERALD7))
|
||||
nextmap = (INT16)(sstage_start + 5); // Special Stage 7
|
||||
else
|
||||
gottoken = false;
|
||||
}
|
||||
|
||||
if (G_IsSpecialStage(gamemap) && !gottoken)
|
||||
nextmap = lastmap; // Exiting from a special stage? Go back to the game. Tails 08-11-2001
|
||||
|
||||
automapactive = false;
|
||||
|
||||
if (gametype != GT_COOP)
|
||||
@@ -3270,7 +3197,6 @@ demointermission:
|
||||
void G_AfterIntermission(void)
|
||||
{
|
||||
HU_ClearCEcho();
|
||||
//G_NextLevel();
|
||||
|
||||
if (demo.playback)
|
||||
{
|
||||
@@ -3827,9 +3753,6 @@ void G_LoadGame(UINT32 slot, INT16 mapoverride)
|
||||
if (demo.playback) // reset game engine
|
||||
G_StopDemo();
|
||||
|
||||
// paused = false;
|
||||
// automapactive = false;
|
||||
|
||||
// dearchive all the modifications
|
||||
if (!P_LoadGame(&save, mapoverride))
|
||||
{
|
||||
@@ -4075,7 +3998,6 @@ void G_InitNew(UINT8 pencoremode, const char *mapname, boolean resetplayer, bool
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
char *G_BuildMapTitle(INT32 mapnum)
|
||||
{
|
||||
char *title = NULL;
|
||||
@@ -4939,6 +4861,13 @@ void G_WriteAllGhostTics(void)
|
||||
if (multiplayer && ((counter % cv_netdemosyncquality.value) != 0)) // Only write 1 in this many ghost datas per tic to cut down on multiplayer replay size.
|
||||
continue;
|
||||
|
||||
if (((ghostext[i].flags && (ghostext[i].flags & EZT_HIT)) || ghostext[i].hits)
|
||||
&& !ghostext[i].hitlist) // hitlist might be freed during resynch, beware PU_LEVEL!
|
||||
{
|
||||
ghostext[i].hits = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
CHECKSPACE(1);
|
||||
|
||||
WRITEUINT8(demobuf.p, i);
|
||||
@@ -5005,9 +4934,9 @@ void G_WriteGhostTic(mobj_t *ghost, INT32 playernum)
|
||||
ziptic |= GZT_XYZ;
|
||||
|
||||
CHECKSPACE(sizeof(fixed_t)*3);
|
||||
WRITEFIXED(demobuf.p,oldghost[playernum].x);
|
||||
WRITEFIXED(demobuf.p,oldghost[playernum].y);
|
||||
WRITEFIXED(demobuf.p,oldghost[playernum].z);
|
||||
WRITEFIXED(demobuf.p, oldghost[playernum].x);
|
||||
WRITEFIXED(demobuf.p, oldghost[playernum].y);
|
||||
WRITEFIXED(demobuf.p, oldghost[playernum].z);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -5025,8 +4954,8 @@ void G_WriteGhostTic(mobj_t *ghost, INT32 playernum)
|
||||
|
||||
CHECKSPACE(4);
|
||||
|
||||
WRITEINT16(demobuf.p,momx);
|
||||
WRITEINT16(demobuf.p,momy);
|
||||
WRITEINT16(demobuf.p, momx);
|
||||
WRITEINT16(demobuf.p, momy);
|
||||
}
|
||||
|
||||
momx = (INT16)((ghost->z-oldghost[playernum].z + (1<<4))>>8);
|
||||
@@ -5038,7 +4967,7 @@ void G_WriteGhostTic(mobj_t *ghost, INT32 playernum)
|
||||
|
||||
CHECKSPACE(2);
|
||||
|
||||
WRITEINT16(demobuf.p,momx);
|
||||
WRITEINT16(demobuf.p, momx);
|
||||
}
|
||||
|
||||
// This SHOULD set oldghost.x/y/z to match ghost->x/y/z
|
||||
@@ -5061,7 +4990,7 @@ void G_WriteGhostTic(mobj_t *ghost, INT32 playernum)
|
||||
|
||||
CHECKSPACE(1);
|
||||
|
||||
WRITEUINT8(demobuf.p,oldghost[playernum].angle);
|
||||
WRITEUINT8(demobuf.p, oldghost[playernum].angle);
|
||||
}
|
||||
|
||||
// Store the sprite frame.
|
||||
@@ -5073,7 +5002,7 @@ void G_WriteGhostTic(mobj_t *ghost, INT32 playernum)
|
||||
|
||||
CHECKSPACE(1);
|
||||
|
||||
WRITEUINT8(demobuf.p,oldghost[playernum].frame);
|
||||
WRITEUINT8(demobuf.p, oldghost[playernum].frame);
|
||||
}
|
||||
|
||||
// Check for sprite set changes
|
||||
@@ -5109,26 +5038,26 @@ void G_WriteGhostTic(mobj_t *ghost, INT32 playernum)
|
||||
if (ghostext[playernum].flags)
|
||||
{
|
||||
ziptic |= GZT_EXTRA;
|
||||
WRITEUINT8(demobuf.p,ghostext[playernum].flags);
|
||||
WRITEUINT8(demobuf.p, ghostext[playernum].flags);
|
||||
|
||||
if (ghostext[playernum].flags & EZT_COLOR)
|
||||
{
|
||||
CHECKSPACE(1);
|
||||
WRITEUINT8(demobuf.p,ghostext[playernum].color);
|
||||
WRITEUINT8(demobuf.p, ghostext[playernum].color);
|
||||
ghostext[playernum].lastcolor = ghostext[playernum].color;
|
||||
}
|
||||
|
||||
if (ghostext[playernum].flags & EZT_SCALE)
|
||||
{
|
||||
CHECKSPACE(sizeof(fixed_t));
|
||||
WRITEFIXED(demobuf.p,ghostext[playernum].scale);
|
||||
WRITEFIXED(demobuf.p, ghostext[playernum].scale);
|
||||
ghostext[playernum].lastscale = ghostext[playernum].scale;
|
||||
}
|
||||
|
||||
if (ghostext[playernum].flags & EZT_HIT)
|
||||
{
|
||||
CHECKSPACE(2);
|
||||
WRITEUINT16(demobuf.p,ghostext[playernum].hits);
|
||||
WRITEUINT16(demobuf.p, ghostext[playernum].hits);
|
||||
|
||||
for (i = 0; i < ghostext[playernum].hits; i++)
|
||||
{
|
||||
@@ -5136,13 +5065,13 @@ void G_WriteGhostTic(mobj_t *ghost, INT32 playernum)
|
||||
|
||||
CHECKSPACE(4+4+2+sizeof(fixed_t)*3+sizeof(angle_t));
|
||||
|
||||
WRITEUINT32(demobuf.p,UINT32_MAX); // reserved for some method of determining exactly which mobj this is. (mobjnum doesn't work here.)
|
||||
WRITEUINT32(demobuf.p,mo->type);
|
||||
WRITEUINT16(demobuf.p,(UINT16)mo->health);
|
||||
WRITEFIXED(demobuf.p,mo->x);
|
||||
WRITEFIXED(demobuf.p,mo->y);
|
||||
WRITEFIXED(demobuf.p,mo->z);
|
||||
WRITEANGLE(demobuf.p,mo->angle);
|
||||
WRITEUINT32(demobuf.p, UINT32_MAX); // reserved for some method of determining exactly which mobj this is. (mobjnum doesn't work here.)
|
||||
WRITEUINT32(demobuf.p, mo->type);
|
||||
WRITEUINT16(demobuf.p, (UINT16)mo->health);
|
||||
WRITEFIXED(demobuf.p, mo->x);
|
||||
WRITEFIXED(demobuf.p, mo->y);
|
||||
WRITEFIXED(demobuf.p, mo->z);
|
||||
WRITEANGLE(demobuf.p, mo->angle);
|
||||
P_SetTarget(ghostext[playernum].hitlist+i, NULL);
|
||||
}
|
||||
|
||||
@@ -5152,7 +5081,7 @@ void G_WriteGhostTic(mobj_t *ghost, INT32 playernum)
|
||||
if (ghostext[playernum].flags & EZT_SPRITE)
|
||||
{
|
||||
CHECKSPACE(1);
|
||||
WRITEUINT8(demobuf.p,sprite);
|
||||
WRITEUINT8(demobuf.p, sprite);
|
||||
}
|
||||
|
||||
if (ghostext[playernum].flags & EZT_KART)
|
||||
@@ -6138,15 +6067,19 @@ void G_BeginRecording(void)
|
||||
char *title = G_BuildMapTitle(gamemap);
|
||||
|
||||
// Print to a separate temp buffer instead of demo.titlename, so we can use it in M_TextInputSetString
|
||||
snprintf(demotitlename, 64, "%s - %s", title, modeattacking ? "Time Attack" : connectedservername);
|
||||
if (title)
|
||||
{
|
||||
snprintf(demotitlename, 64, "%s - %s", title, modeattacking ? "Time Attack" : connectedservername);
|
||||
Z_Free(title);
|
||||
}
|
||||
else
|
||||
snprintf(demotitlename, 64, "%s", modeattacking ? "Time Attack" : connectedservername);
|
||||
|
||||
// Init just in case it isn't initialized already
|
||||
M_TextInputInit(&demo.titlenameinput, demo.titlename, sizeof(demo.titlename));
|
||||
|
||||
// This will indirectly assign to demo.titlename too
|
||||
M_TextInputSetString(&demo.titlenameinput, demotitlename);
|
||||
|
||||
Z_Free(title);
|
||||
}
|
||||
|
||||
// demo checksum
|
||||
|
||||
+15
-8
@@ -388,16 +388,24 @@ boolean G_CheckDemoStatus(void);
|
||||
void G_SaveDemo(void);
|
||||
boolean G_DemoTitleResponder(event_t *ev);
|
||||
|
||||
#define G_GametypeHasTeams() (G_IsGameType(GT_TEAMMATCH) || G_IsGameType(GT_CTF))
|
||||
#define G_BattleGametype() (G_IsGameType(GT_MATCH))
|
||||
#define G_RaceGametype() (G_IsGameType(GT_RACE))
|
||||
#define G_TagGametype() (G_IsGameType(GT_TAG) || G_IsGameType(GT_HIDEANDSEEK))
|
||||
|
||||
FUNCINLINE static ATTRINLINE boolean G_IsGameType(int type)
|
||||
{
|
||||
return (gametype == type);
|
||||
}
|
||||
|
||||
FUNCINLINE static ATTRINLINE boolean G_GametypeHasSpectators(void)
|
||||
{
|
||||
return (netgame || (multiplayer && demo.playback));
|
||||
}
|
||||
|
||||
INT32 G_GetGametypeByName(const char *gametypestr);
|
||||
boolean G_IsSpecialStage(INT32 mapnum);
|
||||
boolean G_GametypeUsesLives(void);
|
||||
boolean G_GametypeHasTeams(void);
|
||||
boolean G_GametypeHasSpectators(void);
|
||||
boolean G_BattleGametype(void);
|
||||
UINT8 G_SometimesGetDifferentGametype(UINT8 prefgametype);
|
||||
UINT8 G_GetGametypeColor(INT16 gt);
|
||||
boolean G_RaceGametype(void);
|
||||
boolean G_TagGametype(void);
|
||||
void G_ExitLevel(void);
|
||||
void G_NextLevel(void);
|
||||
void G_Continue(void);
|
||||
@@ -427,7 +435,6 @@ void G_SetRetryFlag(void);
|
||||
void G_ClearRetryFlag(void);
|
||||
boolean G_GetRetryFlag(void);
|
||||
|
||||
|
||||
void G_LoadGameData(void);
|
||||
void G_LoadGameSettings(void);
|
||||
|
||||
|
||||
+20
-32
@@ -58,44 +58,35 @@ consvar_t cv_rumble[MAXSPLITSCREENPLAYERS] = {
|
||||
{"rumble4", "Off", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, rumble_off_handle4, 0, NULL, NULL, 0, 0, NULL}
|
||||
};
|
||||
|
||||
static CV_PossibleValue_t gamepadled_cons_t[] = {{0, "Off"}, {1, "Skincolor"}, {2, "Mobjcolor"}, {0, NULL}};
|
||||
consvar_t cv_gamepadled[MAXSPLITSCREENPLAYERS] = {
|
||||
{"gamepadled", "On", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, led_off_handle, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"gamepadled2", "On", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, led_off_handle2, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"gamepadled3", "On", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, led_off_handle3, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"gamepadled4", "On", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, led_off_handle4, 0, NULL, NULL, 0, 0, NULL}
|
||||
};
|
||||
|
||||
consvar_t cv_ledpowerup[MAXSPLITSCREENPLAYERS] = {
|
||||
{"ledpowerup", "Off", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, led_off_handle, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"ledpowerup2", "Off", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, led_off_handle2, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"ledpowerup3", "Off", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, led_off_handle3, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"ledpowerup4", "Off", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, led_off_handle4, 0, NULL, NULL, 0, 0, NULL}
|
||||
{"gamepadled", "Skincolor", CV_SAVE|CV_CALL|CV_NOINIT, gamepadled_cons_t, led_off_handle, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"gamepadled2", "Skincolor", CV_SAVE|CV_CALL|CV_NOINIT, gamepadled_cons_t, led_off_handle2, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"gamepadled3", "Skincolor", CV_SAVE|CV_CALL|CV_NOINIT, gamepadled_cons_t, led_off_handle3, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"gamepadled4", "Skincolor", CV_SAVE|CV_CALL|CV_NOINIT, gamepadled_cons_t, led_off_handle4, 0, NULL, NULL, 0, 0, NULL}
|
||||
};
|
||||
|
||||
static void rumble_off_handle(void)
|
||||
{
|
||||
if (cv_rumble[0].value == 0)
|
||||
if (!cv_rumble[0].value)
|
||||
G_ResetPlayerDeviceRumble(0);
|
||||
}
|
||||
|
||||
|
||||
static void rumble_off_handle2(void)
|
||||
{
|
||||
if (cv_rumble[1].value == 0)
|
||||
if (!cv_rumble[1].value)
|
||||
G_ResetPlayerDeviceRumble(1);
|
||||
}
|
||||
|
||||
|
||||
static void rumble_off_handle3(void)
|
||||
{
|
||||
if (cv_rumble[2].value == 0)
|
||||
if (!cv_rumble[2].value)
|
||||
G_ResetPlayerDeviceRumble(2);
|
||||
}
|
||||
|
||||
|
||||
static void rumble_off_handle4(void)
|
||||
{
|
||||
if (cv_rumble[3].value == 0)
|
||||
if (!cv_rumble[3].value)
|
||||
G_ResetPlayerDeviceRumble(3);
|
||||
}
|
||||
|
||||
@@ -104,19 +95,16 @@ static void led_off_handle(void)
|
||||
G_ResetPlayerGamepadIndicatorColor(0);
|
||||
}
|
||||
|
||||
|
||||
static void led_off_handle2(void)
|
||||
{
|
||||
G_ResetPlayerGamepadIndicatorColor(1);
|
||||
}
|
||||
|
||||
|
||||
static void led_off_handle3(void)
|
||||
{
|
||||
G_ResetPlayerGamepadIndicatorColor(2);
|
||||
}
|
||||
|
||||
|
||||
static void led_off_handle4(void)
|
||||
{
|
||||
G_ResetPlayerGamepadIndicatorColor(3);
|
||||
@@ -900,13 +888,16 @@ UINT16 G_GetSkinColor(INT32 playernum)
|
||||
{
|
||||
player_t *player = &players[displayplayers[playernum]];
|
||||
|
||||
// make rgb rainbow vomit when invul or flash blue when grow
|
||||
if (cv_ledpowerup[playernum].value && player->mo && (player->kartstuff[k_invincibilitytimer] || player->kartstuff[k_growshrinktimer] || player->powers[pw_invulnerability]))
|
||||
return player->mo->color;
|
||||
if (player)
|
||||
{
|
||||
// make rgb rainbow vomit when invul or flash blue when grow
|
||||
if ((cv_gamepadled[playernum].value == 2) && player->mo && player->mo->color)
|
||||
return player->mo->color;
|
||||
|
||||
// take actual player skincolour when ingame
|
||||
if (player->skincolor)
|
||||
return player->skincolor;
|
||||
// take actual player skincolour when ingame
|
||||
if (player->skincolor)
|
||||
return player->skincolor;
|
||||
}
|
||||
}
|
||||
|
||||
// otherwise just fallback to whatever the cvar is
|
||||
@@ -963,13 +954,10 @@ static void G_ResetPlayerDeviceRumble(INT32 playernum)
|
||||
void G_ResetAllDeviceRumbles(void)
|
||||
{
|
||||
int i;
|
||||
int devices;
|
||||
|
||||
devices = I_NumJoys();
|
||||
|
||||
for (i = 0; i < devices; i++)
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
I_GamepadRumble(devices, 0, 0, 0);
|
||||
I_GamepadRumble(i, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -109,7 +109,6 @@ extern consvar_t cv_mousesens, cv_mouseysens;
|
||||
extern consvar_t cv_controlperkey, cv_turnsmooth;
|
||||
extern consvar_t cv_rumble[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_gamepadled[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_ledpowerup[MAXSPLITSCREENPLAYERS];
|
||||
|
||||
extern INT32 mousex, mousey;
|
||||
extern INT32 mlooky; //mousey with mlookSensitivity
|
||||
|
||||
@@ -88,7 +88,10 @@ void HWR_ProcessPolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPt
|
||||
if (currently_batching)
|
||||
{
|
||||
if (!pSurf)
|
||||
{
|
||||
I_Error("Got a null FSurfaceInfo in batching");// nulls should not come in the stuff that batching currently applies to
|
||||
}
|
||||
|
||||
if (polygonArraySize == polygonArrayAllocSize)
|
||||
{
|
||||
PolygonArrayEntry* new_array;
|
||||
@@ -121,7 +124,7 @@ void HWR_ProcessPolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPt
|
||||
polygonArray[polygonArraySize].numVerts = iNumPts;
|
||||
polygonArray[polygonArraySize].polyFlags = PolyFlags;
|
||||
polygonArray[polygonArraySize].texture = current_texture;
|
||||
polygonArray[polygonArraySize].shader = (shader_target != -1) ? HWR_GetShaderFromTarget(shader_target) : shader_target;
|
||||
polygonArray[polygonArraySize].shader = (shader_target != SHADER_NONE) ? HWR_GetShaderFromTarget(shader_target) : shader_target;
|
||||
polygonArray[polygonArraySize].horizonSpecial = horizonSpecial;
|
||||
polygonArraySize++;
|
||||
|
||||
@@ -228,7 +231,9 @@ void HWR_RenderBatches(void)
|
||||
int i;
|
||||
|
||||
if (!currently_batching)
|
||||
{
|
||||
I_Error("HWR_RenderBatches called without starting batching");
|
||||
}
|
||||
|
||||
nextSurfaceInfo.LightInfo.fade_end = 0;
|
||||
nextSurfaceInfo.LightInfo.fade_start = 0;
|
||||
@@ -236,6 +241,7 @@ void HWR_RenderBatches(void)
|
||||
nextSurfaceInfo.LightInfo.directional = false;
|
||||
|
||||
currently_batching = false;// no longer collecting batches
|
||||
|
||||
if (!polygonArraySize)
|
||||
{
|
||||
ps_hw_numpolys.value.i = ps_hw_numcalls.value.i = ps_hw_numshaders.value.i
|
||||
@@ -243,6 +249,7 @@ void HWR_RenderBatches(void)
|
||||
= ps_hw_numcolors.value.i = 0;
|
||||
return;// nothing to draw
|
||||
}
|
||||
|
||||
// init stats vars
|
||||
ps_hw_numpolys.value.i = polygonArraySize;
|
||||
ps_hw_numcalls.value.i = ps_hw_numverts.value.i = 0;
|
||||
@@ -291,7 +298,7 @@ void HWR_RenderBatches(void)
|
||||
else
|
||||
GL_SetTexture(currentTexture);
|
||||
|
||||
while (1)// note: remember handling notexture polyflag as having texture number 0 (also in comparePolygons)
|
||||
while (1) // note: remember handling notexture polyflag as having texture number 0 (also in comparePolygons)
|
||||
{
|
||||
int firstIndex;
|
||||
int lastIndex;
|
||||
@@ -361,23 +368,28 @@ void HWR_RenderBatches(void)
|
||||
nextTexture = nextEntry->texture;
|
||||
nextPolyFlags = nextEntry->polyFlags;
|
||||
nextSurfaceInfo = nextEntry->surf;
|
||||
|
||||
if (nextPolyFlags & PF_NoTexture)
|
||||
nextTexture = 0;
|
||||
|
||||
if (currentShader != nextShader && cv_glshaders.value && gl_shadersavailable)
|
||||
{
|
||||
changeState = true;
|
||||
changeShader = true;
|
||||
}
|
||||
|
||||
if (currentTexture != nextTexture)
|
||||
{
|
||||
changeState = true;
|
||||
changeTexture = true;
|
||||
}
|
||||
|
||||
if (currentPolyFlags != nextPolyFlags)
|
||||
{
|
||||
changeState = true;
|
||||
changePolyFlags = true;
|
||||
}
|
||||
|
||||
if (cv_glshaders.value && gl_shadersavailable)
|
||||
{
|
||||
if (currentSurfaceInfo.PolyColor.rgba != nextSurfaceInfo.PolyColor.rgba ||
|
||||
@@ -413,10 +425,12 @@ void HWR_RenderBatches(void)
|
||||
finalVertexWritePos = 0;
|
||||
finalIndexWritePos = 0;
|
||||
}
|
||||
else continue;
|
||||
else
|
||||
continue;
|
||||
|
||||
// if we're here then either its time to stop or time to change state
|
||||
if (stopFlag) break;
|
||||
if (stopFlag)
|
||||
break;
|
||||
|
||||
// change state according to change bools and next vars, update current vars and reset bools
|
||||
if (changeState)
|
||||
@@ -429,6 +443,7 @@ void HWR_RenderBatches(void)
|
||||
|
||||
ps_hw_numshaders.value.i++;
|
||||
}
|
||||
|
||||
if (changeTexture)
|
||||
{
|
||||
// texture should be already ready for use from calls to GL_SetTexture during batch collection
|
||||
@@ -438,6 +453,7 @@ void HWR_RenderBatches(void)
|
||||
|
||||
ps_hw_numtextures.value.i++;
|
||||
}
|
||||
|
||||
if (changePolyFlags)
|
||||
{
|
||||
currentPolyFlags = nextPolyFlags;
|
||||
@@ -445,6 +461,7 @@ void HWR_RenderBatches(void)
|
||||
|
||||
ps_hw_numpolyflags.value.i++;
|
||||
}
|
||||
|
||||
if (changeSurfaceInfo)
|
||||
{
|
||||
currentSurfaceInfo = nextSurfaceInfo;
|
||||
|
||||
+14
-9
@@ -46,12 +46,16 @@ RGBA_t *HWR_GetTexturePalette(void)
|
||||
|
||||
static INT32 format2bpp(GLTextureFormat_t format)
|
||||
{
|
||||
if (format == GL_TEXFMT_RGBA)
|
||||
return 4;
|
||||
else if (format == GL_TEXFMT_ALPHA_INTENSITY_88 || format == GL_TEXFMT_AP_88)
|
||||
return 2;
|
||||
else
|
||||
return 1;
|
||||
switch (format)
|
||||
{
|
||||
case GL_TEXFMT_RGBA:
|
||||
return 4;
|
||||
case GL_TEXFMT_ALPHA_INTENSITY_88:
|
||||
case GL_TEXFMT_AP_88:
|
||||
return 2;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
// This code was originally placed directly in HWR_DrawPatchInCache.
|
||||
@@ -221,8 +225,6 @@ static void HWR_DrawTexturePatchInCache(GLMipmap_t *mipmap,
|
||||
if (texture->width <= 0 || texture->height <= 0)
|
||||
return;
|
||||
|
||||
palette = HWR_GetTexturePalette();
|
||||
|
||||
x1 = patch->originx;
|
||||
width = SHORT(realpatch->width);
|
||||
height = SHORT(realpatch->height);
|
||||
@@ -234,6 +236,8 @@ static void HWR_DrawTexturePatchInCache(GLMipmap_t *mipmap,
|
||||
if (patch->originy > texture->height || (patch->originy + height) < 0)
|
||||
return; // patch not located within texture's y bounds, ignore
|
||||
|
||||
palette = HWR_GetTexturePalette();
|
||||
|
||||
// patch is actually inside the texture!
|
||||
// now check if texture is partly off-screen and adjust accordingly
|
||||
|
||||
@@ -323,7 +327,6 @@ static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *gltex, boolean noe
|
||||
boolean skyspecial = false; // poor hack for Legacy large skies..
|
||||
|
||||
RGBA_t *palette;
|
||||
palette = HWR_GetTexturePalette();
|
||||
|
||||
texture = textures[texnum];
|
||||
|
||||
@@ -361,6 +364,8 @@ static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *gltex, boolean noe
|
||||
INT32 j;
|
||||
RGBA_t col;
|
||||
|
||||
palette = HWR_GetTexturePalette();
|
||||
|
||||
col = palette[HWR_CHROMAKEY_EQUIVALENTCOLORINDEX];
|
||||
|
||||
for (idx = 0, j = 0; j < blockheight; j++)
|
||||
|
||||
@@ -75,7 +75,6 @@ struct GLPatch_s
|
||||
{
|
||||
GLMipmap_t *mipmap;
|
||||
float max_s,max_t;
|
||||
boolean notfound; // if the texture file was not found, mark it here (used in model texture loading)
|
||||
};
|
||||
typedef struct GLPatch_s GLPatch_t;
|
||||
|
||||
|
||||
+11
-3
@@ -131,17 +131,23 @@ typedef struct
|
||||
FLOAT scalex, scaley, scalez;
|
||||
FLOAT fovangle;
|
||||
UINT8 splitscreen;
|
||||
boolean flip; // screenflip
|
||||
boolean roll;
|
||||
FLOAT rollangle;
|
||||
FLOAT centerx, centery;
|
||||
FLOAT rollx, rollz;
|
||||
boolean mirror; // SRB2Kart: Encore Mode
|
||||
boolean mirrorflip; // Encore Mode with Flipcam
|
||||
UINT8 fliptype;
|
||||
boolean shearing; // 14042019
|
||||
float viewaiming; // 17052019
|
||||
} FTransform;
|
||||
|
||||
enum
|
||||
{
|
||||
TRANSFORM_NONE = 0,
|
||||
TRANSFORM_FLIP = 1 << 0, // screenflip
|
||||
TRANSFORM_MIRROR = 1 << 1, // SRB2Kart: Encore Mode
|
||||
TRANSFORM_MIRRORFLIP = TRANSFORM_FLIP|TRANSFORM_MIRROR // SRB2Kart: Encore Mode with Flipcam
|
||||
};
|
||||
|
||||
// Transformed vector, as passed to HWR API
|
||||
typedef struct
|
||||
{
|
||||
@@ -312,6 +318,8 @@ enum hwdsetspecialstate
|
||||
HWD_SET_TEXTUREFILTERMODE,
|
||||
HWD_SET_TEXTUREANISOTROPICMODE,
|
||||
|
||||
HWD_SET_WIREFRAME,
|
||||
|
||||
HWD_SET_MSAA,
|
||||
|
||||
HWD_SET_SCREEN_TEXTURES,
|
||||
|
||||
+88
-69
@@ -226,6 +226,8 @@ consvar_t cv_glsolvetjoin = {"gr_solvetjoin", "On", 0, CV_OnOff, NULL, 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};
|
||||
|
||||
consvar_t cv_glrenderdistance = {"gr_renderdistance", "Max", CV_SAVE, glrenderdistance_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_glhorizonlines = {"gr_horizonlines", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
@@ -338,6 +340,11 @@ static void HWR_SetShaderState(void)
|
||||
GL_SetSpecialState(HWD_SET_SHADERS, HWR_UseShader() ? 1 : 0);
|
||||
}
|
||||
|
||||
static boolean HWR_IsWireframeMode(void)
|
||||
{
|
||||
return (cv_glwireframe.value /*&& cv_debug*/);
|
||||
}
|
||||
|
||||
static boolean HWR_OverrideObjectLightLevel(mobj_t *thing, INT32 *lightlevel)
|
||||
{
|
||||
if (R_ThingIsFullBright(thing))
|
||||
@@ -481,11 +488,11 @@ static UINT8 HWR_FogBlockAlpha(INT32 light, extracolormap_t *colormap) // Let's
|
||||
return surfcolor.s.alpha;
|
||||
}
|
||||
|
||||
static FUINT HWR_CalcWallLight(FUINT lightnum, seg_t *seg)
|
||||
static FUINT HWR_CalcWallLight(FUINT lightnum, seg_t *seg, extracolormap_t *colormap)
|
||||
{
|
||||
INT16 finallight = lightnum;
|
||||
|
||||
if (cv_glfakecontrast.value == 0)
|
||||
if (cv_glfakecontrast.value == 0 || (HWR_ShouldUsePaletteRendering() && colormap))
|
||||
return (FUINT)finallight;
|
||||
|
||||
if (seg != NULL && P_ApplyLightOffsetFine(lightnum, seg->frontsector))
|
||||
@@ -698,8 +705,7 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
|
||||
for (i = 0, v3d = planeVerts; i < (INT32)nrPlaneVerts; i++,v3d++,pv++)
|
||||
SETUP3DVERT(v3d, pv->x, pv->y);
|
||||
|
||||
if (slope)
|
||||
lightlevel = HWR_CalcSlopeLight(lightlevel, slope, gl_frontsector, (FOFsector != NULL));
|
||||
lightlevel = HWR_CalcSlopeLight(lightlevel, slope, gl_frontsector, (FOFsector != NULL));
|
||||
|
||||
HWR_Lighting(&Surf, lightlevel, planecolormap, P_SectorUsesDirectionalLighting(gl_frontsector));
|
||||
|
||||
@@ -1008,7 +1014,7 @@ static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum,
|
||||
fixed_t v2y = FloatToFixed(wallVerts[1].z);
|
||||
|
||||
const UINT8 alpha = Surf->PolyColor.s.alpha;
|
||||
FUINT lightnum = HWR_CalcWallLight(sector->lightlevel, gl_curline);
|
||||
FUINT lightnum = HWR_CalcWallLight(sector->lightlevel, gl_curline, NULL);
|
||||
extracolormap_t *colormap = NULL;
|
||||
|
||||
realtop = top = wallVerts[3].y;
|
||||
@@ -1051,14 +1057,14 @@ static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum,
|
||||
{
|
||||
lightnum = pfloor->master->frontsector->lightlevel;
|
||||
colormap = pfloor->master->frontsector->extra_colormap;
|
||||
lightnum = (HWR_ShouldUsePaletteRendering() && colormap) ? lightnum : HWR_CalcWallLight(lightnum, gl_curline);
|
||||
}
|
||||
else
|
||||
{
|
||||
lightnum = *list[i].lightlevel;
|
||||
colormap = list[i].extra_colormap;
|
||||
lightnum = (HWR_ShouldUsePaletteRendering() && colormap) ? lightnum : HWR_CalcWallLight(lightnum, gl_curline);
|
||||
}
|
||||
|
||||
lightnum = HWR_CalcWallLight(lightnum, gl_curline, colormap);
|
||||
}
|
||||
|
||||
boolean solid = false;
|
||||
@@ -1388,7 +1394,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
|
||||
FUINT lightnum = gl_frontsector->lightlevel;
|
||||
extracolormap_t *colormap = gl_frontsector->extra_colormap;
|
||||
lightnum = (HWR_ShouldUsePaletteRendering() && colormap) ? lightnum : HWR_CalcWallLight(lightnum, gl_curline);
|
||||
lightnum = HWR_CalcWallLight(lightnum, gl_curline, colormap);
|
||||
|
||||
FSurfaceInfo Surf;
|
||||
|
||||
@@ -2015,7 +2021,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
|
||||
Surf.PolyColor.s.alpha = HWR_FogBlockAlpha(lightnum, colormap);
|
||||
|
||||
lightnum = (HWR_ShouldUsePaletteRendering() && colormap) ? lightnum : HWR_CalcWallLight(lightnum, gl_curline);
|
||||
lightnum = HWR_CalcWallLight(lightnum, gl_curline, colormap);
|
||||
|
||||
if (gl_frontsector->numlights)
|
||||
HWR_SplitWall(gl_frontsector, wallVerts, 0, false, &Surf, roverflags, rover, blendmode);
|
||||
@@ -2132,7 +2138,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
|
||||
Surf.PolyColor.s.alpha = HWR_FogBlockAlpha(lightnum, colormap);
|
||||
|
||||
lightnum = (HWR_ShouldUsePaletteRendering() && colormap) ? lightnum : HWR_CalcWallLight(lightnum, gl_curline);
|
||||
lightnum = HWR_CalcWallLight(lightnum, gl_curline, colormap);
|
||||
|
||||
if (gl_backsector->numlights)
|
||||
HWR_SplitWall(gl_backsector, wallVerts, 0, false, &Surf, roverflags, rover, blendmode);
|
||||
@@ -2166,6 +2172,11 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
//Hurdler: end of 3d-floors test
|
||||
}
|
||||
|
||||
static inline boolean HWR_UsePortals(void)
|
||||
{
|
||||
return cv_glportals.value && gl_maphasportals;
|
||||
}
|
||||
|
||||
// From PrBoom:
|
||||
//
|
||||
// e6y: Check whether the player can look beyond this line, returns true if we can't
|
||||
@@ -2226,7 +2237,8 @@ static boolean CheckClip(sector_t * afrontsector, sector_t * abacksector)
|
||||
}
|
||||
|
||||
// using this check with portals causes weird culling issues on ante-station
|
||||
if (LIKELY(!portalclipline) && (afrontsector == viewsector || abacksector == viewsector))
|
||||
if (LIKELY(!portalclipline) &&
|
||||
(afrontsector == viewsector || abacksector == viewsector))
|
||||
{
|
||||
fixed_t viewf1, viewf2, viewc1, viewc2;
|
||||
if (afrontsector == viewsector)
|
||||
@@ -2292,7 +2304,8 @@ static boolean CheckClip(sector_t * afrontsector, sector_t * abacksector)
|
||||
|
||||
// Window.
|
||||
// We know it's a window when the above isn't true and the back and front sectors don't match
|
||||
if (backc1 != frontc1 || backc2 != frontc2 || backf1 != frontf1 || backf2 != frontf2)
|
||||
if (backc1 != frontc1 || backc2 != frontc2
|
||||
|| backf1 != frontf1 || backf2 != frontf2)
|
||||
{
|
||||
checkforemptylines = false;
|
||||
return false;
|
||||
@@ -2359,7 +2372,7 @@ static void HWR_AddLine(seg_t *line)
|
||||
|
||||
gl_backsector = line->backsector;
|
||||
|
||||
if (!cv_glportals.value || LIKELY(!gl_maphasportals))
|
||||
if (LIKELY(!HWR_UsePortals()))
|
||||
{
|
||||
doaddline:
|
||||
if (!line->backsector)
|
||||
@@ -4221,7 +4234,6 @@ static void *HWR_CreateDrawNode(gl_drawnode_type_t type)
|
||||
Z_Realloc(drawnodes, alloceddrawnodes * sizeof(gl_drawnode_t), PU_LEVEL, &drawnodes);
|
||||
}
|
||||
|
||||
|
||||
drawnode = &drawnodes[numdrawnodes++];
|
||||
drawnode->type = type;
|
||||
|
||||
@@ -4365,44 +4377,45 @@ static void HWR_RenderDrawNodes(void)
|
||||
switch (drawnode->type)
|
||||
{
|
||||
case DRAWNODE_PLANE:
|
||||
{
|
||||
planeinfo_t *plane = &drawnode->u.plane;
|
||||
{
|
||||
planeinfo_t *plane = &drawnode->u.plane;
|
||||
|
||||
// We aren't traversing the BSP tree, so make gl_frontsector null to avoid crashes.
|
||||
gl_frontsector = NULL;
|
||||
// We aren't traversing the BSP tree, so make gl_frontsector null to avoid crashes.
|
||||
gl_frontsector = NULL;
|
||||
|
||||
if (!(plane->blend & PF_NoTexture))
|
||||
HWR_GetFlat(plane->lumpnum, R_NoEncore(plane->FOFSector, plane->isceiling));
|
||||
if (!(plane->blend & PF_NoTexture))
|
||||
HWR_GetFlat(plane->lumpnum, R_NoEncore(plane->FOFSector, plane->isceiling));
|
||||
|
||||
HWR_RenderPlane(NULL, plane->xsub, plane->isceiling, plane->fixedheight, plane->blend, plane->lightlevel,
|
||||
plane->lumpnum, plane->FOFSector, plane->alpha, plane->planecolormap);
|
||||
HWR_RenderPlane(NULL, plane->xsub, plane->isceiling, plane->fixedheight, plane->blend, plane->lightlevel,
|
||||
plane->lumpnum, plane->FOFSector, plane->alpha, plane->planecolormap);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case DRAWNODE_POLYOBJECT_PLANE:
|
||||
{
|
||||
polyplaneinfo_t *polyplane = &drawnode->u.polyplane;
|
||||
{
|
||||
polyplaneinfo_t *polyplane = &drawnode->u.polyplane;
|
||||
|
||||
// We aren't traversing the BSP tree, so make gl_frontsector null to avoid crashes.
|
||||
gl_frontsector = NULL;
|
||||
// We aren't traversing the BSP tree, so make gl_frontsector null to avoid crashes.
|
||||
gl_frontsector = NULL;
|
||||
|
||||
if (!(polyplane->blend & PF_NoTexture))
|
||||
HWR_GetFlat(polyplane->lumpnum, R_NoEncore(polyplane->FOFSector, polyplane->isceiling));
|
||||
if (!(polyplane->blend & PF_NoTexture))
|
||||
HWR_GetFlat(polyplane->lumpnum, R_NoEncore(polyplane->FOFSector, polyplane->isceiling));
|
||||
|
||||
HWR_RenderPolyObjectPlane(polyplane->polysector, polyplane->isceiling, polyplane->fixedheight, polyplane->blend, polyplane->lightlevel,
|
||||
polyplane->lumpnum, polyplane->FOFSector, polyplane->alpha, polyplane->planecolormap);
|
||||
HWR_RenderPolyObjectPlane(polyplane->polysector, polyplane->isceiling, polyplane->fixedheight, polyplane->blend, polyplane->lightlevel,
|
||||
polyplane->lumpnum, polyplane->FOFSector, polyplane->alpha, polyplane->planecolormap);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case DRAWNODE_WALL:
|
||||
{
|
||||
wallinfo_t *wall = &drawnode->u.wall;
|
||||
{
|
||||
wallinfo_t *wall = &drawnode->u.wall;
|
||||
|
||||
if (!(wall->blend & PF_NoTexture))
|
||||
HWR_GetTexture(wall->texnum, wall->noencore);
|
||||
if (!(wall->blend & PF_NoTexture))
|
||||
HWR_GetTexture(wall->texnum, wall->noencore);
|
||||
|
||||
HWR_RenderWall(wall->wallVerts, &wall->Surf, wall->blend, wall->fogwall,
|
||||
wall->lightlevel, wall->wallcolormap);
|
||||
HWR_RenderWall(wall->wallVerts, &wall->Surf, wall->blend, wall->fogwall,
|
||||
wall->lightlevel, wall->wallcolormap);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -4666,7 +4679,7 @@ static void HWR_ProjectSprite(mobj_t *thing)
|
||||
const boolean vflip = (thing->eflags & MFE_VERTICALFLIP);
|
||||
const boolean hflip = (!(thing->frame & FF_HORIZONTALFLIP) != !mirrored);
|
||||
|
||||
this_scale = FixedToFloat(interp.scale);
|
||||
this_scale = FixedToFloat(interp.scale);
|
||||
spritexscale = FixedToFloat(interp.spritexscale);
|
||||
spriteyscale = FixedToFloat(interp.spriteyscale);
|
||||
|
||||
@@ -5252,6 +5265,9 @@ static void HWR_DrawSkyBackground(void)
|
||||
if (drewsky)
|
||||
return;
|
||||
|
||||
if (HWR_IsWireframeMode())
|
||||
return;
|
||||
|
||||
GL_SetBlend(PF_Translucent|PF_NoDepthTest|PF_Modulated);
|
||||
|
||||
memcpy(&dometransform, &atransform, sizeof(FTransform));
|
||||
@@ -5336,9 +5352,6 @@ static void HWR_SetTransformAiming(FTransform *trans)
|
||||
|
||||
void HWR_SetTransform(float fpov)
|
||||
{
|
||||
UINT8 viewnum = R_GetViewNumber();
|
||||
camera_t *thiscam = &camera[viewnum];
|
||||
|
||||
gl_viewx = FixedToFloat(viewx);
|
||||
gl_viewy = FixedToFloat(viewy);
|
||||
gl_viewz = FixedToFloat(viewz);
|
||||
@@ -5366,17 +5379,17 @@ void HWR_SetTransform(float fpov)
|
||||
HWR_RollTransform(&atransform, viewroll);
|
||||
atransform.splitscreen = splitscreen;
|
||||
|
||||
atransform.flip = false;
|
||||
if ((thiscam->postimg & POSTIMG_FLIP) && !(thiscam->postimg & POSTIMG_MIRROR))
|
||||
atransform.flip = true;
|
||||
const UINT8 postimg = camera[R_GetViewNumber()].postimg;
|
||||
|
||||
atransform.mirror = false;
|
||||
if ((thiscam->postimg & POSTIMG_MIRROR) && !(thiscam->postimg & POSTIMG_FLIP))
|
||||
atransform.mirror = true;
|
||||
|
||||
atransform.mirrorflip = false;
|
||||
if ((thiscam->postimg & POSTIMG_FLIP) && (thiscam->postimg & POSTIMG_MIRROR))
|
||||
atransform.mirrorflip = true;
|
||||
if (postimg & POSTIMG_FLIP)
|
||||
{
|
||||
if (postimg & POSTIMG_MIRROR)
|
||||
atransform.fliptype = TRANSFORM_MIRRORFLIP;
|
||||
else
|
||||
atransform.fliptype = TRANSFORM_FLIP;
|
||||
}
|
||||
else if (postimg & POSTIMG_MIRROR)
|
||||
atransform.fliptype = TRANSFORM_MIRROR;
|
||||
|
||||
// Set transform.
|
||||
GL_SetTransform(&atransform);
|
||||
@@ -5408,7 +5421,7 @@ void HWR_RenderViewpoint(gl_portal_t *rootportal, const float fpov, player_t *pl
|
||||
gl_portallist_t portallist;
|
||||
|
||||
const boolean skybox = (skyboxmo[0] && cv_skybox.value);
|
||||
const boolean useportals = cv_glportals.value && gl_maphasportals && allow_portals;
|
||||
const boolean useportals = HWR_UsePortals() && allow_portals;
|
||||
bspfunc bspFunc = (useportals && portalclipline) ? HWR_RenderPortalBSPNode : HWR_RenderBSPNode;
|
||||
|
||||
portallist.base = portallist.cap = NULL;
|
||||
@@ -5457,8 +5470,8 @@ void HWR_RenderViewpoint(gl_portal_t *rootportal, const float fpov, player_t *pl
|
||||
HWR_PortalClipping(rootportal);
|
||||
}
|
||||
|
||||
// Set transform.
|
||||
GL_SetTransform(&atransform);
|
||||
if (HWR_IsWireframeMode())
|
||||
GL_SetSpecialState(HWD_SET_WIREFRAME, 1);
|
||||
|
||||
ps_numbspcalls.value.i = 0;
|
||||
ps_numpolyobjects.value.i = 0;
|
||||
@@ -5523,6 +5536,9 @@ void HWR_RenderViewpoint(gl_portal_t *rootportal, const float fpov, player_t *pl
|
||||
ps_hw_nodedrawtime.value.p = 0;
|
||||
HWR_RenderDrawNodes();
|
||||
|
||||
if (HWR_IsWireframeMode())
|
||||
GL_SetSpecialState(HWD_SET_WIREFRAME, 0);
|
||||
|
||||
HWR_FreePortalList(portallist);
|
||||
}
|
||||
|
||||
@@ -5644,6 +5660,7 @@ void HWR_RenderPlayerView(void)
|
||||
{
|
||||
if (cv_ripplewater.value)
|
||||
GL_SetShaderInfo(HWD_SHADERINFO_LEVELTIME, (INT32)leveltime); // The water surface shader needs the leveltime.
|
||||
|
||||
const angle_t light_angle = maplighting.angle - viewangle + ANGLE_90; // I fucking hate OGL's coordinate system
|
||||
GL_SetShaderInfo(HWD_SHADERINFO_LIGHT_X, FINECOSINE(light_angle >> ANGLETOFINESHIFT));
|
||||
GL_SetShaderInfo(HWD_SHADERINFO_LIGHT_Y, 0);
|
||||
@@ -5745,7 +5762,7 @@ static void HWR_TogglePaletteRendering(void)
|
||||
// If the r_opengl "texture palette" stays the same during this switch, these textures
|
||||
// will not be cleared out. However they are still out of date since the
|
||||
// composite texture blending method has changed. Therefore they need to be cleared.
|
||||
GL_ClearMipMapCache();
|
||||
HWR_LoadMapTextures(numtextures);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -5759,7 +5776,7 @@ static void HWR_TogglePaletteRendering(void)
|
||||
// If the r_opengl "texture palette" stays the same during this switch, these textures
|
||||
// will not be cleared out. However they are still out of date since the
|
||||
// composite texture blending method has changed. Therefore they need to be cleared.
|
||||
GL_ClearMipMapCache();
|
||||
HWR_LoadMapTextures(numtextures);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5796,6 +5813,8 @@ void HWR_AddCommands(void)
|
||||
|
||||
CV_RegisterVar(&cv_glbatching);
|
||||
|
||||
CV_RegisterVar(&cv_glwireframe);
|
||||
|
||||
CV_RegisterVar(&cv_glrenderdistance);
|
||||
|
||||
CV_RegisterVar(&cv_glhorizonlines);
|
||||
@@ -5868,7 +5887,6 @@ static void COM_HWR_glinfo(void)
|
||||
CONS_Printf("Unrecognized argument: %s\n", argv);
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
CONS_Printf("\x88OpenGL %s\x80\n", gl_version);
|
||||
@@ -5988,19 +6006,19 @@ static void HWR_DoPostProcessor(player_t *player)
|
||||
if (cv_glscreentextures.value != 2) // screen textures are needed for the rest of the effects
|
||||
return;
|
||||
|
||||
// Capture the screen for intermission and screen waving
|
||||
if (gamestate != GS_INTERMISSION)
|
||||
GL_MakeScreenTexture(HWD_SCREENTEXTURE_GENERIC1);
|
||||
|
||||
if (splitscreen) // Not supported in splitscreen - someone want to add support?
|
||||
return;
|
||||
|
||||
//UINT8 viewnum = R_GetViewNumber(); // see above
|
||||
//UINT8 viewnum = R_GetViewNumber(); // see below
|
||||
//camera_t *thiscam = &camera[viewnum];
|
||||
camera_t *thiscam = &camera[0];
|
||||
|
||||
// Not supported in splitscreen - someone want to add support?
|
||||
const boolean screenwave = (!splitscreen && (thiscam->postimg & POSTIMG_WATER || thiscam->postimg & POSTIMG_HEAT));
|
||||
|
||||
// Capture the screen for intermission and screen waving
|
||||
if ((lastdraw || screenwave) && gamestate != GS_INTERMISSION)
|
||||
GL_MakeScreenTexture(HWD_SCREENTEXTURE_GENERIC1);
|
||||
|
||||
// Drunken vision! WooOOooo~
|
||||
if (thiscam->postimg & POSTIMG_WATER || thiscam->postimg & POSTIMG_HEAT)
|
||||
if (screenwave)
|
||||
{
|
||||
// 10 by 10 grid. 2 coordinates (xy)
|
||||
float v[SCREENVERTS][SCREENVERTS][2];
|
||||
@@ -6015,7 +6033,7 @@ static void HWR_DoPostProcessor(player_t *player)
|
||||
if (thiscam->postimg & POSTIMG_WATER)
|
||||
{
|
||||
WAVELENGTH = 5;
|
||||
AMPLITUDE = 20;
|
||||
AMPLITUDE = 40;
|
||||
FREQUENCY = 8;
|
||||
}
|
||||
else
|
||||
@@ -6034,6 +6052,7 @@ static void HWR_DoPostProcessor(player_t *player)
|
||||
v[x][y][1] = (y/((float)(SCREENVERTS-1.0f)/9.0f))-4.5f;
|
||||
}
|
||||
}
|
||||
|
||||
GL_PostImgRedraw(v);
|
||||
|
||||
// Capture the screen again for screen waving on the intermission
|
||||
|
||||
@@ -202,6 +202,8 @@ extern consvar_t cv_glsolvetjoin;
|
||||
|
||||
extern consvar_t cv_glbatching;
|
||||
|
||||
extern consvar_t cv_glwireframe;
|
||||
|
||||
extern consvar_t cv_glrenderdistance;
|
||||
|
||||
extern consvar_t cv_glhorizonlines;
|
||||
@@ -223,7 +225,7 @@ FUNCINLINE static ATTRINLINE boolean HWR_ShouldUsePaletteRendering(void)
|
||||
|
||||
FUNCINLINE static ATTRINLINE boolean HWR_PalRenderFlashpal(void)
|
||||
{
|
||||
return (HWR_ShouldUsePaletteRendering() && cv_glflashpal.value);
|
||||
return (cv_glflashpal.value && HWR_ShouldUsePaletteRendering());
|
||||
}
|
||||
|
||||
#endif
|
||||
+16
-28
@@ -397,7 +397,7 @@ static void md2_loadTexture(md2_t *model)
|
||||
glPatch->mipmap->format = PCX_Load(filename, &w, &h, glPatch);
|
||||
if (glPatch->mipmap->format == 0)
|
||||
{
|
||||
glPatch->notfound = true;// mark it so its not searched for again repeatedly
|
||||
model->notexturefile = true; // mark it so its not searched for again repeatedly
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -468,7 +468,7 @@ static void md2_loadBlendTexture(md2_t *model)
|
||||
glPatch->mipmap->format = PCX_Load(filename, &w, &h, glPatch);
|
||||
if (glPatch->mipmap->format == 0)
|
||||
{
|
||||
glPatch->notfound = true;// mark it so its not searched for again repeatedly
|
||||
model->noblendfile = true; // mark it so its not searched for again repeatedly
|
||||
Z_Free(filename);
|
||||
return;
|
||||
}
|
||||
@@ -505,6 +505,8 @@ void HWR_InitMD2(void)
|
||||
md2_playermodels[s].model = NULL;
|
||||
md2_playermodels[s].glpatch = NULL;
|
||||
md2_playermodels[s].skin = -1;
|
||||
md2_playermodels[s].notexturefile = false;
|
||||
md2_playermodels[s].noblendfile = false;
|
||||
md2_playermodels[s].notfound = true;
|
||||
md2_playermodels[s].error = false;
|
||||
}
|
||||
@@ -514,6 +516,8 @@ void HWR_InitMD2(void)
|
||||
md2_localplayermodels[s].model = NULL;
|
||||
md2_localplayermodels[s].glpatch = NULL;
|
||||
md2_localplayermodels[s].skin = -1;
|
||||
md2_localplayermodels[s].notexturefile = false;
|
||||
md2_localplayermodels[s].noblendfile = false;
|
||||
md2_localplayermodels[s].notfound = true;
|
||||
md2_localplayermodels[s].error = false;
|
||||
}
|
||||
@@ -523,6 +527,8 @@ void HWR_InitMD2(void)
|
||||
md2_models[i].model = NULL;
|
||||
md2_models[i].glpatch = NULL;
|
||||
md2_models[i].skin = -1;
|
||||
md2_models[s].notexturefile = false;
|
||||
md2_models[s].noblendfile = false;
|
||||
md2_models[i].notfound = true;
|
||||
md2_models[i].error = false;
|
||||
}
|
||||
@@ -543,21 +549,10 @@ void HWR_InitMD2(void)
|
||||
}
|
||||
while (fscanf(f, "%19s %31s %f %f", name, filename, &scale, &offset) == 4)
|
||||
{
|
||||
/*if (stricmp(name, "PLAY") == 0)
|
||||
{
|
||||
CONS_Printf("MD2 for sprite PLAY detected in mdls.dat, use a player skin instead!\n");
|
||||
continue;
|
||||
}*/
|
||||
// 8/1/19: Allow PLAY to load for default MD2.
|
||||
|
||||
for (i = 0; i < NUMSPRITES; i++)
|
||||
{
|
||||
if (stricmp(name, sprnames[i]) == 0)
|
||||
{
|
||||
//if (stricmp(name, "PLAY") == 0)
|
||||
//continue;
|
||||
|
||||
//CONS_Debug(DBG_RENDER, " Found: %s %s %f %f\n", name, filename, scale, offset);
|
||||
md2_models[i].scale = scale;
|
||||
md2_models[i].offset = offset;
|
||||
md2_models[i].notfound = false;
|
||||
@@ -570,7 +565,6 @@ void HWR_InitMD2(void)
|
||||
{
|
||||
if (stricmp(name, skins[s].name) == 0)
|
||||
{
|
||||
//CONS_Printf(" Found: %s %s %f %f\n", name, filename, scale, offset);
|
||||
md2_playermodels[s].skin = s;
|
||||
md2_playermodels[s].scale = scale;
|
||||
md2_playermodels[s].offset = offset;
|
||||
@@ -1060,7 +1054,6 @@ static void HWR_GetBlendedTexture(patch_t *patch, patch_t *blendgpatch, INT32 sk
|
||||
{
|
||||
// mostly copied from HWR_GetMappedPatch, hence the similarities and comment
|
||||
GLPatch_t *glPatch = patch->hardware;
|
||||
GLPatch_t *glBlendPatch = NULL;
|
||||
GLMipmap_t *glMipmap, *newMipmap;
|
||||
|
||||
|
||||
@@ -1071,14 +1064,6 @@ static void HWR_GetBlendedTexture(patch_t *patch, patch_t *blendgpatch, INT32 sk
|
||||
return;
|
||||
}
|
||||
|
||||
if ((blendgpatch && (glBlendPatch = blendgpatch->hardware) && glBlendPatch->mipmap->format)
|
||||
&& (patch->width != blendgpatch->width || patch->height != blendgpatch->height))
|
||||
{
|
||||
// Blend image exists, but it's bad.
|
||||
GL_SetTexture(glPatch->mipmap);
|
||||
return;
|
||||
}
|
||||
|
||||
// search for the Mipmap
|
||||
// skip the first (no colormap translated)
|
||||
for (glMipmap = glPatch->mipmap; glMipmap->nextcolormap; )
|
||||
@@ -1305,7 +1290,7 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
|
||||
hwrPatch = ((GLPatch_t *)gpatch->hardware);
|
||||
|
||||
if (!gpatch || !hwrPatch
|
||||
|| ((!hwrPatch->mipmap->format || !hwrPatch->mipmap->downloaded) && !hwrPatch->notfound))
|
||||
|| ((!hwrPatch->mipmap->format || !hwrPatch->mipmap->downloaded) && !md2->notexturefile))
|
||||
md2_loadTexture(md2);
|
||||
|
||||
// Load it again, because it isn't being loaded into gpatch after md2_loadtexture...
|
||||
@@ -1320,7 +1305,7 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
|
||||
|
||||
if ((gpatch && hwrPatch && hwrPatch->mipmap->format) // don't load the blend texture if the base texture isn't available
|
||||
&& (!blendgpatch || !hwrBlendPatch
|
||||
|| ((!hwrBlendPatch->mipmap->format || !hwrBlendPatch->mipmap->downloaded) && !hwrPatch->notfound)))
|
||||
|| ((!hwrBlendPatch->mipmap->format || !hwrBlendPatch->mipmap->downloaded) && !md2->noblendfile)))
|
||||
md2_loadBlendTexture(md2);
|
||||
|
||||
// Load it again, because it isn't being loaded into blendgpatch after md2_loadblendtexture...
|
||||
@@ -1330,7 +1315,9 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
|
||||
|
||||
if (gpatch && hwrPatch && hwrPatch->mipmap->format) // else if meant that if a texture couldn't be loaded, it would just end up using something else's texture
|
||||
{
|
||||
if ((skincolors_t)spr->mobj->color != SKINCOLOR_NONE)
|
||||
if ((skincolors_t)spr->mobj->color != SKINCOLOR_NONE &&
|
||||
blendgpatch && hwrBlendPatch->mipmap->format
|
||||
&& gpatch->width == blendgpatch->width && gpatch->height == blendgpatch->height)
|
||||
{
|
||||
INT32 tcskinnum = TC_DEFAULT;
|
||||
if ((spr->mobj->flags & MF_BOSS) && (spr->mobj->flags2 & MF2_FRET) && (leveltime & 1)) // Bosses "flash"
|
||||
@@ -1444,6 +1431,8 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
|
||||
? (spr->mobj->rollangle) + (sliptideroll * spr->mobj->player->kartstuff[k_aizdriftstrat])
|
||||
: (spr->mobj->rollangle);
|
||||
|
||||
rollang *= flipfactor;
|
||||
|
||||
fixed_t anglef = AngleFixed(rollang);
|
||||
|
||||
p.rollangle = 0.0f;
|
||||
@@ -1481,8 +1470,7 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
|
||||
p.anglex += flipfactor*FIXED_TO_FLOAT(AngleFixed(interp.roll));
|
||||
p.anglez -= flipfactor*FIXED_TO_FLOAT(AngleFixed(interp.pitch));
|
||||
|
||||
p.flip = atransform.flip;
|
||||
p.mirror = atransform.mirror; // from Kart
|
||||
p.fliptype = atransform.fliptype;
|
||||
|
||||
GL_SetShader(SHADER_MODEL); // model shader
|
||||
{
|
||||
|
||||
@@ -29,7 +29,9 @@ typedef struct
|
||||
float offset;
|
||||
model_t *model;
|
||||
void *glpatch;
|
||||
boolean notexturefile; // true if texture file was not found
|
||||
void *blendglpatch;
|
||||
boolean noblendfile; // true if blend texture file was not found
|
||||
boolean notfound;
|
||||
INT32 skin;
|
||||
boolean error;
|
||||
|
||||
@@ -102,6 +102,8 @@ RGBA_t myPaletteData[256]; // the palette for converting textures to RGBA
|
||||
static GLint gltexformat = GL_RGB5_A1;
|
||||
GLint screen_width = 0; // used by Draw2DLine()
|
||||
GLint screen_height = 0;
|
||||
GLint screen_texsizew = 512; // Power-of-two screen texture render resolution
|
||||
GLint screen_texsizeh = 512; // Power-of-two screen texture render resolution
|
||||
GLbyte screen_depth = 0;
|
||||
GLint maximumAnisotropy = 0;
|
||||
static GLboolean MipMap = GL_FALSE;
|
||||
@@ -129,6 +131,8 @@ GLuint FramebufferObject, FramebufferTexture, RenderbufferObject;
|
||||
|
||||
boolean supportFBO = false;
|
||||
static boolean fboinit = false;
|
||||
|
||||
static void GL_Framebuffer_DeleteAttachments(void);
|
||||
#endif
|
||||
|
||||
// Sryder: NextTexAvail is broken for these because palette changes or changes to the texture filter or antialiasing
|
||||
@@ -346,6 +350,8 @@ typedef void (APIENTRY * PFNglDisable) (GLenum cap);
|
||||
static PFNglDisable pglDisable;
|
||||
typedef void (APIENTRY * PFNglGetFloatv) (GLenum pname, GLfloat *params);
|
||||
static PFNglGetFloatv pglGetFloatv;
|
||||
typedef void (APIENTRY * PFNglPolygonMode) (GLenum, GLenum);
|
||||
static PFNglPolygonMode pglPolygonMode;
|
||||
|
||||
/* Depth Buffer */
|
||||
typedef void (APIENTRY * PFNglClearDepth) (GLclampd depth);
|
||||
@@ -545,6 +551,7 @@ boolean SetupGLfunc(void)
|
||||
GETOPENGLFUNC(pglGetFloatv, glGetFloatv)
|
||||
GETOPENGLFUNC(pglGetIntegerv, glGetIntegerv)
|
||||
GETOPENGLFUNC(pglGetString, glGetString)
|
||||
GETOPENGLFUNC(pglPolygonMode, glPolygonMode)
|
||||
|
||||
GETOPENGLFUNC(pglClearDepth, glClearDepth)
|
||||
GETOPENGLFUNC(pglDepthFunc, glDepthFunc)
|
||||
@@ -948,7 +955,7 @@ void GL_UnSetShader(void)
|
||||
static void GL_SetNoTexture(void)
|
||||
{
|
||||
// Disable texture.
|
||||
if (tex_downloaded != NOTEXTURE_NUM && !currently_batching)
|
||||
if (tex_downloaded != NOTEXTURE_NUM)
|
||||
{
|
||||
if (NOTEXTURE_NUM == 0)
|
||||
pglGenTextures(1, &NOTEXTURE_NUM);
|
||||
@@ -991,8 +998,43 @@ static void GL_Perspective(GLfloat fovy, GLfloat aspect)
|
||||
// -----------------+
|
||||
void GL_SetModelView(GLint w, GLint h)
|
||||
{
|
||||
GLint maxtexsize = 0;
|
||||
//GL_DBG_Printf("SetModelView(): %dx%d\n", (int)w, (int)h);
|
||||
|
||||
// The screen textures need to be flushed if the width or height change so that they be remade for the correct size
|
||||
if (screen_width != w || screen_height != h)
|
||||
{
|
||||
GL_FlushScreenTextures();
|
||||
|
||||
#ifdef USE_FBO_OGL
|
||||
GL_Framebuffer_DeleteAttachments();
|
||||
#endif
|
||||
}
|
||||
|
||||
screen_width = (GLint)w;
|
||||
screen_height = (GLint)h;
|
||||
|
||||
screen_texsizew = screen_texsizeh = 512;
|
||||
|
||||
// look for power of two that is large enough for the screen
|
||||
while (screen_texsizew < w)
|
||||
screen_texsizew <<= 1;
|
||||
|
||||
while (screen_texsizeh < h)
|
||||
screen_texsizeh <<= 1;
|
||||
|
||||
pglGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxtexsize); // Get the maximum supported texture size
|
||||
if ((screen_texsizew > maxtexsize || screen_texsizeh > maxtexsize) && maxtexsize > 0)
|
||||
{
|
||||
// The desired screen texture resolution is too big for the player's GPU!
|
||||
CONS_Alert(CONS_WARNING, "Tried to make a screen texture for a %dx%d game resolution, but your GPU only supports up to %dx%d! Please switch to the software renderer or lower your game resolution.\n", w, h, maxtexsize, maxtexsize);
|
||||
|
||||
// For now, let's just pray that clamping it to the maximum supported size "works"
|
||||
// There'll be a stretchy "border" artefact, but it's better than failing to make the screen textures
|
||||
screen_texsizew = min(screen_texsizew, maxtexsize);
|
||||
screen_texsizeh = min(screen_texsizeh, maxtexsize);
|
||||
}
|
||||
|
||||
pglViewport(0, 0, w, h);
|
||||
|
||||
pglMatrixMode(GL_PROJECTION);
|
||||
@@ -1038,6 +1080,8 @@ void GL_SetStates(void)
|
||||
|
||||
pglPolygonOffset(-1.0f, -1.0f);
|
||||
|
||||
pglDisable(GL_FOG);
|
||||
|
||||
// bp : when no t&l :)
|
||||
pglLoadIdentity();
|
||||
pglScalef(1.0f, 1.0f, -1.0f);
|
||||
@@ -1122,7 +1166,7 @@ static void GL_Framebuffer_GenerateAttachments(void)
|
||||
fboinit = true;
|
||||
}
|
||||
|
||||
void GL_Framebuffer_DeleteAttachments(void)
|
||||
static void GL_Framebuffer_DeleteAttachments(void)
|
||||
{
|
||||
if (!supportFBO || fboinit == false)
|
||||
return;
|
||||
@@ -2323,6 +2367,10 @@ void GL_SetSpecialState(hwdspecialstate_t IdState, INT32 Value)
|
||||
GL_Flush(); //??? if we want to change filter mode by texture, remove this
|
||||
break;
|
||||
|
||||
case HWD_SET_WIREFRAME:
|
||||
pglPolygonMode(GL_FRONT_AND_BACK, Value ? GL_LINE : GL_FILL);
|
||||
break;
|
||||
|
||||
case HWD_SET_TEXTURE_FORMAT:
|
||||
gltexformat = (Value == 32) ? GL_RGBA : GL_RGB5_A1;
|
||||
GL_Flush();
|
||||
@@ -2689,8 +2737,7 @@ void GL_DrawModelEx(model_t *model, INT32 frameIndex, float duration, float tics
|
||||
// pos->mirror is if the screen is flipped horizontally
|
||||
// XOR all the flips together to figure out what culling to use!
|
||||
{
|
||||
boolean reversecull = (flipped ^ hflipped ^ pos->flip ^ pos->mirror);
|
||||
if (reversecull)
|
||||
if ((flipped ^ hflipped ^ !!(pos->fliptype & TRANSFORM_FLIP) ^ !!(pos->fliptype & TRANSFORM_MIRROR)))
|
||||
pglCullFace(GL_FRONT);
|
||||
else
|
||||
pglCullFace(GL_BACK);
|
||||
@@ -2836,14 +2883,21 @@ void GL_SetTransform(FTransform *stransform)
|
||||
used_fov = stransform->fovangle;
|
||||
shearing = stransform->shearing;
|
||||
|
||||
if (stransform->mirror)
|
||||
pglScalef(-stransform->scalex, stransform->scaley, -stransform->scalez);
|
||||
else if (stransform->mirrorflip)
|
||||
pglScalef(-stransform->scalex, -stransform->scaley, -stransform->scalez);
|
||||
else if (stransform->flip)
|
||||
pglScalef(stransform->scalex, -stransform->scaley, -stransform->scalez);
|
||||
else
|
||||
pglScalef(stransform->scalex, stransform->scaley, -stransform->scalez);
|
||||
switch (stransform->fliptype)
|
||||
{
|
||||
case TRANSFORM_MIRROR:
|
||||
pglScalef(-stransform->scalex, stransform->scaley, -stransform->scalez);
|
||||
break;
|
||||
case TRANSFORM_MIRRORFLIP:
|
||||
pglScalef(-stransform->scalex, -stransform->scaley, -stransform->scalez);
|
||||
break;
|
||||
case TRANSFORM_FLIP:
|
||||
pglScalef(stransform->scalex, -stransform->scaley, -stransform->scalez);
|
||||
break;
|
||||
default: // TRANSFORM_NONE
|
||||
pglScalef(stransform->scalex, stransform->scaley, -stransform->scalez);
|
||||
break;
|
||||
}
|
||||
|
||||
if (stransform->roll)
|
||||
pglRotatef(stransform->rollangle, 0.0f, 0.0f, 1.0f);
|
||||
@@ -2869,7 +2923,7 @@ void GL_SetTransform(FTransform *stransform)
|
||||
if (shearing)
|
||||
{
|
||||
float dy = stransform->viewaiming * 2;
|
||||
if (stransform->flip || stransform->mirrorflip)
|
||||
if (stransform->fliptype == TRANSFORM_FLIP || stransform->fliptype == TRANSFORM_MIRRORFLIP)
|
||||
dy *= -1.0f;
|
||||
pglTranslatef(0.0f, -dy/BASEVIDHEIGHT, 0.0f);
|
||||
}
|
||||
@@ -2918,7 +2972,6 @@ void GL_PostImgRedraw(float points[SCREENVERTS][SCREENVERTS][2])
|
||||
INT32 x, y;
|
||||
float float_x, float_y, float_nextx, float_nexty;
|
||||
float xfix, yfix;
|
||||
INT32 texsizew = 512, texsizey = 512;
|
||||
|
||||
const float blackBack[16] =
|
||||
{
|
||||
@@ -2931,16 +2984,9 @@ void GL_PostImgRedraw(float points[SCREENVERTS][SCREENVERTS][2])
|
||||
if (gl_enable_screen_textures != 2)
|
||||
return;
|
||||
|
||||
// look for power of two that is large enough for the screen
|
||||
while (texsizew < screen_width)
|
||||
texsizew <<= 1;
|
||||
|
||||
while (texsizey < screen_height)
|
||||
texsizey <<= 1;
|
||||
|
||||
// X/Y stretch fix for all resolutions(!)
|
||||
xfix = (float)(texsizew)/((float)((screen_width)/(float)(SCREENVERTS-1)));
|
||||
yfix = (float)(texsizey)/((float)((screen_height)/(float)(SCREENVERTS-1)));
|
||||
xfix = (float)(screen_texsizew)/((float)((screen_width)/(float)(SCREENVERTS-1)));
|
||||
yfix = (float)(screen_texsizeh)/((float)((screen_height)/(float)(SCREENVERTS-1)));
|
||||
|
||||
pglDisable(GL_DEPTH_TEST);
|
||||
pglDisable(GL_BLEND);
|
||||
@@ -3014,7 +3060,6 @@ void GL_FlushScreenTextures(void)
|
||||
void GL_DrawScreenTexture(int tex, FSurfaceInfo *surf, FBITFIELD polyflags)
|
||||
{
|
||||
float xfix, yfix;
|
||||
INT32 texsizew = 512, texsizey = 512;
|
||||
|
||||
const float screenVerts[12] =
|
||||
{
|
||||
@@ -3029,15 +3074,8 @@ void GL_DrawScreenTexture(int tex, FSurfaceInfo *surf, FBITFIELD polyflags)
|
||||
if (gl_enable_screen_textures != 2)
|
||||
return;
|
||||
|
||||
// look for power of two that is large enough for the screen
|
||||
while (texsizew < screen_width)
|
||||
texsizew <<= 1;
|
||||
|
||||
while (texsizey < screen_height)
|
||||
texsizey <<= 1;
|
||||
|
||||
xfix = 1/((float)(texsizew)/((float)((screen_width))));
|
||||
yfix = 1/((float)(texsizey)/((float)((screen_height))));
|
||||
xfix = 1/((float)(screen_texsizew)/((float)((screen_width))));
|
||||
yfix = 1/((float)(screen_texsizeh)/((float)((screen_height))));
|
||||
|
||||
// const float screenVerts[12]
|
||||
|
||||
@@ -3070,7 +3108,6 @@ void GL_DrawScreenTexture(int tex, FSurfaceInfo *surf, FBITFIELD polyflags)
|
||||
// Do screen fades!
|
||||
void GL_DoScreenWipe(int wipeStart, int wipeEnd)
|
||||
{
|
||||
INT32 texsizew = 512, texsizey = 512;
|
||||
float xfix, yfix;
|
||||
|
||||
INT32 fademaskdownloaded = tex_downloaded; // the fade mask that has been set
|
||||
@@ -3096,15 +3133,8 @@ void GL_DoScreenWipe(int wipeStart, int wipeEnd)
|
||||
if (!gl_enable_screen_textures)
|
||||
return;
|
||||
|
||||
// look for power of two that is large enough for the screen
|
||||
while (texsizew < screen_width)
|
||||
texsizew <<= 1;
|
||||
|
||||
while (texsizey < screen_height)
|
||||
texsizey <<= 1;
|
||||
|
||||
xfix = 1/((float)(texsizew)/((float)((screen_width))));
|
||||
yfix = 1/((float)(texsizey)/((float)((screen_height))));
|
||||
xfix = 1/((float)(screen_texsizew)/((float)((screen_width))));
|
||||
yfix = 1/((float)(screen_texsizeh)/((float)((screen_height))));
|
||||
|
||||
// const float screenVerts[12]
|
||||
|
||||
@@ -3162,7 +3192,6 @@ void GL_DoScreenWipe(int wipeStart, int wipeEnd)
|
||||
|
||||
void GL_RenderVhsEffect(fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize)
|
||||
{
|
||||
INT32 texsizew = 512, texsizey = 512;
|
||||
int tex = HWD_SCREENTEXTURE_VHS;
|
||||
float xfix, yfix;
|
||||
float fix[8];
|
||||
@@ -3180,15 +3209,8 @@ void GL_RenderVhsEffect(fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8
|
||||
if (gl_enable_screen_textures != 2)
|
||||
return;
|
||||
|
||||
// look for power of two that is large enough for the screen
|
||||
while (texsizew < screen_width)
|
||||
texsizew <<= 1;
|
||||
|
||||
while (texsizey < screen_height)
|
||||
texsizey <<= 1;
|
||||
|
||||
xfix = 1/((float)(texsizew)/((float)((screen_width))));
|
||||
yfix = 1/((float)(texsizey)/((float)((screen_height))));
|
||||
xfix = 1/((float)(screen_texsizew)/((float)((screen_width))));
|
||||
yfix = 1/((float)(screen_texsizeh)/((float)((screen_height))));
|
||||
|
||||
// Slight fuzziness
|
||||
GL_MakeScreenTexture(tex);
|
||||
@@ -3272,19 +3294,11 @@ void GL_RenderVhsEffect(fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8
|
||||
// Create a texture from the screen.
|
||||
void GL_MakeScreenTexture(int tex)
|
||||
{
|
||||
INT32 texsizew = 512, texsizey = 512;
|
||||
boolean firstTime = (screenTextures[tex] == 0);
|
||||
|
||||
if (!gl_enable_screen_textures)
|
||||
return;
|
||||
|
||||
// look for power of two that is large enough for the screen
|
||||
while (texsizew < screen_width)
|
||||
texsizew <<= 1;
|
||||
|
||||
while (texsizey < screen_height)
|
||||
texsizey <<= 1;
|
||||
|
||||
// Create screen texture
|
||||
if (firstTime)
|
||||
pglGenTextures(1, &screenTextures[tex]);
|
||||
@@ -3296,10 +3310,10 @@ void GL_MakeScreenTexture(int tex)
|
||||
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
Clamp2D(GL_TEXTURE_WRAP_S);
|
||||
Clamp2D(GL_TEXTURE_WRAP_T);
|
||||
pglCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, texsizew, texsizey, 0);
|
||||
pglCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, screen_texsizew, screen_texsizeh, 0);
|
||||
}
|
||||
else
|
||||
pglCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, texsizew, texsizey);
|
||||
pglCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, screen_texsizew, screen_texsizeh);
|
||||
|
||||
tex_downloaded = screenTextures[tex];
|
||||
}
|
||||
@@ -3310,7 +3324,6 @@ void GL_DrawScreenFinalTexture(int tex, INT32 width, INT32 height, boolean usesh
|
||||
float origaspect, newaspect;
|
||||
float xoff = 1, yoff = 1; // xoffset and yoffset for the polygon to have black bars around the screen
|
||||
FRGBAFloat clearColour;
|
||||
INT32 texsizew = 512, texsizey = 512;
|
||||
|
||||
float off[12];
|
||||
float fix[8];
|
||||
@@ -3318,15 +3331,8 @@ void GL_DrawScreenFinalTexture(int tex, INT32 width, INT32 height, boolean usesh
|
||||
if (gl_enable_screen_textures != 2)
|
||||
return;
|
||||
|
||||
// look for power of two that is large enough for the screen
|
||||
while (texsizew < screen_width)
|
||||
texsizew <<= 1;
|
||||
|
||||
while (texsizey < screen_height)
|
||||
texsizey <<= 1;
|
||||
|
||||
xfix = 1/((float)(texsizew)/((float)((screen_width))));
|
||||
yfix = 1/((float)(texsizey)/((float)((screen_height))));
|
||||
xfix = 1/((float)(screen_texsizew)/((float)((screen_width))));
|
||||
yfix = 1/((float)(screen_texsizeh)/((float)((screen_height))));
|
||||
|
||||
origaspect = (float)screen_width / screen_height;
|
||||
newaspect = (float)width / height;
|
||||
|
||||
@@ -103,8 +103,6 @@ extern PFNglGetString pglGetString;
|
||||
#endif
|
||||
|
||||
#ifdef USE_FBO_OGL
|
||||
void GL_Framebuffer_DeleteAttachments(void);
|
||||
|
||||
void GL_Framebuffer_Unbind(void);
|
||||
void GL_Framebuffer_Enable(void);
|
||||
void GL_Framebuffer_Disable(void);
|
||||
|
||||
+4
-6
@@ -259,8 +259,6 @@ INT32 HU_FallBackFrSpecialLetter(INT32 key)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static char cechotext[1024];
|
||||
static tic_t cechotimer = 0;
|
||||
static tic_t cechoduration = 5*TICRATE;
|
||||
@@ -2203,6 +2201,10 @@ void HU_Drawer(void)
|
||||
if (cechotimer)
|
||||
HU_DrawCEcho();
|
||||
|
||||
// draw song credits
|
||||
if (cv_songcredits.value)
|
||||
HU_DrawSongCredits();
|
||||
|
||||
if (!( Playing() || demo.playback )
|
||||
|| gamestate == GS_INTERMISSION || gamestate == GS_CUTSCENE
|
||||
|| gamestate == GS_CREDITS || gamestate == GS_EVALUATION
|
||||
@@ -2236,10 +2238,6 @@ void HU_Drawer(void)
|
||||
if (gamestate != GS_LEVEL)
|
||||
return;
|
||||
|
||||
// draw song credits
|
||||
if (cv_songcredits.value)
|
||||
HU_DrawSongCredits();
|
||||
|
||||
// draw desynch text
|
||||
if (hu_resynching
|
||||
#ifdef SATURNPAK
|
||||
|
||||
@@ -112,77 +112,6 @@ ticcmd_t *I_BaseTiccmd4(void);
|
||||
*/
|
||||
void I_Quit(void) FUNCNORETURN;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
EvilForce = -1,
|
||||
//Constant
|
||||
ConstantForce = 0,
|
||||
//Ramp
|
||||
RampForce,
|
||||
//Periodics
|
||||
SquareForce,
|
||||
SineForce,
|
||||
TriangleForce,
|
||||
SawtoothUpForce,
|
||||
SawtoothDownForce,
|
||||
//MAX
|
||||
NumberofForces,
|
||||
} FFType;
|
||||
|
||||
typedef struct JoyFF_s
|
||||
{
|
||||
INT32 ForceX; ///< The X of the Force's Vel
|
||||
INT32 ForceY; ///< The Y of the Force's Vel
|
||||
//All
|
||||
UINT32 Duration; ///< The total duration of the effect, in microseconds
|
||||
INT32 Gain; //< /The gain to be applied to the effect, in the range from 0 through 10,000.
|
||||
//All, CONSTANTFORCE -10,000 to 10,000
|
||||
INT32 Magnitude; ///< Magnitude of the effect, in the range from 0 through 10,000.
|
||||
//RAMPFORCE
|
||||
INT32 Start; ///< Magnitude at the start of the effect, in the range from -10,000 through 10,000.
|
||||
INT32 End; ///< Magnitude at the end of the effect, in the range from -10,000 through 10,000.
|
||||
//PERIODIC
|
||||
INT32 Offset; ///< Offset of the effect.
|
||||
UINT32 Phase; ///< Position in the cycle of the periodic effect at which playback begins, in the range from 0 through 35,999
|
||||
UINT32 Period; ///< Period of the effect, in microseconds.
|
||||
} JoyFF_t;
|
||||
|
||||
/** \brief Forcefeedback for the first joystick
|
||||
|
||||
\param Type what kind of Effect
|
||||
\param Effect Effect Info
|
||||
|
||||
\return void
|
||||
*/
|
||||
|
||||
void I_Tactile(FFType Type, const JoyFF_t *Effect);
|
||||
|
||||
/** \brief Forcefeedback for the second joystick
|
||||
|
||||
\param Type what kind of Effect
|
||||
\param Effect Effect Info
|
||||
|
||||
\return void
|
||||
*/
|
||||
void I_Tactile2(FFType Type, const JoyFF_t *Effect);
|
||||
|
||||
/** \brief Forcefeedback for the third joystick
|
||||
|
||||
\param Type what kind of Effect
|
||||
\param Effect Effect Info
|
||||
|
||||
\return void
|
||||
*/
|
||||
void I_Tactile3(FFType Type, const JoyFF_t *Effect);
|
||||
|
||||
/** \brief Forcefeedback for the fourth joystick
|
||||
|
||||
\param Type what kind of Effect
|
||||
\param Effect Effect Info
|
||||
|
||||
\return void
|
||||
*/
|
||||
void I_Tactile4(FFType Type, const JoyFF_t *Effect);
|
||||
|
||||
/** \brief to set up the first joystick scale
|
||||
*/
|
||||
|
||||
+14
-5
@@ -5617,9 +5617,13 @@ static boolean K_SpeedLinesShouldBlend(player_t *player)
|
||||
static UINT8 K_GetSpeedLineColor(player_t *player, boolean colorSpeed)
|
||||
{
|
||||
UINT8 speedcolor = SKINCOLOR_NONE;
|
||||
const UINT8 playercolor = player->mo->color;
|
||||
|
||||
if (colorSpeed)
|
||||
{
|
||||
if (cv_coloredspeedlines.value != 3)
|
||||
speedcolor = playercolor;
|
||||
|
||||
if (cv_coloredspeedlines.value >= 2 && player->kartstuff[k_driftboost])
|
||||
{
|
||||
if (player->kartstuff[k_driftboost] <= 20)
|
||||
@@ -5628,9 +5632,10 @@ static UINT8 K_GetSpeedLineColor(player_t *player, boolean colorSpeed)
|
||||
speedcolor = SKINCOLOR_RASPBERRY;
|
||||
else if (player->kartstuff[k_driftboost] <= 125)
|
||||
speedcolor = (UINT8)(1 + (leveltime % (MAXSKINCOLORS-1)));
|
||||
}
|
||||
|
||||
speedcolor = (leveltime & 1) ? ((cv_coloredspeedlines.value == 3) ? SKINCOLOR_NONE : player->mo->color) : speedcolor;
|
||||
if (cv_coloredspeedlines.value == 2)
|
||||
speedcolor = (leveltime & 1) ? playercolor : speedcolor;
|
||||
}
|
||||
}
|
||||
|
||||
if (cv_coloredspeedlines.value != 3)
|
||||
@@ -5642,7 +5647,7 @@ static UINT8 K_GetSpeedLineColor(player_t *player, boolean colorSpeed)
|
||||
}
|
||||
else if (player->kartstuff[k_invincibilitytimer])
|
||||
{
|
||||
speedcolor = player->mo->color;
|
||||
speedcolor = playercolor;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10658,6 +10663,7 @@ static void K_drawKartMinimapHead(mobj_t *mo, INT32 x, INT32 y, INT32 flags)
|
||||
|
||||
const skin_t *skin;
|
||||
player_t *player = mo->player;
|
||||
const boolean skinlocal = mo->skinlocal;
|
||||
|
||||
fixed_t amnumxpos, amnumypos;
|
||||
INT32 amxpos, amypos, wntdamxpos, wntdamypos;
|
||||
@@ -10670,7 +10676,7 @@ static void K_drawKartMinimapHead(mobj_t *mo, INT32 x, INT32 y, INT32 flags)
|
||||
#endif
|
||||
|
||||
skin = K_GetMobjSkin(mo);
|
||||
minimaphead = R_GetSkinFaceMini(player);
|
||||
minimaphead = (skinlocal ? localfacemmapprefix : facemmapprefix)[K_GetMobjSkinNum(skin, skinlocal)];
|
||||
|
||||
amnumxpos = (FixedMul(lerp(mo->old_x, mo->x), minimapinfo.zoom) - minimapinfo.offs_x);
|
||||
amnumypos = -(FixedMul(lerp(mo->old_y, mo->y), minimapinfo.zoom) - minimapinfo.offs_y);
|
||||
@@ -10720,7 +10726,7 @@ static void K_drawKartMinimapHead(mobj_t *mo, INT32 x, INT32 y, INT32 flags)
|
||||
if (mo->colorized)
|
||||
colormap = R_GetTranslationColormap(TC_RAINBOW, mo->color, GTC_CACHE);
|
||||
else
|
||||
colormap = R_GetLocalTranslationColormap(mo->skin, mo->localskin, mo->color, GTC_CACHE, mo->skinlocal);
|
||||
colormap = R_GetLocalTranslationColormap(mo->skin, mo->localskin, mo->color, GTC_CACHE, skinlocal);
|
||||
|
||||
V_DrawFixedPatch(amxpos, amypos, scale, flags, minimaphead, colormap);
|
||||
|
||||
@@ -10878,6 +10884,9 @@ static void K_drawKartMinimap(void)
|
||||
|
||||
angle_t ang = R_InterpolateAngle(mobj->old_angle, mobj->angle);
|
||||
|
||||
if (encoremode)
|
||||
ang = ANGLE_180 - ang;
|
||||
|
||||
if (mobj->colorized)
|
||||
colormap = R_GetTranslationColormap(TC_RAINBOW, mobj->color, GTC_CACHE);
|
||||
else
|
||||
|
||||
+2
-5
@@ -1396,11 +1396,9 @@ static int lib_pSetMobjStateNF(lua_State *L)
|
||||
static int lib_pDoSuperTransformation(lua_State *L)
|
||||
{
|
||||
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
boolean giverings = lua_optboolean(L, 2);
|
||||
NOHUD
|
||||
if (!player)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
P_DoSuperTransformation(player, giverings);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2452,16 +2450,15 @@ static int lib_gExitLevel(lua_State *L)
|
||||
|
||||
static int lib_gIsSpecialStage(lua_State *L)
|
||||
{
|
||||
INT32 mapnum = luaL_optinteger(L, 1, gamemap);
|
||||
//HUDSAFE
|
||||
lua_pushboolean(L, G_IsSpecialStage(mapnum));
|
||||
lua_pushboolean(L, false);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lib_gGametypeUsesLives(lua_State *L)
|
||||
{
|
||||
//HUDSAFE
|
||||
lua_pushboolean(L, G_GametypeUsesLives());
|
||||
lua_pushboolean(L, false);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -629,7 +629,7 @@ static int cvar_get(lua_State *L)
|
||||
break;
|
||||
default:
|
||||
if (devparm)
|
||||
return luaL_error(L, LUA_QL("consvar_t") " has no field named " LUA_QS, field);
|
||||
return luaL_error(L, LUA_QL("consvar_t") " has no field named " LUA_QS, lua_tostring(L, 2));
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
+4
-16
@@ -1260,15 +1260,10 @@ extern int lib_hudadd(lua_State *L);
|
||||
|
||||
static int lib_hudsetvotebackground(lua_State *L)
|
||||
{
|
||||
memset(VoteScreen.luaPrefix, 0, sizeof(VoteScreen.luaPrefix));
|
||||
|
||||
if (lua_isnoneornil(L, 1))
|
||||
{
|
||||
if (luaVoteScreen)
|
||||
{
|
||||
free(luaVoteScreen);
|
||||
}
|
||||
|
||||
luaVoteScreen = NULL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1279,15 +1274,8 @@ static int lib_hudsetvotebackground(lua_State *L)
|
||||
return luaL_argerror(L, 1, "prefix should 4 characters wide");
|
||||
}
|
||||
|
||||
if (!luaVoteScreen)
|
||||
{
|
||||
luaVoteScreen = (char*)malloc(5);
|
||||
luaVoteScreen[4] = 0;
|
||||
}
|
||||
|
||||
strncpy(luaVoteScreen, prefix, 4);
|
||||
|
||||
strupr(luaVoteScreen);
|
||||
strncpy(VoteScreen.luaPrefix, prefix, 4);
|
||||
strupr(VoteScreen.luaPrefix);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
+2
-2
@@ -385,7 +385,7 @@ static int state_get(lua_State *L)
|
||||
default:
|
||||
{
|
||||
if (devparm)
|
||||
return luaL_error(L, LUA_QL("state_t") " has no field named " LUA_QS, field);
|
||||
return luaL_error(L, LUA_QL("state_t") " has no field named " LUA_QS, lua_tostring(L, 2));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -462,7 +462,7 @@ static int state_set(lua_State *L)
|
||||
break;
|
||||
|
||||
default:
|
||||
return luaL_error(L, LUA_QL("state_t") " has no field named " LUA_QS, field);
|
||||
return luaL_error(L, LUA_QL("state_t") " has no field named " LUA_QS, lua_tostring(L, 2));
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
+2
-2
@@ -877,7 +877,7 @@ static int mapthing_get(lua_State *L)
|
||||
break;
|
||||
default:
|
||||
if (devparm)
|
||||
return luaL_error(L, LUA_QL("mapthing_t") " has no field named " LUA_QS, field);
|
||||
return luaL_error(L, LUA_QL("mapthing_t") " has no field named " LUA_QS, lua_tostring(L, 2));
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
@@ -931,7 +931,7 @@ static int mapthing_set(lua_State *L)
|
||||
mt->mobj = *((mobj_t **)luaL_checkudata(L, 3, META_MOBJ));
|
||||
break;
|
||||
default:
|
||||
return luaL_error(L, LUA_QL("mapthing_t") " has no field named " LUA_QS, field);
|
||||
return luaL_error(L, LUA_QL("mapthing_t") " has no field named " LUA_QS, lua_tostring(L, 2));
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
+2
-2
@@ -707,8 +707,8 @@ static int kartstuff_len(lua_State *L)
|
||||
return 1;
|
||||
}
|
||||
|
||||
#define NOFIELD luaL_error(L, LUA_QL("ticcmd_t") " has no field named " LUA_QS, field)
|
||||
#define NOSET luaL_error(L, LUA_QL("ticcmd_t") " field " LUA_QS " should not be set directly.", field)
|
||||
#define NOFIELD luaL_error(L, LUA_QL("ticcmd_t") " has no field named " LUA_QS, lua_tostring(L, 2))
|
||||
#define NOSET luaL_error(L, LUA_QL("ticcmd_t") " field " LUA_QS " should not be set directly.", lua_tostring(L, 2))
|
||||
|
||||
enum ticcmd_e
|
||||
{
|
||||
|
||||
+1
-190
@@ -57,29 +57,11 @@ typedef struct
|
||||
// CHEAT Structures
|
||||
// ==========================================================================
|
||||
|
||||
// Cheat responders
|
||||
/*static UINT8 cheatf_ultimate(void)
|
||||
{
|
||||
if (menuactive && (currentMenu != &MainDef && currentMenu != &SP_LoadDef))
|
||||
return 0; // Only on the main menu, or the save select!
|
||||
|
||||
S_StartSound(0, sfx_itemup);
|
||||
ultimate_selectable = (!ultimate_selectable);
|
||||
|
||||
// If on the save select, move to what is now Ultimate Mode!
|
||||
if (currentMenu == &SP_LoadDef)
|
||||
M_ForceSaveSlotSelected(NOSAVESLOT);
|
||||
return 1;
|
||||
}*/
|
||||
|
||||
static UINT8 cheatf_warp(void)
|
||||
{
|
||||
UINT8 i;
|
||||
boolean success = false;
|
||||
|
||||
/*if (modifiedgame)
|
||||
return 0;*/
|
||||
|
||||
if (menuactive && currentMenu != &MainDef)
|
||||
return 0; // Only on the main menu!
|
||||
|
||||
@@ -134,18 +116,6 @@ static UINT8 cheatf_devmode(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
/*static cheatseq_t cheat_ultimate = {
|
||||
0, cheatf_ultimate,
|
||||
{ SCRAMBLE('u'), SCRAMBLE('l'), SCRAMBLE('t'), SCRAMBLE('i'), SCRAMBLE('m'), SCRAMBLE('a'), SCRAMBLE('t'), SCRAMBLE('e'), 0xff }
|
||||
};*/
|
||||
|
||||
/*static cheatseq_t cheat_ultimate_joy = {
|
||||
0, cheatf_ultimate,
|
||||
{ SCRAMBLE(KEY_UPARROW), SCRAMBLE(KEY_UPARROW), SCRAMBLE(KEY_DOWNARROW), SCRAMBLE(KEY_DOWNARROW),
|
||||
SCRAMBLE(KEY_LEFTARROW), SCRAMBLE(KEY_RIGHTARROW), SCRAMBLE(KEY_LEFTARROW), SCRAMBLE(KEY_RIGHTARROW),
|
||||
SCRAMBLE(KEY_ENTER), 0xff }
|
||||
};*/
|
||||
|
||||
static cheatseq_t cheat_warp = {
|
||||
0, cheatf_warp,
|
||||
//{ SCRAMBLE('r'), SCRAMBLE('e'), SCRAMBLE('d'), SCRAMBLE('x'), SCRAMBLE('v'), SCRAMBLE('i'), 0xff }
|
||||
@@ -376,70 +346,6 @@ void Command_Hurtme_f(void)
|
||||
P_DamageMobj(players[consoleplayer].mo, NULL, NULL, atoi(COM_Argv(1)));
|
||||
}
|
||||
|
||||
// Moves the NiGHTS player to another axis within the current mare
|
||||
/*void Command_JumpToAxis_f(void)
|
||||
{
|
||||
REQUIRE_DEVMODE;
|
||||
REQUIRE_INLEVEL;
|
||||
REQUIRE_SINGLEPLAYER;
|
||||
|
||||
if (COM_Argc() != 2)
|
||||
{
|
||||
CONS_Printf(M_GetText("jumptoaxis <axisnum>: Jump to axis within current mare.\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
P_TransferToAxis(&players[consoleplayer], atoi(COM_Argv(1)));
|
||||
}
|
||||
|
||||
void Command_Charability_f(void)
|
||||
{
|
||||
REQUIRE_DEVMODE;
|
||||
REQUIRE_INLEVEL;
|
||||
REQUIRE_SINGLEPLAYER;
|
||||
|
||||
if (COM_Argc() < 3)
|
||||
{
|
||||
CONS_Printf(M_GetText("charability <1/2> <value>: change character abilities\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (atoi(COM_Argv(1)) == 1)
|
||||
players[consoleplayer].charability = (UINT8)atoi(COM_Argv(2));
|
||||
else if (atoi(COM_Argv(1)) == 2)
|
||||
players[consoleplayer].charability2 = (UINT8)atoi(COM_Argv(2));
|
||||
else
|
||||
CONS_Printf(M_GetText("charability <1/2> <value>: change character abilities\n"));
|
||||
}
|
||||
|
||||
void Command_Charspeed_f(void)
|
||||
{
|
||||
REQUIRE_DEVMODE;
|
||||
REQUIRE_INLEVEL;
|
||||
REQUIRE_SINGLEPLAYER;
|
||||
|
||||
if (COM_Argc() < 3)
|
||||
{
|
||||
CONS_Printf(M_GetText("charspeed <normalspeed/runspeed/thrustfactor/accelstart/acceleration/actionspd> <value>: set character speed\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!strcasecmp(COM_Argv(1), "normalspeed"))
|
||||
players[consoleplayer].normalspeed = atoi(COM_Argv(2))<<FRACBITS;
|
||||
else if (!strcasecmp(COM_Argv(1), "runspeed"))
|
||||
players[consoleplayer].runspeed = atoi(COM_Argv(2))<<FRACBITS;
|
||||
else if (!strcasecmp(COM_Argv(1), "thrustfactor"))
|
||||
players[consoleplayer].thrustfactor = atoi(COM_Argv(2));
|
||||
else if (!strcasecmp(COM_Argv(1), "accelstart"))
|
||||
players[consoleplayer].accelstart = atoi(COM_Argv(2));
|
||||
else if (!strcasecmp(COM_Argv(1), "acceleration"))
|
||||
players[consoleplayer].acceleration = atoi(COM_Argv(2));
|
||||
else if (!strcasecmp(COM_Argv(1), "actionspd"))
|
||||
players[consoleplayer].actionspd = atoi(COM_Argv(2))<<FRACBITS;
|
||||
else
|
||||
CONS_Printf(M_GetText("charspeed <normalspeed/runspeed/thrustfactor/accelstart/acceleration/actionspd> <value>: set character speed\n"));
|
||||
}*/
|
||||
|
||||
void Command_RTeleport_f(void)
|
||||
{
|
||||
fixed_t intx, inty, intz;
|
||||
@@ -682,28 +588,6 @@ void Command_Savecheckpoint_f(void)
|
||||
CONS_Printf(M_GetText("Temporary checkpoint created at %d, %d, %d\n"), players[consoleplayer].starpostx, players[consoleplayer].starposty, players[consoleplayer].starpostz);
|
||||
}
|
||||
|
||||
// Like M_GetAllEmeralds() but for console devmode junkies.
|
||||
/*void Command_Getallemeralds_f(void)
|
||||
{
|
||||
REQUIRE_SINGLEPLAYER;
|
||||
REQUIRE_NOULTIMATE;
|
||||
REQUIRE_PANDORA;
|
||||
|
||||
emeralds = ((EMERALD7)*2)-1;
|
||||
|
||||
CONS_Printf(M_GetText("You now have all 7 emeralds.\n"));
|
||||
}
|
||||
|
||||
void Command_Resetemeralds_f(void)
|
||||
{
|
||||
REQUIRE_SINGLEPLAYER;
|
||||
REQUIRE_PANDORA;
|
||||
|
||||
emeralds = 0;
|
||||
|
||||
CONS_Printf(M_GetText("Emeralds reset to zero.\n"));
|
||||
}*/
|
||||
|
||||
void Command_Devmode_f(void)
|
||||
{
|
||||
#ifndef _DEBUG
|
||||
@@ -730,63 +614,6 @@ void Command_Devmode_f(void)
|
||||
G_SetGameModified(multiplayer, true);
|
||||
}
|
||||
|
||||
/*void Command_Setrings_f(void)
|
||||
{
|
||||
REQUIRE_INLEVEL;
|
||||
REQUIRE_SINGLEPLAYER;
|
||||
REQUIRE_NOULTIMATE;
|
||||
REQUIRE_PANDORA;
|
||||
|
||||
if (COM_Argc() > 1)
|
||||
{
|
||||
// P_GivePlayerRings does value clamping
|
||||
players[consoleplayer].health = players[consoleplayer].mo->health = 1;
|
||||
P_GivePlayerRings(&players[consoleplayer], atoi(COM_Argv(1)));
|
||||
if (!G_IsSpecialStage(gamemap) || !useNightsSS)
|
||||
players[consoleplayer].totalring -= atoi(COM_Argv(1)); //undo totalring addition done in P_GivePlayerRings
|
||||
|
||||
G_SetGameModified(multiplayer);
|
||||
}
|
||||
}
|
||||
|
||||
void Command_Setlives_f(void)
|
||||
{
|
||||
REQUIRE_INLEVEL;
|
||||
REQUIRE_SINGLEPLAYER;
|
||||
REQUIRE_NOULTIMATE;
|
||||
REQUIRE_PANDORA;
|
||||
|
||||
if (COM_Argc() > 1)
|
||||
{
|
||||
// P_GivePlayerLives does value clamping
|
||||
players[consoleplayer].lives = 0;
|
||||
P_GivePlayerLives(&players[consoleplayer], atoi(COM_Argv(1)));
|
||||
|
||||
G_SetGameModified(multiplayer);
|
||||
}
|
||||
}
|
||||
|
||||
void Command_Setcontinues_f(void)
|
||||
{
|
||||
REQUIRE_INLEVEL;
|
||||
REQUIRE_SINGLEPLAYER;
|
||||
REQUIRE_NOULTIMATE;
|
||||
REQUIRE_PANDORA;
|
||||
|
||||
if (COM_Argc() > 1)
|
||||
{
|
||||
INT32 numcontinues = atoi(COM_Argv(1));
|
||||
if (numcontinues > 99)
|
||||
numcontinues = 99;
|
||||
else if (numcontinues < 0)
|
||||
numcontinues = 0;
|
||||
|
||||
players[consoleplayer].continues = numcontinues;
|
||||
|
||||
G_SetGameModified(multiplayer);
|
||||
}
|
||||
}*/
|
||||
|
||||
//
|
||||
// OBJECTPLACE (and related variables)
|
||||
//
|
||||
@@ -1006,17 +833,6 @@ void OP_NightsObjectplace(player_t *player)
|
||||
P_SpawnHoopsAndRings(mt);
|
||||
}
|
||||
|
||||
// This places a bumper!
|
||||
/*if (cmd->buttons & BT_SPECTATE)
|
||||
{
|
||||
player->pflags |= PF_ATTACKDOWN;
|
||||
if (!OP_HeightOkay(player, false))
|
||||
return;
|
||||
|
||||
mt = OP_CreateNewMapThing(player, (UINT16)mobjinfo[MT_NIGHTSBUMPER].doomednum, false);
|
||||
P_SpawnMapThing(mt);
|
||||
}*/
|
||||
|
||||
// This places a ring!
|
||||
if (cmd->buttons & BT_BACKWARD)
|
||||
{
|
||||
@@ -1163,12 +979,7 @@ void OP_ObjectplaceMovement(player_t *player)
|
||||
return;
|
||||
}
|
||||
|
||||
/*if (cmd->buttons & BT_FORWARD)
|
||||
{
|
||||
OP_CycleThings(-1);
|
||||
player->pflags |= PF_ATTACKDOWN;
|
||||
}
|
||||
else*/ if (cmd->buttons & BT_DRIFT)
|
||||
if (cmd->buttons & BT_DRIFT)
|
||||
{
|
||||
OP_CycleThings(1);
|
||||
player->pflags |= PF_ATTACKDOWN;
|
||||
|
||||
+145
-222
@@ -1263,153 +1263,74 @@ static menuitem_t OP_AllControlsMenu[] =
|
||||
{IT_CONTROL, NULL, "Custom Action 3", M_ChangeControl, gc_custom3 },
|
||||
};
|
||||
|
||||
#define OP_JOYMENU(pnum) \
|
||||
{IT_HEADER, NULL, "Gameplay Controls", NULL, 7}, \
|
||||
{IT_STRING | IT_CVAR, NULL, "Aim Forward/Back" , &cv_aimaxis[pnum] , 15}, \
|
||||
{IT_STRING | IT_CVAR, NULL, "Turn Left/Right" , &cv_turnaxis[pnum] , 20}, \
|
||||
{IT_STRING | IT_CVAR, NULL, "Accelerate" , &cv_moveaxis[pnum] , 25}, \
|
||||
{IT_STRING | IT_CVAR, NULL, "Brake" , &cv_brakeaxis[pnum] , 30}, \
|
||||
{IT_STRING | IT_CVAR, NULL, "Drift" , &cv_driftaxis[pnum] , 35}, \
|
||||
{IT_STRING | IT_CVAR, NULL, "Use Item" , &cv_fireaxis[pnum] , 40}, \
|
||||
{IT_STRING | IT_CVAR, NULL, "Look Backward" , &cv_lookbackaxis[pnum] , 45}, \
|
||||
{IT_STRING | IT_CVAR, NULL, "Custom Button 1" , &cv_custom1axis[pnum] , 50}, \
|
||||
{IT_STRING | IT_CVAR, NULL, "Custom Button 2" , &cv_custom2axis[pnum] , 55}, \
|
||||
{IT_STRING | IT_CVAR, NULL, "Custom Button 3" , &cv_custom3axis[pnum] , 60}, \
|
||||
{IT_HEADER, NULL, "Camera Controls", NULL, 67}, \
|
||||
{IT_STRING | IT_CVAR, NULL, "Look Up/Down" , &cv_lookaxis[pnum] , 75}, \
|
||||
{IT_STRING | IT_CVAR, NULL, "Turn Left/Right" , &cv_camturnaxis[pnum] , 80}, \
|
||||
{IT_STRING | IT_CVAR, NULL, "Strafe Left/Right" , &cv_camstrafeaxis[pnum] , 85}, \
|
||||
{IT_HEADER, NULL, "Deadzones", NULL, 92}, \
|
||||
{IT_STRING | IT_CVAR, NULL, "X deadzone" , &cv_xdeadzone[pnum] , 100}, \
|
||||
{IT_STRING | IT_CVAR, NULL, "Y deadzone" , &cv_ydeadzone[pnum] , 105}, \
|
||||
{IT_HEADER, NULL, "Miscellaneous", NULL, 112}, \
|
||||
{IT_STRING | IT_CVAR, NULL, "Controller Rumble" , &cv_rumble[pnum] , 120}, \
|
||||
{IT_STRING | IT_CVAR, NULL, "Set LED to Player color", &cv_gamepadled[pnum] , 125},
|
||||
|
||||
static menuitem_t OP_Joystick1Menu[] =
|
||||
{
|
||||
{IT_STRING | IT_CALL, NULL, "Select Gamepad..." , M_Setup1PJoystickMenu , 0},
|
||||
|
||||
{IT_HEADER, NULL, "Gameplay Controls", NULL, 7},
|
||||
{IT_STRING | IT_CVAR, NULL, "Aim Forward/Back" , &cv_aimaxis[0] , 15},
|
||||
{IT_STRING | IT_CVAR, NULL, "Turn Left/Right" , &cv_turnaxis[0] , 20},
|
||||
{IT_STRING | IT_CVAR, NULL, "Accelerate" , &cv_moveaxis[0] , 25},
|
||||
{IT_STRING | IT_CVAR, NULL, "Brake" , &cv_brakeaxis[0] , 30},
|
||||
{IT_STRING | IT_CVAR, NULL, "Drift" , &cv_driftaxis[0] , 35},
|
||||
{IT_STRING | IT_CVAR, NULL, "Use Item" , &cv_fireaxis[0] , 40},
|
||||
{IT_STRING | IT_CVAR, NULL, "Look Backward" , &cv_lookbackaxis[0] , 45},
|
||||
{IT_STRING | IT_CVAR, NULL, "Custom Button 1" , &cv_custom1axis[0] , 50},
|
||||
{IT_STRING | IT_CVAR, NULL, "Custom Button 2" , &cv_custom2axis[0] , 55},
|
||||
{IT_STRING | IT_CVAR, NULL, "Custom Button 3" , &cv_custom3axis[0] , 60},
|
||||
|
||||
{IT_HEADER, NULL, "Camera Controls", NULL, 67},
|
||||
{IT_STRING | IT_CVAR, NULL, "Look Up/Down" , &cv_lookaxis[0] , 75},
|
||||
{IT_STRING | IT_CVAR, NULL, "Turn Left/Right" , &cv_camturnaxis[0] , 80},
|
||||
{IT_STRING | IT_CVAR, NULL, "Strafe Left/Right" , &cv_camstrafeaxis[0] , 85},
|
||||
|
||||
{IT_HEADER, NULL, "Deadzones", NULL, 92},
|
||||
{IT_STRING | IT_CVAR, NULL, "X deadzone" , &cv_xdeadzone[0] , 100},
|
||||
{IT_STRING | IT_CVAR, NULL, "Y deadzone" , &cv_ydeadzone[0] , 105},
|
||||
|
||||
{IT_HEADER, NULL, "Miscellaneous", NULL, 112},
|
||||
{IT_STRING | IT_CVAR, NULL, "Controller Rumble" , &cv_rumble[0] , 120},
|
||||
{IT_STRING | IT_CVAR, NULL, "Set LED to skin color" , &cv_gamepadled[0] , 125},
|
||||
{IT_STRING | IT_CVAR, NULL, "Flash LED on powerups" , &cv_ledpowerup[0] , 130},
|
||||
{IT_STRING | IT_CALL, NULL, "Select Gamepad...", M_Setup1PJoystickMenu, 0},
|
||||
OP_JOYMENU(0)
|
||||
};
|
||||
|
||||
static menuitem_t OP_Joystick2Menu[] =
|
||||
{
|
||||
{IT_STRING | IT_CALL, NULL, "Select Gamepad..." , M_Setup2PJoystickMenu , 10},
|
||||
|
||||
{IT_HEADER, NULL, "Gameplay Controls", NULL, 7},
|
||||
{IT_STRING | IT_CVAR, NULL, "Aim Forward/Back" , &cv_aimaxis[1] , 15},
|
||||
{IT_STRING | IT_CVAR, NULL, "Turn Left/Right" , &cv_turnaxis[1] , 20},
|
||||
{IT_STRING | IT_CVAR, NULL, "Accelerate" , &cv_moveaxis[1] , 25},
|
||||
{IT_STRING | IT_CVAR, NULL, "Brake" , &cv_brakeaxis[1] , 30},
|
||||
{IT_STRING | IT_CVAR, NULL, "Drift" , &cv_driftaxis[1] , 35},
|
||||
{IT_STRING | IT_CVAR, NULL, "Use Item" , &cv_fireaxis[1] , 40},
|
||||
{IT_STRING | IT_CVAR, NULL, "Look Backward" , &cv_lookbackaxis[1] , 45},
|
||||
{IT_STRING | IT_CVAR, NULL, "Custom Button 1" , &cv_custom1axis[1] , 50},
|
||||
{IT_STRING | IT_CVAR, NULL, "Custom Button 2" , &cv_custom2axis[1] , 55},
|
||||
{IT_STRING | IT_CVAR, NULL, "Custom Button 3" , &cv_custom3axis[1] , 60},
|
||||
|
||||
{IT_HEADER, NULL, "Camera Controls", NULL, 67},
|
||||
{IT_STRING | IT_CVAR, NULL, "Look Up/Down" , &cv_lookaxis[1] , 75},
|
||||
{IT_STRING | IT_CVAR, NULL, "Turn Left/Right" , &cv_camturnaxis[1] , 80},
|
||||
{IT_STRING | IT_CVAR, NULL, "Strafe Left/Right" , &cv_camstrafeaxis[1] , 85},
|
||||
|
||||
{IT_HEADER, NULL, "Deadzones", NULL, 92},
|
||||
{IT_STRING | IT_CVAR, NULL, "X deadzone" , &cv_xdeadzone[1] , 100},
|
||||
{IT_STRING | IT_CVAR, NULL, "Y deadzone" , &cv_ydeadzone[1] , 105},
|
||||
|
||||
{IT_HEADER, NULL, "Miscellaneous", NULL, 112},
|
||||
{IT_STRING | IT_CVAR, NULL, "Controller Rumble" , &cv_rumble[1] , 120},
|
||||
{IT_STRING | IT_CVAR, NULL, "Set LED to skin color" , &cv_gamepadled[1] , 125},
|
||||
{IT_STRING | IT_CVAR, NULL, "Flash LED on powerups" , &cv_ledpowerup[1] , 130},
|
||||
{IT_STRING | IT_CALL, NULL, "Select Gamepad...", M_Setup2PJoystickMenu, 0},
|
||||
OP_JOYMENU(1)
|
||||
};
|
||||
|
||||
static menuitem_t OP_Joystick3Menu[] =
|
||||
{
|
||||
{IT_STRING | IT_CALL, NULL, "Select Gamepad..." , M_Setup3PJoystickMenu , 10},
|
||||
|
||||
{IT_HEADER, NULL, "Gameplay Controls", NULL, 7},
|
||||
{IT_STRING | IT_CVAR, NULL, "Aim Forward/Back" , &cv_aimaxis[2] , 15},
|
||||
{IT_STRING | IT_CVAR, NULL, "Turn Left/Right" , &cv_turnaxis[2] , 20},
|
||||
{IT_STRING | IT_CVAR, NULL, "Accelerate" , &cv_moveaxis[2] , 25},
|
||||
{IT_STRING | IT_CVAR, NULL, "Brake" , &cv_brakeaxis[2] , 30},
|
||||
{IT_STRING | IT_CVAR, NULL, "Drift" , &cv_driftaxis[2] , 35},
|
||||
{IT_STRING | IT_CVAR, NULL, "Use Item" , &cv_fireaxis[2] , 40},
|
||||
{IT_STRING | IT_CVAR, NULL, "Look Backward" , &cv_lookbackaxis[2] , 45},
|
||||
{IT_STRING | IT_CVAR, NULL, "Custom Button 1" , &cv_custom1axis[2] , 50},
|
||||
{IT_STRING | IT_CVAR, NULL, "Custom Button 2" , &cv_custom2axis[2] , 55},
|
||||
{IT_STRING | IT_CVAR, NULL, "Custom Button 3" , &cv_custom3axis[2] , 60},
|
||||
|
||||
{IT_HEADER, NULL, "Camera Controls", NULL, 67},
|
||||
{IT_STRING | IT_CVAR, NULL, "Look Up/Down" , &cv_lookaxis[2] , 75},
|
||||
{IT_STRING | IT_CVAR, NULL, "Turn Left/Right" , &cv_camturnaxis[2] , 80},
|
||||
{IT_STRING | IT_CVAR, NULL, "Strafe Left/Right" , &cv_camstrafeaxis[2] , 85},
|
||||
|
||||
{IT_HEADER, NULL, "Deadzones", NULL, 92},
|
||||
{IT_STRING | IT_CVAR, NULL, "X deadzone" , &cv_xdeadzone[2] , 100},
|
||||
{IT_STRING | IT_CVAR, NULL, "Y deadzone" , &cv_ydeadzone[2] , 105},
|
||||
|
||||
{IT_HEADER, NULL, "Miscellaneous", NULL, 112},
|
||||
{IT_STRING | IT_CVAR, NULL, "Controller Rumble" , &cv_rumble[2] , 120},
|
||||
{IT_STRING | IT_CVAR, NULL, "Set LED to skin color" , &cv_gamepadled[2] , 125},
|
||||
{IT_STRING | IT_CVAR, NULL, "Flash LED on powerups" , &cv_ledpowerup[2] , 130},
|
||||
{IT_STRING | IT_CALL, NULL, "Select Gamepad...", M_Setup3PJoystickMenu, 0},
|
||||
OP_JOYMENU(2)
|
||||
};
|
||||
|
||||
static menuitem_t OP_Joystick4Menu[] =
|
||||
{
|
||||
{IT_STRING | IT_CALL, NULL, "Select Gamepad..." , M_Setup4PJoystickMenu , 10},
|
||||
|
||||
{IT_HEADER, NULL, "Gameplay Controls", NULL, 7},
|
||||
{IT_STRING | IT_CVAR, NULL, "Aim Forward/Back" , &cv_aimaxis[3] , 15},
|
||||
{IT_STRING | IT_CVAR, NULL, "Turn Left/Right" , &cv_turnaxis[3] , 20},
|
||||
{IT_STRING | IT_CVAR, NULL, "Accelerate" , &cv_moveaxis[3] , 25},
|
||||
{IT_STRING | IT_CVAR, NULL, "Brake" , &cv_brakeaxis[3] , 30},
|
||||
{IT_STRING | IT_CVAR, NULL, "Drift" , &cv_driftaxis[3] , 35},
|
||||
{IT_STRING | IT_CVAR, NULL, "Use Item" , &cv_fireaxis[3] , 40},
|
||||
{IT_STRING | IT_CVAR, NULL, "Look Backward" , &cv_lookbackaxis[3] , 45},
|
||||
{IT_STRING | IT_CVAR, NULL, "Custom Button 1" , &cv_custom1axis[3] , 50},
|
||||
{IT_STRING | IT_CVAR, NULL, "Custom Button 2" , &cv_custom2axis[3] , 55},
|
||||
{IT_STRING | IT_CVAR, NULL, "Custom Button 3" , &cv_custom3axis[3] , 60},
|
||||
|
||||
{IT_HEADER, NULL, "Camera Controls", NULL, 67},
|
||||
{IT_STRING | IT_CVAR, NULL, "Look Up/Down" , &cv_lookaxis[3] , 75},
|
||||
{IT_STRING | IT_CVAR, NULL, "Turn Left/Right" , &cv_camturnaxis[3] , 80},
|
||||
{IT_STRING | IT_CVAR, NULL, "Strafe Left/Right" , &cv_camstrafeaxis[3] , 85},
|
||||
|
||||
{IT_HEADER, NULL, "Deadzones", NULL, 92},
|
||||
{IT_STRING | IT_CVAR, NULL, "X deadzone" , &cv_xdeadzone[3] , 100},
|
||||
{IT_STRING | IT_CVAR, NULL, "Y deadzone" , &cv_ydeadzone[3] , 105},
|
||||
|
||||
{IT_HEADER, NULL, "Miscellaneous", NULL, 112},
|
||||
{IT_STRING | IT_CVAR, NULL, "Controller Rumble" , &cv_rumble[3] , 120},
|
||||
{IT_STRING | IT_CVAR, NULL, "Set LED to skin color" , &cv_gamepadled[3] , 125},
|
||||
{IT_STRING | IT_CVAR, NULL, "Flash LED on powerups" , &cv_ledpowerup[3] , 130},
|
||||
{IT_STRING | IT_CALL, NULL, "Select Gamepad...", M_Setup4PJoystickMenu, 0},
|
||||
OP_JOYMENU(3)
|
||||
};
|
||||
|
||||
static menuitem_t OP_JoystickSetMenu[] =
|
||||
{
|
||||
{IT_CALL | IT_NOTHING, "None", NULL, M_AssignJoystick, LINEHEIGHT+5},
|
||||
{IT_CALL | IT_NOTHING, "", NULL, M_AssignJoystick, (LINEHEIGHT*2)+5},
|
||||
{IT_CALL | IT_NOTHING, "", NULL, M_AssignJoystick, (LINEHEIGHT*3)+5},
|
||||
{IT_CALL | IT_NOTHING, "", NULL, M_AssignJoystick, (LINEHEIGHT*4)+5},
|
||||
{IT_CALL | IT_NOTHING, "", NULL, M_AssignJoystick, (LINEHEIGHT*5)+5},
|
||||
{IT_CALL | IT_NOTHING, "", NULL, M_AssignJoystick, (LINEHEIGHT*6)+5},
|
||||
{IT_CALL | IT_NOTHING, "", NULL, M_AssignJoystick, (LINEHEIGHT*7)+5},
|
||||
{IT_CALL | IT_NOTHING, "", NULL, M_AssignJoystick, (LINEHEIGHT*8)+5},
|
||||
{IT_CALL | IT_NOTHING, "None", NULL, M_AssignJoystick, LINEHEIGHT+5},
|
||||
{IT_CALL | IT_NOTHING, "", NULL, M_AssignJoystick, (LINEHEIGHT*2)+5},
|
||||
{IT_CALL | IT_NOTHING, "", NULL, M_AssignJoystick, (LINEHEIGHT*3)+5},
|
||||
{IT_CALL | IT_NOTHING, "", NULL, M_AssignJoystick, (LINEHEIGHT*4)+5},
|
||||
{IT_CALL | IT_NOTHING, "", NULL, M_AssignJoystick, (LINEHEIGHT*5)+5},
|
||||
{IT_CALL | IT_NOTHING, "", NULL, M_AssignJoystick, (LINEHEIGHT*6)+5},
|
||||
{IT_CALL | IT_NOTHING, "", NULL, M_AssignJoystick, (LINEHEIGHT*7)+5},
|
||||
{IT_CALL | IT_NOTHING, "", NULL, M_AssignJoystick, (LINEHEIGHT*8)+5},
|
||||
};
|
||||
|
||||
//WTF
|
||||
static menuitem_t OP_MouseOptionsMenu[] =
|
||||
{
|
||||
{IT_STRING | IT_CVAR, NULL, "Use Mouse", &cv_usemouse, 10},
|
||||
{IT_STRING | IT_CVAR, NULL, "Use Mouse", &cv_usemouse, 10},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Mouse Turning", &cv_mouseturn, 20},
|
||||
{IT_STRING | IT_CVAR, NULL, "Invert Mouse", &cv_invertmouse, 30},
|
||||
{IT_STRING | IT_CVAR | IT_CV_SLIDER,
|
||||
NULL, "Mouse X Speed", &cv_mousesens, 40},
|
||||
{IT_STRING | IT_CVAR | IT_CV_SLIDER,
|
||||
NULL, "Mouse Y Speed", &cv_mouseysens, 50},
|
||||
{IT_STRING | IT_CVAR, NULL, "Mouse Turning", &cv_mouseturn, 20},
|
||||
{IT_STRING | IT_CVAR, NULL, "Invert Mouse", &cv_invertmouse, 30},
|
||||
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Mouse X Speed", &cv_mousesens, 40},
|
||||
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Mouse Y Speed", &cv_mouseysens, 50},
|
||||
};
|
||||
|
||||
static const char* OP_MouseTooltips[] =
|
||||
@@ -1555,15 +1476,17 @@ static menuitem_t OP_ExpOptionsMenu[] =
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "FPS counter sampling", &cv_accuratefps, 50},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Votescreen Scaling", &cv_votebgscaling, 60},
|
||||
|
||||
#ifdef HWRENDER
|
||||
{IT_STRING | IT_CVAR, NULL, "Screen Textures", &cv_glscreentextures, 60},
|
||||
{IT_STRING | IT_CVAR, NULL, "Screen Textures", &cv_glscreentextures, 70},
|
||||
#ifdef USE_FBO_OGL
|
||||
{IT_STRING | IT_CVAR, NULL, "FBO Downsampling support", &cv_glframebuffer, 65},
|
||||
{IT_STRING | IT_CVAR, NULL, "Palette Depth", &cv_glpalettedepth, 75},
|
||||
{IT_DISABLED, NULL, "", NULL, 85}, // dummy text
|
||||
{IT_STRING | IT_CVAR, NULL, "FBO Downsampling support", &cv_glframebuffer, 75},
|
||||
{IT_STRING | IT_CVAR, NULL, "Palette Depth", &cv_glpalettedepth, 85},
|
||||
{IT_DISABLED, NULL, "", NULL, 95}, // dummy text
|
||||
#else
|
||||
{IT_STRING | IT_CVAR, NULL, "Palette Depth", &cv_glpalettedepth, 70},
|
||||
{IT_DISABLED, NULL, "", NULL, 80}, // dummy text
|
||||
{IT_STRING | IT_CVAR, NULL, "Palette Depth", &cv_glpalettedepth, 80},
|
||||
{IT_DISABLED, NULL, "", NULL, 90}, // dummy text
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
@@ -1578,6 +1501,7 @@ static const char* OP_ExpTooltips[] =
|
||||
//"Should the directional lightning be randomized each map?\nTakes effect on next map load.",
|
||||
"Toggle being able to see the sky.",
|
||||
"Change the FPS counter sampling method\nInaccurate updates slower and might miss frame drops and such\nAccurate updates faster and is more accurate, but might be less readable", // how to ingles??
|
||||
"Different methods of scaling the votescreen backgrounds.",
|
||||
#ifdef HWRENDER
|
||||
"Should the game do Screen Textures? Provides a good boost to frames\nat the cost of some visual effects not working when disabled.",
|
||||
#ifdef USE_FBO_OGL
|
||||
@@ -1791,9 +1715,11 @@ static menuitem_t OP_FocusOptionsMenu[] =
|
||||
|
||||
{IT_STRING|IT_CVAR, NULL, "Pause Game While Unfocused", &cv_pauseifunfocused, 60},
|
||||
|
||||
{IT_STRING|IT_CVAR, NULL, "Show \"FOCUS LOST\"", &cv_showfocuslost, 80},
|
||||
{IT_STRING|IT_CVAR, NULL, "Background FPS Cap", &cv_fpscapbg, 80},
|
||||
|
||||
{IT_STRING|IT_CVAR, NULL, "Always Grab Mouse While Focused", &cv_alwaysgrabmouse, 100},
|
||||
{IT_STRING|IT_CVAR, NULL, "Show \"FOCUS LOST\"", &cv_showfocuslost, 100},
|
||||
|
||||
{IT_STRING|IT_CVAR, NULL, "Always Grab Mouse While Focused", &cv_alwaysgrabmouse, 120},
|
||||
};
|
||||
|
||||
static const char* OP_FocusOptionsTooltips[] =
|
||||
@@ -1802,6 +1728,7 @@ static const char* OP_FocusOptionsTooltips[] =
|
||||
"Should music play while the game is unfocused?",
|
||||
"Should soundeffects play while the game is unfocused?",
|
||||
"Should the game pause while the game is unfocused?",
|
||||
"Set manual framerate cap while the game is unfocused.",
|
||||
"Should the FOCUS LOST window appear\n while the game is unfocused?",
|
||||
"Should the mouse cursor be grabbed and hidden\n while the game is in focus?",
|
||||
};
|
||||
@@ -1950,76 +1877,38 @@ static const char* OP_CamOptionsTooltips[] =
|
||||
NULL,
|
||||
};
|
||||
|
||||
#define OP_CAMMENU(pnum) \
|
||||
{IT_STRING | IT_CVAR, NULL, "Flipcam", &cv_flipcam[pnum], 30}, \
|
||||
{IT_STRING | IT_CVAR | IT_CV_BIGFLOAT, NULL, "Camera Distance", &cv_cam_dist[pnum], 50}, \
|
||||
{IT_STRING | IT_CVAR | IT_CV_BIGFLOAT, NULL, "Camera Height", &cv_cam_height[pnum], 60}, \
|
||||
{IT_STRING | IT_CVAR, NULL, "Camera Speed", &cv_cam_speed[pnum], 70}, \
|
||||
{IT_STRING | IT_CVAR, NULL, "Camera Lookback Momentum", &cv_lookbackmom[pnum], 90}, \
|
||||
{IT_STRING | IT_CVAR, NULL, "Camera Vertical Look", &cv_verticallook[pnum], 100}, \
|
||||
{IT_STRING | IT_CVAR, NULL, "Freecam Speed", &cv_freecam_speed[pnum], 120}, \
|
||||
{IT_STRING | IT_CVAR, NULL, "Third Person Camera", &cv_chasecam[pnum], 135}, \
|
||||
|
||||
static menuitem_t OP_Player1CamOptionsMenu[] =
|
||||
{
|
||||
{IT_HEADER, NULL, "Player 1 Camera Options", NULL, 0},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Flipcam", &cv_flipcam[0], 30},
|
||||
{IT_STRING | IT_CVAR | IT_CV_BIGFLOAT, NULL, "Camera Distance", &cv_cam_dist[0], 50},
|
||||
{IT_STRING | IT_CVAR | IT_CV_BIGFLOAT, NULL, "Camera Height", &cv_cam_height[0], 60},
|
||||
{IT_STRING | IT_CVAR, NULL, "Camera Speed", &cv_cam_speed[0], 70},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Camera Lookback Momentum", &cv_lookbackmom[0], 90},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Camera Vertical Look", &cv_verticallook[0], 100},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Freecam Speed", &cv_freecam_speed[0], 120},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Third Person Camera", &cv_chasecam[0], 135},
|
||||
OP_CAMMENU(0)
|
||||
};
|
||||
|
||||
static menuitem_t OP_Player2CamOptionsMenu[] =
|
||||
{
|
||||
{IT_HEADER, NULL, "Player 2 Camera Options", NULL, 0},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Flipcam", &cv_flipcam[1], 30},
|
||||
{IT_STRING | IT_CVAR | IT_CV_BIGFLOAT, NULL, "Camera Distance", &cv_cam_dist[1], 50},
|
||||
{IT_STRING | IT_CVAR | IT_CV_BIGFLOAT, NULL, "Camera Height", &cv_cam_height[1], 60},
|
||||
{IT_STRING | IT_CVAR, NULL, "Camera Speed", &cv_cam_speed[1], 70},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Camera Lookback Momentum", &cv_lookbackmom[1], 90},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Camera Vertical Look", &cv_verticallook[1], 100},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Freecam Speed", &cv_freecam_speed[1], 120},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Third Person Camera", &cv_chasecam[1], 135},
|
||||
OP_CAMMENU(1)
|
||||
};
|
||||
|
||||
static menuitem_t OP_Player3CamOptionsMenu[] =
|
||||
{
|
||||
{IT_HEADER, NULL, "Player 3 Camera Options", NULL, 0},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Flipcam", &cv_flipcam[2], 30},
|
||||
{IT_STRING | IT_CVAR | IT_CV_BIGFLOAT, NULL, "Camera Distance", &cv_cam_dist[2], 50},
|
||||
{IT_STRING | IT_CVAR | IT_CV_BIGFLOAT, NULL, "Camera Height", &cv_cam_height[2], 60},
|
||||
{IT_STRING | IT_CVAR, NULL, "Camera Speed", &cv_cam_speed[2], 70},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Camera Lookback Momentum", &cv_lookbackmom[2], 90},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Camera Vertical Look", &cv_verticallook[2], 100},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Freecam Speed", &cv_freecam_speed[2], 120},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Third Person Camera", &cv_chasecam[2], 135},
|
||||
OP_CAMMENU(2)
|
||||
};
|
||||
|
||||
static menuitem_t OP_Player4CamOptionsMenu[] =
|
||||
{
|
||||
{IT_HEADER, NULL, "Player 4 Camera Options", NULL, 0},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Flipcam", &cv_flipcam[3], 30},
|
||||
{IT_STRING | IT_CVAR | IT_CV_BIGFLOAT, NULL, "Camera Distance", &cv_cam_dist[3], 50},
|
||||
{IT_STRING | IT_CVAR | IT_CV_BIGFLOAT, NULL, "Camera Height", &cv_cam_height[3], 60},
|
||||
{IT_STRING | IT_CVAR, NULL, "Camera Speed", &cv_cam_speed[3], 70},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Camera Lookback Momentum", &cv_lookbackmom[3], 90},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Camera Vertical Look", &cv_verticallook[3], 100},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Freecam Speed", &cv_freecam_speed[3], 120},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Third Person Camera", &cv_chasecam[3], 135},
|
||||
OP_CAMMENU(3)
|
||||
};
|
||||
|
||||
static const char* OP_PlayerCamOptionsTooltips[] =
|
||||
@@ -2303,25 +2192,25 @@ static menuitem_t OP_SaturnMenu[] =
|
||||
{IT_STRING | IT_CVAR, NULL, "Skin Select Spinning Speed", &cv_skinselectspin, 35},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Colorized Speedlines", &cv_coloredspeedlines, 45},
|
||||
{IT_STRING | IT_CVAR, NULL, "Colorized Sneakertrails", &cv_coloredsneakertrail, 40},
|
||||
{IT_STRING | IT_CVAR, NULL, "Colorized Sneakertrails", &cv_coloredsneakertrail, 50},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Player Blendeffects", &cv_playerblendeffects, 50},
|
||||
{IT_STRING | IT_CVAR, NULL, "Player Blendeffects", &cv_playerblendeffects, 60},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Bananadrag Jitter", &cv_bananajitter, 60},
|
||||
{IT_STRING | IT_CVAR, NULL, "Bananadrag Jitter", &cv_bananajitter, 70},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Midair Driftsparks", &cv_airsparks, 70},
|
||||
{IT_STRING | IT_CVAR, NULL, "Midair Driftsparks", &cv_airsparks, 80},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Show Localskin Menus", &cv_showlocalskinmenus, 80},
|
||||
{IT_STRING | IT_CVAR, NULL, "Show Localskin Menus", &cv_showlocalskinmenus, 90},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Uppercase Menu", &cv_menucaps, 90},
|
||||
{IT_STRING | IT_CVAR, NULL, "Uppercase Menu", &cv_menucaps, 100},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Keyboard Layout", &cv_keyboardlayout, 100},
|
||||
{IT_STRING | IT_CVAR, NULL, "Keyboard Layout", &cv_keyboardlayout, 110},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Less Midnight Channel Flicker", &cv_lessflicker, 110},
|
||||
{IT_STRING | IT_CVAR, NULL, "Less Midnight Channel Flicker", &cv_lessflicker, 120},
|
||||
|
||||
{IT_SUBMENU|IT_STRING, NULL, "Saturn Hud...", &OP_SaturnHudDef, 120},
|
||||
{IT_SUBMENU|IT_STRING, NULL, "Sprite Distortion...", &OP_PlayerDistortDef, 125},
|
||||
{IT_SUBMENU|IT_STRING, NULL, "Saturn Credits", &OP_SaturnCreditsDef, 130}, // uwu
|
||||
{IT_SUBMENU|IT_STRING, NULL, "Saturn Hud...", &OP_SaturnHudDef, 130},
|
||||
{IT_SUBMENU|IT_STRING, NULL, "Sprite Distortion...", &OP_PlayerDistortDef, 135},
|
||||
{IT_SUBMENU|IT_STRING, NULL, "Saturn Credits", &OP_SaturnCreditsDef, 140}, // uwu
|
||||
};
|
||||
|
||||
static const char* OP_SaturnTooltips[] =
|
||||
@@ -3178,10 +3067,10 @@ menu_t OP_ControlsDef = DEFAULTMENUSTYLE("M_CONTRO", OP_ControlsMenu, &OP_MainDe
|
||||
//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, 60, 36);
|
||||
menu_t OP_Joystick2Def = DEFAULTSCROLLSTYLE("M_CONTRO", OP_Joystick2Menu, &OP_AllControlsDef, 60, 36);
|
||||
menu_t OP_Joystick3Def = DEFAULTSCROLLSTYLE("M_CONTRO", OP_Joystick3Menu, &OP_AllControlsDef, 60, 36);
|
||||
menu_t OP_Joystick4Def = DEFAULTSCROLLSTYLE("M_CONTRO", OP_Joystick4Menu, &OP_AllControlsDef, 60, 36);
|
||||
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 =
|
||||
{
|
||||
"M_CONTRO",
|
||||
@@ -3271,7 +3160,7 @@ menu_t OP_ChatOptionsDef = DEFAULTMENUSTYLE("M_HUD", OP_ChatOptionsMenu, &OP_HUD
|
||||
|
||||
menu_t OP_SoundAdvancedDef = DEFAULTSCROLLSTYLE("M_SOUND", OP_SoundAdvancedMenu, &OP_SoundOptionsDef, 30, 30);
|
||||
|
||||
menu_t OP_FocusOptionsDef = DEFAULTMENUSTYLE(NULL, OP_FocusOptionsMenu, &OP_MainDef, 25, 30);
|
||||
menu_t OP_FocusOptionsDef = DEFAULTMENUSTYLE(NULL, OP_FocusOptionsMenu, &OP_MainDef, 17, 30);
|
||||
|
||||
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);
|
||||
@@ -6356,25 +6245,41 @@ static boolean M_AddonsRefresh(void)
|
||||
{
|
||||
S_StartSound(NULL, sfx_s26d);
|
||||
if (refreshdirmenu & REFRESHDIR_MAX)
|
||||
message = va("%c%s\x80\nMaximum number of addons reached.\nA file could not be loaded.\nIf you wish to play with this addon, restart the game to clear existing ones.\n\n(Press a key)\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), refreshdirname);
|
||||
{
|
||||
if (refreshdirname)
|
||||
message = va("%c%s\x80\nMaximum number of addons reached.\nA file could not be loaded.\nIf you wish to play with this addon, restart the game to clear existing ones.\n\n(Press a key)\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), refreshdirname);
|
||||
else
|
||||
message = va("%c\x80 Maximum number of addons reached.\nA file could not be loaded.\nIf you wish to play with this addon, restart the game to clear existing ones.\n\n(Press a key)\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)));
|
||||
}
|
||||
else
|
||||
message = va("%c%s\x80\nA file was not loaded.\nCheck the console log for more information.\n\n(Press a key)\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), refreshdirname);
|
||||
{
|
||||
if (refreshdirname)
|
||||
message = va("%c%s\x80\nA file was not loaded.\nCheck the console log for more information.\n\n(Press a key)\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), refreshdirname);
|
||||
else
|
||||
message = va("%c\x80 A file was not loaded.\nCheck the console log for more information.\n\n(Press a key)\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)));
|
||||
}
|
||||
}
|
||||
else if (refreshdirmenu & (REFRESHDIR_WARNING | REFRESHDIR_ERROR))
|
||||
{
|
||||
S_StartSound(NULL, sfx_s224);
|
||||
message = va("%c%s\x80\nA file was loaded with %s.\nCheck the console log for more information.\n\n(Press a key)\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), refreshdirname, ((refreshdirmenu & REFRESHDIR_ERROR) ? "errors" : "warnings"));
|
||||
if (refreshdirname)
|
||||
message = va("%c%s\x80\nA file was loaded with %s.\nCheck the console log for more information.\n\n(Press a key)\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), refreshdirname, ((refreshdirmenu & REFRESHDIR_ERROR) ? "errors" : "warnings"));
|
||||
else
|
||||
message = va("%c\x80 A file was loaded with %s.\nCheck the console log for more information.\n\n(Press a key)\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), ((refreshdirmenu & REFRESHDIR_ERROR) ? "errors" : "warnings"));
|
||||
}
|
||||
else if (majormods && !prevmajormods)
|
||||
{
|
||||
S_StartSound(NULL, sfx_s221);
|
||||
message = va("%c%s\x80\nYou've loaded a gameplay-modifying addon.\n\nRecord Attack data will be saved to a seperate save file.\n\n(Press a key)\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), refreshdirname);
|
||||
if (refreshdirname)
|
||||
message = va("%c%s\x80\nYou've loaded a gameplay-modifying addon.\n\nRecord Attack data will be saved to a seperate save file.\n\n(Press a key)\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), refreshdirname);
|
||||
else
|
||||
message = va("%c\x80 You've loaded a gameplay-modifying addon.\n\nRecord Attack data will be saved to a seperate save file.\n\n(Press a key)\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)));
|
||||
prevmajormods = majormods;
|
||||
}
|
||||
|
||||
if (message)
|
||||
{
|
||||
M_StartMessage(message,M_AddonsClearName,MM_EVENTHANDLER);
|
||||
M_StartMessage(message, M_AddonsClearName, MM_EVENTHANDLER);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -7262,8 +7167,11 @@ static void DrawReplayHutReplayInfo(void)
|
||||
if (mapheaderinfo[demolist[dir_on[menudepthleft]].map-1])
|
||||
{
|
||||
char *title = G_BuildMapTitle(demolist[dir_on[menudepthleft]].map);
|
||||
V_DrawString(x, y, V_SNAPTOTOP|MENUCAPS, title);
|
||||
Z_Free(title);
|
||||
if (title)
|
||||
{
|
||||
V_DrawString(x, y, V_SNAPTOTOP|MENUCAPS, title);
|
||||
Z_Free(title);
|
||||
}
|
||||
}
|
||||
else
|
||||
V_DrawString(x, y, V_SNAPTOTOP|V_ALLOWLOWERCASE|V_TRANSLUCENT, "Level is not loaded.");
|
||||
@@ -8215,6 +8123,9 @@ UINT8 skyRoomMenuTranslations[MAXUNLOCKABLES];
|
||||
|
||||
static char *M_GetConditionString(condition_t cond)
|
||||
{
|
||||
char *title = NULL;
|
||||
char *response = NULL;
|
||||
|
||||
switch(cond.type)
|
||||
{
|
||||
case UC_PLAYTIME:
|
||||
@@ -8241,33 +8152,45 @@ static char *M_GetConditionString(condition_t cond)
|
||||
G_TicsToSeconds(cond.requirement));
|
||||
case UC_MAPVISITED:
|
||||
{
|
||||
char *title = G_BuildMapTitle(cond.requirement-1);
|
||||
char *response = va("Visit %s", title);
|
||||
Z_Free(title);
|
||||
title = G_BuildMapTitle(cond.requirement-1);
|
||||
if (title)
|
||||
{
|
||||
response = va("Visit %s", title);
|
||||
Z_Free(title);
|
||||
}
|
||||
return response;
|
||||
}
|
||||
case UC_MAPBEATEN:
|
||||
{
|
||||
char *title = G_BuildMapTitle(cond.requirement-1);
|
||||
char *response = va("Beat %s", title);
|
||||
Z_Free(title);
|
||||
title = G_BuildMapTitle(cond.requirement-1);
|
||||
if (title)
|
||||
{
|
||||
response = va("Beat %s", title);
|
||||
Z_Free(title);
|
||||
}
|
||||
return response;
|
||||
}
|
||||
case UC_MAPALLEMERALDS:
|
||||
{
|
||||
char *title = G_BuildMapTitle(cond.requirement-1);
|
||||
char *response = va("Beat %s w/ all emeralds", title);
|
||||
Z_Free(title);
|
||||
title = G_BuildMapTitle(cond.requirement-1);
|
||||
if (title)
|
||||
{
|
||||
response = va("Beat %s w/ all emeralds", title);
|
||||
Z_Free(title);
|
||||
}
|
||||
return response;
|
||||
}
|
||||
case UC_MAPTIME:
|
||||
{
|
||||
char *title = G_BuildMapTitle(cond.extrainfo1-1);
|
||||
char *response = va("Beat %s in %i:%02i.%02i", title,
|
||||
G_TicsToMinutes(cond.requirement, true),
|
||||
G_TicsToSeconds(cond.requirement),
|
||||
G_TicsToCentiseconds(cond.requirement));
|
||||
Z_Free(title);
|
||||
title = G_BuildMapTitle(cond.extrainfo1-1);
|
||||
if (title)
|
||||
{
|
||||
response = va("Beat %s in %i:%02i.%02i", title,
|
||||
G_TicsToMinutes(cond.requirement, true),
|
||||
G_TicsToSeconds(cond.requirement),
|
||||
G_TicsToCentiseconds(cond.requirement));
|
||||
Z_Free(title);
|
||||
}
|
||||
return response;
|
||||
}
|
||||
case UC_TOTALEMBLEMS:
|
||||
@@ -11442,7 +11365,7 @@ static void M_HandleSetupMultiPlayer(INT32 choice)
|
||||
boolean exitmenu = false; // exit to previous menu and send name change
|
||||
const boolean gridselect = (cv_skinselectmenu.value == SKINMENUTYPE_GRID || cv_skinselectmenu.value == SKINMENUTYPE_EXTENDED); // menus with "grids"
|
||||
|
||||
if ((choice == gamecontrol[0][gc_fire][0] || choice == gamecontrol[0][gc_fire][1]) && (itemOn == 2 || (gridselect && itemOn == 1)))
|
||||
if ((choice == gamecontrol[0][gc_fire][0] || choice == gamecontrol[0][gc_fire][1]) && (itemOn == 2 || (gridselect && itemOn == 1 && choice != KEY_ENTER)))
|
||||
choice = KEY_BACKSPACE; // Hack to allow resetting prefcolor on controllers
|
||||
|
||||
#define BREAKWHENLOCKED {\
|
||||
|
||||
+30
-17
@@ -549,6 +549,28 @@ void M_FirstLoadConfig(void)
|
||||
CV_ToggleExecVersion(false);
|
||||
}
|
||||
|
||||
static boolean M_BackupConfig(const char *filename)
|
||||
{
|
||||
char backupfile[MAX_WADPATH+4];
|
||||
|
||||
snprintf(backupfile, sizeof backupfile, "%s.bak", filename);
|
||||
backupfile[sizeof backupfile - 1] = '\0';
|
||||
|
||||
FILE *config = fopen(filename, "r");
|
||||
|
||||
if (config != NULL)
|
||||
{
|
||||
fclose(config);
|
||||
if (FIL_CopyFile(filename, backupfile) == false)
|
||||
{
|
||||
CONS_Alert(CONS_WARNING,"Failed to create a backup of the configuration file. Will not attempt to write to file\n");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Saves the game configuration.
|
||||
*
|
||||
* \sa Command_SaveConfig_f
|
||||
@@ -557,28 +579,11 @@ void M_SaveConfig(const char *filename)
|
||||
{
|
||||
FILE *f;
|
||||
char *filepath;
|
||||
char backupfile[MAX_WADPATH+4];
|
||||
|
||||
// make sure not to write back the config until it's been correctly loaded
|
||||
if (!loaded_config)
|
||||
return;
|
||||
|
||||
// Create backup of the config file
|
||||
snprintf(backupfile, sizeof backupfile, "%s.bak", configfile);
|
||||
backupfile[sizeof backupfile - 1] = '\0';
|
||||
|
||||
FILE *config = fopen(configfile, "r");
|
||||
|
||||
if (config != NULL)
|
||||
{
|
||||
fclose(config);
|
||||
if (FIL_CopyFile(configfile, backupfile) == false)
|
||||
{
|
||||
CONS_Alert(CONS_WARNING,"Failed to create a backup of the configuration file. Will not attempt to write to file\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// can change the file name
|
||||
if (filename)
|
||||
{
|
||||
@@ -595,6 +600,10 @@ void M_SaveConfig(const char *filename)
|
||||
else
|
||||
filepath = Z_StrDup(filename);
|
||||
|
||||
// If failed to backup, do not proceed
|
||||
if (!M_BackupConfig(filepath))
|
||||
return;
|
||||
|
||||
f = fopen(filepath, "w");
|
||||
// change it only if valid
|
||||
if (f)
|
||||
@@ -613,6 +622,10 @@ void M_SaveConfig(const char *filename)
|
||||
return;
|
||||
}
|
||||
|
||||
// If failed to backup, do not proceed
|
||||
if (!M_BackupConfig(configfile))
|
||||
return;
|
||||
|
||||
f = fopen(configfile, "w");
|
||||
if (!f)
|
||||
{
|
||||
|
||||
@@ -26,12 +26,6 @@
|
||||
|
||||
#if defined (STDC_HEADERS) || defined (_LIBC)
|
||||
#include <stdlib.h>
|
||||
#else
|
||||
#ifndef HAVE_MEMCPY
|
||||
#if !(defined (_WIN32) && !defined (__CYGWIN__)) && !defined (__APPLE__)
|
||||
#define memcpy(d, s, n) bcopy ((s), (d), (n))
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "md5.h"
|
||||
|
||||
+8
-3
@@ -3996,7 +3996,10 @@ void A_SignPlayer(mobj_t *actor)
|
||||
if (LUA_CallAction(A_SIGNPLAYER, actor))
|
||||
return;
|
||||
|
||||
if (!actor->target || !actor->target->player)
|
||||
if (!actor->target)
|
||||
return;
|
||||
|
||||
if (!actor->target->player)
|
||||
return;
|
||||
|
||||
// Set the sign to be an appropriate background color for this player's skincolor.
|
||||
@@ -4011,9 +4014,11 @@ void A_SignPlayer(mobj_t *actor)
|
||||
|
||||
// needs - 1 or else it pukes an error out
|
||||
// same thing happens on p_mobj.c
|
||||
if (actor->target->skinlocal)
|
||||
ov->localskin = &localskins[actor->target->player->localskin - 1];
|
||||
else if (actor->target->player->localskin)
|
||||
ov->localskin = &skins[actor->target->player->localskin - 1];
|
||||
ov->skinlocal = actor->target->skinlocal;
|
||||
if (ov->skinlocal || actor->target->player->localskin)
|
||||
ov->localskin = &K_GetSkinArray(ov->skinlocal)[actor->target->player->localskin - 1];
|
||||
|
||||
P_SetMobjState(ov, actor->info->seestate); // S_PLAY_SIGN
|
||||
}
|
||||
|
||||
+20
-53
@@ -452,25 +452,16 @@ void T_MoveElevator(elevator_t *elevator)
|
||||
const fixed_t dh = abs(elevator->sector->floorheight - elevator->floordestheight);
|
||||
|
||||
// Slow down when reaching destination Tails 12-06-2000
|
||||
if (wh < dh)
|
||||
elevator->speed = FixedDiv(wh,25*FRACUNIT) + FRACUNIT/4;
|
||||
else
|
||||
elevator->speed = FixedDiv(dh,25*FRACUNIT) + FRACUNIT/4;
|
||||
elevator->speed = FixedDiv(((wh < dh) ? wh : dh), 25*FRACUNIT) + FRACUNIT/4;
|
||||
|
||||
if (elevator->origspeed)
|
||||
{
|
||||
elevator->speed = FixedMul(elevator->speed,origspeed);
|
||||
if (elevator->speed > elevator->origspeed)
|
||||
elevator->speed = (elevator->origspeed);
|
||||
if (elevator->speed < 1)
|
||||
elevator->speed = 1;
|
||||
elevator->speed = FixedMul(elevator->speed, origspeed);
|
||||
elevator->speed = CLAMP(elevator->speed, 1, elevator->origspeed);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (elevator->speed > 3*FRACUNIT)
|
||||
elevator->speed = 3*FRACUNIT;
|
||||
if (elevator->speed < 1)
|
||||
elevator->speed = 1;
|
||||
elevator->speed = CLAMP(elevator->speed, 1, 3*FRACUNIT);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -513,26 +504,18 @@ void T_MoveElevator(elevator_t *elevator)
|
||||
const fixed_t origspeed = FixedDiv(elevator->origspeed,(ELEVATORSPEED/2));
|
||||
const fixed_t wc = abs(elevator->sector->ceilingheight - elevator->ceilingwasheight);
|
||||
const fixed_t dc = abs(elevator->sector->ceilingheight - elevator->ceilingdestheight);
|
||||
|
||||
// Slow down when reaching destination Tails 12-06-2000
|
||||
if (wc < dc)
|
||||
elevator->speed = FixedDiv(wc,25*FRACUNIT) + FRACUNIT/4;
|
||||
else
|
||||
elevator->speed = FixedDiv(dc,25*FRACUNIT) + FRACUNIT/4;
|
||||
elevator->speed = FixedDiv(((wc < dc) ? wc : dc), 25*FRACUNIT) + FRACUNIT/4;
|
||||
|
||||
if (elevator->origspeed)
|
||||
{
|
||||
elevator->speed = FixedMul(elevator->speed,origspeed);
|
||||
if (elevator->speed > elevator->origspeed)
|
||||
elevator->speed = (elevator->origspeed);
|
||||
if (elevator->speed < 1)
|
||||
elevator->speed = 1;
|
||||
elevator->speed = FixedMul(elevator->speed, origspeed);
|
||||
elevator->speed = CLAMP(elevator->speed, 1, elevator->origspeed);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (elevator->speed > 3*FRACUNIT)
|
||||
elevator->speed = 3*FRACUNIT;
|
||||
if (elevator->speed < 1)
|
||||
elevator->speed = 1;
|
||||
elevator->speed = CLAMP(elevator->speed, 1, 3*FRACUNIT);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -571,11 +554,7 @@ void T_MoveElevator(elevator_t *elevator)
|
||||
else
|
||||
res = res1;
|
||||
}
|
||||
/*
|
||||
// make floor move sound
|
||||
if (!(leveltime&7))
|
||||
S_StartSound(&elevator->sector->soundorg, sfx_stnmov);
|
||||
*/
|
||||
|
||||
if (res == pastdest || res == crushed) // if destination height acheived
|
||||
{
|
||||
if (elevator->type == elevateContinuous)
|
||||
@@ -608,7 +587,6 @@ void T_MoveElevator(elevator_t *elevator)
|
||||
elevator->ceilingdestheight =
|
||||
elevator->floordestheight + elevator->sector->ceilingheight - elevator->sector->floorheight;
|
||||
}
|
||||
// T_MoveElevator(elevator);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -638,7 +616,6 @@ void T_MoveElevator(elevator_t *elevator)
|
||||
elevator->ceilingdestheight =
|
||||
elevator->floordestheight + elevator->sector->ceilingheight - elevator->sector->floorheight;
|
||||
}
|
||||
// T_MoveElevator(elevator);
|
||||
}
|
||||
elevator->delaytimer = elevator->delay;
|
||||
}
|
||||
@@ -651,9 +628,8 @@ void T_MoveElevator(elevator_t *elevator)
|
||||
P_RemoveThinker(&elevator->thinker); // remove elevator from actives
|
||||
dontupdate = true;
|
||||
}
|
||||
// make floor stop sound
|
||||
// S_StartSound(&elevator->sector->soundorg, sfx_pstop);
|
||||
}
|
||||
|
||||
if (!dontupdate)
|
||||
{
|
||||
elevator->sector->floorspeed = elevator->speed*elevator->direction;
|
||||
@@ -2154,10 +2130,7 @@ void T_EachTimeThinker(levelspecthink_t *eachtime)
|
||||
if (!playeringame[j])
|
||||
continue;
|
||||
|
||||
if (!players[j].mo)
|
||||
continue;
|
||||
|
||||
if (players[j].mo->health <= 0)
|
||||
if (!players[j].mo || (players[j].mo->health <= 0))
|
||||
continue;
|
||||
|
||||
if ((netgame || multiplayer) && players[j].spectator)
|
||||
@@ -2168,6 +2141,7 @@ void T_EachTimeThinker(levelspecthink_t *eachtime)
|
||||
else if (sec->flags & SF_TRIGGERSPECIAL_TOUCH)
|
||||
{
|
||||
boolean insector = false;
|
||||
|
||||
for (node = players[j].mo->touching_sectorlist; node; node = node->m_sectorlist_next)
|
||||
{
|
||||
if (node->m_sector == targetsec)
|
||||
@@ -2176,6 +2150,7 @@ void T_EachTimeThinker(levelspecthink_t *eachtime)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!insector)
|
||||
continue;
|
||||
}
|
||||
@@ -2220,10 +2195,7 @@ void T_EachTimeThinker(levelspecthink_t *eachtime)
|
||||
if (!playeringame[i])
|
||||
continue;
|
||||
|
||||
if (!players[i].mo)
|
||||
continue;
|
||||
|
||||
if (players[i].mo->health <= 0)
|
||||
if (!players[i].mo || (players[i].mo->health <= 0))
|
||||
continue;
|
||||
|
||||
if ((netgame || multiplayer) && players[i].spectator)
|
||||
@@ -2234,6 +2206,7 @@ void T_EachTimeThinker(levelspecthink_t *eachtime)
|
||||
else if (sec->flags & SF_TRIGGERSPECIAL_TOUCH)
|
||||
{
|
||||
boolean insector = false;
|
||||
|
||||
for (node = players[i].mo->touching_sectorlist; node; node = node->m_sectorlist_next)
|
||||
{
|
||||
if (node->m_sector == sec)
|
||||
@@ -2242,6 +2215,7 @@ void T_EachTimeThinker(levelspecthink_t *eachtime)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!insector)
|
||||
continue;
|
||||
}
|
||||
@@ -2302,10 +2276,7 @@ void T_EachTimeThinker(levelspecthink_t *eachtime)
|
||||
if (!playeringame[i])
|
||||
continue;
|
||||
|
||||
if (!players[i].mo)
|
||||
continue;
|
||||
|
||||
if (players[i].mo->health <= 0)
|
||||
if (!players[i].mo || (players[i].mo->health <= 0))
|
||||
continue;
|
||||
|
||||
if ((netgame || multiplayer) && players[i].spectator)
|
||||
@@ -2359,11 +2330,7 @@ void T_RaiseSector(levelspecthink_t *raise)
|
||||
{
|
||||
thing = node->m_thing;
|
||||
|
||||
if (!thing->player)
|
||||
continue;
|
||||
|
||||
// Ignore spectators.
|
||||
if (thing->player && thing->player->spectator)
|
||||
if (!thing->player || thing->player->spectator) // Ignore spectators.
|
||||
continue;
|
||||
|
||||
// Option to require spindashing.
|
||||
@@ -2956,6 +2923,7 @@ void EV_CrumbleChain(sector_t *sec, ffloor_t *rover)
|
||||
if (R_PointInSubsector(a, b)->sector == sec)
|
||||
{
|
||||
mobj_t *spawned = NULL;
|
||||
|
||||
for (c = topz; c > *rover->bottomheight; c -= spacing)
|
||||
{
|
||||
spawned = P_SpawnMobj(a, b, c, type);
|
||||
@@ -3120,7 +3088,6 @@ INT32 EV_StartCrumble(sector_t *sec, ffloor_t *rover, boolean floating,
|
||||
for (i = -1; (i = P_FindSectorFromTag(elevator->sourceline->tag, i)) >= 0 ;)
|
||||
{
|
||||
foundsec = §ors[i];
|
||||
|
||||
P_SpawnMobj(foundsec->soundorg.x, foundsec->soundorg.y, elevator->direction == 1 ? elevator->sector->floorheight : elevator->sector->ceilingheight, MT_CRUMBLEOBJ);
|
||||
}
|
||||
|
||||
|
||||
+23
-167
@@ -37,62 +37,6 @@
|
||||
#define CTFTEAMCODE(pl) pl->ctfteam ? (pl->ctfteam == 1 ? "\x85" : "\x84") : ""
|
||||
#define CTFTEAMENDCODE(pl) pl->ctfteam ? "\x80" : ""
|
||||
|
||||
void P_ForceFeed(const player_t *player, INT32 attack, INT32 fade, tic_t duration, INT32 period)
|
||||
{
|
||||
BasicFF_t Basicfeed;
|
||||
if (!player)
|
||||
return;
|
||||
Basicfeed.Duration = (UINT32)(duration * (100L/TICRATE));
|
||||
Basicfeed.ForceX = Basicfeed.ForceY = 1;
|
||||
Basicfeed.Gain = 25000;
|
||||
Basicfeed.Magnitude = period*10;
|
||||
Basicfeed.player = player;
|
||||
/// \todo test FFB
|
||||
P_RampConstant(&Basicfeed, attack, fade);
|
||||
}
|
||||
|
||||
void P_ForceConstant(const BasicFF_t *FFInfo)
|
||||
{
|
||||
JoyFF_t ConstantQuake;
|
||||
if (!FFInfo || !FFInfo->player)
|
||||
return;
|
||||
ConstantQuake.ForceX = FFInfo->ForceX;
|
||||
ConstantQuake.ForceY = FFInfo->ForceY;
|
||||
ConstantQuake.Duration = FFInfo->Duration;
|
||||
ConstantQuake.Gain = FFInfo->Gain;
|
||||
ConstantQuake.Magnitude = FFInfo->Magnitude;
|
||||
if (FFInfo->player == &players[consoleplayer])
|
||||
I_Tactile(ConstantForce, &ConstantQuake);
|
||||
else if (splitscreen && FFInfo->player == &players[displayplayers[1]])
|
||||
I_Tactile2(ConstantForce, &ConstantQuake);
|
||||
else if (splitscreen > 1 && FFInfo->player == &players[displayplayers[2]])
|
||||
I_Tactile3(ConstantForce, &ConstantQuake);
|
||||
else if (splitscreen > 2 && FFInfo->player == &players[displayplayers[3]])
|
||||
I_Tactile4(ConstantForce, &ConstantQuake);
|
||||
}
|
||||
void P_RampConstant(const BasicFF_t *FFInfo, INT32 Start, INT32 End)
|
||||
{
|
||||
JoyFF_t RampQuake;
|
||||
if (!FFInfo || !FFInfo->player)
|
||||
return;
|
||||
RampQuake.ForceX = FFInfo->ForceX;
|
||||
RampQuake.ForceY = FFInfo->ForceY;
|
||||
RampQuake.Duration = FFInfo->Duration;
|
||||
RampQuake.Gain = FFInfo->Gain;
|
||||
RampQuake.Magnitude = FFInfo->Magnitude;
|
||||
RampQuake.Start = Start;
|
||||
RampQuake.End = End;
|
||||
if (FFInfo->player == &players[consoleplayer])
|
||||
I_Tactile(ConstantForce, &RampQuake);
|
||||
else if (splitscreen && FFInfo->player == &players[displayplayers[1]])
|
||||
I_Tactile2(ConstantForce, &RampQuake);
|
||||
else if (splitscreen > 1 && FFInfo->player == &players[displayplayers[2]])
|
||||
I_Tactile3(ConstantForce, &RampQuake);
|
||||
else if (splitscreen > 2 && FFInfo->player == &players[displayplayers[3]])
|
||||
I_Tactile4(ConstantForce, &RampQuake);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// GET STUFF
|
||||
//
|
||||
@@ -107,9 +51,6 @@ boolean P_CanPickupItem(player_t *player, UINT8 weapon)
|
||||
if (player->exiting || mapreset)
|
||||
return false;
|
||||
|
||||
/*if (G_BattleGametype() && player->kartstuff[k_bumper] <= 0) // No bumpers in Match
|
||||
return false;*/
|
||||
|
||||
if (weapon)
|
||||
{
|
||||
// Item slot already taken up
|
||||
@@ -165,26 +106,14 @@ void P_DoNightsScore(player_t *player)
|
||||
return; // Don't do any fancy shit for failures.
|
||||
|
||||
dummymo = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z+player->mo->height/2, MT_NIGHTSCORE);
|
||||
|
||||
if (player->bot)
|
||||
player = &players[consoleplayer];
|
||||
|
||||
if (G_IsSpecialStage(gamemap)) // Global link count? Maybe not a good idea...
|
||||
{
|
||||
INT32 i;
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
if (playeringame[i])
|
||||
{
|
||||
if (++players[i].linkcount > players[i].maxlink)
|
||||
players[i].maxlink = players[i].linkcount;
|
||||
players[i].linktimer = 2*TICRATE;
|
||||
}
|
||||
}
|
||||
else // Individual link counts
|
||||
{
|
||||
if (++player->linkcount > player->maxlink)
|
||||
player->maxlink = player->linkcount;
|
||||
player->linktimer = 2*TICRATE;
|
||||
}
|
||||
// Individual link counts
|
||||
if (++player->linkcount > player->maxlink)
|
||||
player->maxlink = player->linkcount;
|
||||
player->linktimer = 2*TICRATE;
|
||||
|
||||
if (player->linkcount < 10)
|
||||
{
|
||||
@@ -214,12 +143,10 @@ void P_DoNightsScore(player_t *player)
|
||||
}
|
||||
|
||||
// Hoops are the only things that should add to your drill meter
|
||||
//player->drillmeter += TICRATE;
|
||||
dummymo->momz = FRACUNIT;
|
||||
dummymo->fuse = 3*TICRATE;
|
||||
|
||||
// What?! NO, don't use the camera! Scale up instead!
|
||||
//P_InstaThrust(dummymo, R_PointToAngle2(dummymo->x, dummymo->y, camera[0].x, camera[0].y), 3*FRACUNIT);
|
||||
dummymo->scalespeed = FRACUNIT/25;
|
||||
dummymo->destscale = 2*FRACUNIT;
|
||||
}
|
||||
@@ -374,7 +301,6 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||
else
|
||||
{
|
||||
K_DropItems(player); //K_StripItems(player);
|
||||
//K_StripOther(player);
|
||||
player->kartstuff[k_itemroulette] = 1;
|
||||
player->kartstuff[k_roulettetype] = 2;
|
||||
}
|
||||
@@ -521,8 +447,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||
|
||||
special->target->player->kartstuff[k_comebacktimer] = comebacktime;
|
||||
|
||||
K_DropItems(player); //K_StripItems(player);
|
||||
//K_StripOther(player);
|
||||
K_DropItems(player);
|
||||
|
||||
player->kartstuff[k_itemroulette] = 1;
|
||||
player->kartstuff[k_roulettetype] = 2;
|
||||
@@ -554,7 +479,6 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||
|
||||
if (player->kartstuff[k_invincibilitytimer] > 0 || player->kartstuff[k_growshrinktimer] > 0 || player->kartstuff[k_hyudorotimer] > 0)
|
||||
{
|
||||
//player->powers[pw_flashing] = 0;
|
||||
K_DropHnextList(player);
|
||||
K_StripItems(player);
|
||||
}
|
||||
@@ -842,8 +766,6 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||
return;
|
||||
if (special->fuse == 1)
|
||||
return;
|
||||
// if (special->momz > 0)
|
||||
// return;
|
||||
{
|
||||
UINT8 flagteam = (special->type == MT_REDFLAG) ? 1 : 2;
|
||||
const char *flagtext;
|
||||
@@ -964,14 +886,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||
}
|
||||
return;
|
||||
case MT_NIGHTSWING:
|
||||
if (G_IsSpecialStage(gamemap) && useNightsSS)
|
||||
{ // Pseudo-ring.
|
||||
S_StartSound(toucher, special->info->painsound);
|
||||
player->totalring++;
|
||||
}
|
||||
else
|
||||
S_StartSound(toucher, special->info->activesound);
|
||||
|
||||
S_StartSound(toucher, special->info->activesound);
|
||||
P_DoNightsScore(player);
|
||||
break;
|
||||
case MT_HOOPCOLLIDE:
|
||||
@@ -1002,13 +917,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||
|
||||
// Hoops are the only things that should add to the drill meter
|
||||
// Also, one tic's worth of drill is too much.
|
||||
if (G_IsSpecialStage(gamemap))
|
||||
{
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
if (playeringame[i] && players[i].pflags & PF_NIGHTSMODE)
|
||||
players[i].drillmeter += TICRATE/2;
|
||||
}
|
||||
else if (player->bot)
|
||||
if (player->bot)
|
||||
players[consoleplayer].drillmeter += TICRATE/2;
|
||||
else
|
||||
player->drillmeter += TICRATE/2;
|
||||
@@ -1293,31 +1202,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||
P_SetMobjState(special, special->info->deathstate);
|
||||
return;
|
||||
case MT_SPECIALSPIKEBALL:
|
||||
if (!(!useNightsSS && G_IsSpecialStage(gamemap))) // Only for old special stages
|
||||
{
|
||||
P_DamageMobj(toucher, special, special, 1);
|
||||
return;
|
||||
}
|
||||
|
||||
if (player->powers[pw_invulnerability] || player->powers[pw_flashing]
|
||||
|| (player->powers[pw_super] && !(ALL7EMERALDS(player->powers[pw_emeralds]))))
|
||||
return;
|
||||
if (player->powers[pw_shield] || player->bot) //If One-Hit Shield
|
||||
{
|
||||
P_RemoveShield(player);
|
||||
S_StartSound(toucher, sfx_shldls); // Ba-Dum! Shield loss.
|
||||
}
|
||||
else
|
||||
{
|
||||
P_PlayRinglossSound(toucher, NULL);
|
||||
if (toucher->health > 10)
|
||||
toucher->health -= 10;
|
||||
else
|
||||
toucher->health = 1;
|
||||
player->health = toucher->health;
|
||||
}
|
||||
|
||||
P_DoPlayerPain(player, special, NULL);
|
||||
P_DamageMobj(toucher, special, special, 1);
|
||||
return;
|
||||
case MT_EGGMOBILE2_POGO:
|
||||
// sanity checks
|
||||
@@ -1614,9 +1499,6 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source)
|
||||
mobj_t *mo;
|
||||
int ms;
|
||||
|
||||
if (!useNightsSS && G_IsSpecialStage(gamemap) && target->player && sstimer > 6)
|
||||
sstimer = 6; // Just let P_Ticker take care of the rest.
|
||||
|
||||
if (target->flags & (MF_ENEMY|MF_BOSS))
|
||||
target->momx = target->momy = target->momz = 0;
|
||||
|
||||
@@ -1720,20 +1602,6 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source)
|
||||
target->flags |= MF_NOBLOCKMAP|MF_NOCLIPHEIGHT;
|
||||
P_SetThingPosition(target);
|
||||
|
||||
if (!target->player->bot && !G_IsSpecialStage(gamemap)
|
||||
&& G_GametypeUsesLives())
|
||||
{
|
||||
target->player->lives -= 1; // Lose a life Tails 03-11-2000
|
||||
|
||||
if (target->player->lives <= 0) // Tails 03-14-2000
|
||||
{
|
||||
if (P_IsLocalPlayer(target->player)/* && target->player == &players[consoleplayer] */)
|
||||
{
|
||||
S_StopMusic(); // Stop the Music! Tails 03-14-2000
|
||||
S_ChangeMusicInternal("gmover", false); // Yousa dead now, Okieday? Tails 03-14-2000
|
||||
}
|
||||
}
|
||||
}
|
||||
target->player->playerstate = PST_DEAD;
|
||||
|
||||
if (cv_birdmusic.value && cv_fading.value && P_IsLocalPlayer(target->player))
|
||||
@@ -2252,7 +2120,7 @@ static inline boolean P_PlayerHitsPlayer(mobj_t *target, mobj_t *inflictor, mobj
|
||||
return true;
|
||||
}
|
||||
|
||||
static void P_KillPlayer(player_t *player, mobj_t *source, INT32 damage)
|
||||
static void P_KillPlayer(player_t *player, mobj_t *source)
|
||||
{
|
||||
player->pflags &= ~(PF_CARRIED|PF_SLIDING|PF_ITEMHANG|PF_MACESPIN|PF_ROPEHANG|PF_NIGHTSMODE);
|
||||
|
||||
@@ -2271,8 +2139,6 @@ static void P_KillPlayer(player_t *player, mobj_t *source, INT32 damage)
|
||||
// Get rid of emeralds
|
||||
player->powers[pw_emeralds] = 0;
|
||||
|
||||
P_ForceFeed(player, 40, 10, TICRATE, 40 + min(damage, 100)*2);
|
||||
|
||||
P_ResetPlayer(player);
|
||||
|
||||
P_SetPlayerMobjState(player->mo, player->mo->info->deathstate);
|
||||
@@ -2337,14 +2203,12 @@ void P_RemoveShield(player_t *player)
|
||||
player->powers[pw_shield] = player->powers[pw_shield] & SH_STACK;
|
||||
}
|
||||
|
||||
static void P_RingDamage(player_t *player, mobj_t *inflictor, mobj_t *source, INT32 damage)
|
||||
static void P_RingDamage(player_t *player, mobj_t *inflictor, mobj_t *source)
|
||||
{
|
||||
if (!(inflictor && ((inflictor->flags & MF_MISSILE) || inflictor->player) && player->powers[pw_super] && ALL7EMERALDS(player->powers[pw_emeralds])))
|
||||
{
|
||||
P_DoPlayerPain(player, source, inflictor);
|
||||
|
||||
P_ForceFeed(player, 40, 10, TICRATE, 40 + min(damage, 100)*2);
|
||||
|
||||
if (source && (source->type == MT_SPIKE || (source->type == MT_NULL && source->threshold == 43))) // spikes
|
||||
S_StartSound(player->mo, sfx_spkdth);
|
||||
}
|
||||
@@ -2378,10 +2242,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|
||||
return false;
|
||||
|
||||
// well no clue but this may happen ig
|
||||
if (!target)
|
||||
return false;
|
||||
|
||||
if (target->health <= 0)
|
||||
if (!target || (target->health <= 0))
|
||||
return false;
|
||||
|
||||
// Spectator handling
|
||||
@@ -2403,6 +2264,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|
||||
|
||||
if (P_MobjWasRemoved(target))
|
||||
return (shouldForce == 1); // mobj was removed
|
||||
|
||||
if (shouldForce == 1)
|
||||
force = true;
|
||||
else if (shouldForce == 2)
|
||||
@@ -2543,7 +2405,8 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|
||||
|
||||
// Instant-Death
|
||||
if (damage == DMG_INSTAKILL)
|
||||
P_KillPlayer(player, source, damage);
|
||||
P_KillPlayer(player, source);
|
||||
|
||||
else if (player->kartstuff[k_invincibilitytimer] > 0 || player->kartstuff[k_growshrinktimer] > 0 || player->powers[pw_flashing])
|
||||
{
|
||||
if (!force) // shoulddamage bypasses all of that.
|
||||
@@ -2561,8 +2424,9 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|
||||
player->kartstuff[k_sneakertimer] = 0;
|
||||
K_SpinPlayer(player, source, 1, inflictor, false);
|
||||
damage = player->mo->health - 1;
|
||||
P_RingDamage(player, inflictor, source, damage);
|
||||
P_RingDamage(player, inflictor, source);
|
||||
P_PlayerRingBurst(player, 5);
|
||||
|
||||
if (P_IsLocalPlayer(player))
|
||||
{
|
||||
P_StartQuake(5, 32<<FRACBITS, 0);
|
||||
@@ -2572,6 +2436,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|
||||
{
|
||||
K_SpinPlayer(player, source, 0, inflictor, false);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -2605,8 +2470,6 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|
||||
|
||||
if (player->health < 0)
|
||||
player->health = 0;
|
||||
|
||||
P_ForceFeed(player, 40, 10, TICRATE, 40 + min(damage, 100)*2);
|
||||
}
|
||||
|
||||
// Killing dead. Just for kicks.
|
||||
@@ -2640,19 +2503,11 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (target->type)
|
||||
{
|
||||
case MT_EGGMOBILE2: // egg slimer
|
||||
if (target->health < target->info->damage) // in pinch phase
|
||||
{
|
||||
P_SetMobjState(target, target->info->meleestate); // go to pinch pain state
|
||||
break;
|
||||
}
|
||||
/* FALLTHRU */
|
||||
default:
|
||||
// egg slimer
|
||||
if (target->type == MT_EGGMOBILE2 && (target->health < target->info->damage)) // in pinch phase
|
||||
P_SetMobjState(target, target->info->meleestate); // go to pinch pain state
|
||||
else
|
||||
P_SetMobjState(target, target->info->painstate);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!P_MobjWasRemoved(target))
|
||||
@@ -2664,6 +2519,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|
||||
// if not intent on another player,
|
||||
// chase after this one
|
||||
P_SetTarget(&target->target, source);
|
||||
|
||||
if (target->state == &states[target->info->spawnstate] && target->info->seestate != S_NULL)
|
||||
{
|
||||
if (player)
|
||||
|
||||
@@ -433,25 +433,11 @@ extern struct minimapinfo
|
||||
//
|
||||
// P_INTER
|
||||
//
|
||||
typedef struct BasicFF_s
|
||||
{
|
||||
INT32 ForceX; ///< The X of the Force's Vel
|
||||
INT32 ForceY; ///< The Y of the Force's Vel
|
||||
const player_t *player; ///< Player of Rumble
|
||||
//All
|
||||
UINT32 Duration; ///< The total duration of the effect, in microseconds
|
||||
INT32 Gain; ///< /The gain to be applied to the effect, in the range from 0 through 10,000.
|
||||
//All, CONSTANTFORCE �10,000 to 10,000
|
||||
INT32 Magnitude; ///< Magnitude of the effect, in the range from 0 through 10,000.
|
||||
} BasicFF_t;
|
||||
|
||||
// replace damage magic numbers with smth readable
|
||||
#define DMG_INSTAKILL 10000
|
||||
#define DMG_SPECTATOR 42000
|
||||
|
||||
void P_ForceFeed(const player_t *player, INT32 attack, INT32 fade, tic_t duration, INT32 period);
|
||||
void P_ForceConstant(const BasicFF_t *FFInfo);
|
||||
void P_RampConstant(const BasicFF_t *FFInfo, INT32 Start, INT32 End);
|
||||
void P_RemoveShield(player_t *player);
|
||||
boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage);
|
||||
void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source);
|
||||
@@ -488,7 +474,6 @@ boolean P_Teleport(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z, angle_t angle
|
||||
boolean P_SetMobjStateNF(mobj_t *mobj, statenum_t state);
|
||||
boolean P_CheckMissileSpawn(mobj_t *th);
|
||||
void P_Thrust(mobj_t *mo, angle_t angle, fixed_t move);
|
||||
void P_DoSuperTransformation(player_t *player, boolean giverings);
|
||||
void P_ExplodeMissile(mobj_t *mo);
|
||||
void P_CheckGravity(mobj_t *mo, boolean affect);
|
||||
|
||||
|
||||
+22
-40
@@ -333,11 +333,11 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
||||
return true;
|
||||
|
||||
#ifdef SEENAMES
|
||||
// Do name checks all the way up here
|
||||
// So that NOTHING ELSE can see MT_NAMECHECK because it is client-side.
|
||||
// Do name checks all the way up here
|
||||
// So that NOTHING ELSE can see MT_NAMECHECK because it is client-side.
|
||||
if (tmthing->type == MT_NAMECHECK)
|
||||
{
|
||||
// Ignore things that aren't players, ignore spectators, ignore yourself.
|
||||
// Ignore things that aren't players, ignore spectators, ignore yourself.
|
||||
// (also don't bother to check that tmthing->target->player is non-NULL because we're not actually using it here.)
|
||||
if (!thing->player || thing->player->spectator || (tmthing->target && thing->player == tmthing->target->player))
|
||||
return true;
|
||||
@@ -505,17 +505,15 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
||||
// check for skulls slamming into things
|
||||
if (tmthing->flags2 & MF2_SKULLFLY)
|
||||
{
|
||||
{
|
||||
// see if it went over / under
|
||||
if (tmthing->z > thing->z + thing->height)
|
||||
return true; // overhead
|
||||
if (tmthing->z + tmthing->height < thing->z)
|
||||
return true; // underneath
|
||||
// see if it went over / under
|
||||
if (tmthing->z > thing->z + thing->height)
|
||||
return true; // overhead
|
||||
if (tmthing->z + tmthing->height < thing->z)
|
||||
return true; // underneath
|
||||
|
||||
tmthing->flags2 &= ~MF2_SKULLFLY;
|
||||
tmthing->momx = tmthing->momy = tmthing->momz = 0;
|
||||
return false; // stop moving
|
||||
}
|
||||
tmthing->flags2 &= ~MF2_SKULLFLY;
|
||||
tmthing->momx = tmthing->momy = tmthing->momz = 0;
|
||||
return false; // stop moving
|
||||
}
|
||||
|
||||
// SRB2kart 011617 - Colission[sic] code for kart items //{
|
||||
@@ -543,10 +541,6 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
||||
if (thing->health)
|
||||
P_KillMobj(thing, tmthing, tmthing);
|
||||
|
||||
/*if (tmthing->player && (tmthing->player->kartstuff[k_invincibilitytimer] > 0
|
||||
|| tmthing->player->kartstuff[k_growshrinktimer] > 0))
|
||||
return true;*/
|
||||
|
||||
K_KartBouncing(tmthing, thing, false, true);
|
||||
return false;
|
||||
}
|
||||
@@ -729,7 +723,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
||||
if (tmthing->z + tmthing->height < thing->z)
|
||||
return true; // underneath
|
||||
|
||||
if (!(thing->type == MT_PLAYER))
|
||||
if (thing->type != MT_PLAYER)
|
||||
return true;
|
||||
|
||||
if (thing->player && thing->player->powers[pw_flashing])
|
||||
@@ -1749,7 +1743,7 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
|
||||
if (!(rover->flags & FF_EXISTS))
|
||||
continue;
|
||||
|
||||
topheight = P_GetFOFTopZ(thing, newsubsec->sector, rover, x, y, NULL);
|
||||
topheight = P_GetFOFTopZ(thing, newsubsec->sector, rover, x, y, NULL);
|
||||
bottomheight = P_GetFOFBottomZ(thing, newsubsec->sector, rover, x, y, NULL);
|
||||
|
||||
if ((rover->flags & (FF_SWIMMABLE|FF_GOOWATER)) == (FF_SWIMMABLE|FF_GOOWATER) && !(thing->flags & MF_NOGRAVITY))
|
||||
@@ -1771,14 +1765,16 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
|
||||
// Land on the top or the bottom, depending on gravity flip.
|
||||
if (!(thing->eflags & MFE_VERTICALFLIP) && thing->z >= topheight - sinklevel && thing->momz <= 0)
|
||||
{
|
||||
if (tmfloorz < topheight - sinklevel) {
|
||||
if (tmfloorz < topheight - sinklevel)
|
||||
{
|
||||
tmfloorz = topheight - sinklevel;
|
||||
tmfloorslope = *rover->t_slope;
|
||||
}
|
||||
}
|
||||
else if (thing->eflags & MFE_VERTICALFLIP && thingtop <= bottomheight + sinklevel && thing->momz >= 0)
|
||||
{
|
||||
if (tmceilingz > bottomheight + sinklevel) {
|
||||
if (tmceilingz > bottomheight + sinklevel)
|
||||
{
|
||||
tmceilingz = bottomheight + sinklevel;
|
||||
tmceilingslope = *rover->b_slope;
|
||||
}
|
||||
@@ -1800,7 +1796,8 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
|
||||
{
|
||||
if (thing->z < topheight && bottomheight < thingtop)
|
||||
{
|
||||
if (tmfloorz < thing->z) {
|
||||
if (tmfloorz < thing->z)
|
||||
{
|
||||
tmfloorz = thing->z;
|
||||
tmfloorslope = NULL;
|
||||
}
|
||||
@@ -1820,6 +1817,7 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
|
||||
tmfloorz = tmdropoffz = topheight;
|
||||
tmfloorslope = *rover->t_slope;
|
||||
}
|
||||
|
||||
if (bottomheight < tmceilingz && abs(delta1) >= abs(delta2)
|
||||
&& !(rover->flags & FF_PLATFORM)
|
||||
&& !(thing->type == MT_SKIM && (rover->flags & FF_SWIMMABLE)))
|
||||
@@ -2175,7 +2173,6 @@ boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam)
|
||||
subsector_t *s;
|
||||
|
||||
boolean retval = true;
|
||||
boolean itsatwodlevel = false;
|
||||
UINT8 i;
|
||||
|
||||
floatok = false;
|
||||
@@ -2188,22 +2185,7 @@ boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam)
|
||||
else
|
||||
s = thiscam->subsector;
|
||||
|
||||
if (twodlevel)
|
||||
itsatwodlevel = true;
|
||||
else
|
||||
{
|
||||
for (i = 0; i <= splitscreen; i++)
|
||||
{
|
||||
if (thiscam == &camera[i] && players[displayplayers[i]].mo
|
||||
&& (players[displayplayers[i]].mo->flags2 & MF2_TWOD))
|
||||
{
|
||||
itsatwodlevel = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!itsatwodlevel && players[displayplayers[0]].mo)
|
||||
if (players[displayplayers[0]].mo)
|
||||
{
|
||||
fixed_t tryx = thiscam->x;
|
||||
fixed_t tryy = thiscam->y;
|
||||
@@ -2270,7 +2252,7 @@ boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam)
|
||||
}
|
||||
else
|
||||
{
|
||||
tmfloorz = P_CameraGetFloorZ(thiscam, thiscam->subsector->sector, x, y, NULL);
|
||||
tmfloorz = P_CameraGetFloorZ(thiscam, thiscam->subsector->sector, x, y, NULL);
|
||||
tmceilingz = P_CameraGetCeilingZ(thiscam, thiscam->subsector->sector, x, y, NULL);
|
||||
}
|
||||
|
||||
|
||||
+32
-106
@@ -1124,9 +1124,6 @@ void P_CheckGravity(mobj_t *mo, boolean affect)
|
||||
}
|
||||
}
|
||||
|
||||
#define STOPSPEED (FRACUNIT)
|
||||
//#define FRICTION (ORIG_FRICTION) // 0.90625
|
||||
|
||||
//
|
||||
// P_SceneryXYFriction
|
||||
//
|
||||
@@ -1135,8 +1132,8 @@ static void P_SceneryXYFriction(mobj_t *mo, fixed_t oldx, fixed_t oldy)
|
||||
I_Assert(mo != NULL);
|
||||
I_Assert(!P_MobjWasRemoved(mo));
|
||||
|
||||
if (abs(mo->momx) < FixedMul(STOPSPEED/32, mo->scale)
|
||||
&& abs(mo->momy) < FixedMul(STOPSPEED/32, mo->scale))
|
||||
if (abs(mo->momx) < FixedMul(FRACUNIT/32, mo->scale)
|
||||
&& abs(mo->momy) < FixedMul(FRACUNIT/32, mo->scale))
|
||||
{
|
||||
mo->momx = 0;
|
||||
mo->momy = 0;
|
||||
@@ -1145,13 +1142,13 @@ static void P_SceneryXYFriction(mobj_t *mo, fixed_t oldx, fixed_t oldy)
|
||||
{
|
||||
if ((oldx == mo->x) && (oldy == mo->y)) // didn't go anywhere
|
||||
{
|
||||
mo->momx = FixedMul(mo->momx,ORIG_FRICTION);
|
||||
mo->momy = FixedMul(mo->momy,ORIG_FRICTION);
|
||||
mo->momx = FixedMul(mo->momx, ORIG_FRICTION);
|
||||
mo->momy = FixedMul(mo->momy, ORIG_FRICTION);
|
||||
}
|
||||
else
|
||||
{
|
||||
mo->momx = FixedMul(mo->momx,mo->friction);
|
||||
mo->momy = FixedMul(mo->momy,mo->friction);
|
||||
mo->momx = FixedMul(mo->momx, mo->friction);
|
||||
mo->momy = FixedMul(mo->momy, mo->friction);
|
||||
}
|
||||
|
||||
if (mo->type == MT_CANNONBALLDECOR)
|
||||
@@ -1183,12 +1180,12 @@ static void P_XYFriction(mobj_t *mo, fixed_t oldx, fixed_t oldy)
|
||||
// spinning friction
|
||||
if (player->pflags & PF_SPINNING && (player->rmomx || player->rmomy) && !(player->pflags & PF_STARTDASH))
|
||||
{
|
||||
const fixed_t ns = FixedDiv(549*ORIG_FRICTION,500*FRACUNIT); //const fixed_t ns = FixedDiv(549*FRICTION,500*FRACUNIT);
|
||||
const fixed_t ns = FixedDiv(549*ORIG_FRICTION, 500*FRACUNIT); //const fixed_t ns = FixedDiv(549*FRICTION,500*FRACUNIT);
|
||||
mo->momx = FixedMul(mo->momx, ns);
|
||||
mo->momy = FixedMul(mo->momy, ns);
|
||||
}
|
||||
else if (abs(player->rmomx) < FixedMul(STOPSPEED, mo->scale)
|
||||
&& abs(player->rmomy) < FixedMul(STOPSPEED, mo->scale)
|
||||
else if (abs(player->rmomx) < FixedMul(FRACUNIT, mo->scale)
|
||||
&& abs(player->rmomy) < FixedMul(FRACUNIT, mo->scale)
|
||||
&& (!(player->cmd.forwardmove && !(twodlevel || mo->flags2 & MF2_TWOD)) && !player->cmd.sidemove && !(player->pflags & PF_SPINNING))
|
||||
&& !(player->mo->standingslope && (!(player->mo->standingslope->flags & SL_NOPHYSICS)) && (abs(player->mo->standingslope->zdelta) >= FRACUNIT/2))
|
||||
)
|
||||
@@ -2242,9 +2239,9 @@ static boolean P_ZMovement(mobj_t *mo)
|
||||
|
||||
if (mo->type == MT_BIGTUMBLEWEED || mo->type == MT_LITTLETUMBLEWEED)
|
||||
{
|
||||
if (abs(mom.x) < FixedMul(STOPSPEED, mo->scale)
|
||||
&& abs(mom.y) < FixedMul(STOPSPEED, mo->scale)
|
||||
&& abs(mom.z) < FixedMul(STOPSPEED*3, mo->scale))
|
||||
if (abs(mom.x) < FixedMul(FRACUNIT, mo->scale)
|
||||
&& abs(mom.y) < FixedMul(FRACUNIT, mo->scale)
|
||||
&& abs(mom.z) < FixedMul(FRACUNIT*3, mo->scale))
|
||||
{
|
||||
if (mo->flags2 & MF2_AMBUSH)
|
||||
{
|
||||
@@ -2285,9 +2282,9 @@ static boolean P_ZMovement(mobj_t *mo)
|
||||
mom.z /= 2; // Rocks not so bouncy
|
||||
|
||||
if (!mo->fuse
|
||||
&& abs(mom.x) < FixedMul(STOPSPEED*2, mo->scale)
|
||||
&& abs(mom.y) < FixedMul(STOPSPEED*2, mo->scale)
|
||||
&& abs(mom.z) < FixedMul(STOPSPEED*2*3, mo->scale))
|
||||
&& abs(mom.x) < FixedMul(FRACUNIT*2, mo->scale)
|
||||
&& abs(mom.y) < FixedMul(FRACUNIT*2, mo->scale)
|
||||
&& abs(mom.z) < FixedMul(FRACUNIT*2*3, mo->scale))
|
||||
{
|
||||
//P_RemoveMobj(mo);
|
||||
//return false;
|
||||
@@ -2297,7 +2294,7 @@ static boolean P_ZMovement(mobj_t *mo)
|
||||
else if (mo->type == MT_CANNONBALLDECOR)
|
||||
{
|
||||
mom.z /= 2;
|
||||
if (abs(mom.z) < FixedMul(STOPSPEED*3, mo->scale))
|
||||
if (abs(mom.z) < FixedMul(FRACUNIT*3, mo->scale))
|
||||
mom.z = 0;
|
||||
}
|
||||
}
|
||||
@@ -3278,30 +3275,12 @@ void P_CalcChasePostImg(player_t *player, camera_t *thiscam)
|
||||
// Process the mobj-ish required functions of the camera
|
||||
boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled)
|
||||
{
|
||||
boolean itsatwodlevel = false;
|
||||
UINT8 i;
|
||||
|
||||
// This can happen when joining
|
||||
if (thiscam->subsector == NULL || thiscam->subsector->sector == NULL)
|
||||
return true;
|
||||
|
||||
P_CalcChasePostImg(player, thiscam);
|
||||
|
||||
if (twodlevel)
|
||||
itsatwodlevel = true;
|
||||
else
|
||||
{
|
||||
for (i = 0; i <= splitscreen; i++)
|
||||
{
|
||||
if (thiscam == &camera[i] && players[displayplayers[i]].mo
|
||||
&& (players[displayplayers[i]].mo->flags2 & MF2_TWOD))
|
||||
{
|
||||
itsatwodlevel = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (thiscam->momx || thiscam->momy)
|
||||
{
|
||||
if (!P_TryCameraMove(thiscam->x + thiscam->momx, thiscam->y + thiscam->momy, thiscam)) // Never fails for 2D mode.
|
||||
@@ -3328,9 +3307,6 @@ boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled
|
||||
}
|
||||
}
|
||||
|
||||
if (!itsatwodlevel)
|
||||
P_CheckCameraPosition(thiscam->x, thiscam->y, thiscam);
|
||||
|
||||
thiscam->subsector = R_PointInSubsector(thiscam->x, thiscam->y);
|
||||
thiscam->floorz = tmfloorz;
|
||||
thiscam->ceilingz = tmceilingz;
|
||||
@@ -3384,9 +3360,8 @@ boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled
|
||||
#endif
|
||||
}
|
||||
|
||||
if (itsatwodlevel
|
||||
|| (thiscam->ceilingz - thiscam->z < thiscam->height
|
||||
&& thiscam->ceilingz >= thiscam->z))
|
||||
if (thiscam->ceilingz - thiscam->z < thiscam->height
|
||||
&& thiscam->ceilingz >= thiscam->z)
|
||||
{
|
||||
thiscam->ceilingz = thiscam->z + thiscam->height;
|
||||
thiscam->floorz = thiscam->z;
|
||||
@@ -7406,24 +7381,7 @@ void P_MobjThinker(mobj_t *mobj)
|
||||
P_SetTarget(&mobj->target, goalpost);
|
||||
}
|
||||
|
||||
if (G_IsSpecialStage(gamemap))
|
||||
{ // Never show the NiGHTS drone in special stages. Check ANYONE for bonustime.
|
||||
INT32 i;
|
||||
boolean bonustime = false;
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
if (playeringame[i] && players[i].bonustime)
|
||||
{
|
||||
bonustime = true;
|
||||
break;
|
||||
}
|
||||
if (!bonustime)
|
||||
{
|
||||
mobj->flags &= ~MF_NOGRAVITY;
|
||||
P_SetMobjState(mobj, S_NIGHTSDRONE1);
|
||||
mobj->flags2 |= MF2_DONTDRAW;
|
||||
}
|
||||
}
|
||||
else if (mobj->tracer && mobj->tracer->player)
|
||||
if (mobj->tracer && mobj->tracer->player)
|
||||
{
|
||||
if (!(mobj->tracer->player->pflags & PF_NIGHTSMODE))
|
||||
{
|
||||
@@ -7440,35 +7398,7 @@ void P_MobjThinker(mobj_t *mobj)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (G_IsSpecialStage(gamemap))
|
||||
{ // Never show the NiGHTS drone in special stages. Check ANYONE for bonustime.
|
||||
INT32 i;
|
||||
|
||||
boolean bonustime = false;
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
if (playeringame[i] && players[i].bonustime)
|
||||
{
|
||||
bonustime = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (bonustime)
|
||||
{
|
||||
P_SetMobjState(mobj, S_NIGHTSDRONE_SPARKLING1);
|
||||
mobj->flags |= MF_NOGRAVITY;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mobj->target)
|
||||
{
|
||||
CONS_Debug(DBG_NIGHTSBASIC, "Removing goal post\n");
|
||||
P_RemoveMobj(mobj->target);
|
||||
P_SetTarget(&mobj->target, NULL);
|
||||
}
|
||||
mobj->flags2 |= MF2_DONTDRAW;
|
||||
}
|
||||
}
|
||||
else if (mobj->tracer && mobj->tracer->player)
|
||||
if (mobj->tracer && mobj->tracer->player)
|
||||
{
|
||||
if (mobj->target)
|
||||
{
|
||||
@@ -10479,10 +10409,6 @@ void P_RespawnSpecials(void)
|
||||
if (!cv_itemrespawn.value)
|
||||
return;
|
||||
|
||||
// Don't respawn in special stages!
|
||||
if (G_IsSpecialStage(gamemap))
|
||||
return;
|
||||
|
||||
// nothing left to respawn?
|
||||
if (iquehead == iquetail)
|
||||
return;
|
||||
@@ -11034,9 +10960,17 @@ void P_SpawnMapThing(mapthing_t *mthing)
|
||||
// check for players specially
|
||||
if (mthing->type > 0 && mthing->type <= 32)
|
||||
{
|
||||
// save spots for respawning in network games
|
||||
if (!metalrecording)
|
||||
playerstarts[mthing->type-1] = mthing;
|
||||
if (mthing->type > MAXPLAYERS) // be wary of playerstarts size! playerstarts[MAXPLAYERS]
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, "Excess player start detected %d This will crash vanilla clients!\n", mthing->type);
|
||||
}
|
||||
else
|
||||
{
|
||||
// save spots for respawning in network games
|
||||
if (!metalrecording)
|
||||
playerstarts[mthing->type-1] = mthing;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -11184,7 +11118,7 @@ void P_SpawnMapThing(mapthing_t *mthing)
|
||||
if (i == MT_PITYTV || i == MT_GREENTV || i == MT_YELLOWTV || i == MT_BLUETV || i == MT_BLACKTV || i == MT_WHITETV)
|
||||
return; // No shields in Ultimate mode
|
||||
|
||||
if (i == MT_SUPERRINGBOX && !G_IsSpecialStage(gamemap))
|
||||
if (i == MT_SUPERRINGBOX)
|
||||
return; // No rings in Ultimate mode (except special stages)
|
||||
}
|
||||
|
||||
@@ -11683,14 +11617,6 @@ ML_NOCLIMB : Direction not controllable
|
||||
mobj->health |= 1; // If ambush is set, push using XYZ
|
||||
if (mthing->options & MTF_OBJECTSPECIAL)
|
||||
mobj->health |= 2; // If object special is set, fade using XY
|
||||
|
||||
if (G_IsSpecialStage(gamemap))
|
||||
{
|
||||
if (i == MT_PUSH)
|
||||
P_SetMobjState(mobj, S_GRAVWELLGREEN);
|
||||
if (i == MT_PULL)
|
||||
P_SetMobjState(mobj, S_GRAVWELLRED);
|
||||
}
|
||||
}
|
||||
|
||||
// ignore MTF_ flags and return early
|
||||
|
||||
+143
-114
@@ -67,6 +67,8 @@
|
||||
#include "lua_script.h"
|
||||
#include "lua_hook.h"
|
||||
|
||||
#include "y_inter.h"
|
||||
|
||||
#if !defined (UNDER_CE)
|
||||
#include <time.h>
|
||||
#endif
|
||||
@@ -2868,12 +2870,9 @@ boolean P_SetupLevel(boolean fromnetsave, boolean reloadinggamestate)
|
||||
F_WipeStartScreen();
|
||||
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, levelfadecol);
|
||||
F_WipeEndScreen();
|
||||
F_RunWipe(wipedefs[(encoremode ? wipe_level_final : wipe_level_toblack)], false);
|
||||
}
|
||||
else //dedicated servers
|
||||
{
|
||||
F_RunWipe(wipedefs[(encoremode ? wipe_level_final : wipe_level_toblack)], false);
|
||||
}
|
||||
|
||||
F_RunWipe(wipedefs[(encoremode ? wipe_level_final : wipe_level_toblack)], false);
|
||||
}
|
||||
|
||||
// Reset the palette now all fades have been done
|
||||
@@ -3109,11 +3108,128 @@ boolean P_AddWadFile(const char *wadfilename, boolean local)
|
||||
return true;
|
||||
}
|
||||
|
||||
// check for replacement votescreen backgrounds
|
||||
boolean wideracereplaced = false;
|
||||
boolean racereplaced = false;
|
||||
boolean widebattlereplaced = false;
|
||||
boolean battlereplaced = false;
|
||||
static size_t sreplaces = 0, mreplaces = 0, digmreplaces = 0;
|
||||
|
||||
//
|
||||
// search for sound replacements
|
||||
//
|
||||
static boolean P_CheckSoundReplacements(UINT16 wadnum, char *name, size_t i)
|
||||
{
|
||||
size_t j;
|
||||
lumpnum_t lumpnum = (i|(wadnum<<16));
|
||||
|
||||
if (name[0] == 'D')
|
||||
{
|
||||
if (name[1] == 'S')
|
||||
{
|
||||
for (j = 1; j < NUMSFX; j++)
|
||||
{
|
||||
if (S_sfx[j].name && !strnicmp(S_sfx[j].name, name + 2, 6)
|
||||
&& (S_sfx[j].lumpnum != lumpnum) && (S_sfx[j].lumpnum != LUMPERROR))
|
||||
{
|
||||
// the sound will be reloaded when needed,
|
||||
// since sfx->data will be NULL
|
||||
CONS_Debug(DBG_SETUP, "Sound %.8s replaced\n", name);
|
||||
|
||||
I_FreeSfx(&S_sfx[j]);
|
||||
|
||||
// Re-cache it
|
||||
if (S_PrecacheSound())
|
||||
S_sfx[j].data = I_GetSfx(&S_sfx[j]);
|
||||
|
||||
sreplaces++;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (name[1] == '_')
|
||||
{
|
||||
CONS_Debug(DBG_SETUP, "Music %.8s ignored\n", name);
|
||||
mreplaces++;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (name[0] == 'O' && name[1] == '_')
|
||||
{
|
||||
CONS_Debug(DBG_SETUP, "Music %.8s replaced\n", name);
|
||||
digmreplaces++;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//
|
||||
// search for maps
|
||||
//
|
||||
static boolean P_CheckMapReplacements(char *name)
|
||||
{
|
||||
if (memcmp(name, "MAP", 3) == 0) // Ignore the headers
|
||||
{
|
||||
INT16 num;
|
||||
|
||||
if (name[5] != '\0')
|
||||
return false;
|
||||
|
||||
num = (INT16)M_MapNumber(name[3], name[4]);
|
||||
|
||||
// we want to record whether this map exists. if it doesn't have a header, we can assume it's not relephant
|
||||
if (num <= NUMMAPS && mapheaderinfo[num-1])
|
||||
{
|
||||
if (mapheaderinfo[num-1]->menuflags & LF2_EXISTSHACK)
|
||||
G_SetGameModified(multiplayer, true); // oops, double-defined - no record attack privileges for you
|
||||
mapheaderinfo[num-1]->menuflags |= LF2_EXISTSHACK;
|
||||
}
|
||||
|
||||
if (num == gamemap)
|
||||
partadd_replacescurrentmap = true;
|
||||
|
||||
CONS_Printf("%s\n", name);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//
|
||||
// check for non Lua votescreen replacements
|
||||
//
|
||||
static boolean P_CheckVoteReplacements(char *name)
|
||||
{
|
||||
// widescreen patch Race
|
||||
if (!VoteScreen.replaced.widerace && !memcmp(name, "INTERSCW", 8))
|
||||
{
|
||||
VoteScreen.replaced.widerace = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!VoteScreen.replaced.race && !memcmp(name, "INTERSCR", 8))
|
||||
{
|
||||
VoteScreen.replaced.race = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
// widescreen patch Battle
|
||||
if (!VoteScreen.replaced.widebattle && !memcmp(name, "BATTLSCW", 8))
|
||||
{
|
||||
VoteScreen.replaced.widebattle = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!VoteScreen.replaced.battle && !memcmp(name, "BATTLSCR", 8))
|
||||
{
|
||||
VoteScreen.replaced.battle = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (VoteScreen.replaced.widerace && VoteScreen.replaced.race
|
||||
&& VoteScreen.replaced.widebattle && VoteScreen.replaced.battle)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//
|
||||
// Add a WAD file and do the per-WAD setup stages.
|
||||
@@ -3121,12 +3237,15 @@ boolean battlereplaced = false;
|
||||
//
|
||||
UINT16 P_PartialAddWadFile(const char *wadfilename, boolean local)
|
||||
{
|
||||
size_t i, j, sreplaces = 0, mreplaces = 0, digmreplaces = 0;
|
||||
size_t i;
|
||||
UINT16 numlumps, wadnum;
|
||||
char *name;
|
||||
boolean mapsadded = false;
|
||||
static boolean allvotereplaced = false;
|
||||
lumpinfo_t *lumpinfo;
|
||||
|
||||
sreplaces = mreplaces = digmreplaces = 0;
|
||||
|
||||
if ((numlumps = W_InitFile(wadfilename, local)) == INT16_MAX)
|
||||
{
|
||||
refreshdirmenu |= REFRESHDIR_NOTLOADED;
|
||||
@@ -3141,46 +3260,24 @@ UINT16 P_PartialAddWadFile(const char *wadfilename, boolean local)
|
||||
|
||||
wadfiles[wadnum]->localfile = local;
|
||||
|
||||
//
|
||||
// search for sound replacements
|
||||
//
|
||||
lumpinfo = wadfiles[wadnum]->lumpinfo;
|
||||
for (i = 0; i < numlumps; i++, lumpinfo++)
|
||||
{
|
||||
name = lumpinfo->name;
|
||||
lumpnum_t lumpnum = i|(wadnum<<16);
|
||||
|
||||
if (name[0] == 'D')
|
||||
if (P_CheckSoundReplacements(wadnum, name, i))
|
||||
continue;
|
||||
|
||||
if (P_CheckMapReplacements(name))
|
||||
{
|
||||
if (name[1] == 'S') for (j = 1; j < NUMSFX; j++)
|
||||
{
|
||||
if (S_sfx[j].name && !strnicmp(S_sfx[j].name, name + 2, 6) && S_sfx[j].lumpnum != lumpnum && S_sfx[j].lumpnum != LUMPERROR)
|
||||
{
|
||||
// the sound will be reloaded when needed,
|
||||
// since sfx->data will be NULL
|
||||
CONS_Debug(DBG_SETUP, "Sound %.8s replaced\n", name);
|
||||
|
||||
I_FreeSfx(&S_sfx[j]);
|
||||
|
||||
// Re-cache it
|
||||
if (S_PrecacheSound())
|
||||
S_sfx[j].data = I_GetSfx(&S_sfx[j]);
|
||||
|
||||
sreplaces++;
|
||||
}
|
||||
}
|
||||
else if (name[1] == '_')
|
||||
{
|
||||
CONS_Debug(DBG_SETUP, "Music %.8s ignored\n", name);
|
||||
mreplaces++;
|
||||
}
|
||||
}
|
||||
else if (name[0] == 'O' && name[1] == '_')
|
||||
{
|
||||
CONS_Debug(DBG_SETUP, "Music %.8s replaced\n", name);
|
||||
digmreplaces++;
|
||||
mapsadded = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!allvotereplaced && P_CheckVoteReplacements(name))
|
||||
allvotereplaced = true;
|
||||
}
|
||||
|
||||
if (!devparm && sreplaces)
|
||||
CONS_Printf(M_GetText("%s sounds replaced\n"), sizeu1(sreplaces));
|
||||
if (!devparm && mreplaces)
|
||||
@@ -3188,6 +3285,9 @@ UINT16 P_PartialAddWadFile(const char *wadfilename, boolean local)
|
||||
if (!devparm && digmreplaces)
|
||||
CONS_Printf(M_GetText("%s digital musics replaced\n"), sizeu1(digmreplaces));
|
||||
|
||||
if (!mapsadded)
|
||||
CONS_Printf(M_GetText("No maps added\n"));
|
||||
|
||||
//
|
||||
// search for sprite replacements
|
||||
//
|
||||
@@ -3212,80 +3312,9 @@ UINT16 P_PartialAddWadFile(const char *wadfilename, boolean local)
|
||||
//
|
||||
S_LoadMusicDefs(wadnum);
|
||||
|
||||
//
|
||||
// search for maps
|
||||
//
|
||||
lumpinfo = wadfiles[wadnum]->lumpinfo;
|
||||
for (i = 0; i < numlumps; i++, lumpinfo++)
|
||||
{
|
||||
name = lumpinfo->name;
|
||||
|
||||
if (name[0] == 'M' && name[1] == 'A' && name[2] == 'P') // Ignore the headers
|
||||
{
|
||||
INT16 num;
|
||||
if (name[5]!='\0')
|
||||
continue;
|
||||
num = (INT16)M_MapNumber(name[3], name[4]);
|
||||
|
||||
// we want to record whether this map exists. if it doesn't have a header, we can assume it's not relephant
|
||||
if (num <= NUMMAPS && mapheaderinfo[num-1])
|
||||
{
|
||||
if (mapheaderinfo[num-1]->menuflags & LF2_EXISTSHACK)
|
||||
G_SetGameModified(multiplayer, true); // oops, double-defined - no record attack privileges for you
|
||||
mapheaderinfo[num-1]->menuflags |= LF2_EXISTSHACK;
|
||||
}
|
||||
|
||||
if (num == gamemap)
|
||||
partadd_replacescurrentmap = true;
|
||||
|
||||
CONS_Printf("%s\n", name);
|
||||
mapsadded = true;
|
||||
}
|
||||
}
|
||||
if (!mapsadded)
|
||||
CONS_Printf(M_GetText("No maps added\n"));
|
||||
|
||||
// TODO: Experimental SPRTINFO support, test first
|
||||
R_LoadSpriteInfoLumps(wadnum, wadfiles[wadnum]->numlumps);
|
||||
|
||||
//
|
||||
// check for votescreen replacements
|
||||
//
|
||||
if (!wideracereplaced && !racereplaced && !widebattlereplaced && !battlereplaced)
|
||||
{
|
||||
lumpinfo = wadfiles[wadnum]->lumpinfo;
|
||||
for (i = 0; i < numlumps; i++, lumpinfo++)
|
||||
{
|
||||
name = lumpinfo->name;
|
||||
|
||||
// widescreen patch Race
|
||||
if (!wideracereplaced && !strncmp(name, "INTERSCW", 8))
|
||||
{
|
||||
wideracereplaced = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!racereplaced && !strncmp(name, "INTERSCR", 8))
|
||||
{
|
||||
racereplaced = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
// widescreen patch Battle
|
||||
if (!widebattlereplaced && !strncmp(name, "BATTLSCW", 8))
|
||||
{
|
||||
widebattlereplaced = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!battlereplaced && !strncmp(name, "BATTLSCR", 8))
|
||||
{
|
||||
battlereplaced = true;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
refreshdirmenu &= ~REFRESHDIR_GAMEDATA; // Under usual circumstances we'd wait for REFRESHDIR_GAMEDATA to disappear the next frame, but it's a bit too dangerous for that...
|
||||
partadd_stage = 0;
|
||||
return wadnum;
|
||||
|
||||
@@ -68,11 +68,6 @@ void HWR_LoadLevel(boolean reloadinggamestate);
|
||||
|
||||
boolean P_AddWadFile(const char *wadfilename, boolean local);
|
||||
|
||||
extern boolean wideracereplaced;
|
||||
extern boolean racereplaced;
|
||||
extern boolean widebattlereplaced;
|
||||
extern boolean battlereplaced;
|
||||
|
||||
// WARNING: The following functions should be grouped as follows:
|
||||
// any amount of PartialAdds followed by MultiSetups until returned true,
|
||||
// as soon as possible.
|
||||
|
||||
+36
-35
@@ -72,8 +72,8 @@ static void P_UpdateSlopeLightOffset(pslope_t *slope)
|
||||
* // We reverse it in R_FindPlane now.
|
||||
* nX = -nX;
|
||||
* nY = -nY;
|
||||
}
|
||||
*/
|
||||
* }
|
||||
*/
|
||||
|
||||
light = FixedMul(nX, FINECOSINE(maplighting.angle >> ANGLETOFINESHIFT))
|
||||
+ FixedMul(nY, FINESINE(maplighting.angle >> ANGLETOFINESHIFT));
|
||||
@@ -233,9 +233,11 @@ void P_RunDynamicSlopes(void)
|
||||
I_Error("P_RunDynamicSlopes: slope has invalid type!");
|
||||
}
|
||||
|
||||
if (slope->zdelta != FixedDiv(zdelta, slope->extent))
|
||||
const fixed_t zeedelta = FixedDiv(zdelta, slope->extent);
|
||||
|
||||
if (slope->zdelta != zeedelta)
|
||||
{
|
||||
slope->zdelta = FixedDiv(zdelta, slope->extent);
|
||||
slope->zdelta = zeedelta;
|
||||
slope->zangle = R_PointToAngle2(0, 0, slope->extent, -zdelta);
|
||||
slope->real_zangle = slope->zangle;
|
||||
P_CalculateSlopeNormal(slope);
|
||||
@@ -295,18 +297,18 @@ static fixed_t P_GetExtent(sector_t *sector, line_t *line)
|
||||
fixed_t dist;
|
||||
|
||||
// Don't compare to the slope line.
|
||||
if(li == line)
|
||||
if (li == line)
|
||||
continue;
|
||||
|
||||
P_ClosestPointOnLine(li->v1->x, li->v1->y, line, &tempv);
|
||||
dist = R_PointToDist2(tempv.x, tempv.y, li->v1->x, li->v1->y);
|
||||
if(dist > fardist)
|
||||
if (dist > fardist)
|
||||
fardist = dist;
|
||||
|
||||
// Okay, maybe do it for v2 as well?
|
||||
P_ClosestPointOnLine(li->v2->x, li->v2->y, line, &tempv);
|
||||
dist = R_PointToDist2(tempv.x, tempv.y, li->v2->x, li->v2->y);
|
||||
if(dist > fardist)
|
||||
if (dist > fardist)
|
||||
fardist = dist;
|
||||
}
|
||||
|
||||
@@ -357,11 +359,9 @@ void P_SpawnSlope_Line(int linenum)
|
||||
return;
|
||||
}
|
||||
|
||||
{
|
||||
fixed_t len = R_PointToDist2(0, 0, line->dx, line->dy);
|
||||
nx = FixedDiv(line->dy, len);
|
||||
ny = -FixedDiv(line->dx, len);
|
||||
}
|
||||
fixed_t len = R_PointToDist2(0, 0, line->dx, line->dy);
|
||||
nx = FixedDiv(line->dy, len);
|
||||
ny = -FixedDiv(line->dx, len);
|
||||
|
||||
origin.x = line->v1->x + (line->v2->x - line->v1->x)/2;
|
||||
origin.y = line->v1->y + (line->v2->y - line->v1->y)/2;
|
||||
@@ -377,7 +377,7 @@ void P_SpawnSlope_Line(int linenum)
|
||||
|
||||
extent = P_GetExtent(line->frontsector, line);
|
||||
|
||||
if(extent < 0)
|
||||
if (extent < 0)
|
||||
{
|
||||
CONS_Printf("P_SpawnSlope_Line failed to get frontsector extent on line number %i\n", linenum);
|
||||
return;
|
||||
@@ -694,9 +694,9 @@ void P_CopySectorSlope(line_t *line)
|
||||
{
|
||||
sector_t *srcsec = sectors + i;
|
||||
|
||||
if((special - 719) & 1 && !fsec->f_slope && srcsec->f_slope)
|
||||
if ((special - 719) & 1 && !fsec->f_slope && srcsec->f_slope)
|
||||
fsec->f_slope = srcsec->f_slope; //P_CopySlope(srcsec->f_slope);
|
||||
if((special - 719) & 2 && !fsec->c_slope && srcsec->c_slope)
|
||||
if ((special - 719) & 2 && !fsec->c_slope && srcsec->c_slope)
|
||||
fsec->c_slope = srcsec->c_slope; //P_CopySlope(srcsec->c_slope);
|
||||
}
|
||||
|
||||
@@ -782,25 +782,24 @@ void P_ResetDynamicSlopes(void)
|
||||
if (!(lines[i].flags & ML_NOTAILS))
|
||||
flags |= SL_NODYNAMIC;
|
||||
|
||||
if (which == 704)
|
||||
switch (which)
|
||||
{
|
||||
slopetoset = &lines[i].frontsector->f_slope;
|
||||
which = 0;
|
||||
}
|
||||
else if (which == 705)
|
||||
{
|
||||
slopetoset = &lines[i].frontsector->c_slope;
|
||||
which = 0;
|
||||
}
|
||||
else if (which == 714)
|
||||
{
|
||||
slopetoset = &lines[i].backsector->f_slope;
|
||||
which = 1;
|
||||
}
|
||||
else // 715
|
||||
{
|
||||
slopetoset = &lines[i].backsector->c_slope;
|
||||
which = 1;
|
||||
case 704:
|
||||
slopetoset = &lines[i].frontsector->f_slope;
|
||||
which = 0;
|
||||
break;
|
||||
case 705:
|
||||
slopetoset = &lines[i].frontsector->c_slope;
|
||||
which = 0;
|
||||
break;
|
||||
case 714:
|
||||
slopetoset = &lines[i].backsector->f_slope;
|
||||
which = 1;
|
||||
break;
|
||||
default: // 715
|
||||
slopetoset = &lines[i].backsector->c_slope;
|
||||
which = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
if (lines[i].flags & ML_NOKNUX)
|
||||
@@ -944,10 +943,12 @@ void P_ButteredSlope(mobj_t *mo)
|
||||
|
||||
if (mo->player)
|
||||
{
|
||||
if (abs(mo->standingslope->zdelta) < FRACUNIT/4 && !(mo->player->pflags & PF_SPINNING))
|
||||
const int zeedelta = abs(mo->standingslope->zdelta);
|
||||
|
||||
if (zeedelta < FRACUNIT/4 && !(mo->player->pflags & PF_SPINNING))
|
||||
return; // Don't slide on non-steep slopes unless spinning
|
||||
|
||||
if (abs(mo->standingslope->zdelta) < FRACUNIT/2 && !(mo->player->rmomx || mo->player->rmomy))
|
||||
if (zeedelta < FRACUNIT/2 && !(mo->player->rmomx || mo->player->rmomy))
|
||||
return; // Allow the player to stand still on slopes below a certain steepness
|
||||
}
|
||||
|
||||
|
||||
+25
-52
@@ -3538,6 +3538,7 @@ DoneSection2:
|
||||
for (UINT8 j = 0; j <= splitscreen; ++j)
|
||||
{
|
||||
INT32 id = (j == 0 ? consoleplayer : displayplayers[j]);
|
||||
|
||||
if (player == &players[id])
|
||||
{
|
||||
localangle[j] = player->mo->angle;
|
||||
@@ -3574,7 +3575,6 @@ DoneSection2:
|
||||
sfxenum_t pick = P_RandomKey(2); // Gotta roll the RNG every time this is called for sync reasons
|
||||
if (cv_kartvoices.value)
|
||||
S_StartSound(player->mo, sfx_kbost1+pick);
|
||||
//K_TauntVoiceTimers(player);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -3610,8 +3610,6 @@ DoneSection2:
|
||||
case 2: // Special stage GOAL sector / Exit Sector / CTF Flag Return
|
||||
if (player->bot)
|
||||
break;
|
||||
if (!useNightsSS && G_IsSpecialStage(gamemap) && sstimer > 6)
|
||||
sstimer = 6; // Just let P_Ticker take care of the rest.
|
||||
|
||||
// Exit (for FOF exits; others are handled in P_PlayerThink in p_user.c)
|
||||
{
|
||||
@@ -3802,12 +3800,6 @@ DoneSection2:
|
||||
|
||||
if (!(player->mo->state >= &states[S_KART_RUN1] && player->mo->state <= &states[S_KART_RUN2]))
|
||||
P_SetPlayerMobjState(player->mo, S_KART_RUN1);
|
||||
|
||||
//if (!(player->mo->state >= &states[S_PLAY_ATK1] && player->mo->state <= &states[S_PLAY_ATK4])) // SRB2kart
|
||||
//{
|
||||
// P_SetPlayerMobjState(player->mo, S_PLAY_ATK1);
|
||||
// S_StartSound(player->mo, sfx_spin);
|
||||
//}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -3963,12 +3955,6 @@ DoneSection2:
|
||||
S_StartSound(NULL, sfx_s221);
|
||||
}
|
||||
|
||||
//player->starpostangle = player->starposttime = player->starpostnum = 0;
|
||||
//player->starpostx = player->starposty = player->starpostz = 0;
|
||||
|
||||
// Play the starpost sound for 'consistency'
|
||||
// S_StartSound(player->mo, sfx_strpst);
|
||||
|
||||
thwompsactive = true; // Lap 2 effects
|
||||
player->grieftime = 0;
|
||||
}
|
||||
@@ -4532,14 +4518,6 @@ static void P_RunSpecialSectorCheck(player_t *player, sector_t *sector)
|
||||
switch(GETSECSPECIAL(sector->special, 4))
|
||||
{
|
||||
case 2: // Level Exit / GOAL Sector / Flag Return
|
||||
if (!useNightsSS && G_IsSpecialStage(gamemap))
|
||||
{
|
||||
// Special stage GOAL sector
|
||||
// requires touching floor.
|
||||
break;
|
||||
}
|
||||
/* FALLTHRU */
|
||||
|
||||
case 1: // Starpost activator
|
||||
case 5: // Fan sector
|
||||
case 6: // Super Sonic Transform
|
||||
@@ -4809,11 +4787,11 @@ static ffloor_t *P_AddFakeFloor(sector_t *sec, sector_t *sec2, line_t *master, f
|
||||
i = 0;
|
||||
th = thinkercap.next;
|
||||
|
||||
for(;;)
|
||||
for (;;)
|
||||
{
|
||||
if(secthinkers)
|
||||
if (secthinkers)
|
||||
{
|
||||
if(i < secthinkers[sec2num].count)
|
||||
if (i < secthinkers[sec2num].count)
|
||||
th = secthinkers[sec2num].thinkers[i];
|
||||
else break;
|
||||
}
|
||||
@@ -4845,8 +4823,10 @@ static ffloor_t *P_AddFakeFloor(sector_t *sec, sector_t *sec2, line_t *master, f
|
||||
Add_Pusher(p->type, p->x_mag<<FRACBITS, p->y_mag<<FRACBITS, p->source, (INT32)(sec-sectors), p->affectee, p->exclusive, p->slider);
|
||||
}
|
||||
|
||||
if(secthinkers) i++;
|
||||
else th = th->next;
|
||||
if (secthinkers)
|
||||
i++;
|
||||
else
|
||||
th = th->next;
|
||||
}
|
||||
|
||||
if (flags & FF_TRANSLUCENT)
|
||||
@@ -6371,6 +6351,7 @@ static void P_AddFakeFloorsByLine(size_t line, ffloortype_e ffloorflags, thinker
|
||||
static void P_DoScrollMove(mobj_t *thing, fixed_t dx, fixed_t dy, INT32 exclusive)
|
||||
{
|
||||
fixed_t fuckaj = 0; // Nov 05 14:12:08 <+MonsterIestyn> I've heard of explicitly defined variables but this is ridiculous
|
||||
|
||||
if (thing->player)
|
||||
{
|
||||
if (!(dx | dy))
|
||||
@@ -6392,7 +6373,8 @@ static void P_DoScrollMove(mobj_t *thing, fixed_t dx, fixed_t dy, INT32 exclusiv
|
||||
else if (thing->friction != ORIG_FRICTION)
|
||||
fuckaj = thing->friction;
|
||||
|
||||
if (fuckaj) {
|
||||
if (fuckaj)
|
||||
{
|
||||
// refactor thrust for new friction
|
||||
dx = FixedDiv(dx, CARRYFACTOR);
|
||||
dy = FixedDiv(dy, CARRYFACTOR);
|
||||
@@ -6451,9 +6433,6 @@ void T_Scroll(scroll_t *s)
|
||||
s->vdy = dy += s->vdy;
|
||||
}
|
||||
|
||||
// if (!(dx | dy)) // no-op if both (x,y) offsets 0
|
||||
// return;
|
||||
|
||||
switch (s->type)
|
||||
{
|
||||
side_t *side;
|
||||
@@ -6729,27 +6708,21 @@ static void P_SpawnScrollers(void)
|
||||
// this linedef controls the direction and speed of the scrolling. The
|
||||
// most complicated linedef since donuts, but powerful :)
|
||||
|
||||
if (special == 515 || special == 512 || special == 522 || special == 532 || special == 504) // displacement scrollers
|
||||
switch (special)
|
||||
{
|
||||
special -= 2;
|
||||
control = (INT32)(sides[*l->sidenum].sector - sectors);
|
||||
}
|
||||
else if (special == 514 || special == 511 || special == 521 || special == 531 || special == 503) // accelerative scrollers
|
||||
{
|
||||
special--;
|
||||
accel = 1;
|
||||
control = (INT32)(sides[*l->sidenum].sector - sectors);
|
||||
}
|
||||
else if (special == 535 || special == 525) // displacement scrollers
|
||||
{
|
||||
special -= 2;
|
||||
control = (INT32)(sides[*l->sidenum].sector - sectors);
|
||||
}
|
||||
else if (special == 534 || special == 524) // accelerative scrollers
|
||||
{
|
||||
accel = 1;
|
||||
special--;
|
||||
control = (INT32)(sides[*l->sidenum].sector - sectors);
|
||||
case 515: case 512: case 522: case 532: case 504:
|
||||
case 535: case 525: // displacement scrollers
|
||||
|
||||
special -= 2;
|
||||
control = (INT32)(sides[*l->sidenum].sector - sectors);
|
||||
break;
|
||||
|
||||
case 514: case 511: case 521: case 531: case 503:
|
||||
case 534: case 524: // accelerative scrollers
|
||||
special--;
|
||||
accel = 1;
|
||||
control = (INT32)(sides[*l->sidenum].sector - sectors);
|
||||
break;
|
||||
}
|
||||
|
||||
switch (special)
|
||||
|
||||
+1
-1
@@ -845,7 +845,7 @@ void P_Ticker(boolean run)
|
||||
// if there are no players left at all, stop demo recording
|
||||
// Demos that that dont have any players crash during playback, which can happen with dedicated servers
|
||||
if (demo.savemode == DSM_WILLAUTOSAVE && !D_NumPlayers())
|
||||
G_ResetDemoRecording();
|
||||
G_SaveDemo();
|
||||
}
|
||||
}
|
||||
else if (demo.playback) // Use Ghost data for consistency checks.
|
||||
|
||||
+84
-144
@@ -135,9 +135,6 @@ boolean P_AutoPause(void)
|
||||
//
|
||||
void P_CalcHeight(player_t *player)
|
||||
{
|
||||
//INT32 angle;
|
||||
//fixed_t bob;
|
||||
//fixed_t pviewheight;
|
||||
mobj_t *mo = player->mo;
|
||||
|
||||
// Regular movement bobbing.
|
||||
@@ -256,7 +253,6 @@ void P_GiveEmerald(boolean spawnObj)
|
||||
void P_ResetScore(player_t *player)
|
||||
{
|
||||
// Formally a host for Chaos mode behavior
|
||||
|
||||
player->scoreadd = 0;
|
||||
}
|
||||
|
||||
@@ -440,9 +436,7 @@ void P_GivePlayerRings(player_t *player, INT32 num_rings)
|
||||
|
||||
player->mo->health += num_rings;
|
||||
player->health += num_rings;
|
||||
|
||||
if (!G_IsSpecialStage(gamemap) || !useNightsSS)
|
||||
player->totalring += num_rings;
|
||||
player->totalring += num_rings;
|
||||
|
||||
//{ SRB2kart - rings don't really do anything, but we don't want the player spilling them later.
|
||||
{
|
||||
@@ -450,24 +444,6 @@ void P_GivePlayerRings(player_t *player, INT32 num_rings)
|
||||
player->health = 1;
|
||||
}
|
||||
//}
|
||||
|
||||
// Now extra life bonuses are handled here instead of in P_MovePlayer, since why not?
|
||||
if (!ultimatemode && !modeattacking && !G_IsSpecialStage(gamemap) && G_GametypeUsesLives())
|
||||
{
|
||||
INT32 gainlives = 0;
|
||||
|
||||
while (player->xtralife < maxXtraLife && player->health > 100 * (player->xtralife+1))
|
||||
{
|
||||
++gainlives;
|
||||
++player->xtralife;
|
||||
}
|
||||
|
||||
if (gainlives)
|
||||
{
|
||||
P_GivePlayerLives(player, gainlives);
|
||||
P_PlayLivesJingle(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
@@ -486,22 +462,10 @@ void P_GivePlayerLives(player_t *player, INT32 numlives)
|
||||
player->lives = 1;
|
||||
}
|
||||
|
||||
//
|
||||
// P_DoSuperTransformation
|
||||
//
|
||||
// Transform into Super Sonic!
|
||||
void P_DoSuperTransformation(player_t *player, boolean giverings)
|
||||
{
|
||||
(void)player;
|
||||
(void)giverings;
|
||||
|
||||
return; // SRB2kart - this is not a thing we need
|
||||
}
|
||||
|
||||
// Adds to the player's score
|
||||
void P_AddPlayerScore(player_t *player, UINT32 amount)
|
||||
{
|
||||
if (!(G_BattleGametype()))
|
||||
if (!G_BattleGametype())
|
||||
return;
|
||||
|
||||
if (player->bot)
|
||||
@@ -606,15 +570,21 @@ static boolean isPlayerLosing(player_t *player)
|
||||
UINT8 pos = 1;
|
||||
UINT8 maxpos = 1;
|
||||
|
||||
for (int i = 0; i < MAXPLAYERS; ++i) {
|
||||
for (int i = 0; i < MAXPLAYERS; ++i)
|
||||
{
|
||||
if (!playeringame[i] || players[i].spectator) continue;
|
||||
if (players[i].marescore > player->marescore) ++pos;
|
||||
|
||||
if (players[i].marescore > player->marescore)
|
||||
++pos;
|
||||
|
||||
maxpos = max(getPlayerPos(&players[i]), maxpos);
|
||||
}
|
||||
|
||||
if (maxpos == 1) return false;
|
||||
if (maxpos == 1)
|
||||
return false;
|
||||
|
||||
if (maxpos % 2) ++maxpos;
|
||||
if (maxpos % 2)
|
||||
++maxpos;
|
||||
|
||||
return pos > (maxpos / 2);
|
||||
}
|
||||
@@ -823,20 +793,6 @@ boolean P_IsObjectOnGround(mobj_t *mo)
|
||||
{
|
||||
if (P_IsObjectInGoop(mo))
|
||||
{
|
||||
/*
|
||||
// It's a crazy hack that checking if you're on the ground
|
||||
// would actually CHANGE your position and momentum,
|
||||
if (mo->z < mo->floorz)
|
||||
{
|
||||
mo->z = mo->floorz;
|
||||
mo->momz = 0;
|
||||
}
|
||||
else if (mo->z + mo->height > mo->ceilingz)
|
||||
{
|
||||
mo->z = mo->ceilingz - mo->height;
|
||||
mo->momz = 0;
|
||||
}
|
||||
*/
|
||||
// but I don't want you to ever 'stand' while submerged in goo.
|
||||
// You're in constant vertical momentum, even if you get stuck on something.
|
||||
// No exceptions.
|
||||
@@ -1182,26 +1138,28 @@ mobj_t *P_SpawnGhostMobj(mobj_t *mobj)
|
||||
else
|
||||
ghost->angle = mobj->angle;
|
||||
|
||||
ghost->pitch = mobj->pitch;
|
||||
ghost->roll = mobj->roll;
|
||||
|
||||
ghost->sprite = mobj->sprite;
|
||||
ghost->frame = mobj->frame;
|
||||
ghost->tics = -1;
|
||||
ghost->frame &= ~FF_TRANSMASK;
|
||||
ghost->frame |= tr_trans50<<FF_TRANSSHIFT;
|
||||
ghost->slopepitch = mobj->slopepitch;
|
||||
ghost->sloperoll = mobj->sloperoll;
|
||||
|
||||
ghost->fuse = ghost->info->damage;
|
||||
ghost->skin = mobj->skin;
|
||||
ghost->localskin = mobj->localskin;
|
||||
ghost->skinlocal = mobj->skinlocal;
|
||||
|
||||
ghost->spritexscale = mobj->spritexscale;
|
||||
ghost->spriteyscale = mobj->spriteyscale;
|
||||
ghost->spritexoffset = mobj->spritexoffset;
|
||||
ghost->spriteyoffset = mobj->spriteyoffset;
|
||||
|
||||
ghost->pitch = mobj->pitch;
|
||||
ghost->roll = mobj->roll;
|
||||
ghost->sloperoll = mobj->sloperoll;
|
||||
ghost->rollangle = mobj->rollangle;
|
||||
ghost->sloperoll = mobj->sloperoll;
|
||||
ghost->slopepitch = mobj->slopepitch;
|
||||
|
||||
if (mobj->flags2 & MF2_OBJECTFLIP)
|
||||
ghost->flags |= MF2_OBJECTFLIP;
|
||||
@@ -1282,9 +1240,6 @@ void P_DoPlayerExit(player_t *player)
|
||||
|
||||
if (player == &players[consoleplayer])
|
||||
demo.savebutton = leveltime;
|
||||
|
||||
/*if (playeringame[player-players] && netgame && !circuitmap)
|
||||
CONS_Printf(M_GetText("%s has completed the level.\n"), player_names[player-players]);*/
|
||||
}
|
||||
|
||||
#define SPACESPECIAL 12
|
||||
@@ -1701,7 +1656,6 @@ static void P_CheckInvincibilityTimer(player_t *player)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// P_DoBubbleBreath
|
||||
//
|
||||
@@ -1871,11 +1825,8 @@ static void P_3dMovement(player_t *player)
|
||||
{
|
||||
ticcmd_t *cmd;
|
||||
angle_t movepushangle, movepushsideangle; // Analog
|
||||
//INT32 topspeed, acceleration, thrustfactor;
|
||||
fixed_t movepushforward = 0, movepushside = 0;
|
||||
angle_t dangle; // replaces old quadrants bits
|
||||
//boolean dangleflip = false; // SRB2kart - toaster
|
||||
//fixed_t normalspd = FixedMul(player->normalspeed, player->mo->scale);
|
||||
boolean analogmove = false;
|
||||
fixed_t oldMagnitude, newMagnitude;
|
||||
vector3_t totalthrust;
|
||||
@@ -1913,20 +1864,18 @@ static void P_3dMovement(player_t *player)
|
||||
else
|
||||
movepushangle = player->mo->angle;
|
||||
}
|
||||
|
||||
movepushsideangle = movepushangle-ANGLE_90;
|
||||
|
||||
// cmomx/cmomy stands for the conveyor belt speed.
|
||||
if (player->onconveyor == 2) // Wind/Current
|
||||
{
|
||||
//if (player->mo->z > player->mo->watertop || player->mo->z + player->mo->height < player->mo->waterbottom)
|
||||
if (!(player->mo->eflags & (MFE_UNDERWATER|MFE_TOUCHWATER)))
|
||||
player->cmomx = player->cmomy = 0;
|
||||
}
|
||||
else if (player->onconveyor == 4 && !P_IsObjectOnGround(player->mo)) // Actual conveyor belt
|
||||
player->cmomx = player->cmomy = 0;
|
||||
else if (player->onconveyor != 2 && player->onconveyor != 4
|
||||
&& player->onconveyor != 1
|
||||
)
|
||||
else if (player->onconveyor != 2 && player->onconveyor != 4 && player->onconveyor != 1)
|
||||
player->cmomx = player->cmomy = 0;
|
||||
|
||||
player->rmomx = player->mo->momx - player->cmomx;
|
||||
@@ -1942,29 +1891,8 @@ static void P_3dMovement(player_t *player)
|
||||
if (dangle > ANGLE_180) //flip to keep to one side
|
||||
{
|
||||
dangle = InvAngle(dangle);
|
||||
//dangleflip = true;
|
||||
}
|
||||
|
||||
// anything else will leave both at 0, so no need to do anything else
|
||||
|
||||
//{ SRB2kart 220217 - Toaster Code for misplaced thrust
|
||||
/*
|
||||
if (!player->kartstuff[k_drift]) // Not Drifting
|
||||
{
|
||||
angle_t difference = dangle/2;
|
||||
boolean reverse = (dangle >= ANGLE_90);
|
||||
|
||||
if (dangleflip)
|
||||
difference = InvAngle(difference);
|
||||
|
||||
if (reverse)
|
||||
difference += ANGLE_180;
|
||||
|
||||
P_InstaThrust(player->mo, player->mo->angle + difference, player->speed);
|
||||
}
|
||||
*/
|
||||
//}
|
||||
|
||||
// When sliding, don't allow forward/back
|
||||
if (player->pflags & PF_SLIDING)
|
||||
cmd->forwardmove = 0;
|
||||
@@ -1978,16 +1906,12 @@ static void P_3dMovement(player_t *player)
|
||||
// Forward movement
|
||||
if (!((player->exiting || mapreset) || (P_PlayerInPain(player) && !onground)))
|
||||
{
|
||||
//movepushforward = cmd->forwardmove * (thrustfactor * acceleration);
|
||||
movepushforward = K_3dKartMovement(player, onground, cmd->forwardmove);
|
||||
|
||||
// allow very small movement while in air for gameplay
|
||||
if (!onground)
|
||||
movepushforward >>= 2; // proper air movement
|
||||
|
||||
// don't need to account for scale here with kart accel code
|
||||
//movepushforward = FixedMul(movepushforward, player->mo->scale);
|
||||
|
||||
if (player->mo->movefactor != FRACUNIT) // Friction-scaled acceleration...
|
||||
movepushforward = FixedMul(movepushforward, player->mo->movefactor);
|
||||
|
||||
@@ -2054,9 +1978,11 @@ static void P_3dMovement(player_t *player)
|
||||
// If "no" to 1, we're not reaching any limits yet, so ignore this entirely!
|
||||
// -Shadow Hog
|
||||
newMagnitude = R_PointToDist2(player->mo->momx - player->cmomx, player->mo->momy - player->cmomy, 0, 0);
|
||||
|
||||
if (newMagnitude > K_GetKartSpeed(player, true)) //topspeed)
|
||||
{
|
||||
fixed_t tempmomx, tempmomy;
|
||||
|
||||
if (oldMagnitude > K_GetKartSpeed(player, true) && onground) // SRB2Kart: onground check for air speed cap
|
||||
{
|
||||
if (newMagnitude > oldMagnitude)
|
||||
@@ -2255,8 +2181,6 @@ static void P_MovePlayer(player_t *player)
|
||||
{
|
||||
player->pflags |= PF_FULLSTASIS;
|
||||
// If you're in stasis in tag, you don't drown.
|
||||
/*if (player->powers[pw_underwater] <= 12*TICRATE + 1)
|
||||
P_RestoreMusic(player);*/
|
||||
player->powers[pw_underwater] = player->powers[pw_spacetime] = 0;
|
||||
}
|
||||
}
|
||||
@@ -2285,7 +2209,9 @@ static void P_MovePlayer(player_t *player)
|
||||
{
|
||||
player->lturn_max[leveltime%MAXPREDICTTICS] = K_GetKartTurnValue(player, KART_FULLTURN)+1;
|
||||
player->rturn_max[leveltime%MAXPREDICTTICS] = K_GetKartTurnValue(player, -KART_FULLTURN)-1;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
player->lturn_max[leveltime%MAXPREDICTTICS] = player->rturn_max[leveltime%MAXPREDICTTICS] = 0;
|
||||
}
|
||||
|
||||
@@ -2536,8 +2462,6 @@ static void P_DoZoomTube(player_t *player)
|
||||
fixed_t dist;
|
||||
boolean reverse;
|
||||
|
||||
//player->mo->height = P_GetPlayerSpinHeight(player);
|
||||
|
||||
if (player->speed > 0)
|
||||
reverse = false;
|
||||
else
|
||||
@@ -2643,11 +2567,6 @@ static void P_DoZoomTube(player_t *player)
|
||||
else if (player == &players[displayplayers[3]])
|
||||
localangle[3] = player->mo->angle;
|
||||
}
|
||||
#if 0
|
||||
if (player->mo->state != &states[S_KART_SPIN])
|
||||
P_SetPlayerMobjState(player->mo, S_KART_SPIN);
|
||||
player->frameangle -= ANGLE_22h;
|
||||
#endif
|
||||
}
|
||||
|
||||
//
|
||||
@@ -2758,6 +2677,7 @@ boolean P_LookForEnemies(player_t *player)
|
||||
continue; // not a mobj thinker
|
||||
|
||||
mo = (mobj_t *)think;
|
||||
|
||||
if (!(mo->flags & (MF_ENEMY|MF_BOSS|MF_MONITOR|MF_SPRING)))
|
||||
continue; // not a valid enemy
|
||||
|
||||
@@ -2823,14 +2743,12 @@ void P_HomingAttack(mobj_t *source, mobj_t *enemy) // Home in on your target
|
||||
fixed_t dist;
|
||||
fixed_t ns = 0;
|
||||
|
||||
if (!enemy)
|
||||
return;
|
||||
|
||||
if (!(enemy->health))
|
||||
if (!enemy || !enemy->health)
|
||||
return;
|
||||
|
||||
// change angle
|
||||
source->angle = R_PointToAngle2(source->x, source->y, enemy->x, enemy->y);
|
||||
|
||||
if (source->player)
|
||||
{
|
||||
if (source->player == &players[consoleplayer])
|
||||
@@ -2883,6 +2801,7 @@ void P_FindEmerald(void)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
|
||||
if (mo2->type == MT_EMERHUNT)
|
||||
{
|
||||
if (!hunt1)
|
||||
@@ -2903,9 +2822,6 @@ void P_FindEmerald(void)
|
||||
//
|
||||
static void P_DeathThink(player_t *player)
|
||||
{
|
||||
//ticcmd_t *cmd = &player->cmd;
|
||||
//player->deltaviewheight = 0;
|
||||
|
||||
if (player->deadtimer < INT32_MAX)
|
||||
player->deadtimer++;
|
||||
|
||||
@@ -3746,6 +3662,33 @@ static boolean P_CheckNoclipCameraPosition(player_t *player, camera_t *thiscam,
|
||||
}
|
||||
#endif
|
||||
|
||||
static void P_MoveCameraToSpawn(UINT8 playernum)
|
||||
{
|
||||
camera_t *thiscam = &camera[playernum];
|
||||
player_t *player = playernum == 0 ? &players[consoleplayer] : &players[displayplayers[playernum]];
|
||||
|
||||
if (!thiscam || !player->mo)
|
||||
return;
|
||||
|
||||
thiscam->x = player->mo->x - P_ReturnThrustX(player->mo, thiscam->angle, player->mo->radius);
|
||||
thiscam->y = player->mo->y - P_ReturnThrustY(player->mo, thiscam->angle, player->mo->radius);
|
||||
if (player->mo->eflags & MFE_VERTICALFLIP)
|
||||
thiscam->z = player->mo->z + player->mo->height - (32<<FRACBITS) - 16*FRACUNIT;
|
||||
else
|
||||
thiscam->z = player->mo->z + (32<<FRACBITS);
|
||||
|
||||
thiscam->reset = true;
|
||||
|
||||
thiscam->angle = player->mo->angle;
|
||||
thiscam->aiming = 0;
|
||||
|
||||
thiscam->subsector = R_PointInSubsector(thiscam->x,thiscam->y);
|
||||
|
||||
thiscam->reset_aiming = true;
|
||||
|
||||
R_ResetViewInterpolation(playernum);
|
||||
}
|
||||
|
||||
boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcalled)
|
||||
{
|
||||
static boolean lookbackactive[MAXSPLITSCREENPLAYERS];
|
||||
@@ -3779,6 +3722,13 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
||||
|
||||
if (thiscam->freecam || player->spectator)
|
||||
{
|
||||
// idk if this is the best place?
|
||||
if (player->spectator && InputDown(gc_freecam, num+1))
|
||||
{
|
||||
P_MoveCameraToSpawn(num);
|
||||
return true; // dont move while you hold this
|
||||
}
|
||||
|
||||
P_DemoCameraMovement(thiscam, num);
|
||||
P_CalcChasePostImg(player, thiscam);
|
||||
return true;
|
||||
@@ -4046,7 +3996,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
||||
if (player->playerstate != PST_DEAD && !((player->pflags & PF_NIGHTSMODE) && player->exiting))
|
||||
angle += (focusaiming < ANGLE_180 ? focusaiming/2 : InvAngle(InvAngle(focusaiming)/2)); // overcomplicated version of '((signed)focusaiming)/2;'
|
||||
|
||||
if (twodlevel || (mo->flags2 & MF2_TWOD) || (!camstill && !timeover)) // Keep the view still...
|
||||
if (!camstill && !timeover) // Keep the view still...
|
||||
{
|
||||
G_ClipAimingPitch((INT32 *)&angle);
|
||||
|
||||
@@ -4346,19 +4296,17 @@ void P_DoTimeOver(player_t *player)
|
||||
exitcountdown = 5*TICRATE;
|
||||
}
|
||||
|
||||
/* gaysed script from me, based on Golden's sprite slope roll */
|
||||
|
||||
/* gaysed script from me, based on Golden's sprite slope roll */
|
||||
// holy SHIT
|
||||
static INT32
|
||||
Quaketilt (player_t *player)
|
||||
static INT32 Quaketilt(player_t *player)
|
||||
{
|
||||
angle_t tilt;
|
||||
angle_t tilt, moma;
|
||||
fixed_t lowb; // this threshold for speed
|
||||
angle_t moma = R_PointToAngle2(0, 0, player->mo->momx, player->mo->momy);
|
||||
INT32 delta = (INT32)( player->mo->angle - moma );
|
||||
INT32 delta;
|
||||
fixed_t speed;
|
||||
|
||||
boolean sliptiding = player->kartstuff[k_drift] ? 0 : player->kartstuff[k_aizdriftstrat];
|
||||
moma = R_PointToAngle2(0, 0, player->mo->momx, player->mo->momy);
|
||||
delta = (INT32)( player->mo->angle - moma );
|
||||
|
||||
if (delta == (INT32)ANGLE_180)/* FUCK YOU HAVE A HACK */
|
||||
{
|
||||
@@ -4368,6 +4316,9 @@ Quaketilt (player_t *player)
|
||||
// Hi! I'm "not a math guy"!
|
||||
if (abs(delta) > ANGLE_90)
|
||||
delta = (INT32)(( moma + ANGLE_180 ) - player->mo->angle );
|
||||
|
||||
const boolean sliptiding = player->kartstuff[k_drift] ? 0 : player->kartstuff[k_aizdriftstrat];
|
||||
|
||||
if (P_IsObjectOnGround(player->mo))
|
||||
{
|
||||
if (sliptiding)
|
||||
@@ -4386,23 +4337,24 @@ Quaketilt (player_t *player)
|
||||
tilt = ANGLE_22h;
|
||||
lowb = 10*FRACUNIT;
|
||||
}
|
||||
|
||||
lowb = FixedMul(lowb, player->mo->scale);
|
||||
moma = FixedMul(FixedDiv(delta, ANGLE_90), tilt);
|
||||
speed = abs( player->mo->momx + player->mo->momy );
|
||||
|
||||
if (speed < lowb)
|
||||
{
|
||||
// ease out tilt as we slow...
|
||||
moma = FixedMul(moma, FixedDiv(speed, lowb));
|
||||
}
|
||||
|
||||
return moma;
|
||||
}
|
||||
|
||||
static void
|
||||
DoABarrelRoll (player_t *player)
|
||||
static void DoABarrelRoll(player_t *player)
|
||||
{
|
||||
angle_t slope;
|
||||
angle_t slope = 0;
|
||||
angle_t delta;
|
||||
|
||||
fixed_t smoothing;
|
||||
|
||||
if (player->exiting)
|
||||
@@ -4420,10 +4372,6 @@ DoABarrelRoll (player_t *player)
|
||||
{
|
||||
slope = player->mo->standingslope->real_zangle;
|
||||
}
|
||||
else
|
||||
{
|
||||
slope = 0;
|
||||
}
|
||||
|
||||
if (abs((INT32)slope) > ANGLE_11hh)
|
||||
{
|
||||
@@ -4444,7 +4392,7 @@ DoABarrelRoll (player_t *player)
|
||||
smoothing = FixedDiv(AbsAngle(slope), ANGLE_45);
|
||||
|
||||
delta = FixedDiv(delta, cv_tiltsmoothing.value *
|
||||
FixedDiv(FRACUNIT, FRACUNIT + smoothing));
|
||||
FixedDiv(FRACUNIT, FRACUNIT + smoothing));
|
||||
|
||||
if (delta)
|
||||
player->tilt += delta;
|
||||
@@ -5049,19 +4997,12 @@ void P_PlayerThink(player_t *player)
|
||||
else
|
||||
player->mo->flags2 &= ~MF2_DONTDRAW;
|
||||
}
|
||||
/*else if (player->mo->tracer)
|
||||
{
|
||||
if (player->powers[pw_flashing] & 1)
|
||||
player->mo->tracer->flags2 |= MF2_DONTDRAW;
|
||||
else
|
||||
player->mo->tracer->flags2 &= ~MF2_DONTDRAW;
|
||||
}*/
|
||||
|
||||
player->pflags &= ~PF_SLIDING;
|
||||
|
||||
K_KartPlayerThink(player, cmd); // SRB2kart
|
||||
|
||||
if (rendermode != render_none && cv_tilting.value)
|
||||
if (cv_tilting.value && rendermode != render_none)
|
||||
DoABarrelRoll(player);
|
||||
|
||||
LUA_HookPlayer(player, HOOK(PlayerThink));
|
||||
@@ -5075,7 +5016,6 @@ void P_PlayerThink(player_t *player)
|
||||
void P_PlayerAfterThink(player_t *player)
|
||||
{
|
||||
ticcmd_t *cmd;
|
||||
//INT32 oldweapon = player->currentweapon; // SRB2kart - unused
|
||||
camera_t *thiscam = NULL; // if not one of the displayed players, just don't bother
|
||||
UINT8 i;
|
||||
|
||||
@@ -5137,11 +5077,10 @@ void P_PlayerAfterThink(player_t *player)
|
||||
else if (cmd->forwardmove < 0 && player->mo->tracer->target->lastlook > player->mo->tracer->target->movecount)
|
||||
player->mo->tracer->target->lastlook -= 2;
|
||||
|
||||
if (!(player->mo->tracer->target->flags & MF_SLIDEME) // Noclimb on chain parameters gives this
|
||||
&& !(twodlevel || player->mo->flags2 & MF2_TWOD)) // why on earth would you want to turn them in 2D mode?
|
||||
if (!(player->mo->tracer->target->flags & MF_SLIDEME)) // Noclimb on chain parameters gives this
|
||||
{
|
||||
player->mo->tracer->target->health += cmd->sidemove;
|
||||
player->mo->angle += cmd->sidemove<<ANGLETOFINESHIFT; // 2048 --> ANGLE_MAX
|
||||
player->mo->angle += cmd->sidemove << ANGLETOFINESHIFT; // 2048 --> ANGLE_MAX
|
||||
|
||||
if (player == &players[consoleplayer])
|
||||
localangle[0] = player->mo->angle; // Adjust the local control angle.
|
||||
@@ -5166,6 +5105,7 @@ void P_PlayerAfterThink(player_t *player)
|
||||
// defaults to make sure 1st person cam doesn't do anything weird on startup
|
||||
//player->deltaviewheight = 0;
|
||||
player->viewheight = FixedMul(32 << FRACBITS, player->mo->scale);
|
||||
|
||||
if (player->mo->eflags & MFE_VERTICALFLIP)
|
||||
player->viewz = player->mo->z + player->mo->height - player->viewheight;
|
||||
else
|
||||
|
||||
+1
-1
@@ -668,7 +668,7 @@ typedef struct
|
||||
INT16 height;
|
||||
INT16 leftoffset; // pixels to the left of origin
|
||||
INT16 topoffset; // pixels below the origin
|
||||
INT32 columnofs[8]; // only [width] used
|
||||
INT32 columnofs[]; // only [width] used
|
||||
// the [0] is &columnofs[width]
|
||||
} ATTRPACK softwarepatch_t;
|
||||
|
||||
|
||||
+42
-4
@@ -41,13 +41,49 @@ static CV_PossibleValue_t fpscap_cons_t[] = {
|
||||
{0, "Match refresh rate"},
|
||||
{0, NULL}
|
||||
};
|
||||
|
||||
consvar_t cv_fpscap = {"fpscap", "Match refresh rate", CV_SAVE, fpscap_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_fpscapbg = {"fpscapbackground", "Match refresh rate", CV_SAVE, fpscap_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_precipinterp = {"precipinterpolation", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
ps_metric_t ps_interp_frac = {0};
|
||||
ps_metric_t ps_interp_lag = {0};
|
||||
|
||||
static boolean R_UseBackgroundFramerateCap(void)
|
||||
{
|
||||
if (!window_notinfocus)
|
||||
return false;
|
||||
|
||||
// if foreground is unlimited or matched to refresh rate but bg is limited
|
||||
if (cv_fpscap.value <= 0 && cv_fpscapbg.value >= 0)
|
||||
return true;
|
||||
|
||||
// use the lower value
|
||||
if ((cv_fpscap.value > 0 && cv_fpscapbg.value > 0)
|
||||
&& (cv_fpscapbg.value < cv_fpscap.value))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static UINT32 R_GetBackgroundFramerateCap(void)
|
||||
{
|
||||
if (cv_fpscapbg.value == 0)
|
||||
{
|
||||
// 0: Match refresh rate
|
||||
return I_GetRefreshRate();
|
||||
}
|
||||
|
||||
if (cv_fpscapbg.value < 0)
|
||||
{
|
||||
// -1: Unlimited
|
||||
return 0;
|
||||
}
|
||||
|
||||
return cv_fpscapbg.value;
|
||||
}
|
||||
|
||||
UINT32 R_GetFramerateCap(void)
|
||||
{
|
||||
if (rendermode == render_none)
|
||||
@@ -57,6 +93,11 @@ UINT32 R_GetFramerateCap(void)
|
||||
return TICRATE;
|
||||
}
|
||||
|
||||
if (R_UseBackgroundFramerateCap())
|
||||
{
|
||||
return R_GetBackgroundFramerateCap();
|
||||
}
|
||||
|
||||
if (cv_fpscap.value == 0)
|
||||
{
|
||||
// 0: Match refresh rate
|
||||
@@ -167,16 +208,13 @@ void R_InterpolateViewRollAngle(fixed_t frac)
|
||||
void R_InterpolateView(fixed_t frac, boolean forceinvalid)
|
||||
{
|
||||
viewvars_t* prevview = oldview;
|
||||
UINT8 i;
|
||||
|
||||
if (FIXED_TO_FLOAT(frac) < 0)
|
||||
frac = 0;
|
||||
if (frac > FRACUNIT)
|
||||
frac = FRACUNIT;
|
||||
|
||||
i = R_GetViewNumber();
|
||||
|
||||
if (oldview_invalid[i] != 0 || forceinvalid)
|
||||
if (oldview_invalid[R_GetViewNumber()] != 0 || forceinvalid)
|
||||
{
|
||||
// interpolate from newview to newview
|
||||
prevview = newview;
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@
|
||||
#include "r_state.h"
|
||||
#include "m_perfstats.h"
|
||||
|
||||
extern consvar_t cv_fpscap;
|
||||
extern consvar_t cv_fpscap, cv_fpscapbg;
|
||||
extern consvar_t cv_precipinterp;
|
||||
|
||||
extern ps_metric_t ps_interp_frac;
|
||||
|
||||
+8
-6
@@ -125,16 +125,17 @@ static CV_PossibleValue_t drawdist_cons_t[] = {
|
||||
{8192, "8192"}, {12288, "12288"}, {20480, "20480"},
|
||||
{24576, "24576"},{0, "Infinite"}, {0, NULL}};
|
||||
|
||||
#if defined(__x86_64__) || defined(__amd64__) || defined(__aarch64__) || defined(__arm64__) // only for 64bit (idk how else to proper check lmao)
|
||||
#if __SIZEOF_POINTER__ < 8 // only for 64bit
|
||||
static CV_PossibleValue_t drawdist_precip_cons_t[] = {
|
||||
{256, "256"}, {512, "512"}, {768, "768"},
|
||||
{256, "256"}, {512, "512"}, {768, "768"},
|
||||
{1024, "1024"}, {1536, "1536"}, {2048, "2048"},
|
||||
{3072, "3072"}, {4096, "4096"}, {0, "None"}, {0, NULL}};
|
||||
{0, "None"}, {0, NULL}};
|
||||
|
||||
#else
|
||||
static CV_PossibleValue_t drawdist_precip_cons_t[] = {
|
||||
{256, "256"}, {512, "512"}, {768, "768"},
|
||||
{1024, "1024"}, {1536, "1536"}, {2048, "2048"},
|
||||
{0, "None"}, {0, NULL}};
|
||||
{256, "256"}, {512, "512"}, {768, "768"},
|
||||
{1024, "1024"}, {1536, "1536"}, {2048, "2048"},
|
||||
{3072, "3072"}, {4096, "4096"}, {0, "None"}, {0, NULL}};
|
||||
#endif
|
||||
|
||||
static CV_PossibleValue_t maxinterpdist_cons_t[] = {
|
||||
@@ -1576,5 +1577,6 @@ void R_RegisterEngineStuff(void)
|
||||
|
||||
// Frame interpolation/uncapped
|
||||
CV_RegisterVar(&cv_fpscap);
|
||||
CV_RegisterVar(&cv_fpscapbg);
|
||||
CV_RegisterVar(&cv_precipinterp);
|
||||
}
|
||||
+6
-3
@@ -2042,9 +2042,12 @@ static boolean S_SkipIntroMusic(void)
|
||||
|
||||
char *maptitle = G_BuildMapTitle(gamemap); // 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;
|
||||
if (maptitle)
|
||||
{
|
||||
// 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);
|
||||
|
||||
|
||||
+17
-44
@@ -65,6 +65,9 @@ consvar_t cv_renderview = {"renderview", "On", 0, CV_OnOff, NULL, 0, NULL, NULL,
|
||||
consvar_t cv_vhseffect = {"vhspause", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_shittyscreen = {"televisionsignal", "Okay", CV_NOSHOWHELP, shittyscreen_cons_t, 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};
|
||||
|
||||
static void Highreshudscale_OnChange(void);
|
||||
static CV_PossibleValue_t highreshudscale_cons_t[] = {{4*FRACUNIT/5, "MIN"}, {6*FRACUNIT/5, "MAX"}, {0, NULL}};
|
||||
consvar_t cv_highreshudscale = {"highreshudscale", "1", CV_SAVE|CV_FLOAT|CV_CALL|CV_NOINIT|CV_NOSHOWHELP, highreshudscale_cons_t, Highreshudscale_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
@@ -106,41 +109,18 @@ void SCR_SetMode(void)
|
||||
|
||||
V_SetPalette(0);
|
||||
|
||||
//
|
||||
// setup the right draw routines for either 8bpp or 16bpp
|
||||
//
|
||||
if (true)//vid.bpp == 1) //Always run in 8bpp. todo: remove all 16bpp code?
|
||||
{
|
||||
spanfunc = basespanfunc = R_DrawSpan_8;
|
||||
splatfunc = R_DrawSplat_8;
|
||||
transcolfunc = R_DrawTranslatedColumn_8;
|
||||
transtransfunc = R_DrawTranslatedTranslucentColumn_8;
|
||||
spanfunc = basespanfunc = R_DrawSpan_8;
|
||||
splatfunc = R_DrawSplat_8;
|
||||
transcolfunc = R_DrawTranslatedColumn_8;
|
||||
transtransfunc = R_DrawTranslatedTranslucentColumn_8;
|
||||
|
||||
colfunc = basecolfunc = R_DrawColumn_8;
|
||||
shadecolfunc = R_DrawShadeColumn_8;
|
||||
fuzzcolfunc = R_DrawTranslucentColumn_8;
|
||||
walldrawerfunc = R_DrawWallColumn_8;
|
||||
twosmultipatchfunc = R_Draw2sMultiPatchColumn_8;
|
||||
twosmultipatchtransfunc = R_Draw2sMultiPatchTranslucentColumn_8;
|
||||
}
|
||||
/* else if (vid.bpp > 1)
|
||||
{
|
||||
I_OutputMsg("using highcolor mode\n");
|
||||
spanfunc = basespanfunc = R_DrawSpan_16;
|
||||
transcolfunc = R_DrawTranslatedColumn_16;
|
||||
transtransfunc = R_DrawTranslucentColumn_16; // No 16bit operation for this function
|
||||
colfunc = basecolfunc = R_DrawColumn_8;
|
||||
shadecolfunc = R_DrawShadeColumn_8;
|
||||
fuzzcolfunc = R_DrawTranslucentColumn_8;
|
||||
walldrawerfunc = R_DrawWallColumn_8;
|
||||
twosmultipatchfunc = R_Draw2sMultiPatchColumn_8;
|
||||
twosmultipatchtransfunc = R_Draw2sMultiPatchTranslucentColumn_8;
|
||||
|
||||
colfunc = basecolfunc = R_DrawColumn_16;
|
||||
shadecolfunc = NULL; // detect error if used somewhere..
|
||||
fuzzcolfunc = R_DrawTranslucentColumn_16;
|
||||
walldrawerfunc = R_DrawWallColumn_16;
|
||||
}*/
|
||||
else
|
||||
I_Error("unknown bytes per pixel mode %d\n", vid.bpp);
|
||||
/*
|
||||
if (SCR_IsAspectCorrect(vid.width, vid.height))
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Resolution is not aspect-correct!\nUse a multiple of %dx%d\n"), BASEVIDWIDTH, BASEVIDHEIGHT);
|
||||
*/
|
||||
// set the apprpriate drawer for the sky (tall or INT16)
|
||||
setmodeneeded = 0;
|
||||
}
|
||||
@@ -164,10 +144,7 @@ void SCR_Startup(void)
|
||||
vid.fdupx = FixedDiv(vid.width*FRACUNIT, BASEVIDWIDTH*FRACUNIT);
|
||||
vid.fdupy = FixedDiv(vid.height*FRACUNIT, BASEVIDHEIGHT*FRACUNIT);
|
||||
|
||||
//#ifdef HWRENDER
|
||||
//if (rendermode != render_opengl && rendermode != render_none) // This was just placing it incorrectly at non aspect correct resolutions in opengl
|
||||
//#endif
|
||||
vid.fdupx = vid.fdupy = (vid.fdupx < vid.fdupy ? vid.fdupx : vid.fdupy);
|
||||
vid.fdupx = vid.fdupy = (vid.fdupx < vid.fdupy ? vid.fdupx : vid.fdupy);
|
||||
|
||||
vid.meddupx = (UINT8)(vid.dupx >> 1) + 1;
|
||||
vid.meddupy = (UINT8)(vid.dupy >> 1) + 1;
|
||||
@@ -216,6 +193,8 @@ void SCR_Startup(void)
|
||||
CV_RegisterVar(&cv_bsaturation);
|
||||
CV_RegisterVar(&cv_msaturation);
|
||||
|
||||
CV_RegisterVar(&cv_votebgscaling);
|
||||
|
||||
V_SetPalette(0);
|
||||
}
|
||||
|
||||
@@ -245,13 +224,7 @@ void SCR_Recalc(void)
|
||||
vid.fdupy = FixedDiv(vid.fdupy, cv_highreshudscale.value);
|
||||
}
|
||||
|
||||
#ifdef HWRENDER
|
||||
//if (rendermode != render_opengl && rendermode != render_none) // This was just placing it incorrectly at non aspect correct resolutions in opengl
|
||||
// 13/11/18:
|
||||
// The above is no longer necessary, since we want OpenGL to be just like software now
|
||||
// -- Monster Iestyn
|
||||
#endif
|
||||
vid.fdupx = vid.fdupy = (vid.fdupx < vid.fdupy ? vid.fdupx : vid.fdupy);
|
||||
vid.fdupx = vid.fdupy = (vid.fdupx < vid.fdupy ? vid.fdupx : vid.fdupy);
|
||||
|
||||
//vid.baseratio = FixedDiv(vid.height << FRACBITS, BASEVIDHEIGHT << FRACBITS);
|
||||
vid.baseratio = FRACUNIT;
|
||||
|
||||
@@ -153,6 +153,8 @@ extern consvar_t cv_timescale;
|
||||
|
||||
extern consvar_t cv_alwaysgrabmouse;
|
||||
|
||||
extern consvar_t cv_votebgscaling;
|
||||
|
||||
// quick fix for tall/short skies, depending on bytesperpixel
|
||||
extern void (*walldrawerfunc)(void);
|
||||
|
||||
|
||||
+9
-34
@@ -1485,6 +1485,7 @@ void I_GamepadRumble(INT32 playernum, UINT16 low_strength, UINT16 high_strength,
|
||||
(void)duration;
|
||||
#else
|
||||
SDL_GameController *controller = JoyInfo[playernum].dev;
|
||||
|
||||
if (controller == NULL)
|
||||
{
|
||||
return;
|
||||
@@ -1503,6 +1504,7 @@ void I_SetGamepadIndicatorColor(INT32 playernum, UINT8 red, UINT8 green, UINT8 b
|
||||
(void)blue;
|
||||
#else
|
||||
SDL_GameController *controller = JoyInfo[playernum].dev;
|
||||
|
||||
if (controller == NULL)
|
||||
{
|
||||
return;
|
||||
@@ -1640,37 +1642,6 @@ void I_UpdateMumble(const mobj_t *mobj, const listener_t listener)
|
||||
#undef WINMUMBLE
|
||||
#endif // NOMUMBLE
|
||||
|
||||
//
|
||||
// I_Tactile
|
||||
//
|
||||
void I_Tactile(FFType pFFType, const JoyFF_t *FFEffect)
|
||||
{
|
||||
// UNUSED.
|
||||
(void)pFFType;
|
||||
(void)FFEffect;
|
||||
}
|
||||
|
||||
void I_Tactile2(FFType pFFType, const JoyFF_t *FFEffect)
|
||||
{
|
||||
// UNUSED.
|
||||
(void)pFFType;
|
||||
(void)FFEffect;
|
||||
}
|
||||
|
||||
void I_Tactile3(FFType pFFType, const JoyFF_t *FFEffect)
|
||||
{
|
||||
// UNUSED.
|
||||
(void)pFFType;
|
||||
(void)FFEffect;
|
||||
}
|
||||
|
||||
void I_Tactile4(FFType pFFType, const JoyFF_t *FFEffect)
|
||||
{
|
||||
// UNUSED.
|
||||
(void)pFFType;
|
||||
(void)FFEffect;
|
||||
}
|
||||
|
||||
/** \brief empty ticcmd for player 1
|
||||
*/
|
||||
static ticcmd_t emptycmd;
|
||||
@@ -1921,7 +1892,10 @@ INT32 I_StartupSystem(void)
|
||||
SDL_GetVersion(&SDLlinked);
|
||||
I_StartupConsole();
|
||||
#ifdef NEWSIGNALHANDLER
|
||||
I_Fork();
|
||||
// This is useful when debugging. It lets GDB attach to
|
||||
// the correct process easily.
|
||||
if (!M_CheckParm("-nofork"))
|
||||
I_Fork();
|
||||
#endif
|
||||
#ifdef HAVE_THREADS
|
||||
I_start_threads();
|
||||
@@ -2213,9 +2187,10 @@ void I_ShutdownSystem(void)
|
||||
{
|
||||
INT32 c;
|
||||
|
||||
#ifndef NEWSIGNALHANDLER
|
||||
I_ShutdownConsole();
|
||||
#ifdef NEWSIGNALHANDLER
|
||||
if (M_CheckParm("-nofork"))
|
||||
#endif
|
||||
I_ShutdownConsole();
|
||||
|
||||
for (c = MAX_QUIT_FUNCS-1; c >= 0; c--)
|
||||
if (quit_funcs[c])
|
||||
|
||||
+13
-3
@@ -213,10 +213,20 @@ void I_StartupSound(void)
|
||||
// call to start audio failed -- we do not have it
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
SDL_version SDLmixcompiled;
|
||||
const SDL_version *SDLmixlinked;
|
||||
SDL_MIXER_VERSION(&SDLmixcompiled)
|
||||
SDLmixlinked = Mix_Linked_Version();
|
||||
|
||||
I_OutputMsg("Compiled for SDL_mixer version: %d.%d.%d\n",
|
||||
SDLmixcompiled.major, SDLmixcompiled.minor, SDLmixcompiled.patch);
|
||||
I_OutputMsg("Linked with SDL_mixer version: %d.%d.%d\n",
|
||||
SDLmixlinked->major, SDLmixlinked->minor, SDLmixlinked->patch);
|
||||
|
||||
#ifdef HAVE_OPENMPT
|
||||
CONS_Printf("libopenmpt version: %s\n", openmpt_get_string("library_version"));
|
||||
CONS_Printf("libopenmpt build date: %s\n", openmpt_get_string("build"));
|
||||
I_OutputMsg("libopenmpt version: %s\n", openmpt_get_string("library_version"));
|
||||
I_OutputMsg("libopenmpt build date: %s\n", openmpt_get_string("build"));
|
||||
#endif
|
||||
|
||||
sound_started = true;
|
||||
|
||||
+1
-14
@@ -212,7 +212,7 @@ boolean OglSdlSurface(INT32 w, INT32 h)
|
||||
#ifdef USE_FBO_OGL
|
||||
char videodriver[4] = {'S','D','L',0};
|
||||
if (supportFBO && strstr((const char*)gl_renderer, "NVIDIA")
|
||||
&& (*strncpy(videodriver, SDL_GetCurrentVideoDriver(), 4) != '\0')
|
||||
&& (*strncpy(videodriver, SDL_GetCurrentVideoDriver(), sizeof(videodriver)-1) != '\0')
|
||||
&& (strncasecmp("x11",videodriver,4) == 0))
|
||||
xwaylandcrap = true;
|
||||
#endif
|
||||
@@ -221,19 +221,6 @@ boolean OglSdlSurface(INT32 w, INT32 h)
|
||||
|
||||
SDL_GL_SetSwapInterval(cv_vidwait.value ? 1 : 0);
|
||||
|
||||
// The screen textures need to be flushed if the width or height change so that they be remade for the correct size
|
||||
if (screen_width != w || screen_height != h)
|
||||
{
|
||||
GL_FlushScreenTextures();
|
||||
|
||||
#ifdef USE_FBO_OGL
|
||||
GL_Framebuffer_DeleteAttachments();
|
||||
#endif
|
||||
}
|
||||
|
||||
screen_width = (GLint)w;
|
||||
screen_height = (GLint)h;
|
||||
|
||||
GL_SetModelView(w, h);
|
||||
GL_SetStates();
|
||||
pglClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT);
|
||||
|
||||
+1
-1
@@ -187,7 +187,7 @@ void ST_doPaletteStuff(void)
|
||||
|
||||
#ifdef HWRENDER
|
||||
if (rendermode == render_opengl && !HWR_PalRenderFlashpal())
|
||||
palette = 0; // No flashpals here in OpenGL
|
||||
palette = 0; // Don't set the palette to a flashpal in OpenGL's truecolor mode
|
||||
#endif
|
||||
|
||||
palette = min(max(palette, 0), 13);
|
||||
|
||||
@@ -457,6 +457,9 @@ static void LoadPalette(const char *lumpname)
|
||||
#endif
|
||||
pLocalPalette[i].s.alpha = 0xFF;
|
||||
|
||||
if (!Cubeapply)
|
||||
continue;
|
||||
|
||||
// lerp of colour cubing! if you want, make it smoother yourself
|
||||
V_CubeApply(&pLocalPalette[i].s.red, &pLocalPalette[i].s.green, &pLocalPalette[i].s.blue);
|
||||
}
|
||||
@@ -1562,6 +1565,51 @@ void V_DrawPatchFill(patch_t *pat)
|
||||
}
|
||||
}
|
||||
|
||||
// Draws a patch and tries to always fill the screen with the patch
|
||||
void V_DrawAdaptiveScaledFullScreenPatch(patch_t *patch)
|
||||
{
|
||||
fixed_t x = 0, y = 0;
|
||||
fixed_t scale = ((vid.width * FRACUNIT) / patch->width); // fit the screen horizontally
|
||||
fixed_t scaled_height = FixedMul(patch->height << FRACBITS, scale);
|
||||
|
||||
// however, if this means the patch doesent fill out the screen vertically then
|
||||
if (scaled_height < (vid.height << FRACBITS))
|
||||
{
|
||||
scale = ((vid.height * FRACUNIT) / patch->height); // scale it to fit the screen vertically
|
||||
x = ((vid.width << FRACBITS) - FixedMul(patch->width << FRACBITS, scale)) / 2;
|
||||
}
|
||||
else
|
||||
y = (vid.height << FRACBITS) - scaled_height;
|
||||
|
||||
V_DrawFixedPatch(x, y, scale, V_NOSCALEPATCH, patch, NULL);
|
||||
}
|
||||
|
||||
// Draws a patch and scales it to fill out the screen vertically while remaining centered
|
||||
void V_DrawVerticallyScaledFullScreenPatch(patch_t *patch)
|
||||
{
|
||||
fixed_t scale = ((vid.height * FRACUNIT) / patch->height);
|
||||
fixed_t x = ((vid.width << FRACBITS) - FixedMul(patch->width << FRACBITS, scale)) / 2; // i fucking hate maths
|
||||
|
||||
V_DrawFixedPatch(x, 0, scale, V_NOSCALEPATCH, patch, NULL);
|
||||
}
|
||||
|
||||
// Draws a patch and scales it to fill out the screen horizontally
|
||||
// centers the patch when its too small to fit the screen vertically
|
||||
void V_DrawHorizontallyScaledFullScreenPatch(patch_t *patch)
|
||||
{
|
||||
fixed_t scale = ((vid.width * FRACUNIT) / patch->width);
|
||||
fixed_t scaled_height = FixedMul(patch->height << FRACBITS, scale);
|
||||
fixed_t y = (vid.height << FRACBITS) - scaled_height;
|
||||
|
||||
// center it if it does not fit the screen vertically
|
||||
if (scaled_height < (vid.height << FRACBITS))
|
||||
{
|
||||
y /= 2;
|
||||
}
|
||||
|
||||
V_DrawFixedPatch(0, y, scale, V_NOSCALEPATCH, patch, NULL);
|
||||
}
|
||||
|
||||
void V_DrawVhsEffect(boolean rewind)
|
||||
{
|
||||
static fixed_t upbary = 100*FRACUNIT, downbary = 150*FRACUNIT;
|
||||
|
||||
+5
-1
@@ -45,7 +45,7 @@ typedef struct
|
||||
{
|
||||
boolean init;
|
||||
RGBA_t palette[256];
|
||||
UINT16 table[0xFFFF];
|
||||
UINT16 table[0x10000];
|
||||
} colorlookup_t;
|
||||
|
||||
void InitColorLUT(colorlookup_t *lut, RGBA_t *palette, boolean makecolors);
|
||||
@@ -283,6 +283,10 @@ void V_DoPostProcessor(INT32 view, INT32 param);
|
||||
|
||||
void V_DrawPatchFill(patch_t *pat);
|
||||
|
||||
void V_DrawAdaptiveScaledFullScreenPatch(patch_t *patch);
|
||||
void V_DrawVerticallyScaledFullScreenPatch(patch_t *patch);
|
||||
void V_DrawHorizontallyScaledFullScreenPatch(patch_t *patch);
|
||||
|
||||
void VID_BlitLinearScreen(const UINT8 *srcptr, UINT8 *destptr, INT32 width, INT32 height, size_t srcrowbytes,
|
||||
size_t destrowbytes);
|
||||
|
||||
|
||||
+178
-147
@@ -57,30 +57,15 @@ typedef struct
|
||||
|
||||
static y_data_t data;
|
||||
|
||||
|
||||
// graphics
|
||||
static patch_t *bgpatch = NULL; // INTERSCR
|
||||
static patch_t *widebgpatch = NULL; // INTERSCW
|
||||
static patch_t *bgtile = NULL; // SPECTILE/SRB2BACK
|
||||
|
||||
static INT32 timer;
|
||||
|
||||
static INT32 intertic;
|
||||
static INT32 endtic = -1;
|
||||
static INT32 sorttic = -1;
|
||||
|
||||
patch_t *animVoteFramesPatches = NULL;
|
||||
// VEXTRN - Vote (V) Extra (EXT) Race (R) Normal (N - Normal sized patch)
|
||||
// VEXTBN - Vote (V) Extra (EXT) Battle (B) Normal (N - Normal sized patch)
|
||||
// VEXTBW - Vote (V) Extra (EXT) Battle (B) Normal (W - Wide patch used in software)
|
||||
// VEXTRW - Vote (V) Extra (EXT) Race (R) Normal (W - Wide patch used in software)
|
||||
char animPrefix[] = "INTSC";
|
||||
char animWidePrefix[] = "INTSW";
|
||||
char *luaVoteScreen = NULL;
|
||||
|
||||
INT32 currentAnimFrame = 0;
|
||||
static INT32 foundAnimVoteFrames = 0;
|
||||
static INT32 foundAnimVoteWideFrames = 0;
|
||||
|
||||
intertype_t intertype = int_none;
|
||||
|
||||
static huddrawlist_h luahuddrawlist_intermission = NULL;
|
||||
@@ -118,17 +103,13 @@ typedef struct
|
||||
boolean loaded;
|
||||
} y_voteclient;
|
||||
|
||||
// votescreen stuff
|
||||
votescreen_t VoteScreen = {0};
|
||||
|
||||
static y_votelvlinfo levelinfo[5];
|
||||
static y_voteclient voteclient;
|
||||
static INT32 votetic;
|
||||
static INT32 voteendtic = -1;
|
||||
static patch_t *cursor = NULL;
|
||||
static patch_t *cursor1 = NULL;
|
||||
static patch_t *cursor2 = NULL;
|
||||
static patch_t *cursor3 = NULL;
|
||||
static patch_t *cursor4 = NULL;
|
||||
static patch_t *randomlvl = NULL;
|
||||
static patch_t *rubyicon = NULL;
|
||||
|
||||
static void Y_UnloadVoteData(void);
|
||||
|
||||
@@ -287,53 +268,6 @@ static void Y_CalculateMatchData(UINT8 rankingsmode, void (*comparison)(INT32))
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Y_AnimatedVoteScreenCheck
|
||||
//
|
||||
// Check if the lumps exist (checking for VEXTR(N|W)xx for race and VEXTRB(N|W)xx for battle)
|
||||
static void Y_AnimatedVoteScreenCheck(void)
|
||||
{
|
||||
char tmpPrefix[] = "INTS";
|
||||
boolean stopSearching = false;
|
||||
|
||||
if (luaVoteScreen)
|
||||
strncpy(tmpPrefix, luaVoteScreen, 4);
|
||||
else
|
||||
{
|
||||
if (G_BattleGametype())
|
||||
strcpy(tmpPrefix, "BTLS");
|
||||
}
|
||||
|
||||
strncpy(animPrefix, tmpPrefix, 4);
|
||||
animPrefix[4] = 'C';
|
||||
strncpy(animWidePrefix, tmpPrefix, 4);
|
||||
animWidePrefix[4] = 'W';
|
||||
|
||||
foundAnimVoteFrames = 0;
|
||||
foundAnimVoteWideFrames = 0;
|
||||
currentAnimFrame = 0;
|
||||
|
||||
INT32 i = 1;
|
||||
while (!stopSearching)
|
||||
{
|
||||
boolean normalLumpExists = W_LumpExists(va("%sC%d", tmpPrefix, i));
|
||||
boolean wideLumpExists = W_LumpExists(va("%sW%d", tmpPrefix, i));
|
||||
|
||||
if (normalLumpExists || wideLumpExists)
|
||||
{
|
||||
if (normalLumpExists)
|
||||
foundAnimVoteFrames++;
|
||||
|
||||
if (wideLumpExists)
|
||||
foundAnimVoteWideFrames++;
|
||||
}
|
||||
else // If we don't find at least frame 1 (e.g VEXTRN1), let's just stop looking
|
||||
stopSearching = true;
|
||||
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
// Y_PlayerStandingsDrawer
|
||||
//
|
||||
// Handles drawing the center-of-screen player standings.
|
||||
@@ -608,8 +542,6 @@ void Y_Ticker(void)
|
||||
|
||||
if (demo.savemode == DSM_WILLSAVE || demo.savemode == DSM_WILLAUTOSAVE)
|
||||
G_SaveDemo();
|
||||
else if (demo.savemode != DSM_TITLEENTRY)
|
||||
G_ResetDemoRecording();
|
||||
}
|
||||
|
||||
// Check for pause or menu up in single player
|
||||
@@ -869,7 +801,8 @@ void Y_StartIntermission(void)
|
||||
//
|
||||
void Y_EndIntermission(void)
|
||||
{
|
||||
Y_UnloadData();
|
||||
if (!dedicated)
|
||||
Y_UnloadData();
|
||||
|
||||
endtic = -1;
|
||||
sorttic = -1;
|
||||
@@ -887,76 +820,161 @@ static void Y_FollowIntermission(void)
|
||||
G_AfterIntermission();
|
||||
}
|
||||
|
||||
#define UNLOAD(x) if (x) {Patch_Free(x);} x = NULL;
|
||||
#define UNLOAD(x) {if ((x) != NULL) {Patch_Free(x);} x = NULL;}
|
||||
|
||||
//
|
||||
// Y_UnloadData
|
||||
//
|
||||
static void Y_UnloadData(void)
|
||||
{
|
||||
// In hardware mode, don't Z_ChangeTag a pointer returned by W_CachePatchName().
|
||||
// It doesn't work and is unnecessary.
|
||||
if (rendermode != render_soft)
|
||||
return;
|
||||
|
||||
// unload the background patches
|
||||
UNLOAD(bgpatch);
|
||||
UNLOAD(widebgpatch);
|
||||
UNLOAD(VoteScreen.bgpatch);
|
||||
UNLOAD(VoteScreen.widebgpatch);
|
||||
UNLOAD(bgtile);
|
||||
//UNLOAD(interpic);
|
||||
}
|
||||
|
||||
// SRB2Kart: Voting!
|
||||
|
||||
// Y_DrawAnimatedVoteScreenPatch
|
||||
//
|
||||
// Draw animated patch based on frame counter on vote screen
|
||||
// Y_VoteScreenCheck
|
||||
//
|
||||
static void Y_DrawAnimatedVoteScreenPatch(boolean widePatch)
|
||||
static void Y_VoteScreenCheck(void)
|
||||
{
|
||||
char tempAnimPrefix[7];
|
||||
widePatch ? strcpy(tempAnimPrefix, animWidePrefix) : strcpy(tempAnimPrefix, animPrefix);
|
||||
const INT32 tempFoundAnimVoteFrames = widePatch ? foundAnimVoteWideFrames : foundAnimVoteFrames;
|
||||
strcpy(VoteScreen.Prefix, "INTS");
|
||||
|
||||
// Just in case someone provides LESS widescreen frames than normal frames or vice versa, reset the frame counter to 0
|
||||
if (currentAnimFrame > tempFoundAnimVoteFrames - 1)
|
||||
currentAnimFrame = 0;
|
||||
if (VoteScreen.luaPrefix[0] != 0)
|
||||
strlcpy(VoteScreen.Prefix, VoteScreen.luaPrefix, sizeof(VoteScreen.Prefix));
|
||||
else if (G_BattleGametype())
|
||||
strcpy(VoteScreen.Prefix, "BTLS");
|
||||
|
||||
patch_t *background = W_CachePatchName(va("%s%d", tempAnimPrefix, currentAnimFrame + 1), PU_PATCH);
|
||||
V_DrawScaledPatch(((vid.width/2) / vid.dupx) - (background->width/2), // Keep the width/height adjustments, for screens that are less wide than 320(?)
|
||||
(vid.height / vid.dupy) - background->height,
|
||||
V_SNAPTOTOP|V_SNAPTOLEFT, background);
|
||||
VoteScreen.foundLuaVoteFrames = VoteScreen.foundLuaVoteWideFrames = 0;
|
||||
VoteScreen.currentAnimFrame = 0;
|
||||
|
||||
if (renderisnewtic && votetic % 2 == 0 && !paused)
|
||||
currentAnimFrame = (currentAnimFrame + 1 > tempFoundAnimVoteFrames - 1) ? 0 : currentAnimFrame + 1;
|
||||
INT32 i = 1;
|
||||
|
||||
// check for lua vote background replacements
|
||||
for (;;)
|
||||
{
|
||||
// Check if the lumps exist (checking for VEXTR(N|W)xx for race and VEXTRB(N|W)xx for battle)
|
||||
boolean normalLumpExists = W_LumpExists(va("%sC%d", VoteScreen.Prefix, i));
|
||||
boolean wideLumpExists = W_LumpExists(va("%sW%d", VoteScreen.Prefix, i));
|
||||
|
||||
if (normalLumpExists || wideLumpExists)
|
||||
{
|
||||
if (normalLumpExists)
|
||||
VoteScreen.foundLuaVoteFrames++;
|
||||
|
||||
if (wideLumpExists)
|
||||
VoteScreen.foundLuaVoteWideFrames++;
|
||||
}
|
||||
else // If we don't find at least frame 1 (e.g VEXTRN1), let's just stop looking
|
||||
break;
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
// non lua vote background handling
|
||||
boolean prefbattletype = ((votelevels[0][1] & ~0x80) == GT_MATCH);
|
||||
VoteScreen.widebgpatch = W_CachePatchName((prefbattletype ? "BATTLSCW" : "INTERSCW"), PU_PATCH);
|
||||
VoteScreen.bgpatch = W_CachePatchName((prefbattletype ? "BATTLSCR" : "INTERSCR"), PU_PATCH);
|
||||
}
|
||||
|
||||
static void Y_DrawVoteScreenPatch(void)
|
||||
//
|
||||
// Y_VoteBackgroundDrawer
|
||||
//
|
||||
// Determines which patch drawer to use for scaling
|
||||
//
|
||||
static void Y_VoteBackgroundDrawer(patch_t *patch)
|
||||
{
|
||||
const boolean widescreen = (vid.width / vid.dupx > 320);
|
||||
const boolean animvote = (foundAnimVoteWideFrames || foundAnimVoteFrames);
|
||||
|
||||
if (animvote)
|
||||
switch (cv_votebgscaling.value)
|
||||
{
|
||||
Y_DrawAnimatedVoteScreenPatch((foundAnimVoteWideFrames && widescreen));
|
||||
case 1: // adaptive
|
||||
V_DrawAdaptiveScaledFullScreenPatch(patch);
|
||||
break;
|
||||
case 2: // vertical-fill
|
||||
V_DrawVerticallyScaledFullScreenPatch(patch);
|
||||
break;
|
||||
case 3: // horizontal-fill
|
||||
V_DrawHorizontallyScaledFullScreenPatch(patch);
|
||||
break;
|
||||
case 0: // vanilla
|
||||
default:
|
||||
V_DrawScaledPatch(((vid.width/2) / vid.dupx) - (patch->width/2),
|
||||
(vid.height / vid.dupy) - patch->height,
|
||||
V_SNAPTOTOP|V_SNAPTOLEFT, patch);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Y_DrawLuaVoteScreenPatch
|
||||
//
|
||||
// Handles votebackgrounds set by "setVoteBackground"
|
||||
// Aswell as animated patches
|
||||
//
|
||||
static void Y_DrawLuaVoteScreenPatch(boolean widePatch)
|
||||
{
|
||||
INT32 nextframe = 0;
|
||||
patch_t *votebg = NULL;
|
||||
char tempPrefix[6];
|
||||
const INT32 tempfoundAnimLuaVoteFrames = ((widePatch ? VoteScreen.foundLuaVoteWideFrames : VoteScreen.foundLuaVoteFrames) - 1);
|
||||
|
||||
strcpy(tempPrefix, va("%s%s", VoteScreen.Prefix, (widePatch ? "W" : "C")));
|
||||
|
||||
// Draw non animated patch
|
||||
if (!tempfoundAnimLuaVoteFrames)
|
||||
{
|
||||
votebg = W_CachePatchName(va("%s1", tempPrefix), PU_PATCH);
|
||||
Y_VoteBackgroundDrawer(votebg);
|
||||
return;
|
||||
}
|
||||
|
||||
patch_t *votebg = bgpatch; // non widescreen patch
|
||||
// Draw animated patch based on frame counter on vote screen
|
||||
|
||||
// Just in case someone provides LESS widescreen frames than normal frames or vice versa, reset the frame counter to 0
|
||||
if (VoteScreen.currentAnimFrame > tempfoundAnimLuaVoteFrames)
|
||||
VoteScreen.currentAnimFrame = 0;
|
||||
|
||||
nextframe = (VoteScreen.currentAnimFrame + 1);
|
||||
|
||||
votebg = W_CachePatchName(va("%s%d", tempPrefix, nextframe), PU_PATCH);
|
||||
|
||||
Y_VoteBackgroundDrawer(votebg);
|
||||
|
||||
if (renderisnewtic && (votetic % 2 == 0) && !paused)
|
||||
VoteScreen.currentAnimFrame = (nextframe > tempfoundAnimLuaVoteFrames) ? 0 : nextframe;
|
||||
}
|
||||
|
||||
//
|
||||
// Y_DrawVoteScreenPatch
|
||||
//
|
||||
static void Y_DrawVoteScreenPatch(void)
|
||||
{
|
||||
patch_t *votebg = NULL;
|
||||
const boolean widescreen = (vid.width / vid.dupx > 320);
|
||||
|
||||
if (VoteScreen.foundLuaVoteWideFrames || VoteScreen.foundLuaVoteFrames)
|
||||
{
|
||||
Y_DrawLuaVoteScreenPatch(((widescreen && VoteScreen.foundLuaVoteWideFrames) || !VoteScreen.foundLuaVoteFrames));
|
||||
return;
|
||||
}
|
||||
|
||||
// non widescreen patch
|
||||
votebg = VoteScreen.bgpatch;
|
||||
|
||||
UINT8 prefgametype = (votelevels[0][1] & ~0x80);
|
||||
const boolean widebgreplaced = (prefgametype == GT_MATCH) ? widebattlereplaced : wideracereplaced;
|
||||
const boolean bgreplaced = (prefgametype == GT_MATCH) ? battlereplaced : racereplaced;
|
||||
const boolean widebgreplaced = (prefgametype == GT_MATCH) ? VoteScreen.replaced.widebattle : VoteScreen.replaced.widerace;
|
||||
const boolean bgreplaced = (prefgametype == GT_MATCH) ? VoteScreen.replaced.battle : VoteScreen.replaced.race;
|
||||
|
||||
// we check a bunch of stuff to always have a "valid" fallback
|
||||
if ((widescreen && (widebgreplaced || !bgreplaced))
|
||||
|| (!widescreen && (widebgreplaced && !bgreplaced)))
|
||||
{
|
||||
votebg = widebgpatch;
|
||||
votebg = VoteScreen.widebgpatch; // widescreen patch
|
||||
}
|
||||
|
||||
V_DrawScaledPatch(((vid.width/2) / vid.dupx) - (votebg->width/2),
|
||||
(vid.height / vid.dupy) - votebg->height,
|
||||
V_SNAPTOTOP|V_SNAPTOLEFT, votebg);
|
||||
Y_VoteBackgroundDrawer(votebg);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -1009,6 +1027,7 @@ void Y_VoteDrawer(void)
|
||||
}
|
||||
|
||||
y = (200-height)/2;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
const char *str;
|
||||
@@ -1018,7 +1037,7 @@ void Y_VoteDrawer(void)
|
||||
if (i == 3)
|
||||
{
|
||||
str = "RANDOM";
|
||||
pic = randomlvl;
|
||||
pic = VoteScreen.randomlvl;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1042,7 +1061,7 @@ void Y_VoteDrawer(void)
|
||||
|
||||
if (!splitscreen)
|
||||
{
|
||||
thiscurs = cursor;
|
||||
thiscurs = VoteScreen.cursor[0];
|
||||
p = consoleplayer;
|
||||
color = levelinfo[i].gtc;
|
||||
colormap = NULL;
|
||||
@@ -1052,19 +1071,19 @@ void Y_VoteDrawer(void)
|
||||
switch (j)
|
||||
{
|
||||
case 1:
|
||||
thiscurs = cursor2;
|
||||
thiscurs = VoteScreen.cursor[2];
|
||||
p = displayplayers[1];
|
||||
break;
|
||||
case 2:
|
||||
thiscurs = cursor3;
|
||||
thiscurs = VoteScreen.cursor[3];
|
||||
p = displayplayers[2];
|
||||
break;
|
||||
case 3:
|
||||
thiscurs = cursor4;
|
||||
thiscurs = VoteScreen.cursor[4];
|
||||
p = displayplayers[3];
|
||||
break;
|
||||
default:
|
||||
thiscurs = cursor1;
|
||||
thiscurs = VoteScreen.cursor[1];
|
||||
p = displayplayers[0];
|
||||
break;
|
||||
}
|
||||
@@ -1092,7 +1111,7 @@ void Y_VoteDrawer(void)
|
||||
else
|
||||
{
|
||||
V_DrawFixedPatch((BASEVIDWIDTH-20)<<FRACBITS, (y)<<FRACBITS, FRACUNIT/2, V_FLIP|V_SNAPTORIGHT, pic, 0);
|
||||
V_DrawFixedPatch((BASEVIDWIDTH-60)<<FRACBITS, ((y+25)<<FRACBITS) - (rubyheight<<1), FRACUNIT, V_SNAPTORIGHT, rubyicon, NULL);
|
||||
V_DrawFixedPatch((BASEVIDWIDTH-60)<<FRACBITS, ((y+25)<<FRACBITS) - (rubyheight<<1), FRACUNIT, V_SNAPTORIGHT, VoteScreen.rubyicon, NULL);
|
||||
}
|
||||
|
||||
V_DrawRightAlignedThinString(BASEVIDWIDTH-21, 40+y, V_SNAPTORIGHT|V_6WIDTHSPACE, str);
|
||||
@@ -1116,7 +1135,7 @@ void Y_VoteDrawer(void)
|
||||
else
|
||||
{
|
||||
V_DrawFixedPatch((BASEVIDWIDTH-20)<<FRACBITS, y<<FRACBITS, FRACUNIT/4, V_FLIP|V_SNAPTORIGHT, pic, 0);
|
||||
V_DrawFixedPatch((BASEVIDWIDTH-40)<<FRACBITS, (y<<FRACBITS) + (25<<(FRACBITS-1)) - rubyheight, FRACUNIT/2, V_SNAPTORIGHT, rubyicon, NULL);
|
||||
V_DrawFixedPatch((BASEVIDWIDTH-40)<<FRACBITS, (y<<FRACBITS) + (25<<(FRACBITS-1)) - rubyheight, FRACUNIT/2, V_SNAPTORIGHT, VoteScreen.rubyicon, NULL);
|
||||
}
|
||||
|
||||
if (levelinfo[i].gts)
|
||||
@@ -1145,13 +1164,13 @@ void Y_VoteDrawer(void)
|
||||
patch_t *pic;
|
||||
|
||||
if (votes[i] >= 3 && (i != pickedvote || voteendtic == -1))
|
||||
pic = randomlvl;
|
||||
pic = VoteScreen.randomlvl;
|
||||
else
|
||||
pic = levelinfo[votes[i]].pic;
|
||||
|
||||
if (!timer && i == voteclient.ranim)
|
||||
{
|
||||
V_DrawScaledPatch(x-18, y+9, V_SNAPTOLEFT, cursor);
|
||||
V_DrawScaledPatch(x-18, y+9, V_SNAPTOLEFT, VoteScreen.cursor[0]);
|
||||
if (voteendtic != -1 && !(votetic % 4))
|
||||
V_DrawFill(x-1, y-1, 42, 27, 120|V_SNAPTOLEFT);
|
||||
else
|
||||
@@ -1163,7 +1182,7 @@ void Y_VoteDrawer(void)
|
||||
else
|
||||
{
|
||||
V_DrawFixedPatch((x+40)<<FRACBITS, (y)<<FRACBITS, FRACUNIT/4, V_SNAPTOLEFT|V_FLIP, pic, 0);
|
||||
V_DrawFixedPatch((x+20)<<FRACBITS, (y<<FRACBITS) + (25<<(FRACBITS-1)) - rubyheight, FRACUNIT/2, V_SNAPTOLEFT, rubyicon, NULL);
|
||||
V_DrawFixedPatch((x+20)<<FRACBITS, (y<<FRACBITS) + (25<<(FRACBITS-1)) - rubyheight, FRACUNIT/2, V_SNAPTOLEFT, VoteScreen.rubyicon, NULL);
|
||||
}
|
||||
|
||||
if (levelinfo[votes[i]].gts)
|
||||
@@ -1452,10 +1471,28 @@ void Y_VoteTicker(void)
|
||||
//
|
||||
// MK online style voting screen, appears after intermission
|
||||
//
|
||||
|
||||
static void Y_InitVoteDrawing(void)
|
||||
{
|
||||
if (dedicated)
|
||||
return;
|
||||
|
||||
// setup the background patches
|
||||
Y_VoteScreenCheck();
|
||||
|
||||
VoteScreen.cursor[0] = W_CachePatchName("M_CURSOR", PU_PATCH);
|
||||
VoteScreen.cursor[1] = W_CachePatchName("P1CURSOR", PU_PATCH);
|
||||
VoteScreen.cursor[2] = W_CachePatchName("P2CURSOR", PU_PATCH);
|
||||
VoteScreen.cursor[3] = W_CachePatchName("P3CURSOR", PU_PATCH);
|
||||
VoteScreen.cursor[4] = W_CachePatchName("P4CURSOR", PU_PATCH);
|
||||
|
||||
VoteScreen.randomlvl = W_CachePatchName("RANDOMLV", PU_PATCH);
|
||||
VoteScreen.rubyicon = W_CachePatchName("RUBYICON", PU_PATCH);
|
||||
}
|
||||
|
||||
void Y_StartVote(void)
|
||||
{
|
||||
INT32 i = 0;
|
||||
UINT8 prefgametype = (votelevels[0][1] & ~0x80);
|
||||
|
||||
votetic = -1;
|
||||
|
||||
@@ -1464,17 +1501,8 @@ void Y_StartVote(void)
|
||||
I_Error("voteendtic is dirty");
|
||||
#endif
|
||||
|
||||
Y_AnimatedVoteScreenCheck();
|
||||
|
||||
widebgpatch = W_CachePatchName(((prefgametype == GT_MATCH) ? "BATTLSCW" : "INTERSCW"), PU_PATCH);
|
||||
bgpatch = W_CachePatchName(((prefgametype == GT_MATCH) ? "BATTLSCR" : "INTERSCR"), PU_PATCH);
|
||||
cursor = W_CachePatchName("M_CURSOR", PU_PATCH);
|
||||
cursor1 = W_CachePatchName("P1CURSOR", PU_PATCH);
|
||||
cursor2 = W_CachePatchName("P2CURSOR", PU_PATCH);
|
||||
cursor3 = W_CachePatchName("P3CURSOR", PU_PATCH);
|
||||
cursor4 = W_CachePatchName("P4CURSOR", PU_PATCH);
|
||||
randomlvl = W_CachePatchName("RANDOMLV", PU_PATCH);
|
||||
rubyicon = W_CachePatchName("RUBYICON", PU_PATCH);
|
||||
// cache vote patches
|
||||
Y_InitVoteDrawing();
|
||||
|
||||
timer = cv_votetime.value*TICRATE;
|
||||
pickedvote = -1;
|
||||
@@ -1540,11 +1568,14 @@ void Y_StartVote(void)
|
||||
levelinfo[i].gts = NULL;
|
||||
|
||||
// set up the pic
|
||||
lumpnum = W_CheckNumForName(va("%sP", G_BuildMapName(votelevels[i][0]+1)));
|
||||
if (lumpnum != LUMPERROR)
|
||||
levelinfo[i].pic = W_CachePatchName(va("%sP", G_BuildMapName(votelevels[i][0]+1)), PU_PATCH);
|
||||
else
|
||||
levelinfo[i].pic = W_CachePatchName("BLANKLVL", PU_PATCH);
|
||||
if (!dedicated)
|
||||
{
|
||||
lumpnum = W_CheckNumForName(va("%sP", G_BuildMapName(votelevels[i][0]+1)));
|
||||
if (lumpnum != LUMPERROR)
|
||||
levelinfo[i].pic = W_CachePatchName(va("%sP", G_BuildMapName(votelevels[i][0]+1)), PU_PATCH);
|
||||
else
|
||||
levelinfo[i].pic = W_CachePatchName("BLANKLVL", PU_PATCH);
|
||||
}
|
||||
}
|
||||
|
||||
voteclient.loaded = true;
|
||||
@@ -1569,18 +1600,18 @@ static void Y_UnloadVoteData(void)
|
||||
{
|
||||
voteclient.loaded = false;
|
||||
|
||||
if (rendermode != render_soft)
|
||||
if (dedicated)
|
||||
return;
|
||||
|
||||
UNLOAD(widebgpatch);
|
||||
UNLOAD(bgpatch);
|
||||
UNLOAD(cursor);
|
||||
UNLOAD(cursor1);
|
||||
UNLOAD(cursor2);
|
||||
UNLOAD(cursor3);
|
||||
UNLOAD(cursor4);
|
||||
UNLOAD(randomlvl);
|
||||
UNLOAD(rubyicon);
|
||||
UNLOAD(VoteScreen.widebgpatch);
|
||||
UNLOAD(VoteScreen.bgpatch);
|
||||
UNLOAD(VoteScreen.cursor[0]);
|
||||
UNLOAD(VoteScreen.cursor[1]);
|
||||
UNLOAD(VoteScreen.cursor[2]);
|
||||
UNLOAD(VoteScreen.cursor[3]);
|
||||
UNLOAD(VoteScreen.cursor[4]);
|
||||
UNLOAD(VoteScreen.randomlvl);
|
||||
UNLOAD(VoteScreen.rubyicon);
|
||||
|
||||
UNLOAD(levelinfo[3].pic);
|
||||
UNLOAD(levelinfo[2].pic);
|
||||
|
||||
+34
-1
@@ -10,7 +10,6 @@
|
||||
/// \brief Tally screens, or "Intermissions" as they were formally called in Doom
|
||||
|
||||
extern boolean usebuffer;
|
||||
extern char *luaVoteScreen;
|
||||
|
||||
void Y_IntermissionDrawer(void);
|
||||
void Y_Ticker(void);
|
||||
@@ -55,3 +54,37 @@ typedef enum
|
||||
int_classicrace, // Competition
|
||||
} intertype_t;
|
||||
extern intertype_t intertype;
|
||||
|
||||
// Votescreen stuff
|
||||
typedef struct
|
||||
{
|
||||
boolean race; // non lua race patch replaced
|
||||
boolean widerace; // non lua widescreen race patch replaced
|
||||
boolean battle; // non lua battle patch replaced
|
||||
boolean widebattle; // non lua widescreen battle patch replaced
|
||||
} votereplace_t;
|
||||
|
||||
// VEXTRN - Vote (V) Extra (EXT) Race (R) Normal (N - Normal sized patch)
|
||||
// VEXTRW - Vote (V) Extra (EXT) Race (R) Normal (W - Wide patch)
|
||||
// VEXTBN - Vote (V) Extra (EXT) Battle (B) Normal (N - Normal sized patch)
|
||||
// VEXTBW - Vote (V) Extra (EXT) Battle (B) Normal (W - Wide patch)
|
||||
typedef struct
|
||||
{
|
||||
char Prefix[5]; // Race = INTSX, Battle = BTLSX
|
||||
char luaPrefix[5]; // prefix for lua votescreens
|
||||
|
||||
INT32 currentAnimFrame; // current animated background frame
|
||||
|
||||
INT32 foundLuaVoteFrames; // normal lua patch frames
|
||||
INT32 foundLuaVoteWideFrames; // widescreen lua patch frames
|
||||
|
||||
votereplace_t replaced; // checks which non lua patch has been replaced
|
||||
|
||||
patch_t *bgpatch; // votebackground patch
|
||||
patch_t *widebgpatch; // wide votebackground patch
|
||||
|
||||
patch_t *cursor[5]; // cursor patches
|
||||
patch_t *randomlvl; // randomlevel patch
|
||||
patch_t *rubyicon; // encore ruby patch
|
||||
} votescreen_t;
|
||||
extern votescreen_t VoteScreen;
|
||||
Whitespace-only changes.
@@ -1,227 +0,0 @@
|
||||
<?php
|
||||
/* Based on parts of Example.php from SmartIRC
|
||||
* Example.php Copyright (c) 2002-2003 Mirco "MEEBEY" Bauer <mail@meebey.net> <http://www.meebey.net>
|
||||
* SRB2MS.php Copyright (c) 2004 by Logan Arias of Sonic Team JR.
|
||||
*
|
||||
* the Rest is Copyright (c) 2004 Logan Arias <Logan.GBA@gmail.net>
|
||||
* This is LGPL! that means you can change and use as you like
|
||||
*
|
||||
* Full LGPL License: <http://www.meebey.net/lgpl.txt>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
include_once('./SmartIRC.php');
|
||||
|
||||
class SRB2MS_BOT
|
||||
{
|
||||
|
||||
function ListGamesPM(&$irc, &$data)
|
||||
{
|
||||
$fd = fsockopen("srb2.servegame.org", 28900, $errno, $errstr, 5);
|
||||
if ($fd)
|
||||
{
|
||||
$buff = "000012360000";
|
||||
fwrite($fd, $buff);
|
||||
$irc->message(SMARTIRC_TYPE_NOTICE, $data->nick, 'Running SRB2 NetGames ');
|
||||
while (1)
|
||||
{
|
||||
$content=fgets($fd, 13); // skip 13 first bytes
|
||||
$content=fgets($fd, 1024);
|
||||
$irc->message(SMARTIRC_TYPE_NOTICE, $data->nick, "$content");
|
||||
//echo "$content";
|
||||
if (feof($fd)) break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$irc->message(SMARTIRC_TYPE_QUERY, $data->nick, 'The SRB2 MasterServer is not up');
|
||||
}
|
||||
}
|
||||
|
||||
function ListGamesChan(&$irc, &$data)
|
||||
{
|
||||
$fd = fsockopen("192.168.0.2", 28900, $errno, $errstr, 5);
|
||||
if ($fd)
|
||||
{
|
||||
$buff = "000012360000";
|
||||
fwrite($fd, $buff);
|
||||
$irc->message(SMARTIRC_TYPE_CHANNEL, $data->channel, 'Running SRB2 NetGames ');
|
||||
while (1)
|
||||
{
|
||||
$content=fgets($fd, 13); // skip 13 first bytes
|
||||
$content=fgets($fd, 1024);
|
||||
$irc->message(SMARTIRC_TYPE_CHANNEL, $data->channel, "$content");
|
||||
//echo "$content";
|
||||
if (feof($fd)) break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$irc->message(SMARTIRC_TYPE_CHANNEL, $data->channel, 'The SRB2 MasterServer is not up');
|
||||
}
|
||||
}
|
||||
|
||||
function BeenInvited(&$irc, &$data)
|
||||
{
|
||||
if ($data->message == '#srb2fun')
|
||||
$irc->join($data->message);
|
||||
|
||||
foreach ($irc->channel['#srb2fun']->ops as $invitenick => $key )
|
||||
{
|
||||
if ($data->nick == $invitenick)
|
||||
{
|
||||
$irc->join($data->message);
|
||||
return;
|
||||
}
|
||||
if ($data->nick == 'Logan_GBA')
|
||||
{
|
||||
$irc->join($data->message);
|
||||
return;
|
||||
}
|
||||
}
|
||||
foreach ($irc->channel['#srb2fun']->users as $nick => $key )
|
||||
{
|
||||
if ($data->nick == $nick)
|
||||
{
|
||||
$irc->kick('#srb2fun', $data->nick, "Sorry, but I don't like you, or your channel, $data->message");
|
||||
return;
|
||||
}
|
||||
}
|
||||
//$irc->message(SMARTIRC_TYPE_QUERY, $data->nick, "Sorry, but I don't like you, or your channel, $data->message");
|
||||
}
|
||||
|
||||
function Talk(&$irc, &$data)
|
||||
{
|
||||
foreach ($irc->channel['#srb2fun']->ops as $nick => $key)
|
||||
{
|
||||
if ($data->nick == $nick)
|
||||
{
|
||||
$msg = str_replace("!talk ", '', "$data->message");
|
||||
$irc->message(SMARTIRC_TYPE_CHANNEL, '#srb2fun', $msg);
|
||||
return;
|
||||
}
|
||||
}
|
||||
foreach ($irc->channel['#srb2fun']->users as $nick => $key)
|
||||
{
|
||||
if ($data->nick == $nick)
|
||||
{
|
||||
$irc->kick('#srb2fun', $data->nick, 'Stop talking to me!');
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Action(&$irc, &$data)
|
||||
{
|
||||
foreach ($irc->channel['#srb2fun']->ops as $nick => $key)
|
||||
{
|
||||
if ($data->nick == $nick)
|
||||
{
|
||||
$msg = str_replace("!action ", '', "$data->message");
|
||||
$irc->message(SMARTIRC_TYPE_ACTION, '#srb2fun', $msg);
|
||||
return;
|
||||
}
|
||||
}
|
||||
foreach ($irc->channel['#srb2fun']->users as $nick => $key)
|
||||
{
|
||||
if ($data->nick == $nick)
|
||||
{
|
||||
$irc->kick('#srb2fun', $data->nick, 'Stop talking to me!');
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Kick(&$irc, &$data)
|
||||
{
|
||||
foreach ($irc->channel['#srb2fun']->ops as $nick => $key)
|
||||
{
|
||||
if ($data->nick == $nick)
|
||||
{
|
||||
$msg = str_replace("!kick ", '', "$data->message");
|
||||
$irc->kick('#srb2fun', $msg);
|
||||
return;
|
||||
}
|
||||
}
|
||||
foreach ($irc->channel['#srb2fun']->users as $nick => $key)
|
||||
{
|
||||
if ($data->nick == $nick)
|
||||
{
|
||||
$irc->kick('#srb2fun', $data->nick, 'Stop talking to me!');
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function DebugPM(&$irc, &$data)
|
||||
{
|
||||
$irc->message(SMARTIRC_TYPE_QUERY, $data->nick, "from:");
|
||||
$irc->message(SMARTIRC_TYPE_QUERY, $data->nick, "$data->from");
|
||||
$irc->message(SMARTIRC_TYPE_QUERY, $data->nick, "nick:");
|
||||
$irc->message(SMARTIRC_TYPE_QUERY, $data->nick, "$data->nick");
|
||||
$irc->message(SMARTIRC_TYPE_QUERY, $data->nick, "ident:");
|
||||
$irc->message(SMARTIRC_TYPE_QUERY, $data->nick, "$data->ident");
|
||||
$irc->message(SMARTIRC_TYPE_QUERY, $data->nick, "host:");
|
||||
$irc->message(SMARTIRC_TYPE_QUERY, $data->nick, "$data->host");
|
||||
$irc->message(SMARTIRC_TYPE_QUERY, $data->nick, "channel:");
|
||||
$irc->message(SMARTIRC_TYPE_QUERY, $data->nick, "$data->channel");
|
||||
$irc->message(SMARTIRC_TYPE_QUERY, $data->nick, "message:");
|
||||
$irc->message(SMARTIRC_TYPE_QUERY, $data->nick, "$data->message");
|
||||
$irc->message(SMARTIRC_TYPE_QUERY, $data->nick, "type:");
|
||||
$irc->message(SMARTIRC_TYPE_QUERY, $data->nick, "$data->type");
|
||||
$irc->message(SMARTIRC_TYPE_QUERY, $data->nick, "rawmessage:");
|
||||
$irc->message(SMARTIRC_TYPE_QUERY, $data->nick, "$data->rawmessage");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// the Bot is the Class SRB2MS_BOT
|
||||
$bot = &new SRB2MS_BOT();
|
||||
// Create SmartIRC, and name it as <network>irc for use to, well, do irc stuff ^_^
|
||||
$esperirc = &new Net_SmartIRC();
|
||||
//no Excess Flood!
|
||||
//$esperirc->setSendDelay(300);
|
||||
// To Debug or Not
|
||||
//$esperirc->setDebug(SMARTIRC_DEBUG_IRCMESSAGES);
|
||||
// Do connect to the Internet
|
||||
$esperirc->setUseSockets(TRUE);
|
||||
// Register the trigger !listgames as to call ListGames with the class of SRB2MS_BOT
|
||||
//$esperirc->registerActionhandler(SMARTIRC_TYPE_QUERY, '^!gamelist$', $bot, 'ListGamesPM');
|
||||
$esperirc->registerActionhandler(SMARTIRC_TYPE_CHANNEL, '^!gamelist$', $bot, 'ListGamesChan');
|
||||
$esperirc->registerActionhandler(SMARTIRC_TYPE_INVITE, '', $bot, 'BeenInvited');
|
||||
//$esperirc->registerActionhandler(SMARTIRC_TYPE_ALL, '', $bot, 'DebugPM');
|
||||
//$esperirc->registerActionhandler(SMARTIRC_TYPE_QUERY, '^!talk', $bot, 'Talk');
|
||||
//$esperirc->registerActionhandler(SMARTIRC_TYPE_QUERY, '^!action', $bot, 'Action');
|
||||
//$esperirc->registerActionhandler(SMARTIRC_TYPE_QUERY, '^!kick', $bot, 'Kick');
|
||||
//$esperirc->registerActionhandler(SMARTIRC_TYPE_QUERY, '^!ban', $bot, 'Ban');
|
||||
// If you fail once, try agian
|
||||
$esperirc->setAutoRetry(TRUE);
|
||||
// Connect to EsperNet
|
||||
$esperirc->connect('cosmos.esper.net', 6667);
|
||||
// kep a list of all the users in the channel
|
||||
$esperirc->setChannelSyncing(TRUE);
|
||||
// Reconnect as needed
|
||||
$esperirc->setAutoReconnect(TRUE);
|
||||
// Use the name SRB2MS, and set other stuff
|
||||
$esperirc->login('SRB2MS2', 'Net_SmartIRC Client '.SMARTIRC_VERSION.' (SRB2MS_Bot.php)', 0, 'Net_SmartIRC');
|
||||
// Join #srb2fun and #srb2general
|
||||
$esperirc->join((array('#srb2general,#srb2fun')));
|
||||
// SRB2MS_Pass.php have "$esperirc->message(SMARTIRC_TYPE_QUERY, 'nickserv', 'identify <password>');"
|
||||
include('./SRB2MS_Pass.php');
|
||||
// Idle
|
||||
$esperirc->listen();
|
||||
// Rejoin?
|
||||
$esperirc->reconnect();
|
||||
?>
|
||||
@@ -1,739 +0,0 @@
|
||||
<?php
|
||||
/* Based on parts of Example.php from SmartIRC
|
||||
* Example.php Copyright (c) 2002-2003 Mirco "MEEBEY" Bauer <mail@meebey.net> <http://www.meebey.net>
|
||||
* SRB2MS.php Copyright (c) 2004 by Logan Arias of Sonic Team JR.
|
||||
*
|
||||
* the Rest is Copyright (c) 2004 Logan Arias <Logan.GBA@gmail.net>
|
||||
* This is LGPL! that means you can change and use as you like
|
||||
*
|
||||
* Full LGPL License: <http://www.meebey.net/lgpl.txt>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
include_once('./SmartIRC.php');
|
||||
define('MAGPIE_DIR', './magpierss/');
|
||||
// define('MAGPIE_CACHE_AGE', 30); // half-min
|
||||
require_once(MAGPIE_DIR.'rss_fetch.inc');
|
||||
require_once(MAGPIE_DIR.'rss_utils.inc');
|
||||
$today = getdate();
|
||||
$lastupdatetime = mktime($today['hours'],$today['minutes']-6,0,$today['mon'], $today['mday'], $today['year']);
|
||||
$lastlisttime = mktime($today['hours'],$today['minutes']-1,0,$today['mon'], $today['mday'], $today['year']);
|
||||
|
||||
class SRB2MS_BOT
|
||||
{
|
||||
|
||||
function ListUsersPM(&$irc, &$data)
|
||||
{
|
||||
global $rssdatabase;
|
||||
if ($rssdatabase->users[0])
|
||||
{
|
||||
$irc->message(SMARTIRC_TYPE_NOTICE, $data->nick, 'List of RSS users');
|
||||
foreach ($rssdatabase->users as $users)
|
||||
{
|
||||
$irc->message(SMARTIRC_TYPE_NOTICE, $data->nick, "$users");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$irc->message(SMARTIRC_TYPE_NOTICE, $data->nick, 'there are no RSS users');
|
||||
}
|
||||
}
|
||||
|
||||
function RSSupdateuser(&$irc, &$data)
|
||||
{
|
||||
global $rssdatabase;
|
||||
if ($rssdatabase->OnList("$data->nick"))
|
||||
{
|
||||
$irc->message(SMARTIRC_TYPE_NOTICE, $data->message, "I am trying to update $data->nick to $data->message from the list");
|
||||
if ($rssdatabase->ReplaceUser("$data->nick","$data->message"))
|
||||
{
|
||||
$irc->message(SMARTIRC_TYPE_NOTICE, $data->message, "I have changed $data->nick to $data->message on the list");
|
||||
}
|
||||
else
|
||||
{
|
||||
$irc->message(SMARTIRC_TYPE_NOTICE, $data->message, "$data->nick was not on the list");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function RSScheckuser(&$irc, &$data)
|
||||
{
|
||||
$irc->message(SMARTIRC_TYPE_NOTICE, $data->nick, "I going to check if you are on the list");
|
||||
global $rssdatabase;
|
||||
if ($rssdatabase->OnList("$data->nick"))
|
||||
{
|
||||
$irc->message(SMARTIRC_TYPE_NOTICE, $data->nick, "you are on the list");
|
||||
}
|
||||
else
|
||||
{
|
||||
$irc->message(SMARTIRC_TYPE_NOTICE, $data->nick, "you are not on the list");
|
||||
}
|
||||
}
|
||||
|
||||
function RSSremoveuser(&$irc, &$data)
|
||||
{
|
||||
$irc->message(SMARTIRC_TYPE_NOTICE, $data->nick, "I am trying to remove $data->nick from the list");
|
||||
global $rssdatabase;
|
||||
if ($rssdatabase->DeleteUser("$data->nick"))
|
||||
{
|
||||
$irc->message(SMARTIRC_TYPE_NOTICE, $data->nick, "I have removed $data->nick from the list");
|
||||
}
|
||||
else
|
||||
{
|
||||
$irc->message(SMARTIRC_TYPE_NOTICE, $data->nick, "$data->nick is not on the list");
|
||||
}
|
||||
}
|
||||
|
||||
function RSSadduser(&$irc, &$data)
|
||||
{
|
||||
$irc->message(SMARTIRC_TYPE_NOTICE, $data->nick, "I am trying to add you $data->nick to the list");
|
||||
global $rssdatabase;
|
||||
if ($rssdatabase->AddUser("$data->nick"))
|
||||
{
|
||||
$irc->message(SMARTIRC_TYPE_NOTICE, $data->nick, "I have added $data->nick to the list");
|
||||
}
|
||||
else
|
||||
{
|
||||
$irc->message(SMARTIRC_TYPE_NOTICE, $data->nick, "$data->nick is already on the list");
|
||||
}
|
||||
}
|
||||
/*
|
||||
function RSSListGamesPM(&$irc, &$data)
|
||||
{
|
||||
$content = $this->GenFeed();
|
||||
$SRB2MSRSS10 = new MagpieRSS( $content );
|
||||
if ($SRB2MSRSS10)
|
||||
{
|
||||
$irc->message(SMARTIRC_TYPE_NOTICE, $data->nick, 'Running SRB2 netgames ');
|
||||
foreach ($SRB2MSRSS10->items as $item)
|
||||
{
|
||||
$description = $item['dc']['description'];
|
||||
$title = $item['title'];
|
||||
$irc->message(SMARTIRC_TYPE_NOTICE, $data->nick, "Name: $title $description");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$irc->message(SMARTIRC_TYPE_NOTICE, $data->nick, '.magpie_error()');
|
||||
$irc->message(SMARTIRC_TYPE_NOTICE, $data->nick, 'The SRB2 MasterServer RSS feed is not up');
|
||||
}
|
||||
}
|
||||
*/
|
||||
function RSSListUpdate(&$irc)
|
||||
{
|
||||
global $lastupdatetime;
|
||||
global $SRB2MS_mute;
|
||||
if ($SRB2MS_mute)
|
||||
{
|
||||
return;
|
||||
}
|
||||
$RSS10content = $this->GenFeed();
|
||||
$SRB2MSRSS10 = new MagpieRSS( $RSS10content );
|
||||
if ($SRB2MSRSS10)
|
||||
{
|
||||
//$irc->message(SMARTIRC_TYPE_CHANNEL, '#srb2fun', 'Running SRB2 netgames ');
|
||||
foreach ($SRB2MSRSS10->items as $item)
|
||||
{
|
||||
if ( $item['title'] == "No servers" )
|
||||
{
|
||||
// NOP
|
||||
}
|
||||
elseif ( $item['title'] == "No master server" )
|
||||
{
|
||||
// NOP
|
||||
}
|
||||
else
|
||||
{
|
||||
$published = parse_w3cdtf($item['dc']['date']);
|
||||
if ( $published >= $lastupdatetime )
|
||||
{
|
||||
$title = $item['title'];
|
||||
$serveraddress = $item['srb2ms']['address'];
|
||||
$serverport = $item['srb2ms']['port'];
|
||||
$serverversion = $item['srb2ms']['version'];
|
||||
//if ( $serverversion == "1.09.3" )
|
||||
//{
|
||||
// $irc->message(SMARTIRC_TYPE_CHANNEL, '#srb2fun' , "New Server, $serveraddress:$serverport Name: $title");
|
||||
//}
|
||||
//else
|
||||
{
|
||||
$irc->message(SMARTIRC_TYPE_CHANNEL, '#srb2fun' , "New Server, $serveraddress:$serverport Name: $title Version: $serverversion");
|
||||
}
|
||||
//$irc->message(SMARTIRC_TYPE_CHANNEL, '#srb2general', "New Server, Name: $title $description");
|
||||
}
|
||||
else
|
||||
{
|
||||
// NOP
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
$today = getdate();
|
||||
// update time
|
||||
$lastupdatetime = mktime($today['hours'],$today['minutes'],0,$today['mon'], $today['mday'], $today['year']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$irc->message(SMARTIRC_TYPE_CHANNEL, '#srb2fun', '.magpie_error()');
|
||||
$irc->message(SMARTIRC_TYPE_CHANNEL, '#srb2fun', 'The SRB2 MasterServer RSS feed is not up');
|
||||
}
|
||||
}
|
||||
|
||||
function Mute(&$irc, &$data)
|
||||
{
|
||||
foreach ($irc->channel['#srb2fun']->ops as $nick => $key )
|
||||
{
|
||||
if ($data->nick == $nick || $data->nick == 'Logan_GBA')
|
||||
{
|
||||
global $lastupdatetime;
|
||||
$today = getdate();
|
||||
// update time
|
||||
$lastupdatetime = mktime($today['hours'],$today['minutes'],0,$today['mon'], $today['mday'], $today['year']);
|
||||
$GLOBALS['SRB2MS_mute'] = TRUE;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Unmute(&$irc, &$data)
|
||||
{
|
||||
foreach ($irc->channel['#srb2fun']->ops as $nick => $key )
|
||||
{
|
||||
if ($data->nick == $nick || $data->nick == 'Logan_GBA')
|
||||
{
|
||||
$GLOBALS['SRB2MS_mute'] = FALSE;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function Mute2(&$irc, &$data)
|
||||
{
|
||||
if ($data->nick == 'Logan_GBA')
|
||||
{
|
||||
global $lastupdatetime;
|
||||
$today = getdate();
|
||||
// update time
|
||||
$lastupdatetime = mktime($today['hours'],$today['minutes'],0,$today['mon'], $today['mday'], $today['year']);
|
||||
$GLOBALS['SRB2MS_mute'] = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
function Unmute2(&$irc, &$data)
|
||||
{
|
||||
if ($data->nick == 'Logan_GBA')
|
||||
{
|
||||
$GLOBALS['SRB2MS_mute'] = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
function RSSListGames(&$irc, &$data)
|
||||
{
|
||||
global $lastlisttime;
|
||||
$content = $this->GenFeed();
|
||||
$today = getdate();
|
||||
//$irc->message(SMARTIRC_TYPE_CHANNEL, $data->channel, 'testing feed');
|
||||
//$irc->message(SMARTIRC_TYPE_CHANNEL, $data->channel, "$content");
|
||||
//$content1 = $this->Gettextfromserver();
|
||||
//$irc->message(SMARTIRC_TYPE_CHANNEL, $data->channel, "$content1");
|
||||
$SRB2MSRSS10 = new MagpieRSS( $content );
|
||||
if ($SRB2MSRSS10)
|
||||
{
|
||||
if ((mktime($today['hours'],$today['minutes']-2,0,$today['mon'], $today['mday'], $today['year'])) >= $lastlisttime)
|
||||
{
|
||||
//$irc->message(SMARTIRC_TYPE_CHANNEL, '#srb2fun', 'Running SRB2 netgames ');
|
||||
foreach ($SRB2MSRSS10->items as $item)
|
||||
{
|
||||
if ( $item['title'] == "No servers" )
|
||||
{
|
||||
//0$description = $item['dc']['description'];
|
||||
$irc->message(SMARTIRC_TYPE_CHANNEL, $data->channel, "No SRB2 Games are running, so why don't you start one?");
|
||||
}
|
||||
elseif ( $item['title'] == "No master server" )
|
||||
{
|
||||
$description = $item['dc']['description'];
|
||||
$irc->message(SMARTIRC_TYPE_CHANNEL, $data->channel, "$description");
|
||||
}
|
||||
else
|
||||
{
|
||||
$title = $item['title'];
|
||||
$serveraddress = $item['srb2ms']['address'];
|
||||
$serverport = $item['srb2ms']['port'];
|
||||
$serverversion = $item['srb2ms']['version'];
|
||||
//if ( $serverport == " 5029" )
|
||||
//{
|
||||
// $serverport = "5029";
|
||||
//}
|
||||
//if ( $serverversion == "1.09.3" )
|
||||
//{
|
||||
// $irc->message(SMARTIRC_TYPE_CHANNEL, '#srb2fun' , "$serveraddress:$serverport Name: $title");
|
||||
//}
|
||||
//else
|
||||
{
|
||||
$irc->message(SMARTIRC_TYPE_CHANNEL, '#srb2fun' , "$serveraddress:$serverport Name: $title Version: $serverversion");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
$today = getdate();
|
||||
$lastlisttime = mktime($today['hours'],$today['minutes'],0,$today['mon'], $today['mday'], $today['year']);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$irc->message(SMARTIRC_TYPE_CHANNEL, $data->channel, ".magpie_error()");
|
||||
$irc->message(SMARTIRC_TYPE_CHANNEL, $data->channel, 'The SRB2 MasterServer RSS feed is not up');
|
||||
}
|
||||
}
|
||||
|
||||
function RSSListGamesPM(&$irc, &$data)
|
||||
{
|
||||
global $lastlisttime;
|
||||
$content = $this->GenFeed();
|
||||
$today = getdate();
|
||||
//$irc->message(SMARTIRC_TYPE_CHANNEL, $data->channel, 'testing feed');
|
||||
//$irc->message(SMARTIRC_TYPE_CHANNEL, $data->channel, "$content");
|
||||
//$content1 = $this->Gettextfromserver();
|
||||
//$irc->message(SMARTIRC_TYPE_CHANNEL, $data->channel, "$content1");
|
||||
$SRB2MSRSS10 = new MagpieRSS( $content );
|
||||
if ($SRB2MSRSS10)
|
||||
{
|
||||
//if ((mktime($today['hours'],$today['minutes']-2,0,$today['mon'], $today['mday'], $today['year'])) >= $lastlisttime)
|
||||
{
|
||||
//$irc->message(SMARTIRC_TYPE_CHANNEL, '#srb2fun', 'Running SRB2 netgames ');
|
||||
$irc->message(SMARTIRC_TYPE_NOTICE, $data->nick, "Running SRB2 netgames from http://srb2.servegame.org/");
|
||||
foreach ($SRB2MSRSS10->items as $item)
|
||||
{
|
||||
if ( $item['title'] == "No servers" )
|
||||
{
|
||||
//0$description = $item['dc']['description'];
|
||||
//$irc->message(SMARTIRC_TYPE_CHANNEL, $data->channel, "No SRB2 Games are running, so why don't you start one?");
|
||||
}
|
||||
elseif ( $item['title'] == "No master server" )
|
||||
{
|
||||
$description = $item['dc']['description'];
|
||||
//$irc->message(SMARTIRC_TYPE_CHANNEL, $data->channel, "$description");
|
||||
}
|
||||
else
|
||||
{
|
||||
$title = $item['title'];
|
||||
$serveraddress = $item['srb2ms']['address'];
|
||||
$serverport = $item['srb2ms']['port'];
|
||||
$serverversion = $item['srb2ms']['version'];
|
||||
//if ( $serverport == " 5029" )
|
||||
//{
|
||||
// $serverport = "5029";
|
||||
//}
|
||||
//if ( $serverversion == "1.09.3" )
|
||||
//{
|
||||
// $irc->message(SMARTIRC_TYPE_CHANNEL, '#srb2fun' , "$serveraddress:$serverport Name: $title");
|
||||
//}
|
||||
//else
|
||||
{
|
||||
$irc->message(SMARTIRC_TYPE_NOTICE, $data->nick, "$serveraddress:$serverport Name: $title Version: $serverversion");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
$today = getdate();
|
||||
$lastlisttime = mktime($today['hours'],$today['minutes'],0,$today['mon'], $today['mday'], $today['year']);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//$irc->message(SMARTIRC_TYPE_CHANNEL, $data->channel, ".magpie_error()");
|
||||
//$irc->message(SMARTIRC_TYPE_CHANNEL, $data->channel, 'The SRB2 MasterServer RSS feed is not up');
|
||||
}
|
||||
}
|
||||
|
||||
function ListGamesPM(&$irc, &$data)
|
||||
{
|
||||
$fd = fsockopen("srb2.servegame.org", 28900, $errno, $errstr, 5);
|
||||
if ($fd)
|
||||
{
|
||||
$buff = "000012360000";
|
||||
fwrite($fd, $buff);
|
||||
$irc->message(SMARTIRC_TYPE_NOTICE, $data->nick, 'Running SRB2 netgames ');
|
||||
while (1)
|
||||
{
|
||||
$content=fgets($fd, 13); // skip 13 first bytes
|
||||
$content=fgets($fd, 1024);
|
||||
$irc->message(SMARTIRC_TYPE_NOTICE, $data->nick, "$content");
|
||||
//echo "$content";
|
||||
if (feof($fd)) break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$irc->message(SMARTIRC_TYPE_NOTICE, $data->nick, 'The SRB2 MasterServer is not up');
|
||||
}
|
||||
}
|
||||
|
||||
function ListGamesChan(&$irc, &$data)
|
||||
{
|
||||
global $lastlisttime;
|
||||
$today = getdate();
|
||||
$fd = fsockopen("srb2.servegame.org", 28900, $errno, $errstr, 5);
|
||||
if ($fd)
|
||||
{
|
||||
stream_set_timeout ($fd, 5);
|
||||
$buff = "000012360000";
|
||||
fwrite($fd, $buff);
|
||||
if ( (mktime($today['hours'],$today['minutes']-5,0,$today['mon'], $today['mday'], $today['year'])) >= $lastlisttime )
|
||||
{
|
||||
$content = "";
|
||||
while (1)
|
||||
{
|
||||
fgets($fd, 13); // skip 13 first bytes
|
||||
$content = fgets($fd, 1024);
|
||||
$irc->message(SMARTIRC_TYPE_CHANNEL, $data->channel, "$content");
|
||||
$today = getdate();
|
||||
$lastlisttime = mktime($today['hours'],$today['minutes'],0,$today['mon'], $today['mday'], $today['year']);
|
||||
if (feof($fd)) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$irc->message(SMARTIRC_TYPE_CHANNEL, $data->channel, 'The SRB2 MasterServer is not up');
|
||||
}
|
||||
}
|
||||
|
||||
function byebye(&$irc, &$data)
|
||||
{
|
||||
foreach ($irc->channel['#srb2fun']->ops as $quitnick => $key )
|
||||
{
|
||||
if ($data->nick == $quitnick)
|
||||
{
|
||||
$irc->setAutoReconnect(FALSE);
|
||||
$irc->setAutoRetry(FALSE);
|
||||
$irc->quit('This quit was done by' + "$data->nick");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function BeenInvited(&$irc, &$data)
|
||||
{
|
||||
if ($data->message == '#srb2fun')
|
||||
$irc->join($data->message);
|
||||
|
||||
foreach ($irc->channel['#srb2fun']->ops as $invitenick => $key )
|
||||
{
|
||||
if ($data->nick == $invitenick)
|
||||
{
|
||||
$irc->join($data->message);
|
||||
return;
|
||||
}
|
||||
}
|
||||
foreach ($irc->channel['#srb2fun']->users as $nick => $key )
|
||||
{
|
||||
if ($data->nick == $nick)
|
||||
{
|
||||
$irc->kick('#srb2fun', $data->nick, "Sorry, but I don't like you, or your channel, $data->message");
|
||||
return;
|
||||
}
|
||||
}
|
||||
//$irc->message(SMARTIRC_TYPE_QUERY, $data->nick, "Sorry, but I don't like you, or your channel, $data->message");
|
||||
}
|
||||
|
||||
function Talk(&$irc, &$data)
|
||||
{
|
||||
foreach ($irc->channel['#srb2fun']->ops as $nick => $key)
|
||||
{
|
||||
if ($data->nick == $nick)
|
||||
{
|
||||
$msg = str_replace("!talk ", '', "$data->message");
|
||||
$irc->message(SMARTIRC_TYPE_CHANNEL, '#srb2fun', $msg);
|
||||
return;
|
||||
}
|
||||
}
|
||||
foreach ($irc->channel['#srb2fun']->users as $nick => $key)
|
||||
{
|
||||
if ($data->nick == $nick)
|
||||
{
|
||||
$irc->kick('#srb2fun', $data->nick, 'Stop talking to me!');
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Action(&$irc, &$data)
|
||||
{
|
||||
foreach ($irc->channel['#srb2fun']->ops as $nick => $key)
|
||||
{
|
||||
if ($data->nick == $nick)
|
||||
{
|
||||
$msg = str_replace("!action ", '', "$data->message");
|
||||
$irc->message(SMARTIRC_TYPE_ACTION, '#srb2fun', $msg);
|
||||
return;
|
||||
}
|
||||
}
|
||||
foreach ($irc->channel['#srb2fun']->users as $nick => $key)
|
||||
{
|
||||
if ($data->nick == $nick)
|
||||
{
|
||||
$irc->kick('#srb2fun', $data->nick, 'Stop talking to me!');
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Kick(&$irc, &$data)
|
||||
{
|
||||
foreach ($irc->channel['#srb2fun']->ops as $nick => $key)
|
||||
{
|
||||
if ($data->nick == $nick)
|
||||
{
|
||||
$msg = str_replace("!kick ", '', "$data->message");
|
||||
$irc->kick('#srb2fun', $msg);
|
||||
return;
|
||||
}
|
||||
}
|
||||
foreach ($irc->channel['#srb2fun']->users as $nick => $key)
|
||||
{
|
||||
if ($data->nick == $nick)
|
||||
{
|
||||
$irc->kick('#srb2fun', $data->nick, 'Stop talking to me!');
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function DebugPM(&$irc, &$data)
|
||||
{
|
||||
// $irc->message(SMARTIRC_TYPE_QUERY, $data->nick, "from:");
|
||||
// $irc->message(SMARTIRC_TYPE_QUERY, $data->nick, "$data->from");
|
||||
// $irc->message(SMARTIRC_TYPE_QUERY, $data->nick, "nick:");
|
||||
// $irc->message(SMARTIRC_TYPE_QUERY, $data->nick, "$data->nick");
|
||||
// $irc->message(SMARTIRC_TYPE_QUERY, $data->nick, "ident:");
|
||||
// $irc->message(SMARTIRC_TYPE_QUERY, $data->nick, "$data->ident");
|
||||
// $irc->message(SMARTIRC_TYPE_QUERY, $data->nick, "host:");
|
||||
// $irc->message(SMARTIRC_TYPE_QUERY, $data->nick, "$data->host");
|
||||
// $irc->message(SMARTIRC_TYPE_QUERY, $data->nick, "channel:");
|
||||
// $irc->message(SMARTIRC_TYPE_QUERY, $data->nick, "$data->channel");
|
||||
// $irc->message(SMARTIRC_TYPE_QUERY, $data->nick, "message:");
|
||||
// $irc->message(SMARTIRC_TYPE_QUERY, $data->nick, "$data->message");
|
||||
// $irc->message(SMARTIRC_TYPE_QUERY, $data->nick, "type:");
|
||||
// $irc->message(SMARTIRC_TYPE_QUERY, $data->nick, "$data->type");
|
||||
// $irc->message(SMARTIRC_TYPE_QUERY, $data->nick, "rawmessage:");
|
||||
// $irc->message(SMARTIRC_TYPE_QUERY, $data->nick, "$data->rawmessage");
|
||||
|
||||
$irc->message(SMARTIRC_TYPE_QUERY, "Alam_GBC", "from: $data->from");
|
||||
$irc->message(SMARTIRC_TYPE_QUERY, "Alam_GBC", "nick: $data->nick");
|
||||
$irc->message(SMARTIRC_TYPE_QUERY, "Alam_GBC", "ident: $data->ident");
|
||||
$irc->message(SMARTIRC_TYPE_QUERY, "Alam_GBC", "host: $data->host");
|
||||
$irc->message(SMARTIRC_TYPE_QUERY, "Alam_GBC", "channel: $data->channel");
|
||||
$irc->message(SMARTIRC_TYPE_QUERY, "Alam_GBC", "message: $data->message");
|
||||
$irc->message(SMARTIRC_TYPE_QUERY, "Alam_GBC", "type: $data->type");
|
||||
$irc->message(SMARTIRC_TYPE_QUERY, "Alam_GBC", "rawmessage: $data->rawmessage");
|
||||
}
|
||||
|
||||
function GetRSS10datafromserver()
|
||||
{
|
||||
$content = "";
|
||||
$fd = fsockopen("srb2.servegame.org", 28900, $errno, $errstr, 5);
|
||||
if ($fd)
|
||||
{
|
||||
$buff = "000012400000";
|
||||
fwrite($fd, $buff);
|
||||
while (1)
|
||||
{
|
||||
fgets($fd, 13); // skip 13 first bytes
|
||||
$content .= fgets($fd, 1024);
|
||||
if (feof($fd)) break;
|
||||
}
|
||||
fclose($fd);
|
||||
}
|
||||
else
|
||||
{
|
||||
$content = '<items>';
|
||||
$content .= '<rdf:Seq>';
|
||||
$content .= '<rdf:li rdf:resource="http://srb2.servegame.org/" />';
|
||||
$content .= '</rdf:Seq>';
|
||||
$content .= '</items>';
|
||||
$content .= '</channel>';
|
||||
$content .= "\n";
|
||||
$content .= '<item rdf:about="http://srb2.servegame.org/"> ';
|
||||
$content .= '<title>No master server</title><dc:description>The master server is not running</dc:description></item>';
|
||||
}
|
||||
return "$content";
|
||||
}
|
||||
|
||||
function GenFeed()
|
||||
{
|
||||
$content = '<?xml version="1.0" encoding="ISO-8859-1"?>';
|
||||
$content .= "\n";
|
||||
$content .= '<rdf:RDF';
|
||||
$content .= ' xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"';
|
||||
$content .= "\n";
|
||||
$content .= ' xmlns="http://purl.org/rss/1.0/"';
|
||||
$content .= "\n";
|
||||
$content .= ' xmlns:dc="http://purl.org/dc/elements/1.1/"';
|
||||
$content .= "\n";
|
||||
$content .= ' xmlns:srb2ms="http://srb2.servegame.org/SRB2MS/elements/"';
|
||||
$content .= "\n";
|
||||
$content .= '>';
|
||||
$content .= "\n";
|
||||
$content .= "\n";
|
||||
$content .= ' <channel rdf:about="http://srb2.servegame.org/srb2ms_status.php">';
|
||||
$content .= "\n";
|
||||
$content .= ' <title>SRB2 Master Server RSS Feed</title>';
|
||||
$content .= "\n";
|
||||
$content .= ' <link>http://srb2.servegame.org/srb2ms_status.php</link>';
|
||||
$content .= "\n";
|
||||
$content .= ' <description>Playing around with RSS</description>';
|
||||
$content .= "\n";
|
||||
$content .= ' <language>en-us</language>';
|
||||
$content .= "\n";
|
||||
$feed = $this->GetRSS10datafromserver();
|
||||
$content .= "$feed";
|
||||
$content .= '</rdf:RDF>';
|
||||
return $content;
|
||||
}
|
||||
}
|
||||
|
||||
class RSSDataBase_Class
|
||||
{
|
||||
var $users = array();
|
||||
|
||||
function OnList($User)
|
||||
{
|
||||
$userbeenfound = FALSE;
|
||||
foreach ($this->users as $Userlist)
|
||||
{
|
||||
if ($Userlist == $User) {
|
||||
$userbeenfound = TRUE; }
|
||||
}
|
||||
return $userbeenfound;
|
||||
}
|
||||
|
||||
function AddUser($User)
|
||||
{
|
||||
$userbeenfound = FALSE;
|
||||
foreach ($this->users as $Userlist)
|
||||
{
|
||||
if ($Userlist == $User) {
|
||||
$userbeenfound = TRUE; }
|
||||
}
|
||||
if (!$userbeenfound) {
|
||||
$this->users[] = $User;
|
||||
}
|
||||
return !$userbeenfound;
|
||||
}
|
||||
|
||||
function DeleteUser($User)
|
||||
{
|
||||
$userbeenfound = FALSE;
|
||||
foreach ($this->users as $index => $Userlist)
|
||||
{
|
||||
if ($Userlist == $User)
|
||||
{
|
||||
$userbeenfound = TRUE;
|
||||
$id = $index;
|
||||
}
|
||||
}
|
||||
if ($userbeenfound)
|
||||
{
|
||||
unset($this->users[$id]);
|
||||
$this->users = array_values($this->users);
|
||||
}
|
||||
return $userbeenfound;
|
||||
}
|
||||
function ReplaceUser($oldUser,$newUser)
|
||||
{
|
||||
$userbeenfound = FALSE;
|
||||
foreach ($this->users as $index => $Userlist)
|
||||
{
|
||||
if ($Userlist == $oldUser)
|
||||
{
|
||||
$userbeenfound = TRUE;
|
||||
$id = $index;
|
||||
}
|
||||
}
|
||||
if ($userbeenfound)
|
||||
{
|
||||
$this->users[$id] = $newUser;
|
||||
}
|
||||
return $userbeenfound;
|
||||
}
|
||||
}
|
||||
// gobal var for muting the Bot
|
||||
$SRB2MS_mute = FALSE;
|
||||
//$SRB2MSRSS10 = fetch_rss( 'http://srb2.servegame.org/RSS1.0.php' );
|
||||
// thing to hold RSS stuff
|
||||
$rssdatabase = &new RSSDataBase_Class();
|
||||
// PHP error reporting
|
||||
//error_reporting(E_ERROR);
|
||||
// the Bot is the Class SRB2MS_BOT
|
||||
$bot = &new SRB2MS_BOT();
|
||||
// Create SmartIRC, and name it as <network>irc for use to, well, do irc stuff ^_^
|
||||
$esperirc = &new Net_SmartIRC();
|
||||
// To Debug or Not
|
||||
//$esperirc->setDebug(SMARTIRC_DEBUG_ALL);
|
||||
// Do connect to the Internet
|
||||
$esperirc->setUseSockets(TRUE);
|
||||
// kep a list of all the users in the channel
|
||||
$esperirc->setChannelSyncing(TRUE);
|
||||
// Register the triggers with the class of SRB2MS_BOT
|
||||
//$esperirc->registerActionhandler(SMARTIRC_TYPE_CHANNEL, '^!gamelist$', $bot, 'ListGamesChan');
|
||||
//$esperirc->registerActionhandler(SMARTIRC_TYPE_QUERY, '^!gamelist$', $bot, 'ListGamesPM');
|
||||
//$esperirc->registerActionhandler(SMARTIRC_TYPE_QUERY, '^!RSSgamelist$', $bot, 'RSSListGamesPM');
|
||||
//$esperirc->registerActionhandler(SMARTIRC_TYPE_CHANNEL, '^!gamelist0$', $bot, 'RSSListGames');
|
||||
$esperirc->registerActionhandler(SMARTIRC_TYPE_CHANNEL, '^!gamelist$', $bot, 'RSSListGamesPM');
|
||||
//$esperirc->registerActionhandler(SMARTIRC_TYPE_QUERY, '^!gamelist$', $bot, 'RSSListGamesPM');
|
||||
//$esperirc->registerActionhandler(SMARTIRC_TYPE_CHANNEL, '^!addme$', $bot, 'RSSadduser');
|
||||
//$esperirc->registerActionhandler(SMARTIRC_TYPE_CHANNEL, '^!removeme$', $bot, 'RSSremoveuser');
|
||||
//$esperirc->registerActionhandler(SMARTIRC_TYPE_CHANNEL, '^!listusers$', $bot, 'ListUsersPM');
|
||||
//$esperirc->registerActionhandler(SMARTIRC_TYPE_NICKCHANGE, '', $bot, 'RSSupdateuser');
|
||||
//$esperirc->registerActionhandler(SMARTIRC_TYPE_CHANNEL, '^!checkme$', $bot, 'RSScheckuser');
|
||||
//$esperirc->registerActionhandler(SMARTIRC_TYPE_CHANNEL, '^!shutdown$', $bot, 'byebye');
|
||||
$esperirc->registerActionhandler(SMARTIRC_TYPE_CHANNEL, '^!mute$', $bot, 'Mute');
|
||||
$esperirc->registerActionhandler(SMARTIRC_TYPE_CHANNEL, '^!unmute$', $bot, 'Unmute');
|
||||
$esperirc->registerActionhandler(SMARTIRC_TYPE_CHANNEL, '^!shutup$', $bot, 'Mute2');
|
||||
$esperirc->registerActionhandler(SMARTIRC_TYPE_CHANNEL, '^!talktome$', $bot, 'Unmute2');
|
||||
$esperirc->registerTimehandler(120000, $bot, 'RSSListUpdate');
|
||||
//$esperirc->registerActionhandler(SMARTIRC_TYPE_CHANNEL, '^!gamelist$', $bot, 'ListGamesChan');
|
||||
$esperirc->registerActionhandler(SMARTIRC_TYPE_INVITE, '', $bot, 'BeenInvited');
|
||||
//$esperirc->registerActionhandler(SMARTIRC_TYPE_QUERY, '^!talk', $bot, 'Talk');
|
||||
//$esperirc->registerActionhandler(SMARTIRC_TYPE_QUERY, '^!action', $bot, 'Action');
|
||||
//$esperirc->registerActionhandler(SMARTIRC_TYPE_QUERY, '^!kick', $bot, 'Kick');
|
||||
//$esperirc->registerActionhandler(SMARTIRC_TYPE_QUERY, '^!ban', $bot, 'Ban');
|
||||
//$esperirc->registerActionhandler(SMARTIRC_TYPE_ALL, '', $bot, 'DebugPM');
|
||||
//$esperirc->registerActionhandler(SMARTIRC_TYPE_KICK | SMARTIRC_TYPE_QUIT | SMARTIRC_TYPE_PART, '', $bot, 'DebugPM');
|
||||
// If you fail once, try agian
|
||||
$esperirc->setAutoRetry(TRUE);
|
||||
// Connect to EsperNet
|
||||
//$esperirc->connect('irc.esper.net', 6667);
|
||||
$esperirc->connect('excalibur.esper.net', 6667);
|
||||
// Reconnect as needed
|
||||
$esperirc->setAutoReconnect(TRUE);
|
||||
// Use the name SRB2MS, and set other stuff
|
||||
$esperirc->login('SRB2MS', 'Net_SmartIRC Client '.SMARTIRC_VERSION.' (SRB2MS_Bot.php)', 0, 'Net_SmartIRC');
|
||||
// Join #srb2fun
|
||||
$esperirc->join(array('#srb2fun'));
|
||||
// SRB2MS_Pass.php have "$esperirc->message(SMARTIRC_TYPE_QUERY, 'nickserv', 'identify <password>');"
|
||||
include('./SRB2MS_Pass.php');
|
||||
// Idle
|
||||
$esperirc->listen();
|
||||
// Rejoin?
|
||||
$esperirc->reconnect();
|
||||
|
||||
?>
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,234 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* $Id: defines.php,v 1.9.2.1 2003/07/22 15:32:18 meebey Exp $
|
||||
* $Revision: 1.9.2.1 $
|
||||
* $Author: meebey $
|
||||
* $Date: 2003/07/22 15:32:18 $
|
||||
*
|
||||
* Copyright (c) 2002-2003 Mirco "MEEBEY" Bauer <mail@meebey.net> <http://www.meebey.net>
|
||||
*
|
||||
* Full LGPL License: <http://www.meebey.net/lgpl.txt>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
// don't change this! unless you know what you do
|
||||
define('SMARTIRC_CRLF', "\r\n");
|
||||
define('SMARTIRC_UNUSED', '*');
|
||||
define('SMARTIRC_STDOUT', 0);
|
||||
define('SMARTIRC_FILE', 1);
|
||||
define('SMARTIRC_SYSLOG', 2);
|
||||
define('SMARTIRC_BROWSEROUT', 3);
|
||||
define('SMARTIRC_NONE', 4);
|
||||
define('SMARTIRC_LOW', 0);
|
||||
define('SMARTIRC_MEDIUM', 1);
|
||||
define('SMARTIRC_HIGH', 2);
|
||||
define('SMARTIRC_CRITICAL', 3);
|
||||
define('SMARTIRC_STATE_DISCONNECTED', 0);
|
||||
define('SMARTIRC_STATE_CONNECTING', 1);
|
||||
define('SMARTIRC_STATE_CONNECTED', 2);
|
||||
define('SMARTIRC_DEBUG_NONE', 0);
|
||||
define('SMARTIRC_DEBUG_NOTICE', 1);
|
||||
define('SMARTIRC_DEBUG_CONNECTION', 2);
|
||||
define('SMARTIRC_DEBUG_SOCKET', 4);
|
||||
define('SMARTIRC_DEBUG_IRCMESSAGES', 8);
|
||||
define('SMARTIRC_DEBUG_MESSAGETYPES', 16);
|
||||
define('SMARTIRC_DEBUG_ACTIONHANDLER', 32);
|
||||
define('SMARTIRC_DEBUG_TIMEHANDLER', 64);
|
||||
define('SMARTIRC_DEBUG_MESSAGEHANDLER', 128);
|
||||
define('SMARTIRC_DEBUG_CHANNELSYNCING', 256);
|
||||
define('SMARTIRC_DEBUG_MODULES', 512);
|
||||
define('SMARTIRC_DEBUG_USERSYNCING', 1024);
|
||||
define('SMARTIRC_DEBUG_MESSAGEPARSER', 2048);
|
||||
define('SMARTIRC_DEBUG_ALL', 4095);
|
||||
define('SMARTIRC_TYPE_UNKNOWN', 1);
|
||||
define('SMARTIRC_TYPE_CHANNEL', 2);
|
||||
define('SMARTIRC_TYPE_QUERY', 4);
|
||||
define('SMARTIRC_TYPE_CTCP', 8);
|
||||
define('SMARTIRC_TYPE_NOTICE', 16);
|
||||
define('SMARTIRC_TYPE_WHO', 32);
|
||||
define('SMARTIRC_TYPE_JOIN', 64);
|
||||
define('SMARTIRC_TYPE_INVITE', 128);
|
||||
define('SMARTIRC_TYPE_ACTION', 256);
|
||||
define('SMARTIRC_TYPE_TOPICCHANGE', 512);
|
||||
define('SMARTIRC_TYPE_NICKCHANGE', 1024);
|
||||
define('SMARTIRC_TYPE_KICK', 2048);
|
||||
define('SMARTIRC_TYPE_QUIT', 4096);
|
||||
define('SMARTIRC_TYPE_LOGIN', 8192);
|
||||
define('SMARTIRC_TYPE_INFO', 16384);
|
||||
define('SMARTIRC_TYPE_LIST', 32768);
|
||||
define('SMARTIRC_TYPE_NAME', 65536);
|
||||
define('SMARTIRC_TYPE_MOTD', 131072);
|
||||
define('SMARTIRC_TYPE_MODECHANGE', 262144);
|
||||
define('SMARTIRC_TYPE_PART', 524288);
|
||||
define('SMARTIRC_TYPE_ERROR', 1048576);
|
||||
define('SMARTIRC_TYPE_BANLIST', 2097152);
|
||||
define('SMARTIRC_TYPE_TOPIC', 4194304);
|
||||
define('SMARTIRC_TYPE_NONRELEVANT', 8388608);
|
||||
define('SMARTIRC_TYPE_WHOIS', 16777216);
|
||||
define('SMARTIRC_TYPE_WHOWAS', 33554432);
|
||||
define('SMARTIRC_TYPE_USERMODE', 67108864);
|
||||
define('SMARTIRC_TYPE_CHANNELMODE', 134217728);
|
||||
define('SMARTIRC_TYPE_CTCP_REQUEST', 268435456);
|
||||
define('SMARTIRC_TYPE_CTCP_REPLY', 536870912);
|
||||
define('SMARTIRC_TYPE_ALL', 1073741823);
|
||||
|
||||
$SMARTIRC_replycodes = array(
|
||||
'RPL_WELCOME' => '001',
|
||||
'RPL_YOURHOST' => '002',
|
||||
'RPL_CREATED' => '003',
|
||||
'RPL_MYINFO' => '004',
|
||||
'RPL_BOUNCE' => '005',
|
||||
'RPL_TRACELINK' => '200',
|
||||
'RPL_TRACECONNECTING' => '201',
|
||||
'RPL_TRACEHANDSHAKE' => '202',
|
||||
'RPL_TRACEUNKNOWN' => '203',
|
||||
'RPL_TRACEOPERATOR' => '204',
|
||||
'RPL_TRACEUSER' => '205',
|
||||
'RPL_TRACESERVER' => '206',
|
||||
'RPL_TRACESERVICE' => '207',
|
||||
'RPL_TRACENEWTYPE' => '208',
|
||||
'RPL_TRACECLASS' => '209',
|
||||
'RPL_TRACERECONNECT' => '210',
|
||||
'RPL_STATSLINKINFO' => '211',
|
||||
'RPL_STATSCOMMANDS' => '212',
|
||||
'RPL_ENDOFSTATS' => '219',
|
||||
'RPL_UMODEIS' => '221',
|
||||
'RPL_SERVLIST' => '234',
|
||||
'RPL_SERVLISTEND' => '235',
|
||||
'RPL_STATSUPTIME' => '242',
|
||||
'RPL_STATSOLINE' => '243',
|
||||
'RPL_LUSERCLIENT' => '251',
|
||||
'RPL_LUSEROP' => '252',
|
||||
'RPL_LUSERUNKNOWN' => '253',
|
||||
'RPL_LUSERCHANNELS' => '254',
|
||||
'RPL_LUSERME' => '255',
|
||||
'RPL_ADMINME' => '256',
|
||||
'RPL_ADMINLOC1' => '257',
|
||||
'RPL_ADMINLOC2' => '258',
|
||||
'RPL_ADMINEMAIL' => '259',
|
||||
'RPL_TRACELOG' => '261',
|
||||
'RPL_TRACEEND' => '262',
|
||||
'RPL_TRYAGAIN' => '263',
|
||||
'RPL_AWAY' => '301',
|
||||
'RPL_USERHOST' => '302',
|
||||
'RPL_ISON' => '303',
|
||||
'RPL_UNAWAY' => '305',
|
||||
'RPL_NOWAWAY' => '306',
|
||||
'RPL_WHOISUSER' => '311',
|
||||
'RPL_WHOISSERVER' => '312',
|
||||
'RPL_WHOISOPERATOR' => '313',
|
||||
'RPL_WHOWASUSER' => '314',
|
||||
'RPL_ENDOFWHO' => '315',
|
||||
'RPL_WHOISIDLE' => '317',
|
||||
'RPL_ENDOFWHOIS' => '318',
|
||||
'RPL_WHOISCHANNELS' => '319',
|
||||
'RPL_LISTSTART' => '321',
|
||||
'RPL_LIST' => '322',
|
||||
'RPL_LISTEND' => '323',
|
||||
'RPL_CHANNELMODEIS' => '324',
|
||||
'RPL_UNIQOPIS' => '325',
|
||||
'RPL_NOTOPIC' => '331',
|
||||
'RPL_TOPIC' => '332',
|
||||
'RPL_INVITING' => '341',
|
||||
'RPL_SUMMONING' => '342',
|
||||
'RPL_INVITELIST' => '346',
|
||||
'RPL_ENDOFINVITELIST' => '347',
|
||||
'RPL_EXCEPTLIST' => '348',
|
||||
'RPL_ENDOFEXCEPTLIST' => '349',
|
||||
'RPL_VERSION' => '351',
|
||||
'RPL_WHOREPLY' => '352',
|
||||
'RPL_NAMREPLY' => '353',
|
||||
'RPL_LINKS' => '364',
|
||||
'RPL_ENDOFLINKS' => '365',
|
||||
'RPL_ENDOFNAMES' => '366',
|
||||
'RPL_BANLIST' => '367',
|
||||
'RPL_ENDOFBANLIST' => '368',
|
||||
'RPL_ENDOFWHOWAS' => '369',
|
||||
'RPL_INFO' => '371',
|
||||
'RPL_MOTD' => '372',
|
||||
'RPL_ENDOFINFO' => '374',
|
||||
'RPL_MOTDSTART' => '375',
|
||||
'RPL_ENDOFMOTD' => '376',
|
||||
'RPL_YOUREOPER' => '381',
|
||||
'RPL_REHASHING' => '382',
|
||||
'RPL_YOURESERVICE' => '383',
|
||||
'RPL_TIME' => '391',
|
||||
'RPL_USERSSTART' => '392',
|
||||
'RPL_USERS' => '393',
|
||||
'RPL_ENDOFUSERS' => '394',
|
||||
'RPL_NOUSERS' => '395',
|
||||
'ERR_NOSUCHNICK' => '401',
|
||||
'ERR_NOSUCHSERVER' => '402',
|
||||
'ERR_NOSUCHCHANNEL' => '403',
|
||||
'ERR_CANNOTSENDTOCHAN' => '404',
|
||||
'ERR_TOOMANYCHANNELS' => '405',
|
||||
'ERR_WASNOSUCHNICK' => '406',
|
||||
'ERR_TOOMANYTARGETS' => '407',
|
||||
'ERR_NOSUCHSERVICE' => '408',
|
||||
'ERR_NOORIGIN' => '409',
|
||||
'ERR_NORECIPIENT' => '411',
|
||||
'ERR_NOTEXTTOSEND' => '412',
|
||||
'ERR_NOTOPLEVEL' => '413',
|
||||
'ERR_WILDTOPLEVEL' => '414',
|
||||
'ERR_BADMASK' => '415',
|
||||
'ERR_UNKNOWNCOMMAND' => '421',
|
||||
'ERR_NOMOTD' => '422',
|
||||
'ERR_NOADMININFO' => '423',
|
||||
'ERR_FILEERROR' => '424',
|
||||
'ERR_NONICKNAMEGIVEN' => '431',
|
||||
'ERR_ERRONEUSNICKNAME' => '432',
|
||||
'ERR_NICKNAMEINUSE' => '433',
|
||||
'ERR_NICKCOLLISION' => '436',
|
||||
'ERR_UNAVAILRESOURCE' => '437',
|
||||
'ERR_USERNOTINCHANNEL' => '441',
|
||||
'ERR_NOTONCHANNEL' => '442',
|
||||
'ERR_USERONCHANNEL' => '443',
|
||||
'ERR_NOLOGIN' => '444',
|
||||
'ERR_SUMMONDISABLED' => '445',
|
||||
'ERR_USERSDISABLED' => '446',
|
||||
'ERR_NOTREGISTERED' => '451',
|
||||
'ERR_NEEDMOREPARAMS' => '461',
|
||||
'ERR_ALREADYREGISTRED' => '462',
|
||||
'ERR_NOPERMFORHOST' => '463',
|
||||
'ERR_PASSWDMISMATCH' => '464',
|
||||
'ERR_YOUREBANNEDCREEP' => '465',
|
||||
'ERR_YOUWILLBEBANNED' => '466',
|
||||
'ERR_KEYSET' => '467',
|
||||
'ERR_CHANNELISFULL' => '471',
|
||||
'ERR_UNKNOWNMODE' => '472',
|
||||
'ERR_INVITEONLYCHAN' => '473',
|
||||
'ERR_BANNEDFROMCHAN' => '474',
|
||||
'ERR_BADCHANNELKEY' => '475',
|
||||
'ERR_BADCHANMASK' => '476',
|
||||
'ERR_NOCHANMODES' => '477',
|
||||
'ERR_BANLISTFULL' => '478',
|
||||
'ERR_NOPRIVILEGES' => '481',
|
||||
'ERR_CHANOPRIVSNEEDED' => '482',
|
||||
'ERR_CANTKILLSERVER' => '483',
|
||||
'ERR_RESTRICTED' => '484',
|
||||
'ERR_UNIQOPPRIVSNEEDED' => '485',
|
||||
'ERR_NOOPERHOST' => '491',
|
||||
'ERR_UMODEUNKNOWNFLAG' => '501',
|
||||
'ERR_USERSDONTMATCH' => '502',
|
||||
);
|
||||
|
||||
$SMARTIRC_nreplycodes = array();
|
||||
|
||||
foreach ($SMARTIRC_replycodes as $key => $value) {
|
||||
define('SMARTIRC_'.$key, $value);
|
||||
$SMARTIRC_nreplycodes[$value] = $key;
|
||||
}
|
||||
?>
|
||||
@@ -1,433 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* $Id: irccommands.php,v 1.1.2.1 2003/10/10 20:20:58 meebey Exp $
|
||||
* $Revision: 1.1.2.1 $
|
||||
* $Author: meebey $
|
||||
* $Date: 2003/10/10 20:20:58 $
|
||||
*
|
||||
* Copyright (c) 2002-2003 Mirco "MEEBEY" Bauer <mail@meebey.net> <http://www.meebey.net>
|
||||
*
|
||||
* Full LGPL License: <http://www.meebey.net/lgpl.txt>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
class Net_SmartIRC_irccommands extends Net_SmartIRC_base
|
||||
{
|
||||
/**
|
||||
* sends a new message
|
||||
*
|
||||
* Sends a message to a channel or user.
|
||||
*
|
||||
* @see DOCUMENTATION
|
||||
* @param integer $type specifies the type, like QUERY/ACTION or CTCP see 'Message Types'
|
||||
* @param string $destination can be a user or channel
|
||||
* @param string $message the message
|
||||
* @return boolean
|
||||
* @access public
|
||||
*/
|
||||
function message($type, $destination, $message, $priority = SMARTIRC_MEDIUM)
|
||||
{
|
||||
switch ($type) {
|
||||
case SMARTIRC_TYPE_CHANNEL:
|
||||
case SMARTIRC_TYPE_QUERY:
|
||||
$this->_send('PRIVMSG '.$destination.' :'.$message, $priority);
|
||||
break;
|
||||
case SMARTIRC_TYPE_ACTION:
|
||||
$this->_send('PRIVMSG '.$destination.' :'.chr(1).'ACTION '.$message.chr(1), $priority);
|
||||
break;
|
||||
case SMARTIRC_TYPE_NOTICE:
|
||||
$this->_send('NOTICE '.$destination.' :'.$message, $priority);
|
||||
break;
|
||||
case SMARTIRC_TYPE_CTCP: // backwards compatibilty
|
||||
case SMARTIRC_TYPE_CTCP_REPLY:
|
||||
$this->_send('NOTICE '.$destination.' :'.chr(1).$message.chr(1), $priority);
|
||||
break;
|
||||
case SMARTIRC_TYPE_CTCP_REQUEST:
|
||||
$this->_send('PRIVMSG '.$destination.' :'.chr(1).$message.chr(1), $priority);
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns an object reference to the specified channel
|
||||
*
|
||||
* If the channel does not exist (because not joint) false will be returned.
|
||||
*
|
||||
* @param string $channelname
|
||||
* @return object reference to the channel object
|
||||
* @access public
|
||||
*/
|
||||
function &channel($channelname)
|
||||
{
|
||||
if (isset($this->_channels[strtolower($channelname)])) {
|
||||
return $this->_channels[strtolower($channelname)];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// <IRC methods>
|
||||
/**
|
||||
* Joins one or more IRC channels with an optional key.
|
||||
*
|
||||
* @param mixed $channelarray
|
||||
* @param string $key
|
||||
* @param integer $priority message priority, default is SMARTIRC_MEDIUM
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
function join($channelarray, $key = null, $priority = SMARTIRC_MEDIUM)
|
||||
{
|
||||
if (!is_array($channelarray)) {
|
||||
$channelarray = array($channelarray);
|
||||
}
|
||||
|
||||
$channellist = implode(',', $channelarray);
|
||||
|
||||
if ($key !== null) {
|
||||
$this->_send('JOIN '.$channellist.' '.$key, $priority);
|
||||
} else {
|
||||
$this->_send('JOIN '.$channellist, $priority);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* parts from one or more IRC channels with an optional reason
|
||||
*
|
||||
* @param mixed $channelarray
|
||||
* @param string $reason
|
||||
* @param integer $priority message priority, default is SMARTIRC_MEDIUM
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
function part($channelarray, $reason = null, $priority = SMARTIRC_MEDIUM)
|
||||
{
|
||||
if (!is_array($channelarray)) {
|
||||
$channelarray = array($channelarray);
|
||||
}
|
||||
|
||||
$channellist = implode(',', $channelarray);
|
||||
|
||||
if ($reason !== null) {
|
||||
$this->_send('PART '.$channellist.' :'.$reason, $priority);
|
||||
} else {
|
||||
$this->_send('PART '.$channellist, $priority);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Kicks one or more user from an IRC channel with an optional reason.
|
||||
*
|
||||
* @param string $channel
|
||||
* @param mixed $nicknamearray
|
||||
* @param string $reason
|
||||
* @param integer $priority message priority, default is SMARTIRC_MEDIUM
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
function kick($channel, $nicknamearray, $reason = null, $priority = SMARTIRC_MEDIUM)
|
||||
{
|
||||
if (!is_array($nicknamearray)) {
|
||||
$nicknamearray = array($nicknamearray);
|
||||
}
|
||||
|
||||
$nicknamelist = implode(',', $nicknamearray);
|
||||
|
||||
if ($reason !== null) {
|
||||
$this->_send('KICK '.$channel.' '.$nicknamelist.' :'.$reason, $priority);
|
||||
} else {
|
||||
$this->_send('KICK '.$channel.' '.$nicknamelist, $priority);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gets a list of one ore more channels
|
||||
*
|
||||
* Requests a full channellist if $channelarray is not given.
|
||||
* (use it with care, usualy its a looooong list)
|
||||
*
|
||||
* @param mixed $channelarray
|
||||
* @param integer $priority message priority, default is SMARTIRC_MEDIUM
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
function getList($channelarray = null, $priority = SMARTIRC_MEDIUM)
|
||||
{
|
||||
if ($channelarray !== null) {
|
||||
if (!is_array($channelarray)) {
|
||||
$channelarray = array($channelarray);
|
||||
}
|
||||
|
||||
$channellist = implode(',', $channelarray);
|
||||
$this->_send('LIST '.$channellist, $priority);
|
||||
} else {
|
||||
$this->_send('LIST', $priority);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* requests all nicknames of one or more channels
|
||||
*
|
||||
* The requested nickname list also includes op and voice state
|
||||
*
|
||||
* @param mixed $channelarray
|
||||
* @param integer $priority message priority, default is SMARTIRC_MEDIUM
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
function names($channelarray = null, $priority = SMARTIRC_MEDIUM)
|
||||
{
|
||||
if ($channelarray !== null) {
|
||||
if (!is_array($channelarray)) {
|
||||
$channelarray = array($channelarray);
|
||||
}
|
||||
|
||||
$channellist = implode(',', $channelarray);
|
||||
$this->_send('NAMES '.$channellist, $priority);
|
||||
} else {
|
||||
$this->_send('NAMES', $priority);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* sets a new topic of a channel
|
||||
*
|
||||
* @param string $channel
|
||||
* @param string $newtopic
|
||||
* @param integer $priority message priority, default is SMARTIRC_MEDIUM
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
function setTopic($channel, $newtopic, $priority = SMARTIRC_MEDIUM)
|
||||
{
|
||||
$this->_send('TOPIC '.$channel.' :'.$newtopic, $priority);
|
||||
}
|
||||
|
||||
/**
|
||||
* gets the topic of a channel
|
||||
*
|
||||
* @param string $channel
|
||||
* @param integer $priority message priority, default is SMARTIRC_MEDIUM
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
function getTopic($channel, $priority = SMARTIRC_MEDIUM)
|
||||
{
|
||||
$this->_send('TOPIC '.$channel, $priority);
|
||||
}
|
||||
|
||||
/**
|
||||
* sets or gets the mode of an user or channel
|
||||
*
|
||||
* Changes/requests the mode of the given target.
|
||||
*
|
||||
* @param string $target the target, can be an user (only yourself) or a channel
|
||||
* @param string $newmode the new mode like +mt
|
||||
* @param integer $priority message priority, default is SMARTIRC_MEDIUM
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
function mode($target, $newmode = null, $priority = SMARTIRC_MEDIUM)
|
||||
{
|
||||
if ($newmode !== null) {
|
||||
$this->_send('MODE '.$target.' '.$newmode, $priority);
|
||||
} else {
|
||||
$this->_send('MODE '.$target, $priority);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* ops an user in the given channel
|
||||
*
|
||||
* @param string $channel
|
||||
* @param string $nickname
|
||||
* @param integer $priority message priority, default is SMARTIRC_MEDIUM
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
function op($channel, $nickname, $priority = SMARTIRC_MEDIUM)
|
||||
{
|
||||
$this->mode($channel, '+o '.$nickname, $priority);
|
||||
}
|
||||
|
||||
/**
|
||||
* deops an user in the given channel
|
||||
*
|
||||
* @param string $channel
|
||||
* @param string $nickname
|
||||
* @param integer $priority message priority, default is SMARTIRC_MEDIUM
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
function deop($channel, $nickname, $priority = SMARTIRC_MEDIUM)
|
||||
{
|
||||
$this->mode($channel, '-o '.$nickname, $priority);
|
||||
}
|
||||
|
||||
/**
|
||||
* voice a user in the given channel
|
||||
*
|
||||
* @param string $channel
|
||||
* @param string $nickname
|
||||
* @param integer $priority message priority, default is SMARTIRC_MEDIUM
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
function voice($channel, $nickname, $priority = SMARTIRC_MEDIUM)
|
||||
{
|
||||
$this->mode($channel, '+v '.$nickname, $priority);
|
||||
}
|
||||
|
||||
/**
|
||||
* devoice a user in the given channel
|
||||
*
|
||||
* @param string $channel
|
||||
* @param string $nickname
|
||||
* @param integer $priority message priority, default is SMARTIRC_MEDIUM
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
function devoice($channel, $nickname, $priority = SMARTIRC_MEDIUM)
|
||||
{
|
||||
$this->mode($channel, '-v '.$nickname, $priority);
|
||||
}
|
||||
|
||||
/**
|
||||
* bans a hostmask for the given channel or requests the current banlist
|
||||
*
|
||||
* The banlist will be requested if no hostmask is specified
|
||||
*
|
||||
* @param string $channel
|
||||
* @param string $hostmask
|
||||
* @param integer $priority message priority, default is SMARTIRC_MEDIUM
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
function ban($channel, $hostmask = null, $priority = SMARTIRC_MEDIUM)
|
||||
{
|
||||
if ($hostmask !== null) {
|
||||
$this->mode($channel, '+b '.$hostmask, $priority);
|
||||
} else {
|
||||
$this->mode($channel, 'b', $priority);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* unbans a hostmask on the given channel
|
||||
*
|
||||
* @param string $channel
|
||||
* @param string $hostmask
|
||||
* @param integer $priority message priority, default is SMARTIRC_MEDIUM
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
function unban($channel, $hostmask, $priority = SMARTIRC_MEDIUM)
|
||||
{
|
||||
$this->mode($channel, '-b '.$hostmask, $priority);
|
||||
}
|
||||
|
||||
/**
|
||||
* invites a user to the specified channel
|
||||
*
|
||||
* @param string $nickname
|
||||
* @param string $channel
|
||||
* @param integer $priority message priority, default is SMARTIRC_MEDIUM
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
function invite($nickname, $channel, $priority = SMARTIRC_MEDIUM)
|
||||
{
|
||||
$this->_send('INVITE '.$nickname.' '.$channel, $priority);
|
||||
}
|
||||
|
||||
/**
|
||||
* changes the own nickname
|
||||
*
|
||||
* Trys to set a new nickname, nickcollisions are handled.
|
||||
*
|
||||
* @param string $newnick
|
||||
* @param integer $priority message priority, default is SMARTIRC_MEDIUM
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
function changeNick($newnick, $priority = SMARTIRC_MEDIUM)
|
||||
{
|
||||
$this->_send('NICK '.$newnick, $priority);
|
||||
$this->_nick = $newnick;
|
||||
}
|
||||
|
||||
/**
|
||||
* requests a 'WHO' from the specified target
|
||||
*
|
||||
* @param string $target
|
||||
* @param integer $priority message priority, default is SMARTIRC_MEDIUM
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
function who($target, $priority = SMARTIRC_MEDIUM)
|
||||
{
|
||||
$this->_send('WHO '.$target, $priority);
|
||||
}
|
||||
|
||||
/**
|
||||
* requests a 'WHOIS' from the specified target
|
||||
*
|
||||
* @param string $target
|
||||
* @param integer $priority message priority, default is SMARTIRC_MEDIUM
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
function whois($target, $priority = SMARTIRC_MEDIUM)
|
||||
{
|
||||
$this->_send('WHOIS '.$target, $priority);
|
||||
}
|
||||
|
||||
/**
|
||||
* requests a 'WHOWAS' from the specified target
|
||||
* (if he left the IRC network)
|
||||
*
|
||||
* @param string $target
|
||||
* @param integer $priority message priority, default is SMARTIRC_MEDIUM
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
function whowas($target, $priority = SMARTIRC_MEDIUM)
|
||||
{
|
||||
$this->_send('WHOWAS '.$target, $priority);
|
||||
}
|
||||
|
||||
/**
|
||||
* sends QUIT to IRC server and disconnects
|
||||
*
|
||||
* @param string $quitmessage optional quitmessage
|
||||
* @param integer $priority message priority, default is SMARTIRC_MEDIUM
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
function quit($quitmessage = null, $priority = SMARTIRC_MEDIUM)
|
||||
{
|
||||
if ($quitmessage !== null) {
|
||||
$this->_send('QUIT :'.$quitmessage, $priority);
|
||||
} else {
|
||||
$this->_send('QUIT', $priority);
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -1,411 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* $Id: messagehandler.php,v 1.25.2.5 2004/09/23 23:24:22 meebey Exp $
|
||||
* $Revision: 1.25.2.5 $
|
||||
* $Author: meebey $
|
||||
* $Date: 2004/09/23 23:24:22 $
|
||||
*
|
||||
* Copyright (c) 2002-2003 Mirco "MEEBEY" Bauer <mail@meebey.net> <http://www.meebey.net>
|
||||
*
|
||||
* Full LGPL License: <http://www.meebey.net/lgpl.txt>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
class Net_SmartIRC_messagehandler extends Net_SmartIRC_irccommands
|
||||
{
|
||||
/* misc */
|
||||
function _event_ping(&$ircdata)
|
||||
{
|
||||
$this->_pong(substr($ircdata->rawmessage, 5));
|
||||
}
|
||||
|
||||
function _event_error(&$ircdata)
|
||||
{
|
||||
if ($this->_autoretry == true) {
|
||||
$this->reconnect();
|
||||
} else {
|
||||
$this->disconnect(true);
|
||||
}
|
||||
}
|
||||
|
||||
function _event_join(&$ircdata)
|
||||
{
|
||||
if ($this->_channelsyncing == true) {
|
||||
if ($this->_nick == $ircdata->nick) {
|
||||
$this->log(SMARTIRC_DEBUG_CHANNELSYNCING, 'DEBUG_CHANNELSYNCING: joining channel: '.$ircdata->channel, __FILE__, __LINE__);
|
||||
$channel = &new Net_SmartIRC_channel();
|
||||
$channel->name = $ircdata->channel;
|
||||
$this->_channels[strtolower($channel->name)] = &$channel;
|
||||
|
||||
$this->who($channel->name);
|
||||
$this->mode($channel->name);
|
||||
$this->ban($channel->name);
|
||||
}
|
||||
|
||||
$this->log(SMARTIRC_DEBUG_CHANNELSYNCING, 'DEBUG_CHANNELSYNCING: '.$ircdata->nick.' joins channel: '.$ircdata->channel, __FILE__, __LINE__);
|
||||
$channel = &$this->_channels[strtolower($ircdata->channel)];
|
||||
$user = &new Net_SmartIRC_channeluser();
|
||||
$user->nick = $ircdata->nick;
|
||||
$user->ident = $ircdata->ident;
|
||||
$user->host = $ircdata->host;
|
||||
|
||||
$this->_adduser($channel, $user);
|
||||
$this->who($user->nick);
|
||||
}
|
||||
}
|
||||
|
||||
function _event_part(&$ircdata)
|
||||
{
|
||||
if ($this->_channelsyncing == true) {
|
||||
$this->_removeuser($ircdata);
|
||||
}
|
||||
}
|
||||
|
||||
function _event_kick(&$ircdata)
|
||||
{
|
||||
if ($this->_channelsyncing == true) {
|
||||
$this->_removeuser($ircdata);
|
||||
}
|
||||
}
|
||||
|
||||
function _event_quit(&$ircdata)
|
||||
{
|
||||
if ($this->_channelsyncing == true) {
|
||||
$this->_removeuser($ircdata);
|
||||
}
|
||||
}
|
||||
|
||||
function _event_nick(&$ircdata)
|
||||
{
|
||||
if ($this->_channelsyncing == true) {
|
||||
$newnick = substr($ircdata->rawmessageex[2], 1);
|
||||
$lowerednewnick = strtolower($newnick);
|
||||
$lowerednick = strtolower($ircdata->nick);
|
||||
|
||||
foreach ($this->_channels as $channelkey => $channelvalue) {
|
||||
// loop through all channels
|
||||
$channel = &$this->_channels[$channelkey];
|
||||
foreach ($channel->users as $userkey => $uservalue) {
|
||||
// loop through all user in this channel
|
||||
|
||||
if ($ircdata->nick == $uservalue->nick) {
|
||||
// found him
|
||||
// time for updating the object and his nickname
|
||||
$channel->users[$lowerednewnick] = $channel->users[$lowerednick];
|
||||
$channel->users[$lowerednewnick]->nick = $newnick;
|
||||
|
||||
if ($lowerednewnick != $lowerednick) {
|
||||
unset($channel->users[$lowerednick]);
|
||||
}
|
||||
|
||||
// he was maybe op or voice, update comming
|
||||
if (isset($channel->ops[$ircdata->nick])) {
|
||||
$channel->ops[$newnick] = $channel->ops[$ircdata->nick];
|
||||
unset($channel->ops[$ircdata->nick]);
|
||||
}
|
||||
if (isset($channel->voices[$ircdata->nick])) {
|
||||
$channel->voices[$newnick] = $channel->voices[$ircdata->nick];
|
||||
unset($channel->voices[$ircdata->nick]);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function _event_mode(&$ircdata)
|
||||
{
|
||||
// check if its own usermode
|
||||
if ($ircdata->rawmessageex[2] == $this->_nick) {
|
||||
$this->_usermode = substr($ircdata->rawmessageex[3], 1);
|
||||
} else if ($this->_channelsyncing == true) {
|
||||
// it's not, and we do channel syching
|
||||
$channel = &$this->_channels[strtolower($ircdata->channel)];
|
||||
$this->log(SMARTIRC_DEBUG_CHANNELSYNCING, 'DEBUG_CHANNELSYNCING: updating channel mode for: '.$channel->name, __FILE__, __LINE__);
|
||||
$mode = $ircdata->rawmessageex[3];
|
||||
$parameters = array_slice($ircdata->rawmessageex, 4);
|
||||
|
||||
$add = false;
|
||||
$remove = false;
|
||||
$channelmode = '';
|
||||
$modelength = strlen($mode);
|
||||
for ($i = 0; $i < $modelength; $i++) {
|
||||
switch($mode[$i]) {
|
||||
case '-':
|
||||
$remove = true;
|
||||
$add = false;
|
||||
break;
|
||||
case '+':
|
||||
$add = true;
|
||||
$remove = false;
|
||||
break;
|
||||
// user modes
|
||||
case 'o':
|
||||
$nick = array_shift($parameters);
|
||||
$lowerednick = strtolower($nick);
|
||||
if ($add) {
|
||||
$this->log(SMARTIRC_DEBUG_CHANNELSYNCING, 'DEBUG_CHANNELSYNCING: adding op: '.$nick.' to channel: '.$channel->name, __FILE__, __LINE__);
|
||||
$channel->ops[$nick] = true;
|
||||
$channel->users[$lowerednick]->op = true;
|
||||
}
|
||||
if ($remove) {
|
||||
$this->log(SMARTIRC_DEBUG_CHANNELSYNCING, 'DEBUG_CHANNELSYNCING: removing op: '.$nick.' to channel: '.$channel->name, __FILE__, __LINE__);
|
||||
unset($channel->ops[$nick]);
|
||||
$channel->users[$lowerednick]->op = false;
|
||||
}
|
||||
break;
|
||||
case 'v':
|
||||
$nick = array_shift($parameters);
|
||||
$lowerednick = strtolower($nick);
|
||||
if ($add) {
|
||||
$this->log(SMARTIRC_DEBUG_CHANNELSYNCING, 'DEBUG_CHANNELSYNCING: adding voice: '.$nick.' to channel: '.$channel->name, __FILE__, __LINE__);
|
||||
$channel->voices[$nick] = true;
|
||||
$channel->users[$lowerednick]->voice = true;
|
||||
}
|
||||
if ($remove) {
|
||||
$this->log(SMARTIRC_DEBUG_CHANNELSYNCING, 'DEBUG_CHANNELSYNCING: removing voice: '.$nick.' to channel: '.$channel->name, __FILE__, __LINE__);
|
||||
unset($channel->voices[$nick]);
|
||||
$channel->users[$lowerednick]->voice = false;
|
||||
}
|
||||
break;
|
||||
case 'k':
|
||||
$key = array_shift($parameters);
|
||||
if ($add) {
|
||||
$this->log(SMARTIRC_DEBUG_CHANNELSYNCING, 'DEBUG_CHANNELSYNCING: stored channel key for: '.$channel->name, __FILE__, __LINE__);
|
||||
$channel->key = $key;
|
||||
}
|
||||
if ($remove) {
|
||||
$this->log(SMARTIRC_DEBUG_CHANNELSYNCING, 'DEBUG_CHANNELSYNCING: removed channel key for: '.$channel->name, __FILE__, __LINE__);
|
||||
$channel->key = '';
|
||||
}
|
||||
break;
|
||||
default:
|
||||
// channel modes
|
||||
if ($mode[$i] == 'b') {
|
||||
$hostmask = array_shift($parameters);
|
||||
if ($add) {
|
||||
$this->log(SMARTIRC_DEBUG_CHANNELSYNCING, 'DEBUG_CHANNELSYNCING: adding ban: '.$hostmask.' for: '.$channel->name, __FILE__, __LINE__);
|
||||
$channel->bans[$hostmask] = true;
|
||||
}
|
||||
if ($remove) {
|
||||
$this->log(SMARTIRC_DEBUG_CHANNELSYNCING, 'DEBUG_CHANNELSYNCING: removing ban: '.$hostmask.' for: '.$channel->name, __FILE__, __LINE__);
|
||||
unset($channel->bans[$hostmask]);
|
||||
}
|
||||
} else {
|
||||
$this->log(SMARTIRC_DEBUG_CHANNELSYNCING, 'DEBUG_CHANNELSYNCING: storing unknown channelmode ('.$mode.') in channel->mode for: '.$channel->name, __FILE__, __LINE__);
|
||||
if ($add) {
|
||||
$channel->mode .= $mode[$i];
|
||||
}
|
||||
if ($remove) {
|
||||
$channel->mode = str_replace($mode[$i], '', $channel->mode);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function _event_topic(&$ircdata)
|
||||
{
|
||||
if ($this->_channelsyncing == true) {
|
||||
$channel = &$this->_channels[strtolower($ircdata->rawmessageex[2])];
|
||||
$channel->topic = $ircdata->message;
|
||||
}
|
||||
}
|
||||
|
||||
function _event_privmsg(&$ircdata)
|
||||
{
|
||||
if ($ircdata->type == SMARTIRC_TYPE_CTCP) {
|
||||
// substr must be 1,4 because of \001 in CTCP messages
|
||||
if (substr($ircdata->message, 1, 4) == 'PING') {
|
||||
$this->message(SMARTIRC_TYPE_CTCP, $ircdata->nick, 'PING '.substr($ircdata->message, 5, -1));
|
||||
} elseif (substr($ircdata->message, 1, 7) == 'VERSION') {
|
||||
if (!empty($this->_ctcpversion)) {
|
||||
$versionstring = $this->_ctcpversion.' | using '.SMARTIRC_VERSIONSTRING;
|
||||
} else {
|
||||
$versionstring = SMARTIRC_VERSIONSTRING;
|
||||
}
|
||||
|
||||
$this->message(SMARTIRC_TYPE_CTCP, $ircdata->nick, 'VERSION '.$versionstring);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* rpl_ */
|
||||
function _event_rpl_welcome(&$ircdata)
|
||||
{
|
||||
$this->_loggedin = true;
|
||||
$this->log(SMARTIRC_DEBUG_CONNECTION, 'DEBUG_CONNECTION: logged in', __FILE__, __LINE__);
|
||||
|
||||
// updating our nickname, that we got (maybe cutted...)
|
||||
$this->_nick = $ircdata->rawmessageex[2];
|
||||
}
|
||||
|
||||
function _event_rpl_motdstart(&$ircdata)
|
||||
{
|
||||
$this->_motd[] = $ircdata->message;
|
||||
}
|
||||
|
||||
function _event_rpl_motd(&$ircdata)
|
||||
{
|
||||
$this->_motd[] = $ircdata->message;
|
||||
}
|
||||
|
||||
function _event_rpl_endofmotd(&$ircdata)
|
||||
{
|
||||
$this->_motd[] = $ircdata->message;
|
||||
}
|
||||
|
||||
function _event_rpl_umodeis(&$ircdata)
|
||||
{
|
||||
$this->_usermode = $ircdata->message;
|
||||
}
|
||||
|
||||
function _event_rpl_channelmodeis(&$ircdata) {
|
||||
if ($this->_channelsyncing == true && $this->isJoined($ircdata->channel)) {
|
||||
$mode = $ircdata->rawmessageex[4];
|
||||
$parameters = array_slice($ircdata->rawmessageex, 5);
|
||||
|
||||
$ircdata->rawmessageex = array( 0 => '',
|
||||
1 => '',
|
||||
2 => '',
|
||||
3 => $mode);
|
||||
|
||||
foreach ($parameters as $value) {
|
||||
$ircdata->rawmessageex[] = $value;
|
||||
}
|
||||
|
||||
// let _mode() handle the received mode
|
||||
$this->_event_mode($ircdata);
|
||||
}
|
||||
}
|
||||
|
||||
function _event_rpl_whoreply(&$ircdata)
|
||||
{
|
||||
if ($this->_channelsyncing == true) {
|
||||
$nick = $ircdata->rawmessageex[7];
|
||||
if ($ircdata->channel == '*') {
|
||||
// we got who info without channel info, so we need to search the user
|
||||
// on all channels and update him
|
||||
foreach ($this->_channels as $channel) {
|
||||
if ($this->isJoined($channel->name, $nick)) {
|
||||
$ircdata->channel = $channel->name;
|
||||
$this->_event_rpl_whoreply($ircdata);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!$this->isJoined($ircdata->channel, $nick)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$channel = &$this->_channels[strtolower($ircdata->channel)];
|
||||
|
||||
$user = &new Net_SmartIRC_channeluser();
|
||||
$user->ident = $ircdata->rawmessageex[4];
|
||||
$user->host = $ircdata->rawmessageex[5];
|
||||
$user->server = $ircdata->rawmessageex[6];
|
||||
$user->nick = $ircdata->rawmessageex[7];
|
||||
|
||||
$user->op = false;
|
||||
$user->voice = false;
|
||||
$user->ircop = false;
|
||||
|
||||
$usermode = $ircdata->rawmessageex[8];
|
||||
$usermodelength = strlen($usermode);
|
||||
for ($i = 0; $i < $usermodelength; $i++) {
|
||||
switch ($usermode[$i]) {
|
||||
case 'H':
|
||||
$user->away = false;
|
||||
break;
|
||||
case 'G':
|
||||
$user->away = true;
|
||||
break;
|
||||
case '@':
|
||||
$user->op = true;
|
||||
break;
|
||||
case '+':
|
||||
$user->voice = true;
|
||||
break;
|
||||
case '*':
|
||||
$user->ircop = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$user->hopcount = substr($ircdata->rawmessageex[9], 1);
|
||||
$user->realname = implode(array_slice($ircdata->rawmessageex, 10), ' ');
|
||||
|
||||
$this->_adduser($channel, $user);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function _event_rpl_namreply(&$ircdata)
|
||||
{
|
||||
if ($this->_channelsyncing == true) {
|
||||
$channel = &$this->_channels[strtolower($ircdata->channel)];
|
||||
|
||||
$userarray = explode(' ', rtrim($ircdata->message));
|
||||
$userarraycount = count($userarray);
|
||||
for ($i = 0; $i < $userarraycount; $i++) {
|
||||
$user = &new Net_SmartIRC_channeluser();
|
||||
|
||||
$usermode = substr($userarray[$i], 0, 1);
|
||||
switch ($usermode) {
|
||||
case '@':
|
||||
$user->op = true;
|
||||
$user->nick = substr($userarray[$i], 1);
|
||||
break;
|
||||
case '+':
|
||||
$user->voice = true;
|
||||
$user->nick = substr($userarray[$i], 1);
|
||||
break;
|
||||
default:
|
||||
$user->nick = $userarray[$i];
|
||||
}
|
||||
|
||||
$this->_adduser($channel, $user);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function _event_rpl_banlist(&$ircdata)
|
||||
{
|
||||
if ($this->_channelsyncing == true && $this->isJoined($ircdata->channel)) {
|
||||
$channel = &$this->_channels[strtolower($ircdata->channel)];
|
||||
$hostmask = $ircdata->rawmessageex[4];
|
||||
$channel->bans[$hostmask] = true;
|
||||
}
|
||||
}
|
||||
|
||||
function _event_rpl_topic(&$ircdata)
|
||||
{
|
||||
if ($this->_channelsyncing == true) {
|
||||
$channel = &$this->_channels[strtolower($ircdata->channel)];
|
||||
$topic = substr(implode(array_slice($ircdata->rawmessageex, 4), ' '), 1);
|
||||
$channel->topic = $topic;
|
||||
}
|
||||
}
|
||||
|
||||
/* err_ */
|
||||
function _event_err_nicknameinuse(&$ircdata)
|
||||
{
|
||||
$this->_nicknameinuse();
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -1 +0,0 @@
|
||||
kellan <kellan@protest.net>
|
||||
@@ -1,37 +0,0 @@
|
||||
Version 0.7
|
||||
-----------
|
||||
- support for input and output charset encoding
|
||||
based on the work in FoF, uses iconv or mbstring if available
|
||||
-
|
||||
|
||||
Version 0.6
|
||||
-----------
|
||||
- basic support for Atom syndication format
|
||||
including support for Atom content constructs
|
||||
- fixed support for private feeds (HTTP Auth and SSL)
|
||||
(thanks to silverorange.com for providing test feeds)
|
||||
- support for some broken webservers
|
||||
|
||||
Version 0.52
|
||||
-----------
|
||||
- support GZIP content negoiation
|
||||
- PHP 4.3.2 support
|
||||
|
||||
Version 0.4
|
||||
-----------
|
||||
- improved error handling, better access for script authors
|
||||
- included example scripts of working with MagpieRSS
|
||||
- new Smarty plugin for RSS date parsing
|
||||
|
||||
Version 0.3
|
||||
-----------
|
||||
- added support for conditional gets (Last-Modified, ETag)
|
||||
- now use Snoopy to handle fetching RSS files
|
||||
|
||||
Version 0.2
|
||||
-----------
|
||||
- MAJOR CLEAN UP
|
||||
- removed kludgy $options array in favour of constants
|
||||
- phased out returning arrays
|
||||
- added better error handling
|
||||
- re-worked comments
|
||||
@@ -1,346 +0,0 @@
|
||||
2004-11-21 22:45 kellan
|
||||
|
||||
* rss_fetch.inc: detab, bump version
|
||||
|
||||
2004-11-21 20:52 kellan
|
||||
|
||||
* rss_fetch.inc, rss_parse.inc: cache on $url . $output_encoding
|
||||
otherwise we can get munged output
|
||||
* rss_parse.inc: don't set ERROR on notice or warning (rss_fetch
|
||||
dies on parse errors)
|
||||
* rss_fetch.inc: add encoding defines (fix timeout error reporting)
|
||||
|
||||
2004-11-21 17:21 kellan
|
||||
|
||||
* rss_parse.inc: incorporate steve's patch
|
||||
|
||||
2004-11-21 16:26 kellan
|
||||
|
||||
* rss_parse.inc: remove old debugging functions, totally
|
||||
arbitrarily. might break stuff. can't really explain why i'm
|
||||
doing this.
|
||||
|
||||
2004-10-28 12:52 kellan
|
||||
|
||||
* rss_parse.inc: fixed '=' instead of '=='
|
||||
|
||||
2004-10-25 21:48 kellan
|
||||
|
||||
* rss_parse.inc: chance epoch to timestamp to conform w/ php naming
|
||||
conventions
|
||||
|
||||
2004-06-15 09:00 kellan
|
||||
|
||||
* rss_parse.inc: [no log message]
|
||||
|
||||
2004-04-26 11:16 kellan
|
||||
|
||||
* rss_fetch.inc: bump version
|
||||
|
||||
2004-04-26 09:36 kellan
|
||||
|
||||
* rss_parse.inc: fix field doubling
|
||||
|
||||
2004-04-24 14:47 kellan
|
||||
|
||||
* CHANGES, ChangeLog: updated
|
||||
|
||||
2004-04-24 14:35 kellan
|
||||
|
||||
* rss_fetch.inc: bumped version
|
||||
|
||||
2004-04-24 13:52 kellan
|
||||
|
||||
* rss_parse.inc: support arbitrary atom content constructs
|
||||
|
||||
some refactoring
|
||||
|
||||
2004-04-24 13:15 kellan
|
||||
|
||||
* rss_parse.inc: support summary content contstruct. add normalize
|
||||
function
|
||||
|
||||
2004-03-27 13:29 kellan
|
||||
|
||||
* extlib/Snoopy.class.inc: accept self-signed certs
|
||||
|
||||
2004-03-27 09:53 kellan
|
||||
|
||||
* extlib/Snoopy.class.inc: fixed SSL support * set status * set
|
||||
error on bad curl
|
||||
|
||||
(also ripped out big chunks of dead weight (submit_form) which
|
||||
were getting in my way
|
||||
|
||||
2004-01-24 23:25 kellan
|
||||
|
||||
* rss_parse.inc: make RSS 1.0's rdf:about available
|
||||
|
||||
2004-01-24 23:07 kellan
|
||||
|
||||
* rss_parse.inc: clean up text, and line formats. add support item
|
||||
rdf:about
|
||||
|
||||
2004-01-24 20:40 kellan
|
||||
|
||||
* CHANGES, ChangeLog: update changes
|
||||
|
||||
2004-01-24 20:37 kellan
|
||||
|
||||
* rss_fetch.inc: updated version
|
||||
|
||||
2004-01-24 20:35 kellan
|
||||
|
||||
* rss_parse.inc: whitespace
|
||||
|
||||
2004-01-24 20:23 kellan
|
||||
|
||||
* extlib/Snoopy.class.inc: support badly formatted http headers
|
||||
|
||||
2004-01-24 20:20 kellan
|
||||
|
||||
* rss_parse.inc: added alpha atom parsing support
|
||||
|
||||
2003-06-25 19:34 kellan
|
||||
|
||||
* extlib/Snoopy.class.inc: fixed fread 4.3.2 compatibility problems
|
||||
|
||||
2003-06-13 08:31 kellan
|
||||
|
||||
* rss_fetch.inc: reset cache on 304
|
||||
|
||||
2003-06-12 18:37 kellan
|
||||
|
||||
* rss_cache.inc, rss_fetch.inc, rss_parse.inc, rss_utils.inc:
|
||||
bumped up version numbers
|
||||
|
||||
2003-06-12 18:32 kellan
|
||||
|
||||
* htdocs/index.html: updated news
|
||||
|
||||
2003-06-12 18:27 kellan
|
||||
|
||||
* NEWS: a manual blog :)
|
||||
|
||||
2003-06-12 18:22 kellan
|
||||
|
||||
* htdocs/index.html: fully qualified img
|
||||
|
||||
2003-06-12 18:20 kellan
|
||||
|
||||
* htdocs/index.html: clean up. added badge.
|
||||
|
||||
2003-06-12 18:04 kellan
|
||||
|
||||
* rss_utils.inc: clean up regex
|
||||
|
||||
2003-06-12 18:02 kellan
|
||||
|
||||
* rss_cache.inc: suppress some warnings
|
||||
|
||||
2003-05-30 17:44 kellan
|
||||
|
||||
* extlib/Snoopy.class.inc: more comments, cleaned up notice
|
||||
|
||||
2003-05-30 12:14 kellan
|
||||
|
||||
* extlib/Snoopy.class.inc: don't advertise gzip support if the user
|
||||
hasn't built php with gzinflate support
|
||||
|
||||
2003-05-12 19:32 kellan
|
||||
|
||||
* ChangeLog: changes
|
||||
|
||||
2003-05-12 19:11 kellan
|
||||
|
||||
* htdocs/index.html: announce 0.5
|
||||
|
||||
2003-05-12 18:42 kellan
|
||||
|
||||
* htdocs/index.html: change
|
||||
|
||||
2003-05-12 18:39 kellan
|
||||
|
||||
* rss_fetch.inc: use gzip
|
||||
|
||||
2003-05-12 18:37 kellan
|
||||
|
||||
* extlib/Snoopy.class.inc: added support gzip encoded content
|
||||
negoiation
|
||||
|
||||
2003-05-12 18:32 kellan
|
||||
|
||||
* rss_cache.inc, rss_fetch.inc, rss_parse.inc, rss_utils.inc: fixed
|
||||
typoes
|
||||
|
||||
2003-04-26 18:44 kellan
|
||||
|
||||
* rss_parse.inc: fix minor typo
|
||||
|
||||
2003-04-18 05:19 kellan
|
||||
|
||||
* htdocs/cookbook.html: updated cookbook to show more code for
|
||||
limiting items
|
||||
|
||||
2003-03-03 13:02 kellan
|
||||
|
||||
* rss_parse.inc, scripts/magpie_slashbox.php: committed (or
|
||||
adpated) patch from Nicola (www.technick.com) to quell 'Undefined
|
||||
Indexes' notices
|
||||
|
||||
2003-03-03 12:59 kellan
|
||||
|
||||
* rss_fetch.inc: commited patch from nicola (www.technick.com) to
|
||||
quell 'undefined indexes' notices.
|
||||
|
||||
* Magpie now automatically includes its version in the
|
||||
user-agent, & whether cacheing is turned on.
|
||||
|
||||
2003-02-11 22:22 kellan
|
||||
|
||||
* CHANGES, ChangeLog: ChangeLog now auto-generated by cvs2cl
|
||||
|
||||
2003-02-11 21:21 kellan
|
||||
|
||||
* rss_fetch.inc: better errors, hopefully stomped on pesky notices
|
||||
|
||||
2003-02-11 21:19 kellan
|
||||
|
||||
* rss_parse.inc: check to see is xml is supported, if not die
|
||||
|
||||
also throw better xml errors
|
||||
|
||||
2003-02-11 21:18 kellan
|
||||
|
||||
* rss_cache.inc: hopefully cleared up some notices that were being
|
||||
thrown into the log
|
||||
|
||||
fixed a debug statement that was being called as an error
|
||||
|
||||
2003-02-11 21:15 kellan
|
||||
|
||||
* scripts/: magpie_simple.php, magpie_slashbox.php: moved
|
||||
magpie_simple to magpie_slashbox, and replaced it with a simpler
|
||||
demo.
|
||||
|
||||
2003-02-11 21:02 kellan
|
||||
|
||||
* INSTALL, README, TROUBLESHOOTING: Improved documentation. Better
|
||||
install instructions.
|
||||
|
||||
TROUBLESHOOTING cover common installation and usage problems
|
||||
|
||||
2003-01-22 11:40 kellan
|
||||
|
||||
* htdocs/cookbook.html: added cookbook.html
|
||||
|
||||
2003-01-21 20:47 kellan
|
||||
|
||||
* cookbook: a magpie cookbook
|
||||
|
||||
2003-01-20 07:09 kellan
|
||||
|
||||
* ChangeLog: updated
|
||||
|
||||
2003-01-20 06:23 kellan
|
||||
|
||||
* scripts/simple_smarty.php: minor clean up
|
||||
|
||||
2003-01-20 06:15 kellan
|
||||
|
||||
* scripts/README: added smarty url
|
||||
|
||||
2003-01-20 06:14 kellan
|
||||
|
||||
* magpie_simple.php, htdocs/index.html, scripts/README,
|
||||
scripts/magpie_debug.php, scripts/magpie_simple.php,
|
||||
scripts/simple_smarty.php,
|
||||
scripts/smarty_plugin/modifier.rss_date_parse.php,
|
||||
scripts/templates/simple.smarty: Added scripts directory for
|
||||
examples on how to use MagpieRSS
|
||||
|
||||
magpie_simple - is a simple example magpie_debug - spew all the
|
||||
information from a parsed RSS feed simple_smary - example of
|
||||
using magpie with Smarty template system
|
||||
smarty_plugin/modifier.rss_date_parse.php - support file for the
|
||||
smarty demo templates/simple.smary - template for the smarty demo
|
||||
|
||||
2003-01-20 06:11 kellan
|
||||
|
||||
* rss_fetch.inc, rss_parse.inc: changes to error handling to give
|
||||
script authors more access to magpie's errors.
|
||||
|
||||
added method magpie_error() to retrieve global MAGPIE_ERROR
|
||||
variable for when fetch_rss() returns false
|
||||
|
||||
2002-10-26 16:02 kellan
|
||||
|
||||
* htdocs/index.html: putting the website under source control
|
||||
|
||||
2002-10-26 15:43 kellan
|
||||
|
||||
* AUTHORS, ChangeLog, INSTALL, README: some documentation to make
|
||||
it all look official :)
|
||||
|
||||
2002-10-25 20:04 kellan
|
||||
|
||||
* magpie_simple.php: quxx
|
||||
|
||||
2002-10-25 20:04 kellan
|
||||
|
||||
* rss_parse.inc: added support for textinput and image
|
||||
|
||||
2002-10-25 16:23 kellan
|
||||
|
||||
* magpie_simple.php, rss_cache.inc, rss_fetch.inc, rss_parse.inc,
|
||||
rss_utils.inc: switched to using Snoopy for fetching remote RSS
|
||||
files.
|
||||
|
||||
added support for conditional gets
|
||||
|
||||
2002-10-25 16:22 kellan
|
||||
|
||||
* rss_cache.inc, rss_fetch.inc, rss_parse.inc, rss_utils.inc:
|
||||
Change comment style to slavishly imitate the phpinsider style
|
||||
found in Smarty and Snoopy :)
|
||||
|
||||
2002-10-25 16:18 kellan
|
||||
|
||||
* extlib/Snoopy.class.inc: added Snoopy in order to support
|
||||
conditional gets
|
||||
|
||||
2002-10-23 20:19 kellan
|
||||
|
||||
* magpie_simple.php, rss_cache.inc, rss_fetch.inc, rss_parse.inc:
|
||||
MAJOR CLEANUP!
|
||||
|
||||
* rss_fetch got rid of the options array, replaced it with a more
|
||||
PHP-like solution of using defines. constants are setup, with
|
||||
defaults, in the function init()
|
||||
|
||||
got rid of the idiom of passing back an array, its was awkward to
|
||||
deal with in PHP, and unusual (and consquently confusing to
|
||||
people). now i return true/false values, and try to setup error
|
||||
string where appropiate (rss_cache has the most complete example
|
||||
of this)
|
||||
|
||||
change the logic for interacting with the cache
|
||||
|
||||
* rss_cache major re-working of how error are handled. tried to
|
||||
make the code more resillient. the cache is now much more aware
|
||||
of MAX_AGE, where before this was being driven out of rss_fetch
|
||||
(which was silly)
|
||||
|
||||
* rss_parse properly handles xml parse errors. used to sail
|
||||
along blithely unaware.
|
||||
|
||||
2002-09-11 08:11 kellan
|
||||
|
||||
* rss_cache.inc, rss_parse.inc, magpie_simple.php, rss_fetch.inc,
|
||||
rss_utils.inc: Initial revision
|
||||
|
||||
2002-09-11 08:11 kellan
|
||||
|
||||
* rss_cache.inc, rss_parse.inc, magpie_simple.php, rss_fetch.inc,
|
||||
rss_utils.inc: initial import
|
||||
|
||||
@@ -1,143 +0,0 @@
|
||||
REQUIREMENTS
|
||||
|
||||
MapieRSS requires a recent PHP 4+ (developed with 4.2.0)
|
||||
with xml (expat) support.
|
||||
|
||||
Optionally:
|
||||
* PHP5 with libxml2 support.
|
||||
* cURL for SSL support
|
||||
* iconv (preferred) or mb_string for expanded character set support
|
||||
|
||||
QUICK START
|
||||
|
||||
Magpie consists of 4 files (rss_fetch.inc, rss_parser.inc, rss_cache.inc,
|
||||
and rss_utils.inc), and the directory extlib (which contains a modified
|
||||
version of the Snoopy HTTP client)
|
||||
|
||||
Copy these 5 resources to a directory named 'magpierss' in the same
|
||||
directory as your PHP script.
|
||||
|
||||
At the top of your script add the following line:
|
||||
|
||||
require_once('magpierss/rss_fetch.inc');
|
||||
|
||||
Now you can use the fetch_rss() method:
|
||||
|
||||
$rss = fetch_rss($url);
|
||||
|
||||
Done. That's it. See README for more details on using MagpieRSS.
|
||||
|
||||
NEXT STEPS
|
||||
|
||||
Important: you'll probably want to get the cache directory working in
|
||||
order to speed up your application, and not abuse the webserver you're
|
||||
downloading the RSS from.
|
||||
|
||||
Optionally you can install MagpieRSS in your PHP include path in order to
|
||||
make it available server wide.
|
||||
|
||||
Lastly you might want to look through the constants in rss_fetch.inc see if
|
||||
there is anything you want to override (the defaults are pretty good)
|
||||
|
||||
For more info, or if you have trouble, see TROUBLESHOOTING
|
||||
|
||||
SETTING UP CACHING
|
||||
|
||||
Magpie has built-in transparent caching. With caching Magpie will only
|
||||
fetch and parse RSS feeds when there is new content. Without this feature
|
||||
your pages will be slow, and the sites serving the RSS feed will be annoyed
|
||||
with you.
|
||||
|
||||
** Simple and Automatic **
|
||||
|
||||
By default Magpie will try to create a cache directory named 'cache' in the
|
||||
same directory as your PHP script.
|
||||
|
||||
** Creating a Local Cache Directory **
|
||||
|
||||
Often this will fail, because your webserver doesn't have sufficient
|
||||
permissions to create the directory.
|
||||
|
||||
Exact instructions for how to do this will vary from install to install and
|
||||
platform to platform. The steps are:
|
||||
|
||||
1. Make a directory named 'cache'
|
||||
2. Give the web server write access to that directory.
|
||||
|
||||
An example of how to do this on Debian would be:
|
||||
|
||||
1. mkdir /path/to/script/cache
|
||||
2. chgrp www-data /path/to/script/cache
|
||||
3. chmod 775 /path/to/script/cache
|
||||
|
||||
On other Unixes you'll need to change 'www-data' to what ever user Apache
|
||||
runs as. (on MacOS X the user would be 'www')
|
||||
|
||||
** Cache in /tmp **
|
||||
|
||||
Sometimes you won't be able to create a local cache directory. Some reasons
|
||||
might be:
|
||||
|
||||
1. No shell account
|
||||
2. Insufficient permissions to change ownership of a directory
|
||||
3. Webserver runs as 'nobody'
|
||||
|
||||
In these situations using a cache directory in /tmp can often be a good
|
||||
option.
|
||||
|
||||
The drawback is /tmp is public, so anyone on the box can read the cache
|
||||
files. Usually RSS feeds are public information, so you'll have to decide
|
||||
how much of an issue that is.
|
||||
|
||||
To use /tmp as your cache directory you need to add the following line to
|
||||
your script:
|
||||
|
||||
define('MAGPIE_CACHE_DIR', '/tmp/magpie_cache');
|
||||
|
||||
** Global Cache **
|
||||
|
||||
If you have several applications using Magpie, you can create a single
|
||||
shared cache directory, either using the /tmp cache, or somewhere else on
|
||||
the system.
|
||||
|
||||
The upside is that you'll distribute fetching and parsing feeds across
|
||||
several applications.
|
||||
|
||||
INSTALLING MAGPIE SERVER WIDE
|
||||
|
||||
Rather then following the Quickstart instructions which requires you to have
|
||||
a copy of Magpie per application, alternately you can place it in some
|
||||
shared location.
|
||||
|
||||
** Adding Magpie to Your Include Path **
|
||||
|
||||
Copy the 5 resources (rss_fetch.inc, rss_parser.inc, rss_cache.inc,
|
||||
rss_utils.inc, and extlib) to a directory named 'magpierss' in your include
|
||||
path. Now any PHP file on your system can use Magpie with:
|
||||
|
||||
require_once('magpierss/rss_fetch.inc');
|
||||
|
||||
Different installs have different include paths, and you'll have to figure
|
||||
out what your include_path is.
|
||||
|
||||
From shell you can try:
|
||||
|
||||
php -i | grep 'include_path'
|
||||
|
||||
Alternatley you can create a phpinfo.php file with contains:
|
||||
|
||||
<?php phpinfo(); ?>
|
||||
|
||||
Debian's default is:
|
||||
|
||||
/usr/share/php
|
||||
|
||||
(though more idealogically pure location would be /usr/local/share/php)
|
||||
|
||||
Apple's default include path is:
|
||||
|
||||
/usr/lib/php
|
||||
|
||||
While the Entropy PHP build seems to use:
|
||||
|
||||
/usr/local/php/lib/php
|
||||
@@ -1,53 +0,0 @@
|
||||
MagpieRSS News
|
||||
|
||||
MAGPIERSS 0.51 RELEASED
|
||||
* important bugfix!
|
||||
* fix "silent failure" when PHP doesn't have zlib
|
||||
|
||||
FEED ON FEEDS USES MAGPIE
|
||||
* web-based RSS aggregator built with Magpie
|
||||
* easy to install, easy to use.
|
||||
http://minutillo.com/steve/feedonfeeds/
|
||||
|
||||
MAGPIERSS 0.5 RELEASED
|
||||
* supports transparent HTTP gzip content negotiation for reduced bandwidth usage
|
||||
* quashed some undefined index notices
|
||||
|
||||
MAGPIERSS 0.46 RELEASED
|
||||
* minor release, more error handling clean up
|
||||
* documentation fixes, simpler example
|
||||
* new trouble shooting guide for installation and usage problems
|
||||
http://magpierss.sourceforge.net/TROUBLESHOOTING
|
||||
|
||||
MAGPIE NEWS AS RSS
|
||||
* releases, bug fixes, releated stories in RSS
|
||||
|
||||
MAGPIERSS COOKBOOK: SIMPLE PHP RSS HOW TOS
|
||||
* answers some of the most frequently asked Magpie questions
|
||||
* feedback, suggestions, requests, recipes welcome
|
||||
http://magpierss.sourceforge.net/cookbook.html
|
||||
|
||||
MAGPIERSS 0.4 RELEASED!
|
||||
* improved error handling, more flexibility for script authors, backwards compatible
|
||||
* new and better examples! including using MagpieRSS and Smarty
|
||||
* new Smarty plugin for RSS date parsing
|
||||
http://smarty.php.net
|
||||
|
||||
INFINITE PENGUIN NOW SUPPORTS MAGPIE 0.3
|
||||
* simple, sophisticated RSS viewer
|
||||
* includes auto-generated javascript ticker from RSS feed
|
||||
http://www.infinitepenguins.net/rss/
|
||||
|
||||
TRAUMWIND RELEASES REX BACKEND FOR MAGPIERSS
|
||||
* drop in support using regex based XML parser
|
||||
* parses improperly formed XML that chokes expat
|
||||
http://traumwind.de/blog/magpie/magpie_alike.php
|
||||
|
||||
MAGPIERSS 0.3 RELEASED!
|
||||
* Support added for HTTP Conditional GETs.
|
||||
http://fishbowl.pastiche.org/archives/001132.html
|
||||
|
||||
MAGPIERSS 0.2!
|
||||
* Major clean up of the code. Easier to use.
|
||||
* Simpler install on shared hosts.
|
||||
* Better documentation and comments.
|
||||
@@ -1,48 +0,0 @@
|
||||
NAME
|
||||
|
||||
MagpieRSS - a simple RSS integration tool
|
||||
|
||||
SYNOPSIS
|
||||
|
||||
require_once(rss_fetch.inc);
|
||||
$url = $_GET['url'];
|
||||
$rss = fetch_rss( $url );
|
||||
|
||||
echo "Channel Title: " . $rss->channel['title'] . "<p>";
|
||||
echo "<ul>";
|
||||
foreach ($rss->items as $item) {
|
||||
$href = $item['link'];
|
||||
$title = $item['title'];
|
||||
echo "<li><a href=$href>$title</a></li>";
|
||||
}
|
||||
echo "</ul>";
|
||||
|
||||
DESCRIPTION
|
||||
|
||||
MapieRSS is an XML-based RSS parser in PHP. It attempts to be "PHP-like",
|
||||
and simple to use.
|
||||
|
||||
Some features include:
|
||||
|
||||
* supports RSS 0.9 - 1.0, with limited RSS 2.0 support
|
||||
* supports namespaces, and modules, including mod_content and mod_event
|
||||
* open minded [1]
|
||||
* simple, functional interface, to object oriented backend parser
|
||||
* automatic caching of parsed RSS objects makes its easy to integrate
|
||||
* supports conditional GET with Last-Modified, and ETag
|
||||
* uses constants for easy override of default behaviour
|
||||
* heavily commented
|
||||
|
||||
|
||||
1. By open minded I mean Magpie will accept any tag it finds in good faith that
|
||||
it was supposed to be here. For strict validation, look elsewhere.
|
||||
|
||||
|
||||
GETTING STARTED
|
||||
|
||||
|
||||
|
||||
COPYRIGHT:
|
||||
Copyright(c) 2002 kellan@protest.net. All rights reserved.
|
||||
This software is released under the GNU General Public License.
|
||||
Please read the disclaimer at the top of the Snoopy.class.inc file.
|
||||
@@ -1,152 +0,0 @@
|
||||
TROUBLESHOOTING
|
||||
|
||||
|
||||
Trouble Installing MagpieRSS:
|
||||
|
||||
1. Fatal error: Failed opening required '/path/to/script/rss_fetch.inc'
|
||||
(include_path='.:/usr/local/lib/php:/usr/local/lib/php/pear')
|
||||
|
||||
2. Cache couldn't make dir './cache'.
|
||||
|
||||
3. Fatal error: Failed to load PHP's XML Extension.
|
||||
http://www.php.net/manual/en/ref.xml.php
|
||||
|
||||
Trouble Using MagpieRSS
|
||||
|
||||
4. Warning: MagpieRSS: Failed to fetch example.com/index.rdf.
|
||||
(HTTP Error: Invalid protocol "")
|
||||
|
||||
5. Warning: MagpieRSS: Failed to parse RSS file.
|
||||
(not well-formed (invalid token) at line 19, column 98)
|
||||
|
||||
6. Warning: MagpieRSS: Failed to fetch http://localhost/rss/features.1-0.rss.
|
||||
(HTTP Response: HTTP/1.1 404 Not Found)
|
||||
|
||||
If you would rather provide a custom error, see the COOKBOOK
|
||||
(http://magpierss.sf.net/cookbook.html) recipe 2.
|
||||
|
||||
*************************************************************************
|
||||
1. Fatal error: Failed opening required '/path/to/script/rss_fetch.inc'
|
||||
(include_path='.:/usr/local/lib/php:/usr/local/lib/php/pear')
|
||||
|
||||
This could mean that:
|
||||
|
||||
a) PHP can't find the MagpieRSS files.
|
||||
b) PHP found them the MagpieRSS files, but can't read them.
|
||||
|
||||
a. Telling PHP where to look for MagpieRSS file.
|
||||
|
||||
This might mean your PHP program can't find the MagpieRSS libraries.
|
||||
Magpie relies on 4 include files, rss_fetch.inc, rss_parse.inc,
|
||||
rss_cache.inc, rss_util.inc, and for normal use you'll need all 4 (see the
|
||||
cookbook for exceptions).
|
||||
|
||||
This can be fixed by making sure the MagpieRSS files are in your include
|
||||
path.
|
||||
|
||||
If you can edit your include path (for example your on a shared host) then
|
||||
you need to replace:
|
||||
|
||||
require_once('rss_fetch.inc');
|
||||
|
||||
-with-
|
||||
|
||||
define('MAGPIE_DIR', '/path/to/magpierss/');
|
||||
require_once(MAGPIE_DIR.'rss_fetch.inc');
|
||||
|
||||
b. PHP can't read the MagpieRSS files
|
||||
|
||||
All PHP libraries need to be readable by your webserver.
|
||||
|
||||
On Unix you can accomplish this with:
|
||||
|
||||
chmod 755 rss_fetch.inc rss_parse.inc rss_cache.inc rss_util.inc
|
||||
|
||||
*************************************************************************
|
||||
2. Cache couldn't make dir './cache'.
|
||||
|
||||
MagpieRSS caches the results of fetched and parsed RSS to reduce the load on
|
||||
both your server, and the remote server providing the RSS. It does this by
|
||||
writing files to a cache directory.
|
||||
|
||||
This error means the webserver doesn't have write access to the current
|
||||
directory.
|
||||
|
||||
a. Make a webserver writeable cache directory
|
||||
|
||||
Find the webserver's group. (on my system it is 'www')
|
||||
|
||||
mkdir ./cache
|
||||
chgrp www directory_name
|
||||
chmod g+w directory_name
|
||||
|
||||
(this is the best, and desired solution)
|
||||
|
||||
b. Tell MagpieRSS to create the cache directory somewhere the webserver can
|
||||
write to.
|
||||
|
||||
define('MAGPIE_CACHE_DIR', '/tmp/magpierss');
|
||||
|
||||
(this is not a great solution, and might have security considerations)
|
||||
|
||||
c. Turn off cacheing.
|
||||
|
||||
Magpie can work fine with cacheing, but it will be slower, and you might
|
||||
become a nuiance to the RSS provider, but it is an option.
|
||||
|
||||
define('MAGPIE_CACHE_ON', 0);
|
||||
|
||||
d. And lastly, do NOT
|
||||
|
||||
chmod 777 ./cache
|
||||
|
||||
Any of the above solutions are better then this.
|
||||
|
||||
NOTE: If none of this works for you, let me know. I've got root, and a
|
||||
custom compiled Apache on almost any box I ever touch, so I can be a little
|
||||
out of touch with reality. But I won't know that if I don't feedback.
|
||||
|
||||
************************************************************************* 3.
|
||||
3. Fatal error: Failed to load PHP's XML Extension.
|
||||
http://www.php.net/manual/en/ref.xml.php
|
||||
|
||||
-or-
|
||||
|
||||
Fatal error: Failed to create an instance of PHP's XML parser.
|
||||
http://www.php.net/manual/en/ref.xml.php
|
||||
|
||||
Make sure your PHP was built with --with-xml
|
||||
|
||||
This has been turned on by default for several versions of PHP, but it might
|
||||
be turned off in your build.
|
||||
|
||||
See php.net for details on building and configuring PHP.
|
||||
|
||||
|
||||
*************************************************************************
|
||||
4. Warning: MagpieRSS: Failed to fetch index.rdf.
|
||||
(HTTP Error: Invalid protocol "")
|
||||
|
||||
You need to put http:// in front of your the URL to your RSS feed
|
||||
|
||||
*************************************************************************
|
||||
5. Warning: MagpieRSS: Failed to parse RSS file.
|
||||
(not well-formed (invalid token) at line 19, column 98)
|
||||
|
||||
There is a problem with the RSS feed you are trying to read.
|
||||
MagpieRSS is an XML parser, and therefore can't parse RSS feed with invalid
|
||||
characters. Some RSS parser are based on regular expressions, and can
|
||||
parse invalid RSS but they have their own problems.
|
||||
|
||||
You could try contacting the author of the RSS feed, and pointing them to
|
||||
the online RSS validator at:
|
||||
|
||||
http://feeds.archive.org/validator/
|
||||
|
||||
*************************************************************************
|
||||
6. Warning: MagpieRSS: Failed to fetch http://example.com/index.rdf
|
||||
(HTTP Response: HTTP/1.1 404 Not Found)
|
||||
|
||||
Its a 404! The RSS file ain't there.
|
||||
|
||||
|
||||
@@ -1,899 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*************************************************
|
||||
|
||||
Snoopy - the PHP net client
|
||||
Author: Monte Ohrt <monte@ispi.net>
|
||||
Copyright (c): 1999-2000 ispi, all rights reserved
|
||||
Version: 1.0
|
||||
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
You may contact the author of Snoopy by e-mail at:
|
||||
monte@ispi.net
|
||||
|
||||
Or, write to:
|
||||
Monte Ohrt
|
||||
CTO, ispi
|
||||
237 S. 70th suite 220
|
||||
Lincoln, NE 68510
|
||||
|
||||
The latest version of Snoopy can be obtained from:
|
||||
http://snoopy.sourceforge.com
|
||||
|
||||
*************************************************/
|
||||
|
||||
class Snoopy
|
||||
{
|
||||
/**** Public variables ****/
|
||||
|
||||
/* user definable vars */
|
||||
|
||||
var $host = "www.php.net"; // host name we are connecting to
|
||||
var $port = 80; // port we are connecting to
|
||||
var $proxy_host = ""; // proxy host to use
|
||||
var $proxy_port = ""; // proxy port to use
|
||||
var $agent = "Snoopy v1.0"; // agent we masquerade as
|
||||
var $referer = ""; // referer info to pass
|
||||
var $cookies = array(); // array of cookies to pass
|
||||
// $cookies["username"]="joe";
|
||||
var $rawheaders = array(); // array of raw headers to send
|
||||
// $rawheaders["Content-type"]="text/html";
|
||||
|
||||
var $maxredirs = 5; // http redirection depth maximum. 0 = disallow
|
||||
var $lastredirectaddr = ""; // contains address of last redirected address
|
||||
var $offsiteok = true; // allows redirection off-site
|
||||
var $maxframes = 0; // frame content depth maximum. 0 = disallow
|
||||
var $expandlinks = true; // expand links to fully qualified URLs.
|
||||
// this only applies to fetchlinks()
|
||||
// or submitlinks()
|
||||
var $passcookies = true; // pass set cookies back through redirects
|
||||
// NOTE: this currently does not respect
|
||||
// dates, domains or paths.
|
||||
|
||||
var $user = ""; // user for http authentication
|
||||
var $pass = ""; // password for http authentication
|
||||
|
||||
// http accept types
|
||||
var $accept = "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*";
|
||||
|
||||
var $results = ""; // where the content is put
|
||||
|
||||
var $error = ""; // error messages sent here
|
||||
var $response_code = ""; // response code returned from server
|
||||
var $headers = array(); // headers returned from server sent here
|
||||
var $maxlength = 500000; // max return data length (body)
|
||||
var $read_timeout = 0; // timeout on read operations, in seconds
|
||||
// supported only since PHP 4 Beta 4
|
||||
// set to 0 to disallow timeouts
|
||||
var $timed_out = false; // if a read operation timed out
|
||||
var $status = 0; // http request status
|
||||
|
||||
var $curl_path = "/usr/bin/curl";
|
||||
// Snoopy will use cURL for fetching
|
||||
// SSL content if a full system path to
|
||||
// the cURL binary is supplied here.
|
||||
// set to false if you do not have
|
||||
// cURL installed. See http://curl.haxx.se
|
||||
// for details on installing cURL.
|
||||
// Snoopy does *not* use the cURL
|
||||
// library functions built into php,
|
||||
// as these functions are not stable
|
||||
// as of this Snoopy release.
|
||||
|
||||
// send Accept-encoding: gzip?
|
||||
var $use_gzip = true;
|
||||
|
||||
/**** Private variables ****/
|
||||
|
||||
var $_maxlinelen = 4096; // max line length (headers)
|
||||
|
||||
var $_httpmethod = "GET"; // default http request method
|
||||
var $_httpversion = "HTTP/1.0"; // default http request version
|
||||
var $_submit_method = "POST"; // default submit method
|
||||
var $_submit_type = "application/x-www-form-urlencoded"; // default submit type
|
||||
var $_mime_boundary = ""; // MIME boundary for multipart/form-data submit type
|
||||
var $_redirectaddr = false; // will be set if page fetched is a redirect
|
||||
var $_redirectdepth = 0; // increments on an http redirect
|
||||
var $_frameurls = array(); // frame src urls
|
||||
var $_framedepth = 0; // increments on frame depth
|
||||
|
||||
var $_isproxy = false; // set if using a proxy server
|
||||
var $_fp_timeout = 30; // timeout for socket connection
|
||||
|
||||
/*======================================================================*\
|
||||
Function: fetch
|
||||
Purpose: fetch the contents of a web page
|
||||
(and possibly other protocols in the
|
||||
future like ftp, nntp, gopher, etc.)
|
||||
Input: $URI the location of the page to fetch
|
||||
Output: $this->results the output text from the fetch
|
||||
\*======================================================================*/
|
||||
|
||||
function fetch($URI)
|
||||
{
|
||||
|
||||
//preg_match("|^([^:]+)://([^:/]+)(:[\d]+)*(.*)|",$URI,$URI_PARTS);
|
||||
$URI_PARTS = parse_url($URI);
|
||||
if (!empty($URI_PARTS["user"]))
|
||||
$this->user = $URI_PARTS["user"];
|
||||
if (!empty($URI_PARTS["pass"]))
|
||||
$this->pass = $URI_PARTS["pass"];
|
||||
|
||||
switch($URI_PARTS["scheme"])
|
||||
{
|
||||
case "http":
|
||||
$this->host = $URI_PARTS["host"];
|
||||
if(!empty($URI_PARTS["port"]))
|
||||
$this->port = $URI_PARTS["port"];
|
||||
if($this->_connect($fp))
|
||||
{
|
||||
if($this->_isproxy)
|
||||
{
|
||||
// using proxy, send entire URI
|
||||
$this->_httprequest($URI,$fp,$URI,$this->_httpmethod);
|
||||
}
|
||||
else
|
||||
{
|
||||
$path = $URI_PARTS["path"].(isset($URI_PARTS["query"]) ? "?".$URI_PARTS["query"] : "");
|
||||
// no proxy, send only the path
|
||||
$this->_httprequest($path, $fp, $URI, $this->_httpmethod);
|
||||
}
|
||||
|
||||
$this->_disconnect($fp);
|
||||
|
||||
if($this->_redirectaddr)
|
||||
{
|
||||
/* url was redirected, check if we've hit the max depth */
|
||||
if($this->maxredirs > $this->_redirectdepth)
|
||||
{
|
||||
// only follow redirect if it's on this site, or offsiteok is true
|
||||
if(preg_match("|^http://".preg_quote($this->host)."|i",$this->_redirectaddr) || $this->offsiteok)
|
||||
{
|
||||
/* follow the redirect */
|
||||
$this->_redirectdepth++;
|
||||
$this->lastredirectaddr=$this->_redirectaddr;
|
||||
$this->fetch($this->_redirectaddr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($this->_framedepth < $this->maxframes && count($this->_frameurls) > 0)
|
||||
{
|
||||
$frameurls = $this->_frameurls;
|
||||
$this->_frameurls = array();
|
||||
|
||||
while(list(,$frameurl) = each($frameurls))
|
||||
{
|
||||
if($this->_framedepth < $this->maxframes)
|
||||
{
|
||||
$this->fetch($frameurl);
|
||||
$this->_framedepth++;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
break;
|
||||
case "https":
|
||||
if(!$this->curl_path || (!is_executable($this->curl_path))) {
|
||||
$this->error = "Bad curl ($this->curl_path), can't fetch HTTPS \n";
|
||||
return false;
|
||||
}
|
||||
$this->host = $URI_PARTS["host"];
|
||||
if(!empty($URI_PARTS["port"]))
|
||||
$this->port = $URI_PARTS["port"];
|
||||
if($this->_isproxy)
|
||||
{
|
||||
// using proxy, send entire URI
|
||||
$this->_httpsrequest($URI,$URI,$this->_httpmethod);
|
||||
}
|
||||
else
|
||||
{
|
||||
$path = $URI_PARTS["path"].($URI_PARTS["query"] ? "?".$URI_PARTS["query"] : "");
|
||||
// no proxy, send only the path
|
||||
$this->_httpsrequest($path, $URI, $this->_httpmethod);
|
||||
}
|
||||
|
||||
if($this->_redirectaddr)
|
||||
{
|
||||
/* url was redirected, check if we've hit the max depth */
|
||||
if($this->maxredirs > $this->_redirectdepth)
|
||||
{
|
||||
// only follow redirect if it's on this site, or offsiteok is true
|
||||
if(preg_match("|^http://".preg_quote($this->host)."|i",$this->_redirectaddr) || $this->offsiteok)
|
||||
{
|
||||
/* follow the redirect */
|
||||
$this->_redirectdepth++;
|
||||
$this->lastredirectaddr=$this->_redirectaddr;
|
||||
$this->fetch($this->_redirectaddr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($this->_framedepth < $this->maxframes && count($this->_frameurls) > 0)
|
||||
{
|
||||
$frameurls = $this->_frameurls;
|
||||
$this->_frameurls = array();
|
||||
|
||||
while(list(,$frameurl) = each($frameurls))
|
||||
{
|
||||
if($this->_framedepth < $this->maxframes)
|
||||
{
|
||||
$this->fetch($frameurl);
|
||||
$this->_framedepth++;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
break;
|
||||
default:
|
||||
// not a valid protocol
|
||||
$this->error = 'Invalid protocol "'.$URI_PARTS["scheme"].'"\n';
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*======================================================================*\
|
||||
Private functions
|
||||
\*======================================================================*/
|
||||
|
||||
|
||||
/*======================================================================*\
|
||||
Function: _striplinks
|
||||
Purpose: strip the hyperlinks from an html document
|
||||
Input: $document document to strip.
|
||||
Output: $match an array of the links
|
||||
\*======================================================================*/
|
||||
|
||||
function _striplinks($document)
|
||||
{
|
||||
preg_match_all("'<\s*a\s+.*href\s*=\s* # find <a href=
|
||||
([\"\'])? # find single or double quote
|
||||
(?(1) (.*?)\\1 | ([^\s\>]+)) # if quote found, match up to next matching
|
||||
# quote, otherwise match up to next space
|
||||
'isx",$document,$links);
|
||||
|
||||
|
||||
// catenate the non-empty matches from the conditional subpattern
|
||||
|
||||
while(list($key,$val) = each($links[2]))
|
||||
{
|
||||
if(!empty($val))
|
||||
$match[] = $val;
|
||||
}
|
||||
|
||||
while(list($key,$val) = each($links[3]))
|
||||
{
|
||||
if(!empty($val))
|
||||
$match[] = $val;
|
||||
}
|
||||
|
||||
// return the links
|
||||
return $match;
|
||||
}
|
||||
|
||||
/*======================================================================*\
|
||||
Function: _stripform
|
||||
Purpose: strip the form elements from an html document
|
||||
Input: $document document to strip.
|
||||
Output: $match an array of the links
|
||||
\*======================================================================*/
|
||||
|
||||
function _stripform($document)
|
||||
{
|
||||
preg_match_all("'<\/?(FORM|INPUT|SELECT|TEXTAREA|(OPTION))[^<>]*>(?(2)(.*(?=<\/?(option|select)[^<>]*>[\r\n]*)|(?=[\r\n]*))|(?=[\r\n]*))'Usi",$document,$elements);
|
||||
|
||||
// catenate the matches
|
||||
$match = implode("\r\n",$elements[0]);
|
||||
|
||||
// return the links
|
||||
return $match;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*======================================================================*\
|
||||
Function: _striptext
|
||||
Purpose: strip the text from an html document
|
||||
Input: $document document to strip.
|
||||
Output: $text the resulting text
|
||||
\*======================================================================*/
|
||||
|
||||
function _striptext($document)
|
||||
{
|
||||
|
||||
// I didn't use preg eval (//e) since that is only available in PHP 4.0.
|
||||
// so, list your entities one by one here. I included some of the
|
||||
// more common ones.
|
||||
|
||||
$search = array("'<script[^>]*?>.*?</script>'si", // strip out javascript
|
||||
"'<[\/\!]*?[^<>]*?>'si", // strip out html tags
|
||||
"'([\r\n])[\s]+'", // strip out white space
|
||||
"'&(quote|#34);'i", // replace html entities
|
||||
"'&(amp|#38);'i",
|
||||
"'&(lt|#60);'i",
|
||||
"'&(gt|#62);'i",
|
||||
"'&(nbsp|#160);'i",
|
||||
"'&(iexcl|#161);'i",
|
||||
"'&(cent|#162);'i",
|
||||
"'&(pound|#163);'i",
|
||||
"'&(copy|#169);'i"
|
||||
);
|
||||
$replace = array( "",
|
||||
"",
|
||||
"\\1",
|
||||
"\"",
|
||||
"&",
|
||||
"<",
|
||||
">",
|
||||
" ",
|
||||
chr(161),
|
||||
chr(162),
|
||||
chr(163),
|
||||
chr(169));
|
||||
|
||||
$text = preg_replace($search,$replace,$document);
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
||||
/*======================================================================*\
|
||||
Function: _expandlinks
|
||||
Purpose: expand each link into a fully qualified URL
|
||||
Input: $links the links to qualify
|
||||
$URI the full URI to get the base from
|
||||
Output: $expandedLinks the expanded links
|
||||
\*======================================================================*/
|
||||
|
||||
function _expandlinks($links,$URI)
|
||||
{
|
||||
|
||||
preg_match("/^[^\?]+/",$URI,$match);
|
||||
|
||||
$match = preg_replace("|/[^\/\.]+\.[^\/\.]+$|","",$match[0]);
|
||||
|
||||
$search = array( "|^http://".preg_quote($this->host)."|i",
|
||||
"|^(?!http://)(\/)?(?!mailto:)|i",
|
||||
"|/\./|",
|
||||
"|/[^\/]+/\.\./|"
|
||||
);
|
||||
|
||||
$replace = array( "",
|
||||
$match."/",
|
||||
"/",
|
||||
"/"
|
||||
);
|
||||
|
||||
$expandedLinks = preg_replace($search,$replace,$links);
|
||||
|
||||
return $expandedLinks;
|
||||
}
|
||||
|
||||
/*======================================================================*\
|
||||
Function: _httprequest
|
||||
Purpose: go get the http data from the server
|
||||
Input: $url the url to fetch
|
||||
$fp the current open file pointer
|
||||
$URI the full URI
|
||||
$body body contents to send if any (POST)
|
||||
Output:
|
||||
\*======================================================================*/
|
||||
|
||||
function _httprequest($url,$fp,$URI,$http_method,$content_type="",$body="")
|
||||
{
|
||||
if($this->passcookies && $this->_redirectaddr)
|
||||
$this->setcookies();
|
||||
|
||||
$URI_PARTS = parse_url($URI);
|
||||
if(empty($url))
|
||||
$url = "/";
|
||||
$headers = $http_method." ".$url." ".$this->_httpversion."\r\n";
|
||||
if(!empty($this->agent))
|
||||
$headers .= "User-Agent: ".$this->agent."\r\n";
|
||||
if(!empty($this->host) && !isset($this->rawheaders['Host']))
|
||||
$headers .= "Host: ".$this->host."\r\n";
|
||||
if(!empty($this->accept))
|
||||
$headers .= "Accept: ".$this->accept."\r\n";
|
||||
|
||||
if($this->use_gzip) {
|
||||
// make sure PHP was built with --with-zlib
|
||||
// and we can handle gzipp'ed data
|
||||
if ( function_exists(gzinflate) ) {
|
||||
$headers .= "Accept-encoding: gzip\r\n";
|
||||
}
|
||||
else {
|
||||
trigger_error(
|
||||
"use_gzip is on, but PHP was built without zlib support.".
|
||||
" Requesting file(s) without gzip encoding.",
|
||||
E_USER_NOTICE);
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($this->referer))
|
||||
$headers .= "Referer: ".$this->referer."\r\n";
|
||||
if(!empty($this->cookies))
|
||||
{
|
||||
if(!is_array($this->cookies))
|
||||
$this->cookies = (array)$this->cookies;
|
||||
|
||||
reset($this->cookies);
|
||||
if ( count($this->cookies) > 0 ) {
|
||||
$cookie_headers .= 'Cookie: ';
|
||||
foreach ( $this->cookies as $cookieKey => $cookieVal ) {
|
||||
$cookie_headers .= $cookieKey."=".urlencode($cookieVal)."; ";
|
||||
}
|
||||
$headers .= substr($cookie_headers,0,-2) . "\r\n";
|
||||
}
|
||||
}
|
||||
if(!empty($this->rawheaders))
|
||||
{
|
||||
if(!is_array($this->rawheaders))
|
||||
$this->rawheaders = (array)$this->rawheaders;
|
||||
while(list($headerKey,$headerVal) = each($this->rawheaders))
|
||||
$headers .= $headerKey.": ".$headerVal."\r\n";
|
||||
}
|
||||
if(!empty($content_type)) {
|
||||
$headers .= "Content-type: $content_type";
|
||||
if ($content_type == "multipart/form-data")
|
||||
$headers .= "; boundary=".$this->_mime_boundary;
|
||||
$headers .= "\r\n";
|
||||
}
|
||||
if(!empty($body))
|
||||
$headers .= "Content-length: ".strlen($body)."\r\n";
|
||||
if(!empty($this->user) || !empty($this->pass))
|
||||
$headers .= "Authorization: BASIC ".base64_encode($this->user.":".$this->pass)."\r\n";
|
||||
|
||||
$headers .= "\r\n";
|
||||
|
||||
// set the read timeout if needed
|
||||
if ($this->read_timeout > 0)
|
||||
socket_set_timeout($fp, $this->read_timeout);
|
||||
$this->timed_out = false;
|
||||
|
||||
fwrite($fp,$headers.$body,strlen($headers.$body));
|
||||
|
||||
$this->_redirectaddr = false;
|
||||
unset($this->headers);
|
||||
|
||||
// content was returned gzip encoded?
|
||||
$is_gzipped = false;
|
||||
|
||||
while($currentHeader = fgets($fp,$this->_maxlinelen))
|
||||
{
|
||||
if ($this->read_timeout > 0 && $this->_check_timeout($fp))
|
||||
{
|
||||
$this->status=-100;
|
||||
return false;
|
||||
}
|
||||
|
||||
// if($currentHeader == "\r\n")
|
||||
if(preg_match("/^\r?\n$/", $currentHeader) )
|
||||
break;
|
||||
|
||||
// if a header begins with Location: or URI:, set the redirect
|
||||
if(preg_match("/^(Location:|URI:)/i",$currentHeader))
|
||||
{
|
||||
// get URL portion of the redirect
|
||||
preg_match("/^(Location:|URI:)\s+(.*)/",chop($currentHeader),$matches);
|
||||
// look for :// in the Location header to see if hostname is included
|
||||
if(!preg_match("|\:\/\/|",$matches[2]))
|
||||
{
|
||||
// no host in the path, so prepend
|
||||
$this->_redirectaddr = $URI_PARTS["scheme"]."://".$this->host.":".$this->port;
|
||||
// eliminate double slash
|
||||
if(!preg_match("|^/|",$matches[2]))
|
||||
$this->_redirectaddr .= "/".$matches[2];
|
||||
else
|
||||
$this->_redirectaddr .= $matches[2];
|
||||
}
|
||||
else
|
||||
$this->_redirectaddr = $matches[2];
|
||||
}
|
||||
|
||||
if(preg_match("|^HTTP/|",$currentHeader))
|
||||
{
|
||||
if(preg_match("|^HTTP/[^\s]*\s(.*?)\s|",$currentHeader, $status))
|
||||
{
|
||||
$this->status= $status[1];
|
||||
}
|
||||
$this->response_code = $currentHeader;
|
||||
}
|
||||
|
||||
if (preg_match("/Content-Encoding: gzip/", $currentHeader) ) {
|
||||
$is_gzipped = true;
|
||||
}
|
||||
|
||||
$this->headers[] = $currentHeader;
|
||||
}
|
||||
|
||||
# $results = fread($fp, $this->maxlength);
|
||||
$results = "";
|
||||
while ( $data = fread($fp, $this->maxlength) ) {
|
||||
$results .= $data;
|
||||
if (
|
||||
strlen($results) > $this->maxlength ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// gunzip
|
||||
if ( $is_gzipped ) {
|
||||
// per http://www.php.net/manual/en/function.gzencode.php
|
||||
$results = substr($results, 10);
|
||||
$results = gzinflate($results);
|
||||
}
|
||||
|
||||
if ($this->read_timeout > 0 && $this->_check_timeout($fp))
|
||||
{
|
||||
$this->status=-100;
|
||||
return false;
|
||||
}
|
||||
|
||||
// check if there is a a redirect meta tag
|
||||
|
||||
if(preg_match("'<meta[\s]*http-equiv[^>]*?content[\s]*=[\s]*[\"\']?\d+;[\s]+URL[\s]*=[\s]*([^\"\']*?)[\"\']?>'i",$results,$match))
|
||||
{
|
||||
$this->_redirectaddr = $this->_expandlinks($match[1],$URI);
|
||||
}
|
||||
|
||||
// have we hit our frame depth and is there frame src to fetch?
|
||||
if(($this->_framedepth < $this->maxframes) && preg_match_all("'<frame\s+.*src[\s]*=[\'\"]?([^\'\"\>]+)'i",$results,$match))
|
||||
{
|
||||
$this->results[] = $results;
|
||||
for($x=0; $x<count($match[1]); $x++)
|
||||
$this->_frameurls[] = $this->_expandlinks($match[1][$x],$URI_PARTS["scheme"]."://".$this->host);
|
||||
}
|
||||
// have we already fetched framed content?
|
||||
elseif(is_array($this->results))
|
||||
$this->results[] = $results;
|
||||
// no framed content
|
||||
else
|
||||
$this->results = $results;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*======================================================================*\
|
||||
Function: _httpsrequest
|
||||
Purpose: go get the https data from the server using curl
|
||||
Input: $url the url to fetch
|
||||
$URI the full URI
|
||||
$body body contents to send if any (POST)
|
||||
Output:
|
||||
\*======================================================================*/
|
||||
|
||||
function _httpsrequest($url,$URI,$http_method,$content_type="",$body="")
|
||||
{
|
||||
if($this->passcookies && $this->_redirectaddr)
|
||||
$this->setcookies();
|
||||
|
||||
$headers = array();
|
||||
|
||||
$URI_PARTS = parse_url($URI);
|
||||
if(empty($url))
|
||||
$url = "/";
|
||||
// GET ... header not needed for curl
|
||||
//$headers[] = $http_method." ".$url." ".$this->_httpversion;
|
||||
if(!empty($this->agent))
|
||||
$headers[] = "User-Agent: ".$this->agent;
|
||||
if(!empty($this->host))
|
||||
$headers[] = "Host: ".$this->host;
|
||||
if(!empty($this->accept))
|
||||
$headers[] = "Accept: ".$this->accept;
|
||||
if(!empty($this->referer))
|
||||
$headers[] = "Referer: ".$this->referer;
|
||||
if(!empty($this->cookies))
|
||||
{
|
||||
if(!is_array($this->cookies))
|
||||
$this->cookies = (array)$this->cookies;
|
||||
|
||||
reset($this->cookies);
|
||||
if ( count($this->cookies) > 0 ) {
|
||||
$cookie_str = 'Cookie: ';
|
||||
foreach ( $this->cookies as $cookieKey => $cookieVal ) {
|
||||
$cookie_str .= $cookieKey."=".urlencode($cookieVal)."; ";
|
||||
}
|
||||
$headers[] = substr($cookie_str,0,-2);
|
||||
}
|
||||
}
|
||||
if(!empty($this->rawheaders))
|
||||
{
|
||||
if(!is_array($this->rawheaders))
|
||||
$this->rawheaders = (array)$this->rawheaders;
|
||||
while(list($headerKey,$headerVal) = each($this->rawheaders))
|
||||
$headers[] = $headerKey.": ".$headerVal;
|
||||
}
|
||||
if(!empty($content_type)) {
|
||||
if ($content_type == "multipart/form-data")
|
||||
$headers[] = "Content-type: $content_type; boundary=".$this->_mime_boundary;
|
||||
else
|
||||
$headers[] = "Content-type: $content_type";
|
||||
}
|
||||
if(!empty($body))
|
||||
$headers[] = "Content-length: ".strlen($body);
|
||||
if(!empty($this->user) || !empty($this->pass))
|
||||
$headers[] = "Authorization: BASIC ".base64_encode($this->user.":".$this->pass);
|
||||
|
||||
for($curr_header = 0; $curr_header < count($headers); $curr_header++)
|
||||
$cmdline_params .= " -H \"".$headers[$curr_header]."\"";
|
||||
|
||||
if(!empty($body))
|
||||
$cmdline_params .= " -d \"$body\"";
|
||||
|
||||
if($this->read_timeout > 0)
|
||||
$cmdline_params .= " -m ".$this->read_timeout;
|
||||
|
||||
$headerfile = uniqid(time());
|
||||
|
||||
# accept self-signed certs
|
||||
$cmdline_params .= " -k";
|
||||
exec($this->curl_path." -D \"/tmp/$headerfile\"".$cmdline_params." ".$URI,$results,$return);
|
||||
|
||||
if($return)
|
||||
{
|
||||
$this->error = "Error: cURL could not retrieve the document, error $return.";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
$results = implode("\r\n",$results);
|
||||
|
||||
$result_headers = file("/tmp/$headerfile");
|
||||
|
||||
$this->_redirectaddr = false;
|
||||
unset($this->headers);
|
||||
|
||||
for($currentHeader = 0; $currentHeader < count($result_headers); $currentHeader++)
|
||||
{
|
||||
|
||||
// if a header begins with Location: or URI:, set the redirect
|
||||
if(preg_match("/^(Location: |URI: )/i",$result_headers[$currentHeader]))
|
||||
{
|
||||
// get URL portion of the redirect
|
||||
preg_match("/^(Location: |URI:)(.*)/",chop($result_headers[$currentHeader]),$matches);
|
||||
// look for :// in the Location header to see if hostname is included
|
||||
if(!preg_match("|\:\/\/|",$matches[2]))
|
||||
{
|
||||
// no host in the path, so prepend
|
||||
$this->_redirectaddr = $URI_PARTS["scheme"]."://".$this->host.":".$this->port;
|
||||
// eliminate double slash
|
||||
if(!preg_match("|^/|",$matches[2]))
|
||||
$this->_redirectaddr .= "/".$matches[2];
|
||||
else
|
||||
$this->_redirectaddr .= $matches[2];
|
||||
}
|
||||
else
|
||||
$this->_redirectaddr = $matches[2];
|
||||
}
|
||||
|
||||
if(preg_match("|^HTTP/|",$result_headers[$currentHeader]))
|
||||
{
|
||||
$this->response_code = $result_headers[$currentHeader];
|
||||
if(preg_match("|^HTTP/[^\s]*\s(.*?)\s|",$this->response_code, $match))
|
||||
{
|
||||
$this->status= $match[1];
|
||||
}
|
||||
}
|
||||
$this->headers[] = $result_headers[$currentHeader];
|
||||
}
|
||||
|
||||
// check if there is a a redirect meta tag
|
||||
|
||||
if(preg_match("'<meta[\s]*http-equiv[^>]*?content[\s]*=[\s]*[\"\']?\d+;[\s]+URL[\s]*=[\s]*([^\"\']*?)[\"\']?>'i",$results,$match))
|
||||
{
|
||||
$this->_redirectaddr = $this->_expandlinks($match[1],$URI);
|
||||
}
|
||||
|
||||
// have we hit our frame depth and is there frame src to fetch?
|
||||
if(($this->_framedepth < $this->maxframes) && preg_match_all("'<frame\s+.*src[\s]*=[\'\"]?([^\'\"\>]+)'i",$results,$match))
|
||||
{
|
||||
$this->results[] = $results;
|
||||
for($x=0; $x<count($match[1]); $x++)
|
||||
$this->_frameurls[] = $this->_expandlinks($match[1][$x],$URI_PARTS["scheme"]."://".$this->host);
|
||||
}
|
||||
// have we already fetched framed content?
|
||||
elseif(is_array($this->results))
|
||||
$this->results[] = $results;
|
||||
// no framed content
|
||||
else
|
||||
$this->results = $results;
|
||||
|
||||
unlink("/tmp/$headerfile");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*======================================================================*\
|
||||
Function: setcookies()
|
||||
Purpose: set cookies for a redirection
|
||||
\*======================================================================*/
|
||||
|
||||
function setcookies()
|
||||
{
|
||||
for($x=0; $x<count($this->headers); $x++)
|
||||
{
|
||||
if(preg_match("/^set-cookie:[\s]+([^=]+)=([^;]+)/i", $this->headers[$x],$match))
|
||||
$this->cookies[$match[1]] = $match[2];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*======================================================================*\
|
||||
Function: _check_timeout
|
||||
Purpose: checks whether timeout has occurred
|
||||
Input: $fp file pointer
|
||||
\*======================================================================*/
|
||||
|
||||
function _check_timeout($fp)
|
||||
{
|
||||
if ($this->read_timeout > 0) {
|
||||
$fp_status = socket_get_status($fp);
|
||||
if ($fp_status["timed_out"]) {
|
||||
$this->timed_out = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/*======================================================================*\
|
||||
Function: _connect
|
||||
Purpose: make a socket connection
|
||||
Input: $fp file pointer
|
||||
\*======================================================================*/
|
||||
|
||||
function _connect(&$fp)
|
||||
{
|
||||
if(!empty($this->proxy_host) && !empty($this->proxy_port))
|
||||
{
|
||||
$this->_isproxy = true;
|
||||
$host = $this->proxy_host;
|
||||
$port = $this->proxy_port;
|
||||
}
|
||||
else
|
||||
{
|
||||
$host = $this->host;
|
||||
$port = $this->port;
|
||||
}
|
||||
|
||||
$this->status = 0;
|
||||
|
||||
if($fp = fsockopen(
|
||||
$host,
|
||||
$port,
|
||||
$errno,
|
||||
$errstr,
|
||||
$this->_fp_timeout
|
||||
))
|
||||
{
|
||||
// socket connection succeeded
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// socket connection failed
|
||||
$this->status = $errno;
|
||||
switch($errno)
|
||||
{
|
||||
case -3:
|
||||
$this->error="socket creation failed (-3)";
|
||||
case -4:
|
||||
$this->error="dns lookup failure (-4)";
|
||||
case -5:
|
||||
$this->error="connection refused or timed out (-5)";
|
||||
default:
|
||||
$this->error="connection failed (".$errno.")";
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/*======================================================================*\
|
||||
Function: _disconnect
|
||||
Purpose: disconnect a socket connection
|
||||
Input: $fp file pointer
|
||||
\*======================================================================*/
|
||||
|
||||
function _disconnect($fp)
|
||||
{
|
||||
return(fclose($fp));
|
||||
}
|
||||
|
||||
|
||||
/*======================================================================*\
|
||||
Function: _prepare_post_body
|
||||
Purpose: Prepare post body according to encoding type
|
||||
Input: $formvars - form variables
|
||||
$formfiles - form upload files
|
||||
Output: post body
|
||||
\*======================================================================*/
|
||||
|
||||
function _prepare_post_body($formvars, $formfiles)
|
||||
{
|
||||
settype($formvars, "array");
|
||||
settype($formfiles, "array");
|
||||
|
||||
if (count($formvars) == 0 && count($formfiles) == 0)
|
||||
return;
|
||||
|
||||
switch ($this->_submit_type) {
|
||||
case "application/x-www-form-urlencoded":
|
||||
reset($formvars);
|
||||
while(list($key,$val) = each($formvars)) {
|
||||
if (is_array($val) || is_object($val)) {
|
||||
while (list($cur_key, $cur_val) = each($val)) {
|
||||
$postdata .= urlencode($key)."[]=".urlencode($cur_val)."&";
|
||||
}
|
||||
} else
|
||||
$postdata .= urlencode($key)."=".urlencode($val)."&";
|
||||
}
|
||||
break;
|
||||
|
||||
case "multipart/form-data":
|
||||
$this->_mime_boundary = "Snoopy".md5(uniqid(microtime()));
|
||||
|
||||
reset($formvars);
|
||||
while(list($key,$val) = each($formvars)) {
|
||||
if (is_array($val) || is_object($val)) {
|
||||
while (list($cur_key, $cur_val) = each($val)) {
|
||||
$postdata .= "--".$this->_mime_boundary."\r\n";
|
||||
$postdata .= "Content-Disposition: form-data; name=\"$key\[\]\"\r\n\r\n";
|
||||
$postdata .= "$cur_val\r\n";
|
||||
}
|
||||
} else {
|
||||
$postdata .= "--".$this->_mime_boundary."\r\n";
|
||||
$postdata .= "Content-Disposition: form-data; name=\"$key\"\r\n\r\n";
|
||||
$postdata .= "$val\r\n";
|
||||
}
|
||||
}
|
||||
|
||||
reset($formfiles);
|
||||
while (list($field_name, $file_names) = each($formfiles)) {
|
||||
settype($file_names, "array");
|
||||
while (list(, $file_name) = each($file_names)) {
|
||||
if (!is_readable($file_name)) continue;
|
||||
|
||||
$fp = fopen($file_name, "r");
|
||||
$file_content = fread($fp, filesize($file_name));
|
||||
fclose($fp);
|
||||
$base_name = basename($file_name);
|
||||
|
||||
$postdata .= "--".$this->_mime_boundary."\r\n";
|
||||
$postdata .= "Content-Disposition: form-data; name=\"$field_name\"; filename=\"$base_name\"\r\n\r\n";
|
||||
$postdata .= "$file_content\r\n";
|
||||
}
|
||||
}
|
||||
$postdata .= "--".$this->_mime_boundary."--\r\n";
|
||||
break;
|
||||
}
|
||||
|
||||
return $postdata;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1,184 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* Project: MagpieRSS: a simple RSS integration tool
|
||||
* File: rss_cache.inc, a simple, rolling(no GC), cache
|
||||
* for RSS objects, keyed on URL.
|
||||
* Author: Kellan Elliott-McCrea <kellan@protest.net>
|
||||
* Version: 0.51
|
||||
* License: GPL
|
||||
*
|
||||
* The lastest version of MagpieRSS can be obtained from:
|
||||
* http://magpierss.sourceforge.net
|
||||
*
|
||||
* For questions, help, comments, discussion, etc., please join the
|
||||
* Magpie mailing list:
|
||||
* http://lists.sourceforge.net/lists/listinfo/magpierss-general
|
||||
*
|
||||
*/
|
||||
|
||||
class RSSCache {
|
||||
var $BASE_CACHE = './cache'; // where the cache files are stored
|
||||
var $MAX_AGE = 3600; // when are files stale, default one hour
|
||||
var $ERROR = ""; // accumulate error messages
|
||||
|
||||
function RSSCache ($base='', $age='') {
|
||||
if ( $base ) {
|
||||
$this->BASE_CACHE = $base;
|
||||
}
|
||||
if ( $age ) {
|
||||
$this->MAX_AGE = $age;
|
||||
}
|
||||
|
||||
// attempt to make the cache directory
|
||||
if ( ! file_exists( $this->BASE_CACHE ) ) {
|
||||
$status = @mkdir( $this->BASE_CACHE, 0755 );
|
||||
|
||||
// if make failed
|
||||
if ( ! $status ) {
|
||||
$this->error(
|
||||
"Cache couldn't make dir '" . $this->BASE_CACHE . "'."
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*=======================================================================*\
|
||||
Function: set
|
||||
Purpose: add an item to the cache, keyed on url
|
||||
Input: url from wich the rss file was fetched
|
||||
Output: true on sucess
|
||||
\*=======================================================================*/
|
||||
function set ($url, $rss) {
|
||||
$this->ERROR = "";
|
||||
$cache_file = $this->file_name( $url );
|
||||
$fp = @fopen( $cache_file, 'w' );
|
||||
|
||||
if ( ! $fp ) {
|
||||
$this->error(
|
||||
"Cache unable to open file for writing: $cache_file"
|
||||
);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
$data = $this->serialize( $rss );
|
||||
fwrite( $fp, $data );
|
||||
fclose( $fp );
|
||||
|
||||
return $cache_file;
|
||||
}
|
||||
|
||||
/*=======================================================================*\
|
||||
Function: get
|
||||
Purpose: fetch an item from the cache
|
||||
Input: url from wich the rss file was fetched
|
||||
Output: cached object on HIT, false on MISS
|
||||
\*=======================================================================*/
|
||||
function get ($url) {
|
||||
$this->ERROR = "";
|
||||
$cache_file = $this->file_name( $url );
|
||||
|
||||
if ( ! file_exists( $cache_file ) ) {
|
||||
$this->debug(
|
||||
"Cache doesn't contain: $url (cache file: $cache_file)"
|
||||
);
|
||||
return 0;
|
||||
}
|
||||
|
||||
$fp = @fopen($cache_file, 'r');
|
||||
if ( ! $fp ) {
|
||||
$this->error(
|
||||
"Failed to open cache file for reading: $cache_file"
|
||||
);
|
||||
return 0;
|
||||
}
|
||||
|
||||
$data = fread( $fp, filesize($cache_file) );
|
||||
$rss = $this->unserialize( $data );
|
||||
|
||||
return $rss;
|
||||
}
|
||||
|
||||
/*=======================================================================*\
|
||||
Function: check_cache
|
||||
Purpose: check a url for membership in the cache
|
||||
and whether the object is older then MAX_AGE (ie. STALE)
|
||||
Input: url from wich the rss file was fetched
|
||||
Output: cached object on HIT, false on MISS
|
||||
\*=======================================================================*/
|
||||
function check_cache ( $url ) {
|
||||
$this->ERROR = "";
|
||||
$filename = $this->file_name( $url );
|
||||
|
||||
if ( file_exists( $filename ) ) {
|
||||
// find how long ago the file was added to the cache
|
||||
// and whether that is longer then MAX_AGE
|
||||
$mtime = filemtime( $filename );
|
||||
$age = time() - $mtime;
|
||||
if ( $this->MAX_AGE > $age ) {
|
||||
// object exists and is current
|
||||
return 'HIT';
|
||||
}
|
||||
else {
|
||||
// object exists but is old
|
||||
return 'STALE';
|
||||
}
|
||||
}
|
||||
else {
|
||||
// object does not exist
|
||||
return 'MISS';
|
||||
}
|
||||
}
|
||||
|
||||
/*=======================================================================*\
|
||||
Function: serialize
|
||||
\*=======================================================================*/
|
||||
function serialize ( $rss ) {
|
||||
return serialize( $rss );
|
||||
}
|
||||
|
||||
/*=======================================================================*\
|
||||
Function: unserialize
|
||||
\*=======================================================================*/
|
||||
function unserialize ( $data ) {
|
||||
return unserialize( $data );
|
||||
}
|
||||
|
||||
/*=======================================================================*\
|
||||
Function: file_name
|
||||
Purpose: map url to location in cache
|
||||
Input: url from wich the rss file was fetched
|
||||
Output: a file name
|
||||
\*=======================================================================*/
|
||||
function file_name ($url) {
|
||||
$filename = md5( $url );
|
||||
return join( DIRECTORY_SEPARATOR, array( $this->BASE_CACHE, $filename ) );
|
||||
}
|
||||
|
||||
/*=======================================================================*\
|
||||
Function: error
|
||||
Purpose: register error
|
||||
\*=======================================================================*/
|
||||
function error ($errormsg, $lvl=E_USER_WARNING) {
|
||||
// append PHP's error message if track_errors enabled
|
||||
if ( isset($php_errormsg) ) {
|
||||
$errormsg .= " ($php_errormsg)";
|
||||
}
|
||||
$this->ERROR = $errormsg;
|
||||
if ( MAGPIE_DEBUG ) {
|
||||
trigger_error( $errormsg, $lvl);
|
||||
}
|
||||
else {
|
||||
error_log( $errormsg, 0);
|
||||
}
|
||||
}
|
||||
|
||||
function debug ($debugmsg, $lvl=E_USER_NOTICE) {
|
||||
if ( MAGPIE_DEBUG ) {
|
||||
$this->error("MagpieRSS [debug] $debugmsg", $lvl);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1,458 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* Project: MagpieRSS: a simple RSS integration tool
|
||||
* File: rss_fetch.inc, a simple functional interface
|
||||
to fetching and parsing RSS files, via the
|
||||
function fetch_rss()
|
||||
* Author: Kellan Elliott-McCrea <kellan@protest.net>
|
||||
* License: GPL
|
||||
*
|
||||
* The lastest version of MagpieRSS can be obtained from:
|
||||
* http://magpierss.sourceforge.net
|
||||
*
|
||||
* For questions, help, comments, discussion, etc., please join the
|
||||
* Magpie mailing list:
|
||||
* magpierss-general@lists.sourceforge.net
|
||||
*
|
||||
*/
|
||||
|
||||
// Setup MAGPIE_DIR for use on hosts that don't include
|
||||
// the current path in include_path.
|
||||
// with thanks to rajiv and smarty
|
||||
if (!defined('DIR_SEP')) {
|
||||
define('DIR_SEP', DIRECTORY_SEPARATOR);
|
||||
}
|
||||
|
||||
if (!defined('MAGPIE_DIR')) {
|
||||
define('MAGPIE_DIR', dirname(__FILE__) . DIR_SEP);
|
||||
}
|
||||
|
||||
require_once( MAGPIE_DIR . 'rss_parse.inc' );
|
||||
require_once( MAGPIE_DIR . 'rss_cache.inc' );
|
||||
|
||||
// for including 3rd party libraries
|
||||
define('MAGPIE_EXTLIB', MAGPIE_DIR . 'extlib' . DIR_SEP);
|
||||
require_once( MAGPIE_EXTLIB . 'Snoopy.class.inc');
|
||||
|
||||
|
||||
/*
|
||||
* CONSTANTS - redefine these in your script to change the
|
||||
* behaviour of fetch_rss() currently, most options effect the cache
|
||||
*
|
||||
* MAGPIE_CACHE_ON - Should Magpie cache parsed RSS objects?
|
||||
* For me a built in cache was essential to creating a "PHP-like"
|
||||
* feel to Magpie, see rss_cache.inc for rationale
|
||||
*
|
||||
*
|
||||
* MAGPIE_CACHE_DIR - Where should Magpie cache parsed RSS objects?
|
||||
* This should be a location that the webserver can write to. If this
|
||||
* directory does not already exist Mapie will try to be smart and create
|
||||
* it. This will often fail for permissions reasons.
|
||||
*
|
||||
*
|
||||
* MAGPIE_CACHE_AGE - How long to store cached RSS objects? In seconds.
|
||||
*
|
||||
*
|
||||
* MAGPIE_CACHE_FRESH_ONLY - If remote fetch fails, throw error
|
||||
* instead of returning stale object?
|
||||
*
|
||||
* MAGPIE_DEBUG - Display debugging notices?
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*=======================================================================*\
|
||||
Function: fetch_rss:
|
||||
Purpose: return RSS object for the give url
|
||||
maintain the cache
|
||||
Input: url of RSS file
|
||||
Output: parsed RSS object (see rss_parse.inc)
|
||||
|
||||
NOTES ON CACHEING:
|
||||
If caching is on (MAGPIE_CACHE_ON) fetch_rss will first check the cache.
|
||||
|
||||
NOTES ON RETRIEVING REMOTE FILES:
|
||||
If conditional gets are on (MAGPIE_CONDITIONAL_GET_ON) fetch_rss will
|
||||
return a cached object, and touch the cache object upon recieving a
|
||||
304.
|
||||
|
||||
NOTES ON FAILED REQUESTS:
|
||||
If there is an HTTP error while fetching an RSS object, the cached
|
||||
version will be return, if it exists (and if MAGPIE_CACHE_FRESH_ONLY is off)
|
||||
\*=======================================================================*/
|
||||
|
||||
define('MAGPIE_VERSION', '0.7');
|
||||
|
||||
$MAGPIE_ERROR = "";
|
||||
|
||||
function fetch_rss ($url) {
|
||||
// initialize constants
|
||||
init();
|
||||
|
||||
if ( !isset($url) ) {
|
||||
error("fetch_rss called without a url");
|
||||
return false;
|
||||
}
|
||||
|
||||
// if cache is disabled
|
||||
if ( !MAGPIE_CACHE_ON ) {
|
||||
// fetch file, and parse it
|
||||
$resp = _fetch_remote_file( $url );
|
||||
if ( is_success( $resp->status ) ) {
|
||||
return _response_to_rss( $resp );
|
||||
}
|
||||
else {
|
||||
error("Failed to fetch $url and cache is off");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// else cache is ON
|
||||
else {
|
||||
// Flow
|
||||
// 1. check cache
|
||||
// 2. if there is a hit, make sure its fresh
|
||||
// 3. if cached obj fails freshness check, fetch remote
|
||||
// 4. if remote fails, return stale object, or error
|
||||
|
||||
$cache = new RSSCache( MAGPIE_CACHE_DIR, MAGPIE_CACHE_AGE );
|
||||
|
||||
if (MAGPIE_DEBUG and $cache->ERROR) {
|
||||
debug($cache->ERROR, E_USER_WARNING);
|
||||
}
|
||||
|
||||
|
||||
$cache_status = 0; // response of check_cache
|
||||
$request_headers = array(); // HTTP headers to send with fetch
|
||||
$rss = 0; // parsed RSS object
|
||||
$errormsg = 0; // errors, if any
|
||||
|
||||
// store parsed XML by desired output encoding
|
||||
// as character munging happens at parse time
|
||||
$cache_key = $url . MAGPIE_OUTPUT_ENCODING;
|
||||
|
||||
if (!$cache->ERROR) {
|
||||
// return cache HIT, MISS, or STALE
|
||||
$cache_status = $cache->check_cache( $cache_key);
|
||||
}
|
||||
|
||||
// if object cached, and cache is fresh, return cached obj
|
||||
if ( $cache_status == 'HIT' ) {
|
||||
$rss = $cache->get( $cache_key );
|
||||
if ( isset($rss) and $rss ) {
|
||||
// should be cache age
|
||||
$rss->from_cache = 1;
|
||||
if ( MAGPIE_DEBUG > 1) {
|
||||
debug("MagpieRSS: Cache HIT", E_USER_NOTICE);
|
||||
}
|
||||
return $rss;
|
||||
}
|
||||
}
|
||||
|
||||
// else attempt a conditional get
|
||||
|
||||
// setup headers
|
||||
if ( $cache_status == 'STALE' ) {
|
||||
$rss = $cache->get( $cache_key );
|
||||
if ( $rss and $rss->etag and $rss->last_modified ) {
|
||||
$request_headers['If-None-Match'] = $rss->etag;
|
||||
$request_headers['If-Last-Modified'] = $rss->last_modified;
|
||||
}
|
||||
}
|
||||
|
||||
$resp = _fetch_remote_file( $url, $request_headers );
|
||||
|
||||
if (isset($resp) and $resp) {
|
||||
if ($resp->status == '304' ) {
|
||||
// we have the most current copy
|
||||
if ( MAGPIE_DEBUG > 1) {
|
||||
debug("Got 304 for $url");
|
||||
}
|
||||
// reset cache on 304 (at minutillo insistent prodding)
|
||||
$cache->set($cache_key, $rss);
|
||||
return $rss;
|
||||
}
|
||||
elseif ( is_success( $resp->status ) ) {
|
||||
$rss = _response_to_rss( $resp );
|
||||
if ( $rss ) {
|
||||
if (MAGPIE_DEBUG > 1) {
|
||||
debug("Fetch successful");
|
||||
}
|
||||
// add object to cache
|
||||
$cache->set( $cache_key, $rss );
|
||||
return $rss;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$errormsg = "Failed to fetch $url ";
|
||||
if ( $resp->status == '-100' ) {
|
||||
$errormsg .= "(Request timed out after " . MAGPIE_FETCH_TIME_OUT . " seconds)";
|
||||
}
|
||||
elseif ( $resp->error ) {
|
||||
# compensate for Snoopy's annoying habbit to tacking
|
||||
# on '\n'
|
||||
$http_error = substr($resp->error, 0, -2);
|
||||
$errormsg .= "(HTTP Error: $http_error)";
|
||||
}
|
||||
else {
|
||||
$errormsg .= "(HTTP Response: " . $resp->response_code .')';
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
$errormsg = "Unable to retrieve RSS file for unknown reasons.";
|
||||
}
|
||||
|
||||
// else fetch failed
|
||||
|
||||
// attempt to return cached object
|
||||
if ($rss) {
|
||||
if ( MAGPIE_DEBUG ) {
|
||||
debug("Returning STALE object for $url");
|
||||
}
|
||||
return $rss;
|
||||
}
|
||||
|
||||
// else we totally failed
|
||||
error( $errormsg );
|
||||
|
||||
return false;
|
||||
|
||||
} // end if ( !MAGPIE_CACHE_ON ) {
|
||||
} // end fetch_rss()
|
||||
|
||||
/*=======================================================================*\
|
||||
Function: error
|
||||
Purpose: set MAGPIE_ERROR, and trigger error
|
||||
\*=======================================================================*/
|
||||
|
||||
function error ($errormsg, $lvl=E_USER_WARNING) {
|
||||
global $MAGPIE_ERROR;
|
||||
|
||||
// append PHP's error message if track_errors enabled
|
||||
if ( isset($php_errormsg) ) {
|
||||
$errormsg .= " ($php_errormsg)";
|
||||
}
|
||||
if ( $errormsg ) {
|
||||
$errormsg = "MagpieRSS: $errormsg";
|
||||
$MAGPIE_ERROR = $errormsg;
|
||||
trigger_error( $errormsg, $lvl);
|
||||
}
|
||||
}
|
||||
|
||||
function debug ($debugmsg, $lvl=E_USER_NOTICE) {
|
||||
trigger_error("MagpieRSS [debug] $debugmsg", $lvl);
|
||||
}
|
||||
|
||||
/*=======================================================================*\
|
||||
Function: magpie_error
|
||||
Purpose: accessor for the magpie error variable
|
||||
\*=======================================================================*/
|
||||
function magpie_error ($errormsg="") {
|
||||
global $MAGPIE_ERROR;
|
||||
|
||||
if ( isset($errormsg) and $errormsg ) {
|
||||
$MAGPIE_ERROR = $errormsg;
|
||||
}
|
||||
|
||||
return $MAGPIE_ERROR;
|
||||
}
|
||||
|
||||
/*=======================================================================*\
|
||||
Function: _fetch_remote_file
|
||||
Purpose: retrieve an arbitrary remote file
|
||||
Input: url of the remote file
|
||||
headers to send along with the request (optional)
|
||||
Output: an HTTP response object (see Snoopy.class.inc)
|
||||
\*=======================================================================*/
|
||||
function _fetch_remote_file ($url, $headers = "" ) {
|
||||
// Snoopy is an HTTP client in PHP
|
||||
$client = new Snoopy();
|
||||
$client->agent = MAGPIE_USER_AGENT;
|
||||
$client->read_timeout = MAGPIE_FETCH_TIME_OUT;
|
||||
$client->use_gzip = MAGPIE_USE_GZIP;
|
||||
if (is_array($headers) ) {
|
||||
$client->rawheaders = $headers;
|
||||
}
|
||||
|
||||
@$client->fetch($url);
|
||||
return $client;
|
||||
|
||||
}
|
||||
|
||||
/*=======================================================================*\
|
||||
Function: _response_to_rss
|
||||
Purpose: parse an HTTP response object into an RSS object
|
||||
Input: an HTTP response object (see Snoopy)
|
||||
Output: parsed RSS object (see rss_parse)
|
||||
\*=======================================================================*/
|
||||
function _response_to_rss ($resp) {
|
||||
$rss = new MagpieRSS( $resp->results, MAGPIE_OUTPUT_ENCODING, MAGPIE_INPUT_ENCODING, MAGPIE_DETECT_ENCODING );
|
||||
|
||||
// if RSS parsed successfully
|
||||
if ( $rss and !$rss->ERROR) {
|
||||
|
||||
// find Etag, and Last-Modified
|
||||
foreach($resp->headers as $h) {
|
||||
// 2003-03-02 - Nicola Asuni (www.tecnick.com) - fixed bug "Undefined offset: 1"
|
||||
if (strpos($h, ": ")) {
|
||||
list($field, $val) = explode(": ", $h, 2);
|
||||
}
|
||||
else {
|
||||
$field = $h;
|
||||
$val = "";
|
||||
}
|
||||
|
||||
if ( $field == 'ETag' ) {
|
||||
$rss->etag = $val;
|
||||
}
|
||||
|
||||
if ( $field == 'Last-Modified' ) {
|
||||
$rss->last_modified = $val;
|
||||
}
|
||||
}
|
||||
|
||||
return $rss;
|
||||
} // else construct error message
|
||||
else {
|
||||
$errormsg = "Failed to parse RSS file.";
|
||||
|
||||
if ($rss) {
|
||||
$errormsg .= " (" . $rss->ERROR . ")";
|
||||
}
|
||||
error($errormsg);
|
||||
|
||||
return false;
|
||||
} // end if ($rss and !$rss->error)
|
||||
}
|
||||
|
||||
/*=======================================================================*\
|
||||
Function: init
|
||||
Purpose: setup constants with default values
|
||||
check for user overrides
|
||||
\*=======================================================================*/
|
||||
function init () {
|
||||
if ( defined('MAGPIE_INITALIZED') ) {
|
||||
return;
|
||||
}
|
||||
else {
|
||||
define('MAGPIE_INITALIZED', true);
|
||||
}
|
||||
|
||||
if ( !defined('MAGPIE_CACHE_ON') ) {
|
||||
define('MAGPIE_CACHE_ON', true);
|
||||
}
|
||||
|
||||
if ( !defined('MAGPIE_CACHE_DIR') ) {
|
||||
define('MAGPIE_CACHE_DIR', './cache');
|
||||
}
|
||||
|
||||
if ( !defined('MAGPIE_CACHE_AGE') ) {
|
||||
define('MAGPIE_CACHE_AGE', 60*60); // one hour
|
||||
}
|
||||
|
||||
if ( !defined('MAGPIE_CACHE_FRESH_ONLY') ) {
|
||||
define('MAGPIE_CACHE_FRESH_ONLY', false);
|
||||
}
|
||||
|
||||
if ( !defined('MAGPIE_OUTPUT_ENCODING') ) {
|
||||
define('MAGPIE_OUTPUT_ENCODING', 'ISO-8859-1');
|
||||
}
|
||||
|
||||
if ( !defined('MAGPIE_INPUT_ENCODING') ) {
|
||||
define('MAGPIE_INPUT_ENCODING', null);
|
||||
}
|
||||
|
||||
if ( !defined('MAGPIE_DETECT_ENCODING') ) {
|
||||
define('MAGPIE_DETECT_ENCODING', true);
|
||||
}
|
||||
|
||||
if ( !defined('MAGPIE_DEBUG') ) {
|
||||
define('MAGPIE_DEBUG', 0);
|
||||
}
|
||||
|
||||
if ( !defined('MAGPIE_USER_AGENT') ) {
|
||||
$ua = 'MagpieRSS/'. MAGPIE_VERSION . ' (+http://magpierss.sf.net';
|
||||
|
||||
if ( MAGPIE_CACHE_ON ) {
|
||||
$ua = $ua . ')';
|
||||
}
|
||||
else {
|
||||
$ua = $ua . '; No cache)';
|
||||
}
|
||||
|
||||
define('MAGPIE_USER_AGENT', $ua);
|
||||
}
|
||||
|
||||
if ( !defined('MAGPIE_FETCH_TIME_OUT') ) {
|
||||
define('MAGPIE_FETCH_TIME_OUT', 5); // 5 second timeout
|
||||
}
|
||||
|
||||
// use gzip encoding to fetch rss files if supported?
|
||||
if ( !defined('MAGPIE_USE_GZIP') ) {
|
||||
define('MAGPIE_USE_GZIP', true);
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE: the following code should really be in Snoopy, or at least
|
||||
// somewhere other then rss_fetch!
|
||||
|
||||
/*=======================================================================*\
|
||||
HTTP STATUS CODE PREDICATES
|
||||
These functions attempt to classify an HTTP status code
|
||||
based on RFC 2616 and RFC 2518.
|
||||
|
||||
All of them take an HTTP status code as input, and return true or false
|
||||
|
||||
All this code is adapted from LWP's HTTP::Status.
|
||||
\*=======================================================================*/
|
||||
|
||||
|
||||
/*=======================================================================*\
|
||||
Function: is_info
|
||||
Purpose: return true if Informational status code
|
||||
\*=======================================================================*/
|
||||
function is_info ($sc) {
|
||||
return $sc >= 100 && $sc < 200;
|
||||
}
|
||||
|
||||
/*=======================================================================*\
|
||||
Function: is_success
|
||||
Purpose: return true if Successful status code
|
||||
\*=======================================================================*/
|
||||
function is_success ($sc) {
|
||||
return $sc >= 200 && $sc < 300;
|
||||
}
|
||||
|
||||
/*=======================================================================*\
|
||||
Function: is_redirect
|
||||
Purpose: return true if Redirection status code
|
||||
\*=======================================================================*/
|
||||
function is_redirect ($sc) {
|
||||
return $sc >= 300 && $sc < 400;
|
||||
}
|
||||
|
||||
/*=======================================================================*\
|
||||
Function: is_error
|
||||
Purpose: return true if Error status code
|
||||
\*=======================================================================*/
|
||||
function is_error ($sc) {
|
||||
return $sc >= 400 && $sc < 600;
|
||||
}
|
||||
|
||||
/*=======================================================================*\
|
||||
Function: is_client_error
|
||||
Purpose: return true if Error status code, and its a client error
|
||||
\*=======================================================================*/
|
||||
function is_client_error ($sc) {
|
||||
return $sc >= 400 && $sc < 500;
|
||||
}
|
||||
|
||||
/*=======================================================================*\
|
||||
Function: is_client_error
|
||||
Purpose: return true if Error status code, and its a server error
|
||||
\*=======================================================================*/
|
||||
function is_server_error ($sc) {
|
||||
return $sc >= 500 && $sc < 600;
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1,589 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Project: MagpieRSS: a simple RSS integration tool
|
||||
* File: rss_parse.inc - parse an RSS or Atom feed
|
||||
* return as a simple object.
|
||||
*
|
||||
* Handles RSS 0.9x, RSS 2.0, RSS 1.0, and Atom 0.3
|
||||
*
|
||||
* The lastest version of MagpieRSS can be obtained from:
|
||||
* http://magpierss.sourceforge.net
|
||||
*
|
||||
* For questions, help, comments, discussion, etc., please join the
|
||||
* Magpie mailing list:
|
||||
* magpierss-general@lists.sourceforge.net
|
||||
*
|
||||
* @author Kellan Elliott-McCrea <kellan@protest.net>
|
||||
* @version 0.7a
|
||||
* @license GPL
|
||||
*
|
||||
*/
|
||||
|
||||
define('RSS', 'RSS');
|
||||
define('ATOM', 'Atom');
|
||||
|
||||
require_once (MAGPIE_DIR . 'rss_utils.inc');
|
||||
|
||||
/**
|
||||
* Hybrid parser, and object, takes RSS as a string and returns a simple object.
|
||||
*
|
||||
* see: rss_fetch.inc for a simpler interface with integrated caching support
|
||||
*
|
||||
*/
|
||||
class MagpieRSS {
|
||||
var $parser;
|
||||
|
||||
var $current_item = array(); // item currently being parsed
|
||||
var $items = array(); // collection of parsed items
|
||||
var $channel = array(); // hash of channel fields
|
||||
var $textinput = array();
|
||||
var $image = array();
|
||||
var $feed_type;
|
||||
var $feed_version;
|
||||
var $encoding = ''; // output encoding of parsed rss
|
||||
|
||||
var $_source_encoding = ''; // only set if we have to parse xml prolog
|
||||
|
||||
var $ERROR = "";
|
||||
var $WARNING = "";
|
||||
|
||||
// define some constants
|
||||
|
||||
var $_CONTENT_CONSTRUCTS = array('content', 'summary', 'info', 'title', 'tagline', 'copyright');
|
||||
var $_KNOWN_ENCODINGS = array('UTF-8', 'US-ASCII', 'ISO-8859-1');
|
||||
|
||||
// parser variables, useless if you're not a parser, treat as private
|
||||
var $stack = array(); // parser stack
|
||||
var $inchannel = false;
|
||||
var $initem = false;
|
||||
var $incontent = false; // if in Atom <content mode="xml"> field
|
||||
var $intextinput = false;
|
||||
var $inimage = false;
|
||||
var $current_field = '';
|
||||
var $current_namespace = false;
|
||||
|
||||
|
||||
/**
|
||||
* Set up XML parser, parse source, and return populated RSS object..
|
||||
*
|
||||
* @param string $source string containing the RSS to be parsed
|
||||
*
|
||||
* NOTE: Probably a good idea to leave the encoding options alone unless
|
||||
* you know what you're doing as PHP's character set support is
|
||||
* a little weird.
|
||||
*
|
||||
* NOTE: A lot of this is unnecessary but harmless with PHP5
|
||||
*
|
||||
*
|
||||
* @param string $output_encoding output the parsed RSS in this character
|
||||
* set defaults to ISO-8859-1 as this is PHP's
|
||||
* default.
|
||||
*
|
||||
* NOTE: might be changed to UTF-8 in future
|
||||
* versions.
|
||||
*
|
||||
* @param string $input_encoding the character set of the incoming RSS source.
|
||||
* Leave blank and Magpie will try to figure it
|
||||
* out.
|
||||
*
|
||||
*
|
||||
* @param bool $detect_encoding if false Magpie won't attempt to detect
|
||||
* source encoding. (caveat emptor)
|
||||
*
|
||||
*/
|
||||
function MagpieRSS ($source, $output_encoding='ISO-8859-1',
|
||||
$input_encoding=null, $detect_encoding=true)
|
||||
{
|
||||
# if PHP xml isn't compiled in, die
|
||||
#
|
||||
if (!function_exists('xml_parser_create')) {
|
||||
$this->error( "Failed to load PHP's XML Extension. " .
|
||||
"http://www.php.net/manual/en/ref.xml.php",
|
||||
E_USER_ERROR );
|
||||
}
|
||||
|
||||
list($parser, $source) = $this->create_parser($source,
|
||||
$output_encoding, $input_encoding, $detect_encoding);
|
||||
|
||||
|
||||
if (!is_resource($parser)) {
|
||||
$this->error( "Failed to create an instance of PHP's XML parser. " .
|
||||
"http://www.php.net/manual/en/ref.xml.php",
|
||||
E_USER_ERROR );
|
||||
}
|
||||
|
||||
|
||||
$this->parser = $parser;
|
||||
|
||||
# pass in parser, and a reference to this object
|
||||
# setup handlers
|
||||
#
|
||||
xml_set_object( $this->parser, $this );
|
||||
xml_set_element_handler($this->parser,
|
||||
'feed_start_element', 'feed_end_element' );
|
||||
|
||||
xml_set_character_data_handler( $this->parser, 'feed_cdata' );
|
||||
|
||||
$status = xml_parse( $this->parser, $source );
|
||||
|
||||
if (! $status ) {
|
||||
$errorcode = xml_get_error_code( $this->parser );
|
||||
if ( $errorcode != XML_ERROR_NONE ) {
|
||||
$xml_error = xml_error_string( $errorcode );
|
||||
$error_line = xml_get_current_line_number($this->parser);
|
||||
$error_col = xml_get_current_column_number($this->parser);
|
||||
$errormsg = "$xml_error at line $error_line, column $error_col";
|
||||
|
||||
$this->error( $errormsg );
|
||||
}
|
||||
}
|
||||
|
||||
xml_parser_free( $this->parser );
|
||||
|
||||
$this->normalize();
|
||||
}
|
||||
|
||||
function feed_start_element($p, $element, &$attrs) {
|
||||
$el = $element = strtolower($element);
|
||||
$attrs = array_change_key_case($attrs, CASE_LOWER);
|
||||
|
||||
// check for a namespace, and split if found
|
||||
$ns = false;
|
||||
if ( strpos( $element, ':' ) ) {
|
||||
list($ns, $el) = split( ':', $element, 2);
|
||||
}
|
||||
if ( $ns and $ns != 'rdf' ) {
|
||||
$this->current_namespace = $ns;
|
||||
}
|
||||
|
||||
# if feed type isn't set, then this is first element of feed
|
||||
# identify feed from root element
|
||||
#
|
||||
if (!isset($this->feed_type) ) {
|
||||
if ( $el == 'rdf' ) {
|
||||
$this->feed_type = RSS;
|
||||
$this->feed_version = '1.0';
|
||||
}
|
||||
elseif ( $el == 'rss' ) {
|
||||
$this->feed_type = RSS;
|
||||
$this->feed_version = $attrs['version'];
|
||||
}
|
||||
elseif ( $el == 'feed' ) {
|
||||
$this->feed_type = ATOM;
|
||||
$this->feed_version = $attrs['version'];
|
||||
$this->inchannel = true;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if ( $el == 'channel' )
|
||||
{
|
||||
$this->inchannel = true;
|
||||
}
|
||||
elseif ($el == 'item' or $el == 'entry' )
|
||||
{
|
||||
$this->initem = true;
|
||||
if ( isset($attrs['rdf:about']) ) {
|
||||
$this->current_item['about'] = $attrs['rdf:about'];
|
||||
}
|
||||
}
|
||||
|
||||
// if we're in the default namespace of an RSS feed,
|
||||
// record textinput or image fields
|
||||
elseif (
|
||||
$this->feed_type == RSS and
|
||||
$this->current_namespace == '' and
|
||||
$el == 'textinput' )
|
||||
{
|
||||
$this->intextinput = true;
|
||||
}
|
||||
|
||||
elseif (
|
||||
$this->feed_type == RSS and
|
||||
$this->current_namespace == '' and
|
||||
$el == 'image' )
|
||||
{
|
||||
$this->inimage = true;
|
||||
}
|
||||
|
||||
# handle atom content constructs
|
||||
elseif ( $this->feed_type == ATOM and in_array($el, $this->_CONTENT_CONSTRUCTS) )
|
||||
{
|
||||
// avoid clashing w/ RSS mod_content
|
||||
if ($el == 'content' ) {
|
||||
$el = 'atom_content';
|
||||
}
|
||||
|
||||
$this->incontent = $el;
|
||||
|
||||
|
||||
}
|
||||
|
||||
// if inside an Atom content construct (e.g. content or summary) field treat tags as text
|
||||
elseif ($this->feed_type == ATOM and $this->incontent )
|
||||
{
|
||||
// if tags are inlined, then flatten
|
||||
$attrs_str = join(' ',
|
||||
array_map('map_attrs',
|
||||
array_keys($attrs),
|
||||
array_values($attrs) ) );
|
||||
|
||||
$this->append_content( "<$element $attrs_str>" );
|
||||
|
||||
array_unshift( $this->stack, $el );
|
||||
}
|
||||
|
||||
// Atom support many links per containging element.
|
||||
// Magpie treats link elements of type rel='alternate'
|
||||
// as being equivalent to RSS's simple link element.
|
||||
//
|
||||
elseif ($this->feed_type == ATOM and $el == 'link' )
|
||||
{
|
||||
if ( isset($attrs['rel']) and $attrs['rel'] == 'alternate' )
|
||||
{
|
||||
$link_el = 'link';
|
||||
}
|
||||
else {
|
||||
$link_el = 'link_' . $attrs['rel'];
|
||||
}
|
||||
|
||||
$this->append($link_el, $attrs['href']);
|
||||
}
|
||||
// set stack[0] to current element
|
||||
else {
|
||||
array_unshift($this->stack, $el);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function feed_cdata ($p, $text) {
|
||||
|
||||
if ($this->feed_type == ATOM and $this->incontent)
|
||||
{
|
||||
$this->append_content( $text );
|
||||
}
|
||||
else {
|
||||
$current_el = join('_', array_reverse($this->stack));
|
||||
$this->append($current_el, $text);
|
||||
}
|
||||
}
|
||||
|
||||
function feed_end_element ($p, $el) {
|
||||
$el = strtolower($el);
|
||||
|
||||
if ( $el == 'item' or $el == 'entry' )
|
||||
{
|
||||
$this->items[] = $this->current_item;
|
||||
$this->current_item = array();
|
||||
$this->initem = false;
|
||||
}
|
||||
elseif ($this->feed_type == RSS and $this->current_namespace == '' and $el == 'textinput' )
|
||||
{
|
||||
$this->intextinput = false;
|
||||
}
|
||||
elseif ($this->feed_type == RSS and $this->current_namespace == '' and $el == 'image' )
|
||||
{
|
||||
$this->inimage = false;
|
||||
}
|
||||
elseif ($this->feed_type == ATOM and in_array($el, $this->_CONTENT_CONSTRUCTS) )
|
||||
{
|
||||
$this->incontent = false;
|
||||
}
|
||||
elseif ($el == 'channel' or $el == 'feed' )
|
||||
{
|
||||
$this->inchannel = false;
|
||||
}
|
||||
elseif ($this->feed_type == ATOM and $this->incontent ) {
|
||||
// balance tags properly
|
||||
// note: i don't think this is actually neccessary
|
||||
if ( $this->stack[0] == $el )
|
||||
{
|
||||
$this->append_content("</$el>");
|
||||
}
|
||||
else {
|
||||
$this->append_content("<$el />");
|
||||
}
|
||||
|
||||
array_shift( $this->stack );
|
||||
}
|
||||
else {
|
||||
array_shift( $this->stack );
|
||||
}
|
||||
|
||||
$this->current_namespace = false;
|
||||
}
|
||||
|
||||
function concat (&$str1, $str2="") {
|
||||
if (!isset($str1) ) {
|
||||
$str1="";
|
||||
}
|
||||
$str1 .= $str2;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function append_content($text) {
|
||||
if ( $this->initem ) {
|
||||
$this->concat( $this->current_item[ $this->incontent ], $text );
|
||||
}
|
||||
elseif ( $this->inchannel ) {
|
||||
$this->concat( $this->channel[ $this->incontent ], $text );
|
||||
}
|
||||
}
|
||||
|
||||
// smart append - field and namespace aware
|
||||
function append($el, $text) {
|
||||
if (!$el) {
|
||||
return;
|
||||
}
|
||||
if ( $this->current_namespace )
|
||||
{
|
||||
if ( $this->initem ) {
|
||||
$this->concat(
|
||||
$this->current_item[ $this->current_namespace ][ $el ], $text);
|
||||
}
|
||||
elseif ($this->inchannel) {
|
||||
$this->concat(
|
||||
$this->channel[ $this->current_namespace][ $el ], $text );
|
||||
}
|
||||
elseif ($this->intextinput) {
|
||||
$this->concat(
|
||||
$this->textinput[ $this->current_namespace][ $el ], $text );
|
||||
}
|
||||
elseif ($this->inimage) {
|
||||
$this->concat(
|
||||
$this->image[ $this->current_namespace ][ $el ], $text );
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ( $this->initem ) {
|
||||
$this->concat(
|
||||
$this->current_item[ $el ], $text);
|
||||
}
|
||||
elseif ($this->intextinput) {
|
||||
$this->concat(
|
||||
$this->textinput[ $el ], $text );
|
||||
}
|
||||
elseif ($this->inimage) {
|
||||
$this->concat(
|
||||
$this->image[ $el ], $text );
|
||||
}
|
||||
elseif ($this->inchannel) {
|
||||
$this->concat(
|
||||
$this->channel[ $el ], $text );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function normalize () {
|
||||
// if atom populate rss fields
|
||||
if ( $this->is_atom() ) {
|
||||
$this->channel['description'] = $this->channel['tagline'];
|
||||
for ( $i = 0; $i < count($this->items); $i++) {
|
||||
$item = $this->items[$i];
|
||||
if ( isset($item['summary']) )
|
||||
$item['description'] = $item['summary'];
|
||||
if ( isset($item['atom_content']))
|
||||
$item['content']['encoded'] = $item['atom_content'];
|
||||
|
||||
$atom_date = (isset($item['issued']) ) ? $item['issued'] : $item['modified'];
|
||||
if ( $atom_date ) {
|
||||
$epoch = @parse_w3cdtf($item['modified']);
|
||||
if ($epoch and $epoch > 0) {
|
||||
$item['date_timestamp'] = $epoch;
|
||||
}
|
||||
}
|
||||
|
||||
$this->items[$i] = $item;
|
||||
}
|
||||
}
|
||||
elseif ( $this->is_rss() ) {
|
||||
$this->channel['tagline'] = $this->channel['description'];
|
||||
for ( $i = 0; $i < count($this->items); $i++) {
|
||||
$item = $this->items[$i];
|
||||
if ( isset($item['description']))
|
||||
$item['summary'] = $item['description'];
|
||||
if ( isset($item['content']['encoded'] ) )
|
||||
$item['atom_content'] = $item['content']['encoded'];
|
||||
|
||||
if ( $this->is_rss() == '1.0' and isset($item['dc']['date']) ) {
|
||||
$epoch = @parse_w3cdtf($item['dc']['date']);
|
||||
if ($epoch and $epoch > 0) {
|
||||
$item['date_timestamp'] = $epoch;
|
||||
}
|
||||
}
|
||||
elseif ( isset($item['pubdate']) ) {
|
||||
$epoch = @strtotime($item['pubdate']);
|
||||
if ($epoch > 0) {
|
||||
$item['date_timestamp'] = $epoch;
|
||||
}
|
||||
}
|
||||
|
||||
$this->items[$i] = $item;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function is_rss () {
|
||||
if ( $this->feed_type == RSS ) {
|
||||
return $this->feed_version;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function is_atom() {
|
||||
if ( $this->feed_type == ATOM ) {
|
||||
return $this->feed_version;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* return XML parser, and possibly re-encoded source
|
||||
*
|
||||
*/
|
||||
function create_parser($source, $out_enc, $in_enc, $detect) {
|
||||
if ( substr(phpversion(),0,1) == 5) {
|
||||
$parser = $this->php5_create_parser($in_enc, $detect);
|
||||
}
|
||||
else {
|
||||
list($parser, $source) = $this->php4_create_parser($source, $in_enc, $detect);
|
||||
}
|
||||
if ($out_enc) {
|
||||
$this->encoding = $out_enc;
|
||||
xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, $out_enc);
|
||||
}
|
||||
|
||||
return array($parser, $source);
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiate an XML parser under PHP5
|
||||
*
|
||||
* PHP5 will do a fine job of detecting input encoding
|
||||
* if passed an empty string as the encoding.
|
||||
*
|
||||
* All hail libxml2!
|
||||
*
|
||||
*/
|
||||
function php5_create_parser($in_enc, $detect) {
|
||||
// by default php5 does a fine job of detecting input encodings
|
||||
if(!$detect && $in_enc) {
|
||||
return xml_parser_create($in_enc);
|
||||
}
|
||||
else {
|
||||
return xml_parser_create('');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Instaniate an XML parser under PHP4
|
||||
*
|
||||
* Unfortunately PHP4's support for character encodings
|
||||
* and especially XML and character encodings sucks. As
|
||||
* long as the documents you parse only contain characters
|
||||
* from the ISO-8859-1 character set (a superset of ASCII,
|
||||
* and a subset of UTF-8) you're fine. However once you
|
||||
* step out of that comfy little world things get mad, bad,
|
||||
* and dangerous to know.
|
||||
*
|
||||
* The following code is based on SJM's work with FoF
|
||||
* @see http://minutillo.com/steve/weblog/2004/6/17/php-xml-and-character-encodings-a-tale-of-sadness-rage-and-data-loss
|
||||
*
|
||||
*/
|
||||
function php4_create_parser($source, $in_enc, $detect) {
|
||||
if ( !$detect ) {
|
||||
return array(xml_parser_create($in_enc), $source);
|
||||
}
|
||||
|
||||
if (!$in_enc) {
|
||||
if (preg_match('/<?xml.*encoding=[\'"](.*?)[\'"].*?>/m', $source, $m)) {
|
||||
$in_enc = strtoupper($m[1]);
|
||||
$this->source_encoding = $in_enc;
|
||||
}
|
||||
else {
|
||||
$in_enc = 'UTF-8';
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->known_encoding($in_enc)) {
|
||||
return array(xml_parser_create($in_enc), $source);
|
||||
}
|
||||
|
||||
// the dectected encoding is not one of the simple encodings PHP knows
|
||||
|
||||
// attempt to use the iconv extension to
|
||||
// cast the XML to a known encoding
|
||||
// @see http://php.net/iconv
|
||||
|
||||
if (function_exists('iconv')) {
|
||||
$encoded_source = iconv($in_enc,'UTF-8', $source);
|
||||
if ($encoded_source) {
|
||||
return array(xml_parser_create('UTF-8'), $encoded_source);
|
||||
}
|
||||
}
|
||||
|
||||
// iconv didn't work, try mb_convert_encoding
|
||||
// @see http://php.net/mbstring
|
||||
if(function_exists('mb_convert_encoding')) {
|
||||
$encoded_source = mb_convert_encoding($source, 'UTF-8', $in_enc );
|
||||
if ($encoded_source) {
|
||||
return array(xml_parser_create('UTF-8'), $encoded_source);
|
||||
}
|
||||
}
|
||||
|
||||
// else
|
||||
$this->error("Feed is in an unsupported character encoding. ($in_enc) " .
|
||||
"You may see strange artifacts, and mangled characters.",
|
||||
E_USER_NOTICE);
|
||||
|
||||
return array(xml_parser_create(), $source);
|
||||
}
|
||||
|
||||
function known_encoding($enc) {
|
||||
$enc = strtoupper($enc);
|
||||
if ( in_array($enc, $this->_KNOWN_ENCODINGS) ) {
|
||||
return $enc;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function error ($errormsg, $lvl=E_USER_WARNING) {
|
||||
// append PHP's error message if track_errors enabled
|
||||
if ( $php_errormsg ) {
|
||||
$errormsg .= " ($php_errormsg)";
|
||||
}
|
||||
if ( MAGPIE_DEBUG ) {
|
||||
trigger_error( $errormsg, $lvl);
|
||||
}
|
||||
else {
|
||||
error_log( $errormsg, 0);
|
||||
}
|
||||
|
||||
$notices = E_USER_NOTICE|E_NOTICE;
|
||||
if ( $lvl&$notices ) {
|
||||
$this->WARNING = $errormsg;
|
||||
} else {
|
||||
$this->ERROR = $errormsg;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // end class RSS
|
||||
|
||||
function map_attrs($k, $v) {
|
||||
return "$k=\"$v\"";
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
@@ -1,67 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* Project: MagpieRSS: a simple RSS integration tool
|
||||
* File: rss_utils.inc, utility methods for working with RSS
|
||||
* Author: Kellan Elliott-McCrea <kellan@protest.net>
|
||||
* Version: 0.51
|
||||
* License: GPL
|
||||
*
|
||||
* The lastest version of MagpieRSS can be obtained from:
|
||||
* http://magpierss.sourceforge.net
|
||||
*
|
||||
* For questions, help, comments, discussion, etc., please join the
|
||||
* Magpie mailing list:
|
||||
* magpierss-general@lists.sourceforge.net
|
||||
*/
|
||||
|
||||
|
||||
/*======================================================================*\
|
||||
Function: parse_w3cdtf
|
||||
Purpose: parse a W3CDTF date into unix epoch
|
||||
|
||||
NOTE: http://www.w3.org/TR/NOTE-datetime
|
||||
\*======================================================================*/
|
||||
|
||||
function parse_w3cdtf ( $date_str ) {
|
||||
|
||||
# regex to match wc3dtf
|
||||
$pat = "/(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(:(\d{2}))?(?:([-+])(\d{2}):?(\d{2})|(Z))?/";
|
||||
|
||||
if ( preg_match( $pat, $date_str, $match ) ) {
|
||||
list( $year, $month, $day, $hours, $minutes, $seconds) =
|
||||
array( $match[1], $match[2], $match[3], $match[4], $match[5], $match[6]);
|
||||
|
||||
# calc epoch for current date assuming GMT
|
||||
$epoch = gmmktime( $hours, $minutes, $seconds, $month, $day, $year);
|
||||
|
||||
$offset = 0;
|
||||
if ( $match[10] == 'Z' ) {
|
||||
# zulu time, aka GMT
|
||||
}
|
||||
else {
|
||||
list( $tz_mod, $tz_hour, $tz_min ) =
|
||||
array( $match[8], $match[9], $match[10]);
|
||||
|
||||
# zero out the variables
|
||||
if ( ! $tz_hour ) { $tz_hour = 0; }
|
||||
if ( ! $tz_min ) { $tz_min = 0; }
|
||||
|
||||
$offset_secs = (($tz_hour*60)+$tz_min)*60;
|
||||
|
||||
# is timezone ahead of GMT? then subtract offset
|
||||
#
|
||||
if ( $tz_mod == '+' ) {
|
||||
$offset_secs = $offset_secs * -1;
|
||||
}
|
||||
|
||||
$offset = $offset_secs;
|
||||
}
|
||||
$epoch = $epoch + $offset;
|
||||
return $epoch;
|
||||
}
|
||||
else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1,16 +0,0 @@
|
||||
# Makfile for SRB2 Level Converter
|
||||
# by Alam Arias et al.
|
||||
|
||||
SRC=levelconverter.c
|
||||
OBJ=$(SRC:.c=.o)# replaces the .c from SRC with .o
|
||||
EXE=LevelConverter
|
||||
|
||||
.PHONY : all # .PHONY ignores files named all
|
||||
all: $(EXE) # all is dependent on $(BIN) to be complete
|
||||
|
||||
$(EXE): $(OBJ) # $(EXE) is dependent on all of the files in $(OBJ) to exist
|
||||
$(CC) $(OBJ) $(LDFLAGS) -o $@
|
||||
|
||||
.PHONY : clean # .PHONY ignores files named clean
|
||||
clean:
|
||||
-$(RM) $(OBJ) $(EXE)
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,88 +0,0 @@
|
||||
# Microsoft Developer Studio Project File - Name="levelconverter" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
||||
|
||||
CFG=levelconverter - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "levelconverter.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "levelconverter.mak" CFG="levelconverter - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "levelconverter - Win32 Release" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "levelconverter - Win32 Debug" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "levelconverter - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||
|
||||
!ELSEIF "$(CFG)" == "levelconverter - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "levelconverter - Win32 Release"
|
||||
# Name "levelconverter - Win32 Debug"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\levelconverter.c
|
||||
# End Source File
|
||||
# End Target
|
||||
# End Project
|
||||
@@ -1,29 +0,0 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "levelconverter"=.\levelconverter.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
-235
@@ -1,235 +0,0 @@
|
||||
# Doxyfile 1.4.3
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Project related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
PROJECT_NAME = "SRB2 MasterServer"
|
||||
PROJECT_NUMBER =
|
||||
OUTPUT_DIRECTORY = ../doc/MasterServer
|
||||
CREATE_SUBDIRS = YES
|
||||
OUTPUT_LANGUAGE = English
|
||||
USE_WINDOWS_ENCODING = YES
|
||||
BRIEF_MEMBER_DESC = YES
|
||||
REPEAT_BRIEF = YES
|
||||
ABBREVIATE_BRIEF = "The $name class" \
|
||||
"The $name widget" \
|
||||
"The $name file" \
|
||||
is \
|
||||
provides \
|
||||
specifies \
|
||||
contains \
|
||||
represents \
|
||||
a \
|
||||
an \
|
||||
the
|
||||
ALWAYS_DETAILED_SEC = NO
|
||||
INLINE_INHERITED_MEMB = NO
|
||||
FULL_PATH_NAMES = YES
|
||||
STRIP_FROM_PATH =
|
||||
STRIP_FROM_INC_PATH =
|
||||
SHORT_NAMES = NO
|
||||
JAVADOC_AUTOBRIEF = NO
|
||||
MULTILINE_CPP_IS_BRIEF = NO
|
||||
DETAILS_AT_TOP = NO
|
||||
INHERIT_DOCS = YES
|
||||
DISTRIBUTE_GROUP_DOC = NO
|
||||
SEPARATE_MEMBER_PAGES = NO
|
||||
TAB_SIZE = 8
|
||||
ALIASES =
|
||||
OPTIMIZE_OUTPUT_FOR_C = NO
|
||||
OPTIMIZE_OUTPUT_JAVA = NO
|
||||
SUBGROUPING = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Build related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
EXTRACT_ALL = YES
|
||||
EXTRACT_PRIVATE = YES
|
||||
EXTRACT_STATIC = YES
|
||||
EXTRACT_LOCAL_CLASSES = YES
|
||||
EXTRACT_LOCAL_METHODS = NO
|
||||
HIDE_UNDOC_MEMBERS = NO
|
||||
HIDE_UNDOC_CLASSES = NO
|
||||
HIDE_FRIEND_COMPOUNDS = NO
|
||||
HIDE_IN_BODY_DOCS = NO
|
||||
INTERNAL_DOCS = NO
|
||||
CASE_SENSE_NAMES = NO
|
||||
HIDE_SCOPE_NAMES = NO
|
||||
SHOW_INCLUDE_FILES = YES
|
||||
INLINE_INFO = YES
|
||||
SORT_MEMBER_DOCS = YES
|
||||
SORT_BRIEF_DOCS = NO
|
||||
SORT_BY_SCOPE_NAME = NO
|
||||
GENERATE_TODOLIST = YES
|
||||
GENERATE_TESTLIST = YES
|
||||
GENERATE_BUGLIST = YES
|
||||
GENERATE_DEPRECATEDLIST= YES
|
||||
ENABLED_SECTIONS =
|
||||
MAX_INITIALIZER_LINES = 30
|
||||
SHOW_USED_FILES = YES
|
||||
SHOW_DIRECTORIES = YES
|
||||
FILE_VERSION_FILTER =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to warning and progress messages
|
||||
#---------------------------------------------------------------------------
|
||||
QUIET = NO
|
||||
WARNINGS = YES
|
||||
WARN_IF_UNDOCUMENTED = YES
|
||||
WARN_IF_DOC_ERROR = YES
|
||||
WARN_NO_PARAMDOC = NO
|
||||
WARN_FORMAT = "$file:$line: $text"
|
||||
WARN_LOGFILE =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the input files
|
||||
#---------------------------------------------------------------------------
|
||||
INPUT = ./masterserver
|
||||
FILE_PATTERNS = *.cpp \
|
||||
*.h
|
||||
RECURSIVE = NO
|
||||
EXCLUDE =
|
||||
EXCLUDE_SYMLINKS = NO
|
||||
EXCLUDE_PATTERNS =
|
||||
EXAMPLE_PATH =
|
||||
EXAMPLE_PATTERNS = *
|
||||
EXAMPLE_RECURSIVE = NO
|
||||
IMAGE_PATH =
|
||||
INPUT_FILTER =
|
||||
FILTER_PATTERNS =
|
||||
FILTER_SOURCE_FILES = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to source browsing
|
||||
#---------------------------------------------------------------------------
|
||||
SOURCE_BROWSER = YES
|
||||
INLINE_SOURCES = YES
|
||||
STRIP_CODE_COMMENTS = YES
|
||||
REFERENCED_BY_RELATION = NO
|
||||
REFERENCES_RELATION = NO
|
||||
USE_HTAGS = NO
|
||||
VERBATIM_HEADERS = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the alphabetical class index
|
||||
#---------------------------------------------------------------------------
|
||||
ALPHABETICAL_INDEX = NO
|
||||
COLS_IN_ALPHA_INDEX = 5
|
||||
IGNORE_PREFIX =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the HTML output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_HTML = YES
|
||||
HTML_OUTPUT = html
|
||||
HTML_FILE_EXTENSION = .html
|
||||
HTML_HEADER =
|
||||
HTML_FOOTER =
|
||||
HTML_STYLESHEET =
|
||||
HTML_ALIGN_MEMBERS = YES
|
||||
GENERATE_HTMLHELP = NO
|
||||
CHM_FILE =
|
||||
HHC_LOCATION =
|
||||
GENERATE_CHI = NO
|
||||
BINARY_TOC = NO
|
||||
TOC_EXPAND = NO
|
||||
DISABLE_INDEX = NO
|
||||
ENUM_VALUES_PER_LINE = 4
|
||||
GENERATE_TREEVIEW = YES
|
||||
TREEVIEW_WIDTH = 250
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the LaTeX output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_LATEX = NO
|
||||
LATEX_OUTPUT = latex
|
||||
LATEX_CMD_NAME = latex
|
||||
MAKEINDEX_CMD_NAME = makeindex
|
||||
COMPACT_LATEX = NO
|
||||
PAPER_TYPE = a4wide
|
||||
EXTRA_PACKAGES =
|
||||
LATEX_HEADER =
|
||||
PDF_HYPERLINKS = NO
|
||||
USE_PDFLATEX = NO
|
||||
LATEX_BATCHMODE = NO
|
||||
LATEX_HIDE_INDICES = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the RTF output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_RTF = NO
|
||||
RTF_OUTPUT = rtf
|
||||
COMPACT_RTF = NO
|
||||
RTF_HYPERLINKS = NO
|
||||
RTF_STYLESHEET_FILE =
|
||||
RTF_EXTENSIONS_FILE =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the man page output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_MAN = NO
|
||||
MAN_OUTPUT = man
|
||||
MAN_EXTENSION = .3
|
||||
MAN_LINKS = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the XML output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_XML = NO
|
||||
XML_OUTPUT = xml
|
||||
XML_SCHEMA =
|
||||
XML_DTD =
|
||||
XML_PROGRAMLISTING = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options for the AutoGen Definitions output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_AUTOGEN_DEF = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the Perl module output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_PERLMOD = NO
|
||||
PERLMOD_LATEX = NO
|
||||
PERLMOD_PRETTY = YES
|
||||
PERLMOD_MAKEVAR_PREFIX =
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the preprocessor
|
||||
#---------------------------------------------------------------------------
|
||||
ENABLE_PREPROCESSING = YES
|
||||
MACRO_EXPANSION = NO
|
||||
EXPAND_ONLY_PREDEF = NO
|
||||
SEARCH_INCLUDES = YES
|
||||
INCLUDE_PATH = C:/Dev/include
|
||||
INCLUDE_FILE_PATTERNS =
|
||||
PREDEFINED = HWRENDER \
|
||||
DIRECTFULLSCREEN \
|
||||
HW3SOUND
|
||||
EXPAND_AS_DEFINED =
|
||||
SKIP_FUNCTION_MACROS = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration::additions related to external references
|
||||
#---------------------------------------------------------------------------
|
||||
TAGFILES =
|
||||
GENERATE_TAGFILE =
|
||||
ALLEXTERNALS = NO
|
||||
EXTERNAL_GROUPS = YES
|
||||
PERL_PATH = /usr/bin/perl
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the dot tool
|
||||
#---------------------------------------------------------------------------
|
||||
CLASS_DIAGRAMS = YES
|
||||
HIDE_UNDOC_RELATIONS = YES
|
||||
HAVE_DOT = NO
|
||||
CLASS_GRAPH = YES
|
||||
COLLABORATION_GRAPH = YES
|
||||
GROUP_GRAPHS = YES
|
||||
UML_LOOK = NO
|
||||
TEMPLATE_RELATIONS = NO
|
||||
INCLUDE_GRAPH = YES
|
||||
INCLUDED_BY_GRAPH = YES
|
||||
CALL_GRAPH = NO
|
||||
GRAPHICAL_HIERARCHY = YES
|
||||
DIRECTORY_GRAPH = YES
|
||||
DOT_IMAGE_FORMAT = png
|
||||
DOT_PATH =
|
||||
DOTFILE_DIRS =
|
||||
MAX_DOT_GRAPH_WIDTH = 1024
|
||||
MAX_DOT_GRAPH_HEIGHT = 1024
|
||||
MAX_DOT_GRAPH_DEPTH = 1000
|
||||
DOT_TRANSPARENT = NO
|
||||
DOT_MULTI_TARGETS = NO
|
||||
GENERATE_LEGEND = YES
|
||||
DOT_CLEANUP = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration::additions related to the search engine
|
||||
#---------------------------------------------------------------------------
|
||||
SEARCHENGINE = NO
|
||||
-239
@@ -1,239 +0,0 @@
|
||||
# Doxyfile 1.4.3
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Project related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
PROJECT_NAME = "SRB2 MasterServer IRC Bot and PHP stuff"
|
||||
PROJECT_NUMBER =
|
||||
OUTPUT_DIRECTORY = ../doc/IRC_Bot
|
||||
CREATE_SUBDIRS = YES
|
||||
OUTPUT_LANGUAGE = English
|
||||
USE_WINDOWS_ENCODING = YES
|
||||
BRIEF_MEMBER_DESC = YES
|
||||
REPEAT_BRIEF = YES
|
||||
ABBREVIATE_BRIEF = "The $name class" \
|
||||
"The $name widget" \
|
||||
"The $name file" \
|
||||
is \
|
||||
provides \
|
||||
specifies \
|
||||
contains \
|
||||
represents \
|
||||
a \
|
||||
an \
|
||||
the
|
||||
ALWAYS_DETAILED_SEC = NO
|
||||
INLINE_INHERITED_MEMB = NO
|
||||
FULL_PATH_NAMES = YES
|
||||
STRIP_FROM_PATH =
|
||||
STRIP_FROM_INC_PATH =
|
||||
SHORT_NAMES = NO
|
||||
JAVADOC_AUTOBRIEF = NO
|
||||
MULTILINE_CPP_IS_BRIEF = NO
|
||||
DETAILS_AT_TOP = NO
|
||||
INHERIT_DOCS = YES
|
||||
DISTRIBUTE_GROUP_DOC = NO
|
||||
SEPARATE_MEMBER_PAGES = NO
|
||||
TAB_SIZE = 8
|
||||
ALIASES =
|
||||
OPTIMIZE_OUTPUT_FOR_C = NO
|
||||
OPTIMIZE_OUTPUT_JAVA = NO
|
||||
SUBGROUPING = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Build related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
EXTRACT_ALL = YES
|
||||
EXTRACT_PRIVATE = YES
|
||||
EXTRACT_STATIC = YES
|
||||
EXTRACT_LOCAL_CLASSES = YES
|
||||
EXTRACT_LOCAL_METHODS = NO
|
||||
HIDE_UNDOC_MEMBERS = NO
|
||||
HIDE_UNDOC_CLASSES = NO
|
||||
HIDE_FRIEND_COMPOUNDS = NO
|
||||
HIDE_IN_BODY_DOCS = NO
|
||||
INTERNAL_DOCS = NO
|
||||
CASE_SENSE_NAMES = NO
|
||||
HIDE_SCOPE_NAMES = NO
|
||||
SHOW_INCLUDE_FILES = YES
|
||||
INLINE_INFO = YES
|
||||
SORT_MEMBER_DOCS = YES
|
||||
SORT_BRIEF_DOCS = NO
|
||||
SORT_BY_SCOPE_NAME = NO
|
||||
GENERATE_TODOLIST = YES
|
||||
GENERATE_TESTLIST = YES
|
||||
GENERATE_BUGLIST = YES
|
||||
GENERATE_DEPRECATEDLIST= YES
|
||||
ENABLED_SECTIONS =
|
||||
MAX_INITIALIZER_LINES = 30
|
||||
SHOW_USED_FILES = YES
|
||||
SHOW_DIRECTORIES = YES
|
||||
FILE_VERSION_FILTER =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to warning and progress messages
|
||||
#---------------------------------------------------------------------------
|
||||
QUIET = NO
|
||||
WARNINGS = YES
|
||||
WARN_IF_UNDOCUMENTED = YES
|
||||
WARN_IF_DOC_ERROR = YES
|
||||
WARN_NO_PARAMDOC = NO
|
||||
WARN_FORMAT = "$file:$line: $text"
|
||||
WARN_LOGFILE =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the input files
|
||||
#---------------------------------------------------------------------------
|
||||
INPUT = ./
|
||||
FILE_PATTERNS = *.php \
|
||||
*.php3 \
|
||||
*.inc \
|
||||
*.dox
|
||||
RECURSIVE = YES
|
||||
EXCLUDE = ./IRC_Bot/SmartIRC.php
|
||||
EXCLUDE_SYMLINKS = NO
|
||||
EXCLUDE_PATTERNS = */IRC_Bot/magpierss/* \
|
||||
*/IRC_Bot/SmartIRC/* \
|
||||
*/IRC_Bot/*SRB2MS_Pass.php
|
||||
EXAMPLE_PATH =
|
||||
EXAMPLE_PATTERNS = *
|
||||
EXAMPLE_RECURSIVE = NO
|
||||
IMAGE_PATH =
|
||||
INPUT_FILTER =
|
||||
FILTER_PATTERNS =
|
||||
FILTER_SOURCE_FILES = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to source browsing
|
||||
#---------------------------------------------------------------------------
|
||||
SOURCE_BROWSER = YES
|
||||
INLINE_SOURCES = YES
|
||||
STRIP_CODE_COMMENTS = YES
|
||||
REFERENCED_BY_RELATION = NO
|
||||
REFERENCES_RELATION = NO
|
||||
USE_HTAGS = NO
|
||||
VERBATIM_HEADERS = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the alphabetical class index
|
||||
#---------------------------------------------------------------------------
|
||||
ALPHABETICAL_INDEX = NO
|
||||
COLS_IN_ALPHA_INDEX = 5
|
||||
IGNORE_PREFIX =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the HTML output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_HTML = YES
|
||||
HTML_OUTPUT = html
|
||||
HTML_FILE_EXTENSION = .html
|
||||
HTML_HEADER =
|
||||
HTML_FOOTER =
|
||||
HTML_STYLESHEET =
|
||||
HTML_ALIGN_MEMBERS = YES
|
||||
GENERATE_HTMLHELP = NO
|
||||
CHM_FILE =
|
||||
HHC_LOCATION =
|
||||
GENERATE_CHI = NO
|
||||
BINARY_TOC = NO
|
||||
TOC_EXPAND = NO
|
||||
DISABLE_INDEX = NO
|
||||
ENUM_VALUES_PER_LINE = 4
|
||||
GENERATE_TREEVIEW = YES
|
||||
TREEVIEW_WIDTH = 250
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the LaTeX output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_LATEX = NO
|
||||
LATEX_OUTPUT = latex
|
||||
LATEX_CMD_NAME = latex
|
||||
MAKEINDEX_CMD_NAME = makeindex
|
||||
COMPACT_LATEX = NO
|
||||
PAPER_TYPE = a4wide
|
||||
EXTRA_PACKAGES =
|
||||
LATEX_HEADER =
|
||||
PDF_HYPERLINKS = NO
|
||||
USE_PDFLATEX = NO
|
||||
LATEX_BATCHMODE = NO
|
||||
LATEX_HIDE_INDICES = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the RTF output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_RTF = NO
|
||||
RTF_OUTPUT = rtf
|
||||
COMPACT_RTF = NO
|
||||
RTF_HYPERLINKS = NO
|
||||
RTF_STYLESHEET_FILE =
|
||||
RTF_EXTENSIONS_FILE =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the man page output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_MAN = NO
|
||||
MAN_OUTPUT = man
|
||||
MAN_EXTENSION = .3
|
||||
MAN_LINKS = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the XML output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_XML = NO
|
||||
XML_OUTPUT = xml
|
||||
XML_SCHEMA =
|
||||
XML_DTD =
|
||||
XML_PROGRAMLISTING = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options for the AutoGen Definitions output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_AUTOGEN_DEF = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the Perl module output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_PERLMOD = NO
|
||||
PERLMOD_LATEX = NO
|
||||
PERLMOD_PRETTY = YES
|
||||
PERLMOD_MAKEVAR_PREFIX =
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the preprocessor
|
||||
#---------------------------------------------------------------------------
|
||||
ENABLE_PREPROCESSING = YES
|
||||
MACRO_EXPANSION = NO
|
||||
EXPAND_ONLY_PREDEF = NO
|
||||
SEARCH_INCLUDES = YES
|
||||
INCLUDE_PATH = C:/Dev/include
|
||||
INCLUDE_FILE_PATTERNS =
|
||||
PREDEFINED = HWRENDER \
|
||||
DIRECTFULLSCREEN \
|
||||
HW3SOUND
|
||||
EXPAND_AS_DEFINED =
|
||||
SKIP_FUNCTION_MACROS = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration::additions related to external references
|
||||
#---------------------------------------------------------------------------
|
||||
TAGFILES =
|
||||
GENERATE_TAGFILE =
|
||||
ALLEXTERNALS = NO
|
||||
EXTERNAL_GROUPS = YES
|
||||
PERL_PATH = /usr/bin/perl
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the dot tool
|
||||
#---------------------------------------------------------------------------
|
||||
CLASS_DIAGRAMS = YES
|
||||
HIDE_UNDOC_RELATIONS = YES
|
||||
HAVE_DOT = NO
|
||||
CLASS_GRAPH = YES
|
||||
COLLABORATION_GRAPH = YES
|
||||
GROUP_GRAPHS = YES
|
||||
UML_LOOK = NO
|
||||
TEMPLATE_RELATIONS = NO
|
||||
INCLUDE_GRAPH = YES
|
||||
INCLUDED_BY_GRAPH = YES
|
||||
CALL_GRAPH = NO
|
||||
GRAPHICAL_HIERARCHY = YES
|
||||
DIRECTORY_GRAPH = YES
|
||||
DOT_IMAGE_FORMAT = png
|
||||
DOT_PATH =
|
||||
DOTFILE_DIRS =
|
||||
MAX_DOT_GRAPH_WIDTH = 1024
|
||||
MAX_DOT_GRAPH_HEIGHT = 1024
|
||||
MAX_DOT_GRAPH_DEPTH = 1000
|
||||
DOT_TRANSPARENT = NO
|
||||
DOT_MULTI_TARGETS = NO
|
||||
GENERATE_LEGEND = YES
|
||||
DOT_CLEANUP = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration::additions related to the search engine
|
||||
#---------------------------------------------------------------------------
|
||||
SEARCHENGINE = NO
|
||||
@@ -1,364 +0,0 @@
|
||||
/*
|
||||
* anglechk.c
|
||||
*
|
||||
* Copyright 2007 Alam Arias <Alam.GBC@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#ifdef _MSC_VER
|
||||
#include <assert.h>
|
||||
#endif
|
||||
#include "../src/tables.h"
|
||||
#define NO_M
|
||||
#include "../src/m_fixed.c"
|
||||
#define FIXEDPOINTCONV
|
||||
|
||||
// With angle_t,
|
||||
// 360 deg = 2^32
|
||||
// 45 deg = 2^29
|
||||
// 1 deg = 2^29 / 45
|
||||
// To convert an angle to a fixed-point number of degrees, then, use
|
||||
// fixed = angle * FRACUNIT / ((1<<29) / 45)
|
||||
// But, done literally like that, this will overflow.
|
||||
// It's mathematically equivalent to
|
||||
// fixed = angle * (1<<FRACBITS) / (1<<29) * 45
|
||||
// fixed = 45 * angle * (1<<(FRACBITS-29))
|
||||
// fixed = 45 * angle * (1>>(29-FRACBITS))
|
||||
// fixed = (angle>>(29-FRACBITS)) * 45
|
||||
|
||||
#define ANGLE_TO_FIXED(a) (fixed_t)(((a)>>(29-FRACBITS))*45)
|
||||
#define FIXED_TO_ANGLE(x) (angle_t)(((x)/45)<<(29-FRACBITS))
|
||||
|
||||
/*
|
||||
Old code that failed if FRACBITS was not 16.
|
||||
In particular, the use of FRACUNIT in the definition of ANGLE_F is completely
|
||||
wrong. The value wanted actually happens to be 65536 due to the definition
|
||||
of angle_t (it's specified so that 360 degrees = 2^32, to take advantage of
|
||||
modular arithmetic). That 65536 has nothing whatsoever to do with the setting
|
||||
of FRACUNIT.
|
||||
|
||||
#define ANGF_D 8192
|
||||
#define ANGF_N 45
|
||||
#define ANGLE_F (ANGF_N*FRACUNIT/ANGF_D)
|
||||
#define FIXED_TO_ANGLE(x) (angle_t)FixedDiv(x, ANGLE_F) // angle_t = FixedDiv(fixed_t, ANGLE_F)
|
||||
#define ANGLE_TO_FIXED(x) FixedMul((fixed_t)(x), ANGLE_F) // fixed_t = FixedMul(angle_t, ANGLE_F)
|
||||
*/
|
||||
|
||||
static fixed_t AngleFixed204(angle_t af)
|
||||
{
|
||||
const fixed_t cfn = 180*FRACUNIT;
|
||||
if (af == 0)
|
||||
return 0;
|
||||
else if (af > ANGLE_180)
|
||||
return cfn + ANGLE_TO_FIXED(af - ANGLE_180);
|
||||
else if (af < ANGLE_180)
|
||||
return ANGLE_TO_FIXED(af);
|
||||
else return cfn;
|
||||
}
|
||||
|
||||
static inline angle_t FixedAngleC204(fixed_t fa, fixed_t factor)
|
||||
{
|
||||
#if 0 //FixedMod off?
|
||||
const boolean neqda = da < 0, neqfa = fa < 0;
|
||||
const fixed_t afactor = abs(factor);
|
||||
angle_t ra = ANGLE_180;
|
||||
|
||||
if (factor == 0)
|
||||
return FixedAngle204(fa);
|
||||
else if (fa == 0)
|
||||
return 0;
|
||||
|
||||
if (neqfactor)
|
||||
{
|
||||
const fixed_t maf = FixedDiv(afactor, ANGLE_F);
|
||||
const fixed_t cfn = FixedMul(360*FRACUNIT, afactor), hcfn = (cfn/2);
|
||||
const fixed_t fam = FixedMod(fa, cfn);
|
||||
|
||||
if (fam > hcfn)
|
||||
ra = ANGLE_180 + (angle_t)FixedMul(fam - hcfn, maf);
|
||||
else if (fam < hcfn)
|
||||
ra = (angle_t)FixedMul(fam, maf);
|
||||
}
|
||||
else
|
||||
{
|
||||
const fixed_t maf = FixedMul(afactor, ANGLE_F);
|
||||
const fixed_t cfn = FixedDiv(360*FRACUNIT, afactor), hcfn = (cfn/2);
|
||||
const fixed_t fam = FixedMod(fa, cfn);
|
||||
|
||||
if (fam > hcfn)
|
||||
ra = ANGLE_180 + (angle_t)FixedDiv(fam - hcfn, maf);
|
||||
else if (fam < hcfn)
|
||||
ra = (angle_t)FixedDiv(fam, maf);
|
||||
}
|
||||
|
||||
if (neqfa)
|
||||
ra = ANGLE_MAX-ra;
|
||||
|
||||
return ra;
|
||||
#else
|
||||
if (factor == 0)
|
||||
return FixedAngle(fa);
|
||||
else if (factor > 0)
|
||||
return (angle_t)((FIXED_TO_FLOAT(fa)/FIXED_TO_FLOAT(factor))*(ANGLE_45/45));
|
||||
else
|
||||
return (angle_t)((FIXED_TO_FLOAT(fa)*FIXED_TO_FLOAT(-factor))*(ANGLE_45/45));
|
||||
#endif
|
||||
}
|
||||
|
||||
angle_t FixedAngle(fixed_t fa)
|
||||
{
|
||||
#if 0 //FixedMod off?
|
||||
const boolean neqfa = fa < 0;
|
||||
const fixed_t cfn = 180*FRACUNIT;
|
||||
const fixed_t fam = FixedMod(fa, 360*FRACUNIT);
|
||||
angle_t ra = ANGLE_180;
|
||||
|
||||
if (fa == 0)
|
||||
return 0;
|
||||
|
||||
if (fam > cfn)
|
||||
ra = ANGLE_180+FIXED_TO_ANGLE(fam-cfn);
|
||||
else if (fam < cfn)
|
||||
ra = FIXED_TO_ANGLE(fam);
|
||||
|
||||
if (neqfa)
|
||||
ra = ANGLE_MAX-ra;
|
||||
|
||||
return ra;
|
||||
#else
|
||||
return (angle_t)(FIXED_TO_FLOAT(fa)*(ANGLE_45/45));
|
||||
#endif
|
||||
}
|
||||
|
||||
fixed_t AngleFixed205(angle_t af)
|
||||
{
|
||||
#ifdef FIXEDPOINTCONV
|
||||
angle_t wa = ANGLE_180;
|
||||
fixed_t wf = 180*FRACUNIT;
|
||||
fixed_t rf = 0*FRACUNIT;
|
||||
//const angle_t adj = 0x2000;
|
||||
|
||||
//if (af < adj) // too small to notice
|
||||
//return rf;
|
||||
|
||||
while (af)
|
||||
{
|
||||
while (af < wa)
|
||||
{
|
||||
wa /= 2;
|
||||
wf /= 2;
|
||||
}
|
||||
rf += wf;
|
||||
af -= wa;
|
||||
}
|
||||
|
||||
return rf;
|
||||
#else
|
||||
const fixed_t cfn = 180*FRACUNIT;
|
||||
if (af == 0)
|
||||
return 0;
|
||||
else if (af > ANGLE_180)
|
||||
return cfn + ANGLE_TO_FIXED(af - ANGLE_180);
|
||||
else if (af < ANGLE_180)
|
||||
return ANGLE_TO_FIXED(af);
|
||||
else return cfn;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef FIXEDPOINTCONV
|
||||
static FUNCMATH angle_t AngleAdj(const fixed_t fa, const fixed_t wf,
|
||||
angle_t ra)
|
||||
{
|
||||
const angle_t adj = 0x77;
|
||||
const boolean fan = fa < 0;
|
||||
const fixed_t sl = FixedDiv(fa, wf*2);
|
||||
const fixed_t lb = FixedRem(fa, wf*2);
|
||||
const fixed_t lo = (wf*2)-lb;
|
||||
|
||||
if (ra == 0)
|
||||
{
|
||||
if (lb == 0)
|
||||
{
|
||||
ra = FixedMul(FRACUNIT/512, sl);
|
||||
if (ra > FRACUNIT/64)
|
||||
return ANGLE_MAX-ra+1;
|
||||
return ra;
|
||||
}
|
||||
else if (lb > 0)
|
||||
return ANGLE_MAX-FixedMul(lo*FRACUNIT, adj)+1;
|
||||
else
|
||||
return ANGLE_MAX-FixedMul(lo*FRACUNIT, adj)+1;
|
||||
}
|
||||
|
||||
if (fan)
|
||||
return ANGLE_MAX-ra+1;
|
||||
else
|
||||
return ra;
|
||||
}
|
||||
#endif
|
||||
|
||||
angle_t FixedAngleC205(fixed_t fa, fixed_t factor)
|
||||
{
|
||||
#ifdef FIXEDPOINTCONV
|
||||
angle_t wa = ANGLE_180;
|
||||
fixed_t wf = 180*FRACUNIT;
|
||||
angle_t ra = 0;
|
||||
const fixed_t cfa = fa;
|
||||
fixed_t cwf = wf;
|
||||
|
||||
if (fa == 0)
|
||||
return 0;
|
||||
|
||||
if (factor == 0)
|
||||
return FixedAngle(fa);
|
||||
else if (factor > 0)
|
||||
cwf = wf = FixedMul(wf, factor);
|
||||
else if (factor < 0)
|
||||
cwf = wf = FixedDiv(wf, -factor);
|
||||
|
||||
fa = abs(fa);
|
||||
|
||||
while (fa)
|
||||
{
|
||||
while (fa < wf)
|
||||
{
|
||||
wa /= 2;
|
||||
wf /= 2;
|
||||
}
|
||||
ra = ra + wa;
|
||||
fa = fa - wf;
|
||||
}
|
||||
|
||||
return AngleAdj(cfa, cwf, ra);
|
||||
#else
|
||||
if (factor == 0)
|
||||
return FixedAngle(fa);
|
||||
|
||||
//fa = FixedMod(fa, 360*FRACUNIT);
|
||||
|
||||
if (factor > 0)
|
||||
return (angle_t)((FIXED_TO_FLOAT(fa)/FIXED_TO_FLOAT(factor))*(ANGLE_45/45));
|
||||
else
|
||||
return (angle_t)((FIXED_TO_FLOAT(fa)*FIXED_TO_FLOAT(-factor))*(ANGLE_45/45));
|
||||
#endif
|
||||
}
|
||||
|
||||
angle_t FixedAngle205(fixed_t fa)
|
||||
{
|
||||
#ifdef FIXEDPOINTCONV
|
||||
angle_t wa = ANGLE_180;
|
||||
fixed_t wf = 180*FRACUNIT;
|
||||
angle_t ra = 0;
|
||||
const fixed_t cfa = fa;
|
||||
const fixed_t cwf = wf;
|
||||
|
||||
if (fa == 0)
|
||||
return 0;
|
||||
|
||||
fa = abs(fa);
|
||||
|
||||
while (fa)
|
||||
{
|
||||
while (fa < wf)
|
||||
{
|
||||
wa /= 2;
|
||||
wf /= 2;
|
||||
}
|
||||
ra = ra + wa;
|
||||
fa = fa - wf;
|
||||
}
|
||||
|
||||
return AngleAdj(cfa, cwf, ra);
|
||||
#else
|
||||
//fa = FixedMod(fa, 360*FRACUNIT);
|
||||
|
||||
if (fa == 0)
|
||||
return 0;
|
||||
|
||||
return (angle_t)(FIXED_TO_FLOAT(fa)*(ANGLE_45/45));
|
||||
#endif
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
fixed_t f, f204, f205;
|
||||
INT64 a;
|
||||
angle_t a204, a205;
|
||||
fixed_t CF = 40*FRACUNIT;
|
||||
int err = 0;
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
|
||||
err = 0x29; //41
|
||||
|
||||
if (1)
|
||||
for (a = 0; a < ANGLE_MAX; a += 0x1)
|
||||
{
|
||||
f204 = AngleFixed204((angle_t)a);
|
||||
f205 = AngleFixed205((angle_t)a);
|
||||
if (f204 != f205 && (abs(f204-f205) > err || f204 == 0 || f205 == 0))
|
||||
{
|
||||
printf("Angle: %u, %d, %d, %d\n", (angle_t)a, f204, f205, f204-f205);
|
||||
//err = abs(f204-f205);
|
||||
}
|
||||
}
|
||||
|
||||
//err = FixedDiv(FRACUNIT, 120*FRACUNIT); // 547
|
||||
err = FixedDiv(FRACUNIT, 62*FRACUNIT); //1059
|
||||
|
||||
if (1)
|
||||
for (f = FRACUNIT*-720; f < FRACUNIT*720; f += 1)
|
||||
{
|
||||
a204 = FixedAngle(f);
|
||||
a205 = FixedAngle205(f);
|
||||
if (a204 != a205 && (abs(a204-a205) > err || a204 == 0 || a205 == 0))
|
||||
{
|
||||
printf("Fixed: %f, %u, %u, %d\n", FIXED_TO_FLOAT(f), a204, a205, a204-a205);
|
||||
err = abs(a204-a205);
|
||||
}
|
||||
}
|
||||
|
||||
//err = FixedDiv(FRACUNIT, 316*FRACUNIT); //207
|
||||
err = FixedDiv(FRACUNIT, 125*FRACUNIT); //526
|
||||
|
||||
if (1)
|
||||
for (f = FixedMul(FRACUNIT*-720, CF); f < FixedMul(FRACUNIT*720, CF); f += FRACUNIT/16)
|
||||
{
|
||||
a204 = FixedAngleC204(f, CF);
|
||||
a205 = FixedAngleC205(f, CF);
|
||||
if (a204 != a205 && (abs(a204-a205) > err || a204 == 0 || a205 == 0))
|
||||
{
|
||||
printf("FixedC: %f, %u, %u, %d\n", FIXED_TO_FLOAT(f), a204, a205, a204-a205);
|
||||
//err = abs(a204-a205);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void *cpu_cpy(void *dest, const void *src, size_t n)
|
||||
{
|
||||
return memcpy(dest, src, n);
|
||||
}
|
||||
|
||||
void *(*M_Memcpy)(void* dest, const void* src, size_t n) = cpu_cpy;
|
||||
|
||||
void I_Error(const char *error, ...)
|
||||
{
|
||||
(void)error;
|
||||
exit(-1);
|
||||
}
|
||||
Loaded 100 of 149 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user