mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-12-25 11:50:50 +00:00
Merge branch 'next' of https://git.magicalgirl.moe/STJr/SRB2.git into nextmerge_plus_rain
# Conflicts: # src/d_netcmd.c # src/d_netcmd.h # src/g_game.c # src/p_floor.c # src/p_user.c # src/r_data.c # src/r_data.h # src/v_video.c
This commit is contained in:
commit
a1e1aa81b5
45 changed files with 442 additions and 513 deletions
22
src/Makefile
22
src/Makefile
|
@ -66,6 +66,7 @@
|
|||
# Compile without 3D sound support, add 'NOHS=1'
|
||||
# Compile with GDBstubs, add 'RDB=1'
|
||||
# Compile without PNG, add 'NOPNG=1'
|
||||
# Compile without zlib, add 'NOZLIB=1'
|
||||
#
|
||||
# Addon for SDL:
|
||||
# To Cross-Compile, add 'SDL_CONFIG=/usr/*/bin/sdl-config'
|
||||
|
@ -119,6 +120,7 @@ include Makefile.cfg
|
|||
|
||||
ifdef DUMMY
|
||||
NOPNG=1
|
||||
NOZLIB=1
|
||||
NONET=1
|
||||
NOHW=1
|
||||
NOHS=1
|
||||
|
@ -199,6 +201,7 @@ endif
|
|||
|
||||
ifdef NDS
|
||||
NOPNG=1
|
||||
NOZLIB=1
|
||||
NONET=1
|
||||
#NOHW=1
|
||||
NOHS=1
|
||||
|
@ -325,13 +328,6 @@ LIBS+=$(PNG_LDFLAGS)
|
|||
CFLAGS+=$(PNG_CFLAGS)
|
||||
endif
|
||||
|
||||
ZLIB_PKGCONFIG?=zlib
|
||||
ZLIB_CFLAGS?=$(shell $(PKG_CONFIG) $(ZLIB_PKGCONFIG) --cflags)
|
||||
ZLIB_LDFLAGS?=$(shell $(PKG_CONFIG) $(ZLIB_PKGCONFIG) --libs)
|
||||
|
||||
LIBS+=$(ZLIB_LDFLAGS)
|
||||
CFLAGS+=$(ZLIB_CFLAGS)
|
||||
|
||||
ifdef HAVE_LIBGME
|
||||
OPTS+=-DHAVE_LIBGME
|
||||
|
||||
|
@ -343,6 +339,18 @@ LIBS+=$(LIBGME_LDFLAGS)
|
|||
CFLAGS+=$(LIBGME_CFLAGS)
|
||||
endif
|
||||
|
||||
ifndef NOZLIB
|
||||
OPTS+=-DHAVE_ZLIB
|
||||
ZLIB_PKGCONFIG?=zlib
|
||||
ZLIB_CFLAGS?=$(shell $(PKG_CONFIG) $(ZLIB_PKGCONFIG) --cflags)
|
||||
ZLIB_LDFLAGS?=$(shell $(PKG_CONFIG) $(ZLIB_PKGCONFIG) --libs)
|
||||
|
||||
LIBS+=$(ZLIB_LDFLAGS)
|
||||
CFLAGS+=$(ZLIB_CFLAGS)
|
||||
else
|
||||
NOPNG=1
|
||||
endif
|
||||
|
||||
ifdef STATIC
|
||||
LIBS:=-static $(LIBS)
|
||||
endif
|
||||
|
|
|
@ -21,13 +21,14 @@ void I_ShutdownSound(void){}
|
|||
// SFX I/O
|
||||
//
|
||||
|
||||
INT32 I_StartSound(sfxenum_t id, INT32 vol, INT32 sep, INT32 pitch, INT32 priority)
|
||||
INT32 I_StartSound(sfxenum_t id, INT32 vol, INT32 sep, INT32 pitch, INT32 priority, INT32 channel)
|
||||
{
|
||||
(void)id;
|
||||
(void)vol;
|
||||
(void)sep;
|
||||
(void)pitch;
|
||||
(void)priority;
|
||||
(void)channel;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -1631,8 +1631,6 @@ static void CL_LoadReceivedSavegame(void)
|
|||
automapactive = false;
|
||||
|
||||
// load a base level
|
||||
playerdeadview = false;
|
||||
|
||||
if (P_LoadNetGame())
|
||||
{
|
||||
CONS_Printf(M_GetText("Map is now \"%s"), G_BuildMapName(gamemap));
|
||||
|
|
|
@ -810,7 +810,6 @@ void D_StartTitle(void)
|
|||
maptol = 0;
|
||||
|
||||
gameaction = ga_nothing;
|
||||
playerdeadview = false;
|
||||
displayplayer = consoleplayer = 0;
|
||||
//demosequence = -1;
|
||||
gametype = GT_RACE; // SRB2kart
|
||||
|
|
|
@ -34,7 +34,7 @@ void D_SRB2Loop(void) FUNCNORETURN;
|
|||
// D_SRB2Main()
|
||||
// Not a globally visible function, just included for source reference,
|
||||
// calls all startup code, parses command line options.
|
||||
// If not overrided by user input, calls N_AdvanceDemo.
|
||||
// If not overrided by user input, calls D_AdvanceDemo.
|
||||
//
|
||||
void D_SRB2Main(void);
|
||||
|
||||
|
@ -51,9 +51,6 @@ const char *D_Home(void);
|
|||
//
|
||||
// BASE LEVEL
|
||||
//
|
||||
void D_PageTicker(void);
|
||||
// pagename is lumpname of a 320x200 patch to fill the screen
|
||||
void D_PageDrawer(const char *pagename);
|
||||
void D_AdvanceDemo(void);
|
||||
void D_StartTitle(void);
|
||||
|
||||
|
|
|
@ -49,7 +49,9 @@ doomcom_t *doomcom = NULL;
|
|||
/// \brief network packet data, points inside doomcom
|
||||
doomdata_t *netbuffer = NULL;
|
||||
|
||||
#ifdef DEBUGFILE
|
||||
FILE *debugfile = NULL; // put some net info in a file during the game
|
||||
#endif
|
||||
|
||||
#define MAXREBOUND 8
|
||||
static doomdata_t reboundstore[MAXREBOUND];
|
||||
|
|
|
@ -3341,6 +3341,12 @@ static void Command_Login_f(void)
|
|||
XBOXSTATIC UINT8 finalmd5[16];
|
||||
const char *pw;
|
||||
|
||||
if (!netgame)
|
||||
{
|
||||
CONS_Printf(M_GetText("This only works in a netgame.\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
// If the server uses login, it will effectively just remove admin privileges
|
||||
// from whoever has them. This is good.
|
||||
if (COM_Argc() != 2)
|
||||
|
@ -3455,6 +3461,12 @@ static void Command_Verify_f(void)
|
|||
return;
|
||||
}
|
||||
|
||||
if (!netgame)
|
||||
{
|
||||
CONS_Printf(M_GetText("This only works in a netgame.\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (COM_Argc() != 2)
|
||||
{
|
||||
CONS_Printf(M_GetText("giveadmin <node>: give admin privileges to a node\n"));
|
||||
|
@ -3809,7 +3821,7 @@ static void Command_Addfile(void)
|
|||
WRITEMEM(buf_p, md5sum, 16);
|
||||
}
|
||||
|
||||
if (IsPlayerAdmin(consoleplayer)) // Request to add file
|
||||
if (IsPlayerAdmin(consoleplayer) && (!server)) // Request to add file
|
||||
SendNetXCmd(XD_REQADDFILE, buf, buf_p - buf);
|
||||
else
|
||||
SendNetXCmd(XD_ADDFILE, buf, buf_p - buf);
|
||||
|
|
|
@ -165,9 +165,11 @@ INT32 I_StartSound ( sfxenum_t id,
|
|||
INT32 vol,
|
||||
INT32 sep,
|
||||
INT32 pitch,
|
||||
INT32 priority )
|
||||
INT32 priority,
|
||||
INT32 channel)
|
||||
{
|
||||
int voice;
|
||||
(void)channel;
|
||||
|
||||
if (nosound)
|
||||
return 0;
|
||||
|
|
|
@ -497,19 +497,17 @@ extern mapthing_t *redctfstarts[MAXPLAYERS]; // CTF
|
|||
|
||||
#if defined (macintosh)
|
||||
#define DEBFILE(msg) I_OutputMsg(msg)
|
||||
extern FILE *debugfile;
|
||||
#else
|
||||
#define DEBUGFILE
|
||||
#ifdef DEBUGFILE
|
||||
#define DEBFILE(msg) { if (debugfile) { fputs(msg, debugfile); fflush(debugfile); } }
|
||||
extern FILE *debugfile;
|
||||
#else
|
||||
#define DEBFILE(msg) {}
|
||||
extern FILE *debugfile;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef DEBUGFILE
|
||||
extern FILE *debugfile;
|
||||
extern INT32 debugload;
|
||||
#endif
|
||||
|
||||
|
|
|
@ -23,13 +23,14 @@ void I_UpdateSound(void){};
|
|||
// SFX I/O
|
||||
//
|
||||
|
||||
INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority)
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -276,7 +276,6 @@ void F_StartIntro(void)
|
|||
|
||||
G_SetGamestate(GS_INTRO);
|
||||
gameaction = ga_nothing;
|
||||
playerdeadview = false;
|
||||
paused = false;
|
||||
CON_ToggleOff();
|
||||
CON_ClearHUD();
|
||||
|
@ -579,7 +578,6 @@ void F_StartCredits(void)
|
|||
}
|
||||
|
||||
gameaction = ga_nothing;
|
||||
playerdeadview = false;
|
||||
paused = false;
|
||||
CON_ToggleOff();
|
||||
CON_ClearHUD();
|
||||
|
@ -741,7 +739,6 @@ void F_StartGameEvaluation(void)
|
|||
G_SaveGame((UINT32)cursaveslot);
|
||||
|
||||
gameaction = ga_nothing;
|
||||
playerdeadview = false;
|
||||
paused = false;
|
||||
CON_ToggleOff();
|
||||
CON_ClearHUD();
|
||||
|
@ -852,7 +849,6 @@ void F_StartGameEnd(void)
|
|||
G_SetGamestate(GS_GAMEEND);
|
||||
|
||||
gameaction = ga_nothing;
|
||||
playerdeadview = false;
|
||||
paused = false;
|
||||
CON_ToggleOff();
|
||||
CON_ClearHUD();
|
||||
|
@ -1109,7 +1105,6 @@ void F_StartContinue(void)
|
|||
gameaction = ga_nothing;
|
||||
|
||||
keypressed = false;
|
||||
playerdeadview = false;
|
||||
paused = false;
|
||||
CON_ToggleOff();
|
||||
CON_ClearHUD();
|
||||
|
@ -1278,7 +1273,6 @@ void F_StartCustomCutscene(INT32 cutscenenum, boolean precutscene, boolean reset
|
|||
G_SetGamestate(GS_CUTSCENE);
|
||||
|
||||
gameaction = ga_nothing;
|
||||
playerdeadview = false;
|
||||
paused = false;
|
||||
CON_ToggleOff();
|
||||
|
||||
|
|
|
@ -4328,7 +4328,6 @@ void G_InitNew(UINT8 pencoremode, const char *mapname, boolean resetplayer, bool
|
|||
// Don't carry over custom music change to another map.
|
||||
mapmusflags |= MUSIC_RELOADRESET;
|
||||
|
||||
playerdeadview = false;
|
||||
automapactive = false;
|
||||
imcontinuing = false;
|
||||
|
||||
|
|
|
@ -565,8 +565,6 @@ static inline void HWR_SubsecPoly(INT32 num, poly_t *poly)
|
|||
subsector_t *sub;
|
||||
seg_t *lseg;
|
||||
|
||||
sscount++;
|
||||
|
||||
sub = &subsectors[num];
|
||||
count = sub->numlines;
|
||||
lseg = &segs[sub->firstline];
|
||||
|
|
|
@ -3276,7 +3276,6 @@ static void HWR_Subsector(size_t num, UINT8 ssplayer)
|
|||
|
||||
if (num < numsubsectors)
|
||||
{
|
||||
sscount++;
|
||||
// subsector
|
||||
sub = &subsectors[num];
|
||||
// sector
|
||||
|
@ -5176,7 +5175,9 @@ static void HWR_AddSprites(sector_t *sec, UINT8 ssplayer)
|
|||
|
||||
approx_dist = P_AproxDistance(viewx-thing->x, viewy-thing->y);
|
||||
|
||||
if (approx_dist <= limit_dist)
|
||||
if (approx_dist > limit_dist)
|
||||
continue;
|
||||
|
||||
HWR_ProjectSprite(thing);
|
||||
}
|
||||
}
|
||||
|
@ -5222,7 +5223,9 @@ static void HWR_AddSprites(sector_t *sec, UINT8 ssplayer)
|
|||
|
||||
approx_dist = P_AproxDistance(viewx-precipthing->x, viewy-precipthing->y);
|
||||
|
||||
if (approx_dist <= limit_dist)
|
||||
if (approx_dist > limit_dist)
|
||||
continue;
|
||||
|
||||
HWR_ProjectPrecipitationSprite(precipthing);
|
||||
}
|
||||
}
|
||||
|
@ -5554,6 +5557,16 @@ static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing)
|
|||
x1 = tr_x + x1 * rightcos;
|
||||
x2 = tr_x - x2 * rightcos;
|
||||
|
||||
// okay, we can't return now... this is a hack, but weather isn't networked, so it should be ok
|
||||
if (!(thing->precipflags & PCF_THUNK))
|
||||
{
|
||||
if (thing->precipflags & PCF_RAIN)
|
||||
P_RainThinker(thing);
|
||||
else
|
||||
P_SnowThinker(thing);
|
||||
thing->precipflags |= PCF_THUNK;
|
||||
}
|
||||
|
||||
//
|
||||
// store information in a vissprite
|
||||
//
|
||||
|
|
|
@ -93,9 +93,6 @@ extern boolean chat_on;
|
|||
// set true whenever the tab rankings are being shown for any reason
|
||||
extern boolean hu_showscores;
|
||||
|
||||
// P_DeathThink sets this true to show scores while dead, in multiplayer
|
||||
extern boolean playerdeadview;
|
||||
|
||||
// init heads up data at game startup.
|
||||
void HU_Init(void);
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ void I_ShutdownSound(void);
|
|||
|
||||
\return sfx handle
|
||||
*/
|
||||
INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority);
|
||||
INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority, INT32 channel);
|
||||
|
||||
/** \brief Stops a sound channel.
|
||||
|
||||
|
|
68
src/i_tcp.c
68
src/i_tcp.c
|
@ -686,14 +686,29 @@ static boolean SOCK_CanGet(void)
|
|||
#endif
|
||||
|
||||
#ifndef NONET
|
||||
static void SOCK_Send(void)
|
||||
static inline ssize_t SOCK_SendToAddr(SOCKET_TYPE socket, mysockaddr_t *sockaddr)
|
||||
{
|
||||
ssize_t c = ERRSOCKET;
|
||||
socklen_t d4 = (socklen_t)sizeof(struct sockaddr_in);
|
||||
#ifdef HAVE_IPV6
|
||||
socklen_t d6 = (socklen_t)sizeof(struct sockaddr_in6);
|
||||
#endif
|
||||
socklen_t d, da = (socklen_t)sizeof(mysockaddr_t);
|
||||
|
||||
switch (sockaddr->any.sa_family)
|
||||
{
|
||||
case AF_INET: d = d4; break;
|
||||
#ifdef HAVE_IPV6
|
||||
case AF_INET6: d = d6; break;
|
||||
#endif
|
||||
default: d = da; break;
|
||||
}
|
||||
|
||||
return sendto(socket, (char *)&doomcom->data, doomcom->datalength, 0, &sockaddr->any, d);
|
||||
}
|
||||
|
||||
static void SOCK_Send(void)
|
||||
{
|
||||
ssize_t c = ERRSOCKET;
|
||||
size_t i, j;
|
||||
|
||||
if (!nodeconnected[doomcom->remotenode])
|
||||
|
@ -706,19 +721,7 @@ static void SOCK_Send(void)
|
|||
for (j = 0; j < broadcastaddresses; j++)
|
||||
{
|
||||
if (myfamily[i] == broadcastaddress[j].any.sa_family)
|
||||
{
|
||||
if (broadcastaddress[i].any.sa_family == AF_INET)
|
||||
d = d4;
|
||||
#ifdef HAVE_IPV6
|
||||
else if (broadcastaddress[i].any.sa_family == AF_INET6)
|
||||
d = d6;
|
||||
#endif
|
||||
else
|
||||
d = da;
|
||||
|
||||
c = sendto(mysockets[i], (char *)&doomcom->data, doomcom->datalength, 0,
|
||||
&broadcastaddress[j].any, d);
|
||||
}
|
||||
SOCK_SendToAddr(mysockets[i], &broadcastaddress[j]);
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
@ -728,35 +731,13 @@ static void SOCK_Send(void)
|
|||
for (i = 0; i < mysocketses; i++)
|
||||
{
|
||||
if (myfamily[i] == clientaddress[doomcom->remotenode].any.sa_family)
|
||||
{
|
||||
if (clientaddress[doomcom->remotenode].any.sa_family == AF_INET)
|
||||
d = d4;
|
||||
#ifdef HAVE_IPV6
|
||||
else if (clientaddress[doomcom->remotenode].any.sa_family == AF_INET6)
|
||||
d = d6;
|
||||
#endif
|
||||
else
|
||||
d = da;
|
||||
|
||||
sendto(mysockets[i], (char *)&doomcom->data, doomcom->datalength, 0,
|
||||
&clientaddress[doomcom->remotenode].any, d);
|
||||
}
|
||||
SOCK_SendToAddr(mysockets[i], &clientaddress[doomcom->remotenode]);
|
||||
}
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (clientaddress[doomcom->remotenode].any.sa_family == AF_INET)
|
||||
d = d4;
|
||||
#ifdef HAVE_IPV6
|
||||
else if (clientaddress[doomcom->remotenode].any.sa_family == AF_INET6)
|
||||
d = d6;
|
||||
#endif
|
||||
else
|
||||
d = da;
|
||||
|
||||
c = sendto(nodesocket[doomcom->remotenode], (char *)&doomcom->data, doomcom->datalength, 0,
|
||||
&clientaddress[doomcom->remotenode].any, d);
|
||||
c = SOCK_SendToAddr(nodesocket[doomcom->remotenode], &clientaddress[doomcom->remotenode]);
|
||||
}
|
||||
|
||||
if (c == ERRSOCKET && errno != ECONNREFUSED && errno != EWOULDBLOCK)
|
||||
|
@ -1044,7 +1025,7 @@ static boolean UDP_Socket(void)
|
|||
if (gaie == 0)
|
||||
{
|
||||
runp = ai;
|
||||
while (runp != NULL)
|
||||
while (runp != NULL && s < MAXNETNODES+1)
|
||||
{
|
||||
memcpy(&clientaddress[s], runp->ai_addr, runp->ai_addrlen);
|
||||
s++;
|
||||
|
@ -1059,12 +1040,15 @@ static boolean UDP_Socket(void)
|
|||
clientaddress[s].ip4.sin_addr.s_addr = htonl(INADDR_LOOPBACK); //GetLocalAddress(); // my own ip
|
||||
s++;
|
||||
}
|
||||
|
||||
s = 0;
|
||||
|
||||
// setup broadcast adress to BROADCASTADDR entry
|
||||
gaie = I_getaddrinfo("255.255.255.255", "0", &hints, &ai);
|
||||
if (gaie == 0)
|
||||
{
|
||||
runp = ai;
|
||||
while (runp != NULL)
|
||||
while (runp != NULL && s < MAXNETNODES+1)
|
||||
{
|
||||
memcpy(&broadcastaddress[s], runp->ai_addr, runp->ai_addrlen);
|
||||
s++;
|
||||
|
@ -1087,7 +1071,7 @@ static boolean UDP_Socket(void)
|
|||
if (gaie == 0)
|
||||
{
|
||||
runp = ai;
|
||||
while (runp != NULL)
|
||||
while (runp != NULL && s < MAXNETNODES+1)
|
||||
{
|
||||
memcpy(&broadcastaddress[s], runp->ai_addr, runp->ai_addrlen);
|
||||
s++;
|
||||
|
|
|
@ -327,6 +327,7 @@ static int sector_get(lua_State *L)
|
|||
{
|
||||
sector_t *sector = *((sector_t **)luaL_checkudata(L, 1, META_SECTOR));
|
||||
enum sector_e field = luaL_checkoption(L, 2, sector_opt[0], sector_opt);
|
||||
INT16 i;
|
||||
|
||||
if (!sector)
|
||||
{
|
||||
|
@ -349,11 +350,23 @@ static int sector_get(lua_State *L)
|
|||
lua_pushfixed(L, sector->ceilingheight);
|
||||
return 1;
|
||||
case sector_floorpic: // floorpic
|
||||
lua_pushlstring(L, levelflats[sector->floorpic].name, 8);
|
||||
{
|
||||
levelflat_t *levelflat = &levelflats[sector->floorpic];
|
||||
for (i = 0; i < 8; i++)
|
||||
if (!levelflat->name[i])
|
||||
break;
|
||||
lua_pushlstring(L, levelflat->name, i);
|
||||
return 1;
|
||||
}
|
||||
case sector_ceilingpic: // ceilingpic
|
||||
lua_pushlstring(L, levelflats[sector->ceilingpic].name, 8);
|
||||
{
|
||||
levelflat_t *levelflat = &levelflats[sector->ceilingpic];
|
||||
for (i = 0; i < 8; i++)
|
||||
if (!levelflat->name[i])
|
||||
break;
|
||||
lua_pushlstring(L, levelflat->name, i);
|
||||
return 1;
|
||||
}
|
||||
case sector_lightlevel:
|
||||
lua_pushinteger(L, sector->lightlevel);
|
||||
return 1;
|
||||
|
|
|
@ -182,19 +182,21 @@ void LUA_LoadLump(UINT16 wad, UINT16 lump)
|
|||
{
|
||||
MYFILE f;
|
||||
char *name;
|
||||
size_t len;
|
||||
f.wad = wad;
|
||||
f.size = W_LumpLengthPwad(wad, lump);
|
||||
f.data = Z_Malloc(f.size, PU_LUA, NULL);
|
||||
W_ReadLumpPwad(wad, lump, f.data);
|
||||
f.curpos = f.data;
|
||||
|
||||
name = malloc(strlen(wadfiles[wad]->filename)+10);
|
||||
len = strlen(wadfiles[wad]->filename);
|
||||
name = malloc(len+10);
|
||||
strcpy(name, wadfiles[wad]->filename);
|
||||
if (!fasticmp(&name[strlen(name) - 4], ".lua")) {
|
||||
if (!fasticmp(&name[len - 4], ".lua")) {
|
||||
// If it's not a .lua file, copy the lump name in too.
|
||||
name[strlen(wadfiles[wad]->filename)] = '|';
|
||||
M_Memcpy(name+strlen(wadfiles[wad]->filename)+1, wadfiles[wad]->lumpinfo[lump].name, 8);
|
||||
name[strlen(wadfiles[wad]->filename)+9] = '\0';
|
||||
name[len] = '|';
|
||||
M_Memcpy(name+len+1, wadfiles[wad]->lumpinfo[lump].name, 8);
|
||||
name[len+9] = '\0';
|
||||
}
|
||||
|
||||
LUA_LoadFile(&f, name);
|
||||
|
|
|
@ -492,7 +492,9 @@ static void GIF_framewrite(void)
|
|||
|
||||
// screen regions are handled in GIF_lzw
|
||||
{
|
||||
UINT16 delay = 3; // todo
|
||||
int d1 = (int)((100.0/NEWTICRATE)*(gif_frames+1));
|
||||
int d2 = (int)((100.0/NEWTICRATE)*(gif_frames));
|
||||
UINT16 delay = d1-d2;
|
||||
INT32 startline;
|
||||
|
||||
WRITEMEM(p, gifframe_gchead, 4);
|
||||
|
|
|
@ -21,13 +21,14 @@ void I_ShutdownSound(void){}
|
|||
// SFX I/O
|
||||
//
|
||||
|
||||
INT32 I_StartSound(sfxenum_t id, INT32 vol, INT32 sep, INT32 pitch, INT32 priority)
|
||||
INT32 I_StartSound(sfxenum_t id, INT32 vol, INT32 sep, INT32 pitch, INT32 priority, INT32 channel)
|
||||
{
|
||||
(void)id;
|
||||
(void)vol;
|
||||
(void)sep;
|
||||
(void)pitch;
|
||||
(void)priority;
|
||||
(void)channel;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -1819,6 +1819,7 @@ void T_ThwompSector(levelspecthink_t *thwomp)
|
|||
#define ceilingwasheight vars[5]
|
||||
fixed_t thwompx, thwompy;
|
||||
sector_t *actionsector;
|
||||
ffloor_t *rover = NULL;
|
||||
INT32 secnum;
|
||||
|
||||
// SRB2kart 170217 - Thwomps are automatic.
|
||||
|
@ -1843,7 +1844,16 @@ void T_ThwompSector(levelspecthink_t *thwomp)
|
|||
secnum = P_FindSectorFromTag((INT16)thwomp->vars[0], -1);
|
||||
|
||||
if (secnum > 0)
|
||||
{
|
||||
actionsector = §ors[secnum];
|
||||
|
||||
// Look for thwomp FFloor
|
||||
for (rover = actionsector->ffloors; rover; rover = rover->next)
|
||||
{
|
||||
if (rover->master == thwomp->sourceline)
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
return; // Bad bad bad!
|
||||
|
||||
|
@ -1932,10 +1942,13 @@ void T_ThwompSector(levelspecthink_t *thwomp)
|
|||
{
|
||||
mobj_t *mp = (void *)&actionsector->soundorg;
|
||||
|
||||
if (!rover || (rover->flags & FF_EXISTS))
|
||||
{
|
||||
if (thwomp->sourceline->flags & ML_EFFECT4)
|
||||
S_StartSound(mp, sides[thwomp->sourceline->sidenum[0]].textureoffset>>FRACBITS);
|
||||
else
|
||||
S_StartSound(mp, sfx_thwomp);
|
||||
}
|
||||
|
||||
thwomp->direction = 1; // start heading back up
|
||||
thwomp->distance = TICRATE; // but only after a small delay
|
||||
|
@ -1952,6 +1965,9 @@ void T_ThwompSector(levelspecthink_t *thwomp)
|
|||
thwomp->direction = -1;
|
||||
|
||||
/* // SRB2kart 170217 - Thwomps are automatic.
|
||||
// scan the thinkers to find players!
|
||||
if (!rover || (rover->flags & FF_EXISTS))
|
||||
{
|
||||
// scan the thinkers to find players!
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
{
|
||||
|
@ -1959,12 +1975,14 @@ void T_ThwompSector(levelspecthink_t *thwomp)
|
|||
continue;
|
||||
|
||||
mo = (mobj_t *)th;
|
||||
if (mo->type == MT_PLAYER && mo->health && mo->z <= thwomp->sector->ceilingheight
|
||||
if (mo->type == MT_PLAYER && mo->health && mo->player && !mo->player->spectator
|
||||
&& mo->z <= thwomp->sector->ceilingheight
|
||||
&& P_AproxDistance(thwompx - mo->x, thwompy - mo->y) <= 96*FRACUNIT)
|
||||
{
|
||||
thwomp->direction = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
thwomp->sector->ceilspeed = 0;
|
||||
|
|
|
@ -68,7 +68,6 @@
|
|||
|
||||
// both the head and tail of the thinker list
|
||||
extern thinker_t thinkercap;
|
||||
extern INT32 runcount;
|
||||
|
||||
void P_InitThinkers(void);
|
||||
void P_AddThinker(thinker_t *thinker);
|
||||
|
|
33
src/p_mobj.c
33
src/p_mobj.c
|
@ -4007,7 +4007,8 @@ void P_RecalcPrecipInSector(sector_t *sector)
|
|||
//
|
||||
void P_NullPrecipThinker(precipmobj_t *mobj)
|
||||
{
|
||||
(void)mobj;
|
||||
//(void)mobj;
|
||||
mobj->precipflags &= ~PCF_THUNK;
|
||||
}
|
||||
|
||||
void P_SnowThinker(precipmobj_t *mobj)
|
||||
|
@ -4027,25 +4028,26 @@ void P_RainThinker(precipmobj_t *mobj)
|
|||
{
|
||||
// cycle through states,
|
||||
// calling action functions at transitions
|
||||
if (mobj->tics > 0 && --mobj->tics == 0)
|
||||
{
|
||||
// you can cycle through multiple states in a tic
|
||||
if (!P_SetPrecipMobjState(mobj, mobj->state->nextstate))
|
||||
return; // freed itself
|
||||
}
|
||||
if (mobj->tics <= 0)
|
||||
return;
|
||||
|
||||
if (--mobj->tics)
|
||||
return;
|
||||
|
||||
if (!P_SetPrecipMobjState(mobj, mobj->state->nextstate))
|
||||
return;
|
||||
|
||||
if (mobj->state != &states[S_RAINRETURN])
|
||||
return;
|
||||
|
||||
if (mobj->state == &states[S_RAINRETURN])
|
||||
{
|
||||
mobj->z = mobj->ceilingz;
|
||||
P_SetPrecipMobjState(mobj, S_RAIN1);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// adjust height
|
||||
mobj->z += mobj->momz;
|
||||
|
||||
if (mobj->z <= mobj->floorz)
|
||||
if ((mobj->z += mobj->momz) <= mobj->floorz)
|
||||
{
|
||||
// no splashes on sky or bottomless pits
|
||||
if (mobj->precipflags & PCF_PIT)
|
||||
|
@ -9545,14 +9547,15 @@ static precipmobj_t *P_SpawnPrecipMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype
|
|||
static inline precipmobj_t *P_SpawnRainMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
|
||||
{
|
||||
precipmobj_t *mo = P_SpawnPrecipMobj(x,y,z,type);
|
||||
mo->thinker.function.acp1 = (actionf_p1)P_RainThinker;
|
||||
mo->precipflags |= PCF_RAIN;
|
||||
//mo->thinker.function.acp1 = (actionf_p1)P_RainThinker;
|
||||
return mo;
|
||||
}
|
||||
|
||||
static inline precipmobj_t *P_SpawnSnowMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
|
||||
{
|
||||
precipmobj_t *mo = P_SpawnPrecipMobj(x,y,z,type);
|
||||
mo->thinker.function.acp1 = (actionf_p1)P_SnowThinker;
|
||||
//mo->thinker.function.acp1 = (actionf_p1)P_SnowThinker;
|
||||
return mo;
|
||||
}
|
||||
|
||||
|
|
|
@ -261,6 +261,10 @@ typedef enum {
|
|||
PCF_FOF = 4,
|
||||
// Above MOVING FOF (this means we need to keep floorz up to date...)
|
||||
PCF_MOVINGFOF = 8,
|
||||
// Is rain.
|
||||
PCF_RAIN = 16,
|
||||
// Ran the thinker this tic.
|
||||
PCF_THUNK = 32,
|
||||
} precipflag_t;
|
||||
// Map Object definition.
|
||||
typedef struct mobj_s
|
||||
|
|
|
@ -968,6 +968,7 @@ typedef enum
|
|||
tc_bouncecheese,
|
||||
tc_startcrumble,
|
||||
tc_marioblock,
|
||||
tc_marioblockchecker,
|
||||
tc_spikesector,
|
||||
tc_floatsector,
|
||||
tc_bridgethinker,
|
||||
|
@ -1283,7 +1284,10 @@ static void SaveSpecialLevelThinker(const thinker_t *th, const UINT8 type)
|
|||
size_t i;
|
||||
WRITEUINT8(save_p, type);
|
||||
for (i = 0; i < 16; i++)
|
||||
{
|
||||
WRITEFIXED(save_p, ht->vars[i]); //var[16]
|
||||
WRITEFIXED(save_p, ht->var2s[i]); //var[16]
|
||||
}
|
||||
WRITEUINT32(save_p, SaveLine(ht->sourceline));
|
||||
WRITEUINT32(save_p, SaveSector(ht->sector));
|
||||
}
|
||||
|
@ -1685,8 +1689,7 @@ static void P_NetArchiveThinkers(void)
|
|||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
{
|
||||
if (!(th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed
|
||||
|| th->function.acp1 == (actionf_p1)P_RainThinker
|
||||
|| th->function.acp1 == (actionf_p1)P_SnowThinker))
|
||||
|| th->function.acp1 == (actionf_p1)P_NullPrecipThinker))
|
||||
numsaved++;
|
||||
|
||||
if (th->function.acp1 == (actionf_p1)P_MobjThinker)
|
||||
|
@ -1695,8 +1698,7 @@ static void P_NetArchiveThinkers(void)
|
|||
continue;
|
||||
}
|
||||
#ifdef PARANOIA
|
||||
else if (th->function.acp1 == (actionf_p1)P_RainThinker
|
||||
|| th->function.acp1 == (actionf_p1)P_SnowThinker);
|
||||
else if (th->function.acp1 == (actionf_p1)P_NullPrecipThinker);
|
||||
#endif
|
||||
else if (th->function.acp1 == (actionf_p1)T_MoveCeiling)
|
||||
{
|
||||
|
@ -1798,6 +1800,11 @@ static void P_NetArchiveThinkers(void)
|
|||
SaveSpecialLevelThinker(th, tc_marioblock);
|
||||
continue;
|
||||
}
|
||||
else if (th->function.acp1 == (actionf_p1)T_MarioBlockChecker)
|
||||
{
|
||||
SaveSpecialLevelThinker(th, tc_marioblockchecker);
|
||||
continue;
|
||||
}
|
||||
else if (th->function.acp1 == (actionf_p1)T_SpikeSector)
|
||||
{
|
||||
SaveSpecialLevelThinker(th, tc_spikesector);
|
||||
|
@ -2189,7 +2196,10 @@ static void LoadSpecialLevelThinker(actionf_p1 thinker, UINT8 floorOrCeiling)
|
|||
size_t i;
|
||||
ht->thinker.function.acp1 = thinker;
|
||||
for (i = 0; i < 16; i++)
|
||||
{
|
||||
ht->vars[i] = READFIXED(save_p); //var[16]
|
||||
ht->var2s[i] = READFIXED(save_p); //var[16]
|
||||
}
|
||||
ht->sourceline = LoadLine(READUINT32(save_p));
|
||||
ht->sector = LoadSector(READUINT32(save_p));
|
||||
|
||||
|
@ -2762,6 +2772,10 @@ static void P_NetUnArchiveThinkers(void)
|
|||
LoadSpecialLevelThinker((actionf_p1)T_MarioBlock, 3);
|
||||
break;
|
||||
|
||||
case tc_marioblockchecker:
|
||||
LoadSpecialLevelThinker((actionf_p1)T_MarioBlockChecker, 0);
|
||||
break;
|
||||
|
||||
case tc_spikesector:
|
||||
LoadSpecialLevelThinker((actionf_p1)T_SpikeSector, 0);
|
||||
break;
|
||||
|
|
|
@ -2782,7 +2782,6 @@ boolean P_SetupLevel(boolean skipprecip)
|
|||
P_CreateBlockMap(); // Graue 02-29-2004
|
||||
P_LoadSideDefs2(lastloadedmaplumpnum + ML_SIDEDEFS);
|
||||
|
||||
R_MakeColormaps();
|
||||
P_LoadLineDefs2();
|
||||
P_LoadSubsectors(lastloadedmaplumpnum + ML_SSECTORS);
|
||||
P_LoadNodes(lastloadedmaplumpnum + ML_NODES);
|
||||
|
|
32
src/p_spec.c
32
src/p_spec.c
|
@ -2056,8 +2056,7 @@ void P_SwitchWeather(INT32 weathernum)
|
|||
|
||||
for (think = thinkercap.next; think != &thinkercap; think = think->next)
|
||||
{
|
||||
if ((think->function.acp1 != (actionf_p1)P_SnowThinker)
|
||||
&& (think->function.acp1 != (actionf_p1)P_RainThinker))
|
||||
if (think->function.acp1 != (actionf_p1)P_NullPrecipThinker)
|
||||
continue; // not a precipmobj thinker
|
||||
|
||||
precipmobj = (precipmobj_t *)think;
|
||||
|
@ -2073,14 +2072,12 @@ void P_SwitchWeather(INT32 weathernum)
|
|||
|
||||
for (think = thinkercap.next; think != &thinkercap; think = think->next)
|
||||
{
|
||||
if (swap == PRECIP_RAIN) // Snow To Rain
|
||||
{
|
||||
if (!(think->function.acp1 == (actionf_p1)P_SnowThinker
|
||||
|| think->function.acp1 == (actionf_p1)P_NullPrecipThinker))
|
||||
if (think->function.acp1 != (actionf_p1)P_NullPrecipThinker)
|
||||
continue; // not a precipmobj thinker
|
||||
|
||||
precipmobj = (precipmobj_t *)think;
|
||||
|
||||
if (swap == PRECIP_RAIN) // Snow To Rain
|
||||
{
|
||||
precipmobj->flags = mobjinfo[MT_RAIN].flags;
|
||||
st = &states[mobjinfo[MT_RAIN].spawnstate];
|
||||
precipmobj->state = st;
|
||||
|
@ -2091,18 +2088,13 @@ void P_SwitchWeather(INT32 weathernum)
|
|||
|
||||
precipmobj->precipflags &= ~PCF_INVISIBLE;
|
||||
|
||||
think->function.acp1 = (actionf_p1)P_RainThinker;
|
||||
precipmobj->precipflags |= PCF_RAIN;
|
||||
//think->function.acp1 = (actionf_p1)P_RainThinker;
|
||||
}
|
||||
else if (swap == PRECIP_SNOW) // Rain To Snow
|
||||
{
|
||||
INT32 z;
|
||||
|
||||
if (!(think->function.acp1 == (actionf_p1)P_RainThinker
|
||||
|| think->function.acp1 == (actionf_p1)P_NullPrecipThinker))
|
||||
continue; // not a precipmobj thinker
|
||||
|
||||
precipmobj = (precipmobj_t *)think;
|
||||
|
||||
precipmobj->flags = mobjinfo[MT_SNOWFLAKE].flags;
|
||||
z = M_RandomByte();
|
||||
|
||||
|
@ -2120,19 +2112,13 @@ void P_SwitchWeather(INT32 weathernum)
|
|||
precipmobj->frame = st->frame;
|
||||
precipmobj->momz = mobjinfo[MT_SNOWFLAKE].speed;
|
||||
|
||||
precipmobj->precipflags &= ~PCF_INVISIBLE;
|
||||
precipmobj->precipflags &= ~(PCF_INVISIBLE|PCF_RAIN);
|
||||
|
||||
think->function.acp1 = (actionf_p1)P_SnowThinker;
|
||||
//think->function.acp1 = (actionf_p1)P_SnowThinker;
|
||||
}
|
||||
else if (swap == PRECIP_BLANK || swap == PRECIP_STORM_NORAIN) // Remove precip, but keep it around for reuse.
|
||||
{
|
||||
if (!(think->function.acp1 == (actionf_p1)P_RainThinker
|
||||
|| think->function.acp1 == (actionf_p1)P_SnowThinker))
|
||||
continue;
|
||||
|
||||
precipmobj = (precipmobj_t *)think;
|
||||
|
||||
think->function.acp1 = (actionf_p1)P_NullPrecipThinker;
|
||||
//think->function.acp1 = (actionf_p1)P_NullPrecipThinker;
|
||||
|
||||
precipmobj->precipflags |= PCF_INVISIBLE;
|
||||
}
|
||||
|
|
24
src/p_tick.c
24
src/p_tick.c
|
@ -57,12 +57,12 @@ void Command_Numthinkers_f(void)
|
|||
CONS_Printf(M_GetText("numthinkers <#>: Count number of thinkers\n"));
|
||||
CONS_Printf(
|
||||
"\t1: P_MobjThinker\n"
|
||||
"\t2: P_RainThinker\n"
|
||||
"\t3: P_SnowThinker\n"
|
||||
"\t4: P_NullPrecipThinker\n"
|
||||
"\t5: T_Friction\n"
|
||||
"\t6: T_Pusher\n"
|
||||
"\t7: P_RemoveThinkerDelayed\n");
|
||||
/*"\t2: P_RainThinker\n"
|
||||
"\t3: P_SnowThinker\n"*/
|
||||
"\t2: P_NullPrecipThinker\n"
|
||||
"\t3: T_Friction\n"
|
||||
"\t4: T_Pusher\n"
|
||||
"\t5: P_RemoveThinkerDelayed\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -74,27 +74,27 @@ void Command_Numthinkers_f(void)
|
|||
action = (actionf_p1)P_MobjThinker;
|
||||
CONS_Printf(M_GetText("Number of %s: "), "P_MobjThinker");
|
||||
break;
|
||||
case 2:
|
||||
/*case 2:
|
||||
action = (actionf_p1)P_RainThinker;
|
||||
CONS_Printf(M_GetText("Number of %s: "), "P_RainThinker");
|
||||
break;
|
||||
case 3:
|
||||
action = (actionf_p1)P_SnowThinker;
|
||||
CONS_Printf(M_GetText("Number of %s: "), "P_SnowThinker");
|
||||
break;
|
||||
case 4:
|
||||
break;*/
|
||||
case 2:
|
||||
action = (actionf_p1)P_NullPrecipThinker;
|
||||
CONS_Printf(M_GetText("Number of %s: "), "P_NullPrecipThinker");
|
||||
break;
|
||||
case 5:
|
||||
case 3:
|
||||
action = (actionf_p1)T_Friction;
|
||||
CONS_Printf(M_GetText("Number of %s: "), "T_Friction");
|
||||
break;
|
||||
case 6:
|
||||
case 4:
|
||||
action = (actionf_p1)T_Pusher;
|
||||
CONS_Printf(M_GetText("Number of %s: "), "T_Pusher");
|
||||
break;
|
||||
case 7:
|
||||
case 5:
|
||||
action = (actionf_p1)P_RemoveThinkerDelayed;
|
||||
CONS_Printf(M_GetText("Number of %s: "), "P_RemoveThinkerDelayed");
|
||||
break;
|
||||
|
|
31
src/p_user.c
31
src/p_user.c
|
@ -8143,11 +8143,17 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
|||
subsector_t *newsubsec;
|
||||
fixed_t f1, f2;
|
||||
|
||||
// We probably shouldn't move the camera if there is no player or player mobj somehow
|
||||
if (!player || !player->mo)
|
||||
return true;
|
||||
|
||||
mo = player->mo;
|
||||
|
||||
#ifdef NOCLIPCAM
|
||||
cameranoclip = true; // We like camera noclip!
|
||||
#else
|
||||
cameranoclip = ((player->pflags & (PF_NOCLIP|PF_NIGHTSMODE))
|
||||
|| (player->mo->flags & (MF_NOCLIP|MF_NOCLIPHEIGHT)) // Noclipping player camera noclips too!!
|
||||
|| (mo->flags & (MF_NOCLIP|MF_NOCLIPHEIGHT)) // Noclipping player camera noclips too!!
|
||||
|| (leveltime < introtime)); // Kart intro cam
|
||||
#endif
|
||||
|
||||
|
@ -8180,7 +8186,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
|||
else if (player == &players[fourthdisplayplayer])
|
||||
focusangle = localangle4;
|
||||
else
|
||||
focusangle = player->mo->angle;
|
||||
focusangle = mo->angle;
|
||||
if (thiscam == &camera)
|
||||
camrotate = cv_cam_rotate.value;
|
||||
else if (thiscam == &camera2)
|
||||
|
@ -8201,17 +8207,9 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
|||
return true;
|
||||
}
|
||||
|
||||
if (!player || !player->mo)
|
||||
return true;
|
||||
|
||||
mo = player->mo;
|
||||
|
||||
thiscam->radius = FixedMul(20*FRACUNIT, mapheaderinfo[gamemap-1]->mobj_scale);
|
||||
thiscam->height = FixedMul(16*FRACUNIT, mapheaderinfo[gamemap-1]->mobj_scale);
|
||||
|
||||
if (!mo)
|
||||
return true;
|
||||
|
||||
// Don't run while respawning from a starpost
|
||||
// Inu 4/8/13 Why not?!
|
||||
// if (leveltime > 0 && timeinmap <= 0)
|
||||
|
@ -8219,7 +8217,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
|||
|
||||
if (player->pflags & PF_NIGHTSMODE)
|
||||
{
|
||||
focusangle = player->mo->angle;
|
||||
focusangle = mo->angle;
|
||||
focusaiming = 0;
|
||||
}
|
||||
else if (player == &players[consoleplayer])
|
||||
|
@ -8244,7 +8242,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
|||
}
|
||||
else
|
||||
{
|
||||
focusangle = player->mo->angle;
|
||||
focusangle = mo->angle;
|
||||
focusaiming = player->aiming;
|
||||
}
|
||||
|
||||
|
@ -8909,8 +8907,6 @@ void P_DoTimeOver(player_t *player)
|
|||
// P_PlayerThink
|
||||
//
|
||||
|
||||
boolean playerdeadview; // show match/chaos/tag/capture the flag rankings while in death view
|
||||
|
||||
void P_PlayerThink(player_t *player)
|
||||
{
|
||||
ticcmd_t *cmd;
|
||||
|
@ -9093,10 +9089,6 @@ void P_PlayerThink(player_t *player)
|
|||
if (player->playerstate == PST_DEAD)
|
||||
{
|
||||
player->mo->flags2 &= ~MF2_SHADOW;
|
||||
// show the multiplayer rankings while dead
|
||||
if (player == &players[displayplayer])
|
||||
playerdeadview = true;
|
||||
|
||||
P_DeathThink(player);
|
||||
|
||||
return;
|
||||
|
@ -9121,9 +9113,6 @@ void P_PlayerThink(player_t *player)
|
|||
player->lives = 1; // SRB2Kart
|
||||
#endif
|
||||
|
||||
if (player == &players[displayplayer])
|
||||
playerdeadview = false;
|
||||
|
||||
// SRB2kart 010217
|
||||
if (leveltime < starttime)
|
||||
player->powers[pw_nocontrol] = 2;
|
||||
|
|
253
src/r_data.c
253
src/r_data.c
|
@ -476,40 +476,22 @@ void R_LoadTextures(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
UINT16 patchcount = 1;
|
||||
//CONS_Printf("\n\"%s\" is a single patch, dimensions %d x %d",W_CheckNameForNumPwad((UINT16)w,texstart+j),patchlump->width, patchlump->height);
|
||||
if (SHORT(patchlump->width) == 64
|
||||
&& SHORT(patchlump->height) == 64)
|
||||
{ // 64x64 patch
|
||||
const column_t *column;
|
||||
for (k = 0; k < SHORT(patchlump->width); k++)
|
||||
{ // Find use of transparency.
|
||||
column = (const column_t *)((const UINT8 *)patchlump + LONG(patchlump->columnofs[k]));
|
||||
if (column->length != SHORT(patchlump->height))
|
||||
break;
|
||||
}
|
||||
if (k == SHORT(patchlump->width))
|
||||
patchcount = 2; // No transparency? 64x128 texture.
|
||||
}
|
||||
texture = textures[i] = Z_Calloc(sizeof(texture_t) + (sizeof(texpatch_t) * patchcount), PU_STATIC, NULL);
|
||||
texture = textures[i] = Z_Calloc(sizeof(texture_t) + sizeof(texpatch_t), PU_STATIC, NULL);
|
||||
|
||||
// Set texture properties.
|
||||
M_Memcpy(texture->name, W_CheckNameForNumPwad((UINT16)w, texstart + j), sizeof(texture->name));
|
||||
texture->width = SHORT(patchlump->width);
|
||||
texture->height = SHORT(patchlump->height)*patchcount;
|
||||
texture->patchcount = patchcount;
|
||||
texture->height = SHORT(patchlump->height);
|
||||
texture->patchcount = 1;
|
||||
texture->holes = false;
|
||||
|
||||
// Allocate information for the texture's patches.
|
||||
for (k = 0; k < patchcount; k++)
|
||||
{
|
||||
patch = &texture->patches[k];
|
||||
patch = &texture->patches[0];
|
||||
|
||||
patch->originx = 0;
|
||||
patch->originy = (INT16)(k*patchlump->height);
|
||||
patch->originx = patch->originy = 0;
|
||||
patch->wad = (UINT16)w;
|
||||
patch->lump = texstart + j;
|
||||
}
|
||||
|
||||
Z_Unlock(patchlump);
|
||||
|
||||
|
@ -1071,9 +1053,6 @@ void R_ReInitColormaps(UINT16 num, lumpnum_t newencoremap)
|
|||
|
||||
static lumpnum_t foundcolormaps[MAXCOLORMAPS];
|
||||
|
||||
static char colormapFixingArray[MAXCOLORMAPS][3][9];
|
||||
static size_t carrayindex;
|
||||
|
||||
//
|
||||
// R_ClearColormaps
|
||||
//
|
||||
|
@ -1085,8 +1064,6 @@ void R_ClearColormaps(void)
|
|||
|
||||
num_extra_colormaps = 0;
|
||||
|
||||
carrayindex = 0;
|
||||
|
||||
for (i = 0; i < MAXCOLORMAPS; i++)
|
||||
foundcolormaps[i] = LUMPERROR;
|
||||
|
||||
|
@ -1140,10 +1117,20 @@ static double deltas[256][3], map[256][3];
|
|||
static UINT8 NearestColor(UINT8 r, UINT8 g, UINT8 b);
|
||||
static int RoundUp(double number);
|
||||
|
||||
#ifdef HASINVERT
|
||||
void R_MakeInvertmap(void)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < 256; i++)
|
||||
invertmap[i] = NearestColor(256 - pLocalPalette[i].s.red, 256 - pLocalPalette[i].s.green, 256 - pLocalPalette[i].s.blue);
|
||||
}
|
||||
#endif
|
||||
|
||||
INT32 R_CreateColormap(char *p1, char *p2, char *p3)
|
||||
{
|
||||
double cmaskr, cmaskg, cmaskb, cdestr, cdestg, cdestb;
|
||||
double r, g, b, cbrightness, maskamt = 0, othermask = 0;
|
||||
double maskamt = 0, othermask = 0;
|
||||
int mask, fog = 0;
|
||||
size_t mapnum = num_extra_colormaps;
|
||||
size_t i;
|
||||
|
@ -1206,7 +1193,7 @@ INT32 R_CreateColormap(char *p1, char *p2, char *p3)
|
|||
fadedist = fadeend - fadestart;
|
||||
fog = NUMFROMCHAR(p2[1]);
|
||||
}
|
||||
#undef getnum
|
||||
#undef NUMFROMCHAR
|
||||
|
||||
if (p3[0] == '#')
|
||||
{
|
||||
|
@ -1249,38 +1236,8 @@ INT32 R_CreateColormap(char *p1, char *p2, char *p3)
|
|||
if (num_extra_colormaps == MAXCOLORMAPS)
|
||||
I_Error("R_CreateColormap: Too many colormaps! the limit is %d\n", MAXCOLORMAPS);
|
||||
|
||||
strncpy(colormapFixingArray[num_extra_colormaps][0], p1, 8);
|
||||
strncpy(colormapFixingArray[num_extra_colormaps][1], p2, 8);
|
||||
strncpy(colormapFixingArray[num_extra_colormaps][2], p3, 8);
|
||||
|
||||
num_extra_colormaps++;
|
||||
|
||||
if (rendermode == render_soft)
|
||||
{
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
r = pLocalPalette[i].s.red;
|
||||
g = pLocalPalette[i].s.green;
|
||||
b = pLocalPalette[i].s.blue;
|
||||
cbrightness = sqrt((r*r) + (g*g) + (b*b));
|
||||
|
||||
map[i][0] = (cbrightness * cmaskr) + (r * othermask);
|
||||
if (map[i][0] > 255.0l)
|
||||
map[i][0] = 255.0l;
|
||||
deltas[i][0] = (map[i][0] - cdestr) / (double)fadedist;
|
||||
|
||||
map[i][1] = (cbrightness * cmaskg) + (g * othermask);
|
||||
if (map[i][1] > 255.0l)
|
||||
map[i][1] = 255.0l;
|
||||
deltas[i][1] = (map[i][1] - cdestg) / (double)fadedist;
|
||||
|
||||
map[i][2] = (cbrightness * cmaskb) + (b * othermask);
|
||||
if (map[i][2] > 255.0l)
|
||||
map[i][2] = 255.0l;
|
||||
deltas[i][2] = (map[i][2] - cdestb) / (double)fadedist;
|
||||
}
|
||||
}
|
||||
|
||||
foundcolormaps[mapnum] = LUMPERROR;
|
||||
|
||||
// aligned on 8 bit for asm code
|
||||
|
@ -1292,145 +1249,17 @@ INT32 R_CreateColormap(char *p1, char *p2, char *p3)
|
|||
extra_colormaps[mapnum].fadeend = (UINT16)fadeend;
|
||||
extra_colormaps[mapnum].fog = fog;
|
||||
|
||||
return (INT32)mapnum;
|
||||
}
|
||||
|
||||
void R_MakeColormaps(void)
|
||||
if (rendermode == render_soft)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
carrayindex = num_extra_colormaps;
|
||||
num_extra_colormaps = 0;
|
||||
|
||||
for (i = 0; i < carrayindex; i++)
|
||||
R_CreateColormap2(colormapFixingArray[i][0], colormapFixingArray[i][1],
|
||||
colormapFixingArray[i][2]);
|
||||
}
|
||||
|
||||
#ifdef HASINVERT
|
||||
void R_MakeInvertmap(void)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < 256; i++)
|
||||
invertmap[i] = NearestColor(256 - pLocalPalette[i].s.red, 256 - pLocalPalette[i].s.green, 256 - pLocalPalette[i].s.blue);
|
||||
}
|
||||
#endif
|
||||
|
||||
void R_CreateColormap2(char *p1, char *p2, char *p3)
|
||||
{
|
||||
double cmaskr, cmaskg, cmaskb, cdestr, cdestg, cdestb;
|
||||
double r, g, b, cbrightness;
|
||||
double maskamt = 0, othermask = 0;
|
||||
INT32 mask, p, fog = 0;
|
||||
size_t mapnum = num_extra_colormaps;
|
||||
size_t i;
|
||||
lighttable_t *colormap_p, *colormap_p2;
|
||||
UINT32 cr, cg, cb, maskcolor, fadecolor;
|
||||
UINT32 fadestart = 0, fadeend = 31, fadedist = 31;
|
||||
int p;
|
||||
lighttable_t *colormap_p;
|
||||
|
||||
#define HEX2INT(x) (UINT32)(x >= '0' && x <= '9' ? x - '0' : x >= 'a' && x <= 'f' ? x - 'a' + 10 : x >= 'A' && x <= 'F' ? x - 'A' + 10 : 0)
|
||||
if (p1[0] == '#')
|
||||
{
|
||||
cr = ((HEX2INT(p1[1]) * 16) + HEX2INT(p1[2]));
|
||||
cg = ((HEX2INT(p1[3]) * 16) + HEX2INT(p1[4]));
|
||||
cb = ((HEX2INT(p1[5]) * 16) + HEX2INT(p1[6]));
|
||||
|
||||
if (encoremap)
|
||||
{
|
||||
i = encoremap[NearestColor((UINT8)cr, (UINT8)cg, (UINT8)cb)];
|
||||
cr = pLocalPalette[i].s.red;
|
||||
cg = pLocalPalette[i].s.green;
|
||||
cb = pLocalPalette[i].s.blue;
|
||||
}
|
||||
|
||||
cmaskr = cr;
|
||||
cmaskg = cg;
|
||||
cmaskb = cb;
|
||||
// Create a rough approximation of the color (a 16 bit color)
|
||||
maskcolor = ((cb) >> 3) + (((cg) >> 2) << 5) + (((cr) >> 3) << 11);
|
||||
if (p1[7] >= 'a' && p1[7] <= 'z')
|
||||
mask = (p1[7] - 'a');
|
||||
else if (p1[7] >= 'A' && p1[7] <= 'Z')
|
||||
mask = (p1[7] - 'A');
|
||||
else
|
||||
mask = 24;
|
||||
|
||||
maskamt = (double)(mask/24.0l);
|
||||
|
||||
othermask = 1 - maskamt;
|
||||
maskamt /= 0xff;
|
||||
cmaskr *= maskamt;
|
||||
cmaskg *= maskamt;
|
||||
cmaskb *= maskamt;
|
||||
}
|
||||
else
|
||||
{
|
||||
cmaskr = cmaskg = cmaskb = 0xff;
|
||||
maskamt = 0;
|
||||
maskcolor = ((0xff) >> 3) + (((0xff) >> 2) << 5) + (((0xff) >> 3) << 11);
|
||||
}
|
||||
|
||||
#define NUMFROMCHAR(c) (c >= '0' && c <= '9' ? c - '0' : 0)
|
||||
if (p2[0] == '#')
|
||||
{
|
||||
// Get parameters like fadestart, fadeend, and the fogflag
|
||||
fadestart = NUMFROMCHAR(p2[3]) + (NUMFROMCHAR(p2[2]) * 10);
|
||||
fadeend = NUMFROMCHAR(p2[5]) + (NUMFROMCHAR(p2[4]) * 10);
|
||||
if (fadestart > 30)
|
||||
fadestart = 0;
|
||||
if (fadeend > 31 || fadeend < 1)
|
||||
fadeend = 31;
|
||||
fadedist = fadeend - fadestart;
|
||||
fog = NUMFROMCHAR(p2[1]);
|
||||
}
|
||||
#undef getnum
|
||||
|
||||
if (p3[0] == '#')
|
||||
{
|
||||
cr = ((HEX2INT(p3[1]) * 16) + HEX2INT(p3[2]));
|
||||
cg = ((HEX2INT(p3[3]) * 16) + HEX2INT(p3[4]));
|
||||
cb = ((HEX2INT(p3[5]) * 16) + HEX2INT(p3[6]));
|
||||
|
||||
if (encoremap)
|
||||
{
|
||||
i = encoremap[NearestColor((UINT8)cr, (UINT8)cg, (UINT8)cb)];
|
||||
cr = pLocalPalette[i].s.red;
|
||||
cg = pLocalPalette[i].s.green;
|
||||
cb = pLocalPalette[i].s.blue;
|
||||
}
|
||||
|
||||
cdestr = cr;
|
||||
cdestg = cg;
|
||||
cdestb = cb;
|
||||
fadecolor = (((cb) >> 3) + (((cg) >> 2) << 5) + (((cr) >> 3) << 11));
|
||||
}
|
||||
else
|
||||
cdestr = cdestg = cdestb = fadecolor = 0;
|
||||
#undef HEX2INT
|
||||
|
||||
for (i = 0; i < num_extra_colormaps; i++)
|
||||
{
|
||||
if (foundcolormaps[i] != LUMPERROR)
|
||||
continue;
|
||||
if (maskcolor == extra_colormaps[i].maskcolor
|
||||
&& fadecolor == extra_colormaps[i].fadecolor
|
||||
&& (float)maskamt == (float)extra_colormaps[i].maskamt
|
||||
&& fadestart == extra_colormaps[i].fadestart
|
||||
&& fadeend == extra_colormaps[i].fadeend
|
||||
&& fog == extra_colormaps[i].fog)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (num_extra_colormaps == MAXCOLORMAPS)
|
||||
I_Error("R_CreateColormap: Too many colormaps! the limit is %d\n", MAXCOLORMAPS);
|
||||
|
||||
num_extra_colormaps++;
|
||||
|
||||
if (rendermode == render_soft)
|
||||
{
|
||||
// Initialise the map and delta arrays
|
||||
// map[i] stores an RGB color (as double) for index i,
|
||||
// which is then converted to SRB2's palette later
|
||||
// deltas[i] stores a corresponding fade delta between the RGB color and the final fade color;
|
||||
// map[i]'s values are decremented by after each use
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
r = pLocalPalette[i].s.red;
|
||||
|
@ -1453,25 +1282,13 @@ void R_CreateColormap2(char *p1, char *p2, char *p3)
|
|||
map[i][2] = 255.0l;
|
||||
deltas[i][2] = (map[i][2] - cdestb) / (double)fadedist;
|
||||
}
|
||||
}
|
||||
|
||||
foundcolormaps[mapnum] = LUMPERROR;
|
||||
|
||||
// aligned on 8 bit for asm code
|
||||
extra_colormaps[mapnum].colormap = NULL;
|
||||
extra_colormaps[mapnum].maskcolor = (UINT16)maskcolor;
|
||||
extra_colormaps[mapnum].fadecolor = (UINT16)fadecolor;
|
||||
extra_colormaps[mapnum].maskamt = maskamt;
|
||||
extra_colormaps[mapnum].fadestart = (UINT16)fadestart;
|
||||
extra_colormaps[mapnum].fadeend = (UINT16)fadeend;
|
||||
extra_colormaps[mapnum].fog = fog;
|
||||
|
||||
#define ABS2(x) ((x) < 0 ? -(x) : (x))
|
||||
if (rendermode == render_soft)
|
||||
{
|
||||
// Now allocate memory for the actual colormap array itself!
|
||||
colormap_p = Z_MallocAlign((256 * (encoremap ? 64 : 32)) + 10, PU_LEVEL, NULL, 8);
|
||||
extra_colormaps[mapnum].colormap = (UINT8 *)colormap_p;
|
||||
|
||||
// Calculate the palette index for each palette index, for each light level
|
||||
// (as well as the two unused colormap lines we inherited from Doom)
|
||||
for (p = 0; p < 32; p++)
|
||||
{
|
||||
for (i = 0; i < 256; i++)
|
||||
|
@ -1483,7 +1300,7 @@ void R_CreateColormap2(char *p1, char *p2, char *p3)
|
|||
|
||||
if ((UINT32)p < fadestart)
|
||||
continue;
|
||||
|
||||
#define ABS2(x) ((x) < 0 ? -(x) : (x))
|
||||
if (ABS2(map[i][0] - cdestr) > ABS2(deltas[i][0]))
|
||||
map[i][0] -= deltas[i][0];
|
||||
else
|
||||
|
@ -1498,13 +1315,13 @@ void R_CreateColormap2(char *p1, char *p2, char *p3)
|
|||
map[i][2] -= deltas[i][2];
|
||||
else
|
||||
map[i][2] = cdestb;
|
||||
#undef ABS2
|
||||
}
|
||||
}
|
||||
|
||||
if (!encoremap)
|
||||
return;
|
||||
|
||||
colormap_p2 = extra_colormaps[mapnum].colormap;
|
||||
if (encoremap)
|
||||
{
|
||||
lighttable_t *colormap_p2 = extra_colormaps[mapnum].colormap;
|
||||
|
||||
for (p = 0; p < 32; p++)
|
||||
{
|
||||
|
@ -1516,9 +1333,9 @@ void R_CreateColormap2(char *p1, char *p2, char *p3)
|
|||
colormap_p2 += 256;
|
||||
}
|
||||
}
|
||||
#undef ABS2
|
||||
}
|
||||
|
||||
return;
|
||||
return (INT32)mapnum;
|
||||
}
|
||||
|
||||
// Thanks to quake2 source!
|
||||
|
|
|
@ -93,8 +93,6 @@ void R_ReInitColormaps(UINT16 num, lumpnum_t newencoremap);
|
|||
void R_ClearColormaps(void);
|
||||
INT32 R_ColormapNumForName(char *name);
|
||||
INT32 R_CreateColormap(char *p1, char *p2, char *p3);
|
||||
void R_CreateColormap2(char *p1, char *p2, char *p3);
|
||||
void R_MakeColormaps(void);
|
||||
#ifdef HASINVERT
|
||||
void R_MakeInvertmap(void);
|
||||
#endif
|
||||
|
|
12
src/r_main.c
12
src/r_main.c
|
@ -60,7 +60,6 @@ fixed_t projectiony; // aspect ratio
|
|||
// just for profiling purposes
|
||||
size_t framecount;
|
||||
|
||||
size_t sscount;
|
||||
size_t loopcount;
|
||||
|
||||
fixed_t viewx, viewy, viewz;
|
||||
|
@ -557,9 +556,6 @@ static void R_InitTextureMapping(void)
|
|||
// Take out the fencepost cases from viewangletox.
|
||||
for (i = 0; i < FINEANGLES/2; i++)
|
||||
{
|
||||
t = FixedMul(FINETANGENT(i), focallength);
|
||||
t = centerx - t;
|
||||
|
||||
if (viewangletox[i] == -1)
|
||||
viewangletox[i] = 0;
|
||||
else if (viewangletox[i] == viewwidth+1)
|
||||
|
@ -1048,8 +1044,6 @@ void R_SkyboxFrame(player_t *player)
|
|||
viewsin = FINESINE(viewangle>>ANGLETOFINESHIFT);
|
||||
viewcos = FINECOSINE(viewangle>>ANGLETOFINESHIFT);
|
||||
|
||||
sscount = 0;
|
||||
|
||||
// recalc necessary stuff for mouseaiming
|
||||
// slopes are already calculated for the full possible view (which is 4*viewheight).
|
||||
|
||||
|
@ -1192,8 +1186,6 @@ void R_SetupFrame(player_t *player, boolean skybox)
|
|||
viewsin = FINESINE(viewangle>>ANGLETOFINESHIFT);
|
||||
viewcos = FINECOSINE(viewangle>>ANGLETOFINESHIFT);
|
||||
|
||||
sscount = 0;
|
||||
|
||||
// recalc necessary stuff for mouseaiming
|
||||
// slopes are already calculated for the full possible view (which is 4*viewheight).
|
||||
|
||||
|
@ -1349,9 +1341,9 @@ void R_RenderPlayerView(player_t *player)
|
|||
if (cv_homremoval.value && player == &players[displayplayer])
|
||||
{
|
||||
if (cv_homremoval.value == 1)
|
||||
V_DrawFill(0, 0, vid.width, vid.height, 31); // No HOM effect!
|
||||
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31); // No HOM effect!
|
||||
else //'development' HOM removal -- makes it blindingly obvious if HOM is spotted.
|
||||
V_DrawFill(0, 0, vid.width, vid.height, 128+(timeinmap&15));
|
||||
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 128+(timeinmap&15));
|
||||
}
|
||||
// Draw over the fourth screen so you don't have to stare at a HOM :V
|
||||
else if (splitscreen == 2 && player == &players[thirddisplayplayer])
|
||||
|
|
|
@ -112,7 +112,4 @@ extern angle_t rw_normalangle;
|
|||
// angle to line origin
|
||||
extern angle_t rw_angle1;
|
||||
|
||||
// Segs count?
|
||||
extern size_t sscount;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1602,6 +1602,17 @@ static void R_ProjectPrecipitationSprite(precipmobj_t *thing)
|
|||
return;
|
||||
}
|
||||
|
||||
// okay, we can't return now except for vertical clipping... this is a hack, but weather isn't networked, so it should be ok
|
||||
if (!(thing->precipflags & PCF_THUNK))
|
||||
{
|
||||
if (thing->precipflags & PCF_RAIN)
|
||||
P_RainThinker(thing);
|
||||
else
|
||||
P_SnowThinker(thing);
|
||||
thing->precipflags |= PCF_THUNK;
|
||||
}
|
||||
|
||||
|
||||
//SoM: 3/17/2000: Disregard sprites that are out of view..
|
||||
gzt = thing->z + spritecachedinfo[lump].topoffset;
|
||||
gz = gzt - spritecachedinfo[lump].height;
|
||||
|
@ -1740,7 +1751,9 @@ void R_AddSprites(sector_t *sec, INT32 lightlevel, UINT8 viewnumber)
|
|||
|
||||
approx_dist = P_AproxDistance(viewx-thing->x, viewy-thing->y);
|
||||
|
||||
if (approx_dist <= limit_dist)
|
||||
if (approx_dist > limit_dist)
|
||||
continue;
|
||||
|
||||
R_ProjectSprite(thing);
|
||||
}
|
||||
}
|
||||
|
@ -1785,7 +1798,9 @@ void R_AddSprites(sector_t *sec, INT32 lightlevel, UINT8 viewnumber)
|
|||
|
||||
approx_dist = P_AproxDistance(viewx-precipthing->x, viewy-precipthing->y);
|
||||
|
||||
if (approx_dist <= limit_dist)
|
||||
if (approx_dist > limit_dist)
|
||||
continue;
|
||||
|
||||
R_ProjectPrecipitationSprite(precipthing);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -582,7 +582,7 @@ void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume)
|
|||
|
||||
// Assigns the handle to one of the channels in the
|
||||
// mix/output buffer.
|
||||
channels[cnum].handle = I_StartSound(sfx_id, volume, sep, pitch, priority);
|
||||
channels[cnum].handle = I_StartSound(sfx_id, volume, sep, pitch, priority, cnum);
|
||||
}
|
||||
|
||||
dontplay:
|
||||
|
@ -638,7 +638,7 @@ dontplay:
|
|||
|
||||
// Assigns the handle to one of the channels in the
|
||||
// mix/output buffer.
|
||||
channels[cnum].handle = I_StartSound(sfx_id, volume, sep, pitch, priority);
|
||||
channels[cnum].handle = I_StartSound(sfx_id, volume, sep, pitch, priority, cnum);
|
||||
}
|
||||
|
||||
dontplay3:
|
||||
|
@ -694,7 +694,7 @@ dontplay3:
|
|||
|
||||
// Assigns the handle to one of the channels in the
|
||||
// mix/output buffer.
|
||||
channels[cnum].handle = I_StartSound(sfx_id, volume, sep, pitch, priority);
|
||||
channels[cnum].handle = I_StartSound(sfx_id, volume, sep, pitch, priority, cnum);
|
||||
}
|
||||
|
||||
dontplay4:
|
||||
|
@ -743,7 +743,7 @@ dontplay4:
|
|||
|
||||
// Assigns the handle to one of the channels in the
|
||||
// mix/output buffer.
|
||||
channels[cnum].handle = I_StartSound(sfx_id, volume, sep, pitch, priority);
|
||||
channels[cnum].handle = I_StartSound(sfx_id, volume, sep, pitch, priority, cnum);
|
||||
}
|
||||
|
||||
void S_StartSound(const void *origin, sfxenum_t sfx_id)
|
||||
|
|
|
@ -124,6 +124,10 @@ typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T);
|
|||
#include "macosx/mac_resources.h"
|
||||
#endif
|
||||
|
||||
#ifndef errno
|
||||
#include <errno.h>
|
||||
#endif
|
||||
|
||||
// Locations for searching the srb2.srb
|
||||
#if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)
|
||||
#define DEFAULTWADLOCATION1 "/usr/local/share/games/SRB2"
|
||||
|
@ -1179,6 +1183,7 @@ static void I_ShutdownJoystick2(void)
|
|||
D_PostEvent(&event);
|
||||
}
|
||||
|
||||
joystick2_started = 0;
|
||||
JoyReset(&JoyInfo2);
|
||||
if (!joystick_started && !joystick2_started && !joystick3_started && !joystick4_started
|
||||
&& SDL_WasInit(SDL_INIT_JOYSTICK) == SDL_INIT_JOYSTICK)
|
||||
|
@ -2753,7 +2758,6 @@ INT32 I_StartupSystem(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// I_Quit
|
||||
//
|
||||
|
@ -3374,7 +3378,30 @@ const char *I_LocateWad(void)
|
|||
#ifdef __linux__
|
||||
#define MEMINFO_FILE "/proc/meminfo"
|
||||
#define MEMTOTAL "MemTotal:"
|
||||
#define MEMAVAILABLE "MemAvailable:"
|
||||
#define MEMFREE "MemFree:"
|
||||
#define CACHED "Cached:"
|
||||
#define BUFFERS "Buffers:"
|
||||
#define SHMEM "Shmem:"
|
||||
|
||||
/* Parse the contents of /proc/meminfo (in buf), return value of "name"
|
||||
* (example: MemTotal) */
|
||||
static long get_entry(const char* name, const char* buf)
|
||||
{
|
||||
long val;
|
||||
char* hit = strstr(buf, name);
|
||||
if (hit == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
errno = 0;
|
||||
val = strtol(hit + strlen(name), NULL, 10);
|
||||
if (errno != 0) {
|
||||
CONS_Alert(CONS_ERROR, M_GetText("get_entry: strtol() failed: %s\n"), strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
return val;
|
||||
}
|
||||
#endif
|
||||
|
||||
// quick fix for compil
|
||||
|
@ -3446,6 +3473,11 @@ UINT32 I_GetFreeMem(UINT32 *total)
|
|||
UINT32 totalKBytes;
|
||||
INT32 n;
|
||||
INT32 meminfo_fd = -1;
|
||||
long Cached;
|
||||
long MemFree;
|
||||
long Buffers;
|
||||
long Shmem;
|
||||
long MemAvailable = -1;
|
||||
|
||||
meminfo_fd = open(MEMINFO_FILE, O_RDONLY);
|
||||
n = read(meminfo_fd, buf, 1023);
|
||||
|
@ -3471,16 +3503,28 @@ UINT32 I_GetFreeMem(UINT32 *total)
|
|||
memTag += sizeof (MEMTOTAL);
|
||||
totalKBytes = atoi(memTag);
|
||||
|
||||
if ((memTag = strstr(buf, MEMFREE)) == NULL)
|
||||
if ((memTag = strstr(buf, MEMAVAILABLE)) == NULL)
|
||||
{
|
||||
Cached = get_entry(CACHED, buf);
|
||||
MemFree = get_entry(MEMFREE, buf);
|
||||
Buffers = get_entry(BUFFERS, buf);
|
||||
Shmem = get_entry(SHMEM, buf);
|
||||
MemAvailable = Cached + MemFree + Buffers - Shmem;
|
||||
|
||||
if (MemAvailable == -1)
|
||||
{
|
||||
// Error
|
||||
if (total)
|
||||
*total = 0L;
|
||||
return 0;
|
||||
}
|
||||
|
||||
memTag += sizeof (MEMFREE);
|
||||
freeKBytes = MemAvailable;
|
||||
}
|
||||
else
|
||||
{
|
||||
memTag += sizeof (MEMAVAILABLE);
|
||||
freeKBytes = atoi(memTag);
|
||||
}
|
||||
|
||||
if (total)
|
||||
*total = totalKBytes << 10;
|
||||
|
|
|
@ -38,10 +38,8 @@
|
|||
#include "gme/gme.h"
|
||||
#define GME_TREBLE 5.0
|
||||
#define GME_BASS 1.0
|
||||
#ifdef HAVE_PNG /// TODO: compile with zlib support without libpng
|
||||
|
||||
#define HAVE_ZLIB
|
||||
|
||||
#ifdef HAVE_ZLIB
|
||||
#ifndef _MSC_VER
|
||||
#ifndef _LARGEFILE64_SOURCE
|
||||
#define _LARGEFILE64_SOURCE
|
||||
|
@ -57,8 +55,8 @@
|
|||
#endif
|
||||
|
||||
#include "zlib.h"
|
||||
#endif
|
||||
#endif
|
||||
#endif // HAVE_ZLIB
|
||||
#endif // HAVE_LIBGME
|
||||
|
||||
UINT8 sound_started = false;
|
||||
|
||||
|
@ -178,7 +176,7 @@ static Mix_Chunk *ds2chunk(void *stream)
|
|||
return NULL; // would and/or did wrap, can't store.
|
||||
break;
|
||||
}
|
||||
sound = malloc(newsamples<<2); // samples * frequency shift * bytes per sample * channels
|
||||
sound = Z_Malloc(newsamples<<2, PU_SOUND, NULL); // samples * frequency shift * bytes per sample * channels
|
||||
|
||||
s = (SINT8 *)stream;
|
||||
d = (INT16 *)sound;
|
||||
|
@ -246,6 +244,7 @@ void *I_GetSfx(sfxinfo_t *sfx)
|
|||
{
|
||||
void *lump;
|
||||
Mix_Chunk *chunk;
|
||||
SDL_RWops *rw;
|
||||
#ifdef HAVE_LIBGME
|
||||
Music_Emu *emu;
|
||||
gme_info_t *info;
|
||||
|
@ -361,7 +360,7 @@ void *I_GetSfx(sfxinfo_t *sfx)
|
|||
}
|
||||
Z_Free(inflatedData); // GME didn't open jack, but don't let that stop us from freeing this up
|
||||
#else
|
||||
//CONS_Alert(CONS_ERROR,"Cannot decompress VGZ; no zlib support\n");
|
||||
return NULL; // No zlib support
|
||||
#endif
|
||||
}
|
||||
// Try to read it as a GME sound
|
||||
|
@ -387,21 +386,43 @@ void *I_GetSfx(sfxinfo_t *sfx)
|
|||
#endif
|
||||
|
||||
// Try to load it as a WAVE or OGG using Mixer.
|
||||
return Mix_LoadWAV_RW(SDL_RWFromMem(lump, sfx->length), 1);
|
||||
rw = SDL_RWFromMem(lump, sfx->length);
|
||||
if (rw != NULL)
|
||||
{
|
||||
chunk = Mix_LoadWAV_RW(rw, 1);
|
||||
return chunk;
|
||||
}
|
||||
|
||||
return NULL; // haven't been able to get anything
|
||||
}
|
||||
|
||||
void I_FreeSfx(sfxinfo_t *sfx)
|
||||
{
|
||||
if (sfx->data)
|
||||
{
|
||||
Mix_Chunk *chunk = (Mix_Chunk*)sfx->data;
|
||||
UINT8 *abufdata = NULL;
|
||||
if (chunk->allocated == 0)
|
||||
{
|
||||
// We allocated the data in this chunk, so get the abuf from mixer, then let it free the chunk, THEN we free the data
|
||||
// I believe this should ensure the sound is not playing when we free it
|
||||
abufdata = chunk->abuf;
|
||||
}
|
||||
Mix_FreeChunk(sfx->data);
|
||||
if (abufdata)
|
||||
{
|
||||
// I'm going to assume we used Z_Malloc to allocate this data.
|
||||
Z_Free(abufdata);
|
||||
}
|
||||
}
|
||||
sfx->data = NULL;
|
||||
sfx->lumpnum = LUMPERROR;
|
||||
}
|
||||
|
||||
INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority)
|
||||
INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority, INT32 channel)
|
||||
{
|
||||
UINT8 volume = (((UINT16)vol + 1) * (UINT16)sfx_volume) / 62; // (256 * 31) / 62 == 127
|
||||
INT32 handle = Mix_PlayChannel(-1, S_sfx[id].data, 0);
|
||||
INT32 handle = Mix_PlayChannel(channel, S_sfx[id].data, 0);
|
||||
Mix_Volume(handle, volume);
|
||||
Mix_SetPanning(handle, min((UINT16)(0xff-sep)<<1, 0xff), min((UINT16)(sep)<<1, 0xff));
|
||||
(void)pitch; // Mixer can't handle pitch
|
||||
|
@ -524,6 +545,7 @@ boolean I_StartDigSong(const char *musicname, boolean looping)
|
|||
char *data;
|
||||
size_t len;
|
||||
lumpnum_t lumpnum = W_CheckNumForName(va("O_%s",musicname));
|
||||
SDL_RWops *rw;
|
||||
|
||||
I_Assert(!music);
|
||||
#ifdef HAVE_LIBGME
|
||||
|
@ -621,7 +643,8 @@ boolean I_StartDigSong(const char *musicname, boolean looping)
|
|||
}
|
||||
Z_Free(inflatedData); // GME didn't open jack, but don't let that stop us from freeing this up
|
||||
#else
|
||||
//CONS_Alert(CONS_ERROR,"Cannot decompress VGZ; no zlib support\n");
|
||||
CONS_Alert(CONS_ERROR,"Cannot decompress VGZ; no zlib support\n");
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
else if (!gme_open_data(data, len, &gme, 44100))
|
||||
|
@ -635,7 +658,11 @@ boolean I_StartDigSong(const char *musicname, boolean looping)
|
|||
}
|
||||
#endif
|
||||
|
||||
music = Mix_LoadMUS_RW(SDL_RWFromMem(data, len), SDL_FALSE);
|
||||
rw = SDL_RWFromMem(data, len);
|
||||
if (rw != NULL)
|
||||
{
|
||||
music = Mix_LoadMUS_RW(rw, 1);
|
||||
}
|
||||
if (!music)
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, "Mix_LoadMUS_RW: %s\n", Mix_GetError());
|
||||
|
@ -798,7 +825,11 @@ void I_SetMIDIMusicVolume(UINT8 volume)
|
|||
|
||||
INT32 I_RegisterSong(void *data, size_t len)
|
||||
{
|
||||
music = Mix_LoadMUS_RW(SDL_RWFromMem(data, len), SDL_FALSE);
|
||||
SDL_RWops *rw = SDL_RWFromMem(data, len);
|
||||
if (rw != NULL)
|
||||
{
|
||||
music = Mix_LoadMUS_RW(rw, 1);
|
||||
}
|
||||
if (!music)
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, "Mix_LoadMUS_RW: %s\n", Mix_GetError());
|
||||
|
|
|
@ -604,10 +604,11 @@ void I_FreeSfx(sfxinfo_t * sfx)
|
|||
// Pitching (that is, increased speed of playback)
|
||||
// is set, but currently not used by mixing.
|
||||
//
|
||||
INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority)
|
||||
INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority, INT32 channel)
|
||||
{
|
||||
(void)priority;
|
||||
(void)pitch;
|
||||
(void)channel;
|
||||
|
||||
if (nosound)
|
||||
return 0;
|
||||
|
|
|
@ -376,10 +376,10 @@ void I_FreeSfx(sfxinfo_t *sfx)
|
|||
sfx->data = NULL;
|
||||
}
|
||||
|
||||
INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority)
|
||||
INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority, INT32 channel)
|
||||
{
|
||||
UINT8 volume = (((UINT16)vol + 1) * (UINT16)sfx_volume) / 62; // (256 * 31) / 62 == 127
|
||||
INT32 handle = Mix_PlayChannel(-1, S_sfx[id].data, 0);
|
||||
INT32 handle = Mix_PlayChannel(channel, S_sfx[id].data, 0);
|
||||
Mix_Volume(handle, volume);
|
||||
Mix_SetPanning(handle, min((UINT16)(0xff-sep)<<1, 0xff), min((UINT16)(sep)<<1, 0xff));
|
||||
(void)pitch; // Mixer can't handle pitch
|
||||
|
|
|
@ -621,10 +621,11 @@ void I_FreeSfx(sfxinfo_t * sfx)
|
|||
// Pitching (that is, increased speed of playback)
|
||||
// is set, but currently not used by mixing.
|
||||
//
|
||||
INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority)
|
||||
INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority, INT32 channel)
|
||||
{
|
||||
(void)priority;
|
||||
(void)pitch;
|
||||
(void)channel;
|
||||
|
||||
if (nosound)
|
||||
return 0;
|
||||
|
|
|
@ -668,14 +668,10 @@ void V_DrawCroppedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_
|
|||
//
|
||||
void V_DrawContinueIcon(INT32 x, INT32 y, INT32 flags, INT32 skinnum, UINT8 skincolor)
|
||||
{
|
||||
if (skins[skinnum].flags & SF_HIRES
|
||||
#ifdef HWRENDER
|
||||
// || (rendermode != render_soft && rendermode != render_none)
|
||||
#endif
|
||||
)
|
||||
V_DrawScaledPatch(x - 10, y - 14, flags, W_CachePatchName("CONTINS", PU_CACHE));
|
||||
if (skinnum < 0 || skinnum >= numskins || (skins[skinnum].flags & SF_HIRES))
|
||||
V_DrawScaledPatch(x - 10, y - 14, flags, W_CachePatchName("CONTINS", PU_CACHE)); // Draw a star
|
||||
else
|
||||
{
|
||||
{ // Find front angle of the first waiting frame of the character's actual sprites
|
||||
spriteframe_t *sprframe = &skins[skinnum].spritedef.spriteframes[2 & FF_FRAMEMASK];
|
||||
patch_t *patch = W_CachePatchNum(sprframe->lumppat[0], PU_CACHE);
|
||||
const UINT8 *colormap = R_GetTranslationColormap(skinnum, skincolor, GTC_CACHE);
|
||||
|
|
15
src/w_wad.c
15
src/w_wad.c
|
@ -196,16 +196,21 @@ static inline void W_LoadDehackedLumps(UINT16 wadnum)
|
|||
for (lump = 0; lump < wadfiles[wadnum]->numlumps; lump++, lump_p++)
|
||||
if (memcmp(lump_p->name,"SOC_",4)==0) // Check for generic SOC lump
|
||||
{ // shameless copy+paste of code from LUA_LoadLump
|
||||
char *name = malloc(strlen(wadfiles[wadnum]->filename)+10);
|
||||
size_t len = strlen(wadfiles[wadnum]->filename);
|
||||
char *name = malloc(len+10);
|
||||
|
||||
strcpy(name, wadfiles[wadnum]->filename);
|
||||
if (!fasticmp(&name[strlen(name) - 4], ".soc")) {
|
||||
if (!fasticmp(&name[len - 4], ".soc")) {
|
||||
// If it's not a .soc file, copy the lump name in too.
|
||||
name[strlen(wadfiles[wadnum]->filename)] = '|';
|
||||
M_Memcpy(name+strlen(wadfiles[wadnum]->filename)+1, lump_p->name, 8);
|
||||
name[strlen(wadfiles[wadnum]->filename)+9] = '\0';
|
||||
name[len] = '|';
|
||||
M_Memcpy(name+len+1, lump_p->name, 8);
|
||||
name[len+9] = '\0';
|
||||
}
|
||||
|
||||
CONS_Printf(M_GetText("Loading SOC from %s\n"), name);
|
||||
DEH_LoadDehackedLumpPwad(wadnum, lump);
|
||||
|
||||
free(name);
|
||||
}
|
||||
else if (memcmp(lump_p->name,"MAINCFG",8)==0) // Check for MAINCFG
|
||||
{
|
||||
|
|
|
@ -17,17 +17,13 @@
|
|||
#include "gme/gme.h"
|
||||
#define GME_TREBLE 5.0
|
||||
#define GME_BASS 1.0
|
||||
#ifdef HAVE_PNG /// TODO: compile with zlib support without libpng
|
||||
|
||||
#define HAVE_ZLIB
|
||||
|
||||
#ifdef HAVE_ZLIB
|
||||
#ifndef _MSC_VER
|
||||
#ifndef _WII
|
||||
#ifndef _LARGEFILE64_SOURCE
|
||||
#define _LARGEFILE64_SOURCE
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef _LFS64_LARGEFILE
|
||||
#define _LFS64_LARGEFILE
|
||||
|
@ -38,8 +34,8 @@
|
|||
#endif
|
||||
|
||||
#include "zlib.h"
|
||||
#endif
|
||||
#endif
|
||||
#endif // HAVE_ZLIB
|
||||
#endif // HAVE_LIBGME
|
||||
|
||||
static FMOD_SYSTEM *fsys;
|
||||
static FMOD_SOUND *music_stream;
|
||||
|
@ -357,12 +353,13 @@ void I_FreeSfx(sfxinfo_t *sfx)
|
|||
sfx->data = NULL;
|
||||
}
|
||||
|
||||
INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority)
|
||||
INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority, INT32 channel)
|
||||
{
|
||||
FMOD_SOUND *sound;
|
||||
FMOD_CHANNEL *chan;
|
||||
INT32 i;
|
||||
float frequency;
|
||||
(void)channel;
|
||||
|
||||
sound = (FMOD_SOUND *)S_sfx[id].data;
|
||||
I_Assert(sound != NULL);
|
||||
|
|
|
@ -538,7 +538,8 @@ INT32 I_StartSound (sfxenum_t id,
|
|||
INT32 vol,
|
||||
INT32 sep,
|
||||
INT32 pitch,
|
||||
INT32 priority)
|
||||
INT32 priority,
|
||||
INT32 channel)
|
||||
{
|
||||
HRESULT hr;
|
||||
LPDIRECTSOUNDBUFFER dsbuffer;
|
||||
|
@ -549,6 +550,7 @@ INT32 I_StartSound (sfxenum_t id,
|
|||
#ifdef SURROUND
|
||||
LPDIRECTSOUNDBUFFER dssurround;
|
||||
#endif
|
||||
(void)channel;
|
||||
|
||||
if (nosound)
|
||||
return -1;
|
||||
|
|
Loading…
Reference in a new issue