mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-02-01 06:00:45 +00:00
Merge branch 'next' into fullscreen-toggle
This commit is contained in:
commit
3da52592f2
14 changed files with 340 additions and 348 deletions
|
@ -150,26 +150,78 @@ FUNCINLINE static ATTRINLINE UINT32 readulong(void *ptr)
|
||||||
|
|
||||||
#undef DEALIGNED
|
#undef DEALIGNED
|
||||||
|
|
||||||
#define WRITESTRINGN(p,s,n) do { size_t tmp_i = 0; for (; tmp_i < n && s[tmp_i] != '\0'; tmp_i++) WRITECHAR(p, s[tmp_i]); if (tmp_i < n) WRITECHAR(p, '\0');} while (0)
|
#define WRITESTRINGN(p, s, n) ({ \
|
||||||
#define WRITESTRING(p,s) do { size_t tmp_i = 0; for (; s[tmp_i] != '\0'; tmp_i++) WRITECHAR(p, s[tmp_i]); WRITECHAR(p, '\0');} while (0)
|
size_t tmp_i; \
|
||||||
#define WRITEMEM(p,s,n) do { memcpy(p, s, n); p += n; } while (0)
|
\
|
||||||
|
for (tmp_i = 0; tmp_i < n && s[tmp_i] != '\0'; tmp_i++) \
|
||||||
|
WRITECHAR(p, s[tmp_i]); \
|
||||||
|
\
|
||||||
|
if (tmp_i < n) \
|
||||||
|
WRITECHAR(p, '\0'); \
|
||||||
|
})
|
||||||
|
|
||||||
#define SKIPSTRING(p) while (READCHAR(p) != '\0')
|
#define WRITESTRINGL(p, s, n) ({ \
|
||||||
|
size_t tmp_i; \
|
||||||
|
\
|
||||||
|
for (tmp_i = 0; tmp_i < n - 1 && s[tmp_i] != '\0'; tmp_i++) \
|
||||||
|
WRITECHAR(p, s[tmp_i]); \
|
||||||
|
\
|
||||||
|
WRITECHAR(p, '\0'); \
|
||||||
|
})
|
||||||
|
|
||||||
#define READSTRINGN(p,s,n) ({ size_t tmp_i = 0; for (; tmp_i < n && (s[tmp_i] = READCHAR(p)) != '\0'; tmp_i++); s[tmp_i] = '\0';})
|
#define WRITESTRING(p, s) ({ \
|
||||||
#define READSTRING(p,s) ({ size_t tmp_i = 0; for (; (s[tmp_i] = READCHAR(p)) != '\0'; tmp_i++); s[tmp_i] = '\0';})
|
size_t tmp_i; \
|
||||||
#define READMEM(p,s,n) ({ memcpy(s, p, n); p += n; })
|
\
|
||||||
|
for (tmp_i = 0; s[tmp_i] != '\0'; tmp_i++) \
|
||||||
|
WRITECHAR(p, s[tmp_i]); \
|
||||||
|
\
|
||||||
|
WRITECHAR(p, '\0'); \
|
||||||
|
})
|
||||||
|
|
||||||
#if 0 // old names
|
#define WRITEMEM(p, s, n) ({ \
|
||||||
#define WRITEBYTE(p,b) WRITEUINT8(p,b)
|
memcpy(p, s, n); \
|
||||||
#define WRITESHORT(p,b) WRITEINT16(p,b)
|
p += n; \
|
||||||
#define WRITEUSHORT(p,b) WRITEUINT16(p,b)
|
})
|
||||||
#define WRITELONG(p,b) WRITEINT32(p,b)
|
|
||||||
#define WRITEULONG(p,b) WRITEUINT32(p,b)
|
|
||||||
|
|
||||||
#define READBYTE(p) READUINT8(p)
|
#define SKIPSTRING(p) while (READCHAR(p) != '\0')
|
||||||
#define READSHORT(p) READINT16(p)
|
|
||||||
#define READUSHORT(p) READUINT16(p)
|
#define SKIPSTRINGN(p, n) ({ \
|
||||||
#define READLONG(p) READINT32(p)
|
size_t tmp_i = 0; \
|
||||||
#define READULONG(p) READUINT32(p)
|
\
|
||||||
#endif
|
while (tmp_i < n && READCHAR(p) != '\0') \
|
||||||
|
tmp_i++; \
|
||||||
|
})
|
||||||
|
|
||||||
|
#define SKIPSTRINGL(p, n) SKIPSTRINGN(p, n)
|
||||||
|
|
||||||
|
#define READSTRINGN(p, s, n) ({ \
|
||||||
|
size_t tmp_i = 0; \
|
||||||
|
\
|
||||||
|
while (tmp_i < n && (s[tmp_i] = READCHAR(p)) != '\0') \
|
||||||
|
tmp_i++; \
|
||||||
|
\
|
||||||
|
s[tmp_i] = '\0'; \
|
||||||
|
})
|
||||||
|
|
||||||
|
#define READSTRINGL(p, s, n) ({ \
|
||||||
|
size_t tmp_i = 0; \
|
||||||
|
\
|
||||||
|
while (tmp_i < n - 1 && (s[tmp_i] = READCHAR(p)) != '\0') \
|
||||||
|
tmp_i++; \
|
||||||
|
\
|
||||||
|
s[tmp_i] = '\0'; \
|
||||||
|
})
|
||||||
|
|
||||||
|
#define READSTRING(p, s) ({ \
|
||||||
|
size_t tmp_i = 0; \
|
||||||
|
\
|
||||||
|
while ((s[tmp_i] = READCHAR(p)) != '\0') \
|
||||||
|
tmp_i++; \
|
||||||
|
\
|
||||||
|
s[tmp_i] = '\0'; \
|
||||||
|
})
|
||||||
|
|
||||||
|
#define READMEM(p, s, n) ({ \
|
||||||
|
memcpy(s, p, n); \
|
||||||
|
p += n; \
|
||||||
|
})
|
||||||
|
|
|
@ -1144,8 +1144,9 @@ boolean HGetPacket(void)
|
||||||
if (netbuffer->checksum != NetbufferChecksum())
|
if (netbuffer->checksum != NetbufferChecksum())
|
||||||
{
|
{
|
||||||
DEBFILE("Bad packet checksum\n");
|
DEBFILE("Bad packet checksum\n");
|
||||||
//Net_CloseConnection(nodejustjoined ? (doomcom->remotenode | FORCECLOSE) : doomcom->remotenode);
|
// Do not disconnect or anything, just ignore the packet.
|
||||||
Net_CloseConnection(doomcom->remotenode);
|
// Bad checksums with UDP tend to happen very scarcely
|
||||||
|
// so they are not normally an issue.
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1411,7 +1411,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
||||||
newtarget = P_SpawnMobj(ticcmd_ztargetfocus[forplayer]->x, ticcmd_ztargetfocus[forplayer]->y, ticcmd_ztargetfocus[forplayer]->z, MT_LOCKON); // positioning, flip handled in P_SceneryThinker
|
newtarget = P_SpawnMobj(ticcmd_ztargetfocus[forplayer]->x, ticcmd_ztargetfocus[forplayer]->y, ticcmd_ztargetfocus[forplayer]->z, MT_LOCKON); // positioning, flip handled in P_SceneryThinker
|
||||||
P_SetTarget(&newtarget->target, ticcmd_ztargetfocus[forplayer]);
|
P_SetTarget(&newtarget->target, ticcmd_ztargetfocus[forplayer]);
|
||||||
|
|
||||||
if (P_AproxDistance(
|
if (player->mo && P_AproxDistance(
|
||||||
player->mo->x - ticcmd_ztargetfocus[forplayer]->x,
|
player->mo->x - ticcmd_ztargetfocus[forplayer]->x,
|
||||||
player->mo->y - ticcmd_ztargetfocus[forplayer]->y
|
player->mo->y - ticcmd_ztargetfocus[forplayer]->y
|
||||||
) > 50*player->mo->scale)
|
) > 50*player->mo->scale)
|
||||||
|
|
415
src/hu_stuff.c
415
src/hu_stuff.c
|
@ -76,7 +76,7 @@ patch_t *nto_font[NT_FONTSIZE];
|
||||||
|
|
||||||
static player_t *plr;
|
static player_t *plr;
|
||||||
boolean chat_on; // entering a chat message?
|
boolean chat_on; // entering a chat message?
|
||||||
static char w_chat[HU_MAXMSGLEN];
|
static char w_chat[HU_MAXMSGLEN + 1];
|
||||||
static size_t c_input = 0; // let's try to make the chat input less shitty.
|
static size_t c_input = 0; // let's try to make the chat input less shitty.
|
||||||
static boolean headsupactive = false;
|
static boolean headsupactive = false;
|
||||||
boolean hu_showscores; // draw rankings
|
boolean hu_showscores; // draw rankings
|
||||||
|
@ -461,7 +461,7 @@ void HU_AddChatText(const char *text, boolean playsound)
|
||||||
|
|
||||||
static void DoSayCommand(SINT8 target, size_t usedargs, UINT8 flags)
|
static void DoSayCommand(SINT8 target, size_t usedargs, UINT8 flags)
|
||||||
{
|
{
|
||||||
char buf[254];
|
char buf[2 + HU_MAXMSGLEN + 1];
|
||||||
size_t numwords, ix;
|
size_t numwords, ix;
|
||||||
char *msg = &buf[2];
|
char *msg = &buf[2];
|
||||||
const size_t msgspace = sizeof buf - 2;
|
const size_t msgspace = sizeof buf - 2;
|
||||||
|
@ -537,7 +537,7 @@ static void DoSayCommand(SINT8 target, size_t usedargs, UINT8 flags)
|
||||||
}
|
}
|
||||||
buf[0] = target;
|
buf[0] = target;
|
||||||
newmsg = msg+5+spc;
|
newmsg = msg+5+spc;
|
||||||
strlcpy(msg, newmsg, 252);
|
strlcpy(msg, newmsg, HU_MAXMSGLEN + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
SendNetXCmd(XD_SAY, buf, strlen(msg) + 1 + msg-buf);
|
SendNetXCmd(XD_SAY, buf, strlen(msg) + 1 + msg-buf);
|
||||||
|
@ -644,7 +644,7 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum)
|
||||||
target = READSINT8(*p);
|
target = READSINT8(*p);
|
||||||
flags = READUINT8(*p);
|
flags = READUINT8(*p);
|
||||||
msg = (char *)*p;
|
msg = (char *)*p;
|
||||||
SKIPSTRING(*p);
|
SKIPSTRINGL(*p, HU_MAXMSGLEN + 1);
|
||||||
|
|
||||||
if ((cv_mute.value || flags & (HU_CSAY|HU_SERVER_SAY)) && playernum != serverplayer && !(IsPlayerAdmin(playernum)))
|
if ((cv_mute.value || flags & (HU_CSAY|HU_SERVER_SAY)) && playernum != serverplayer && !(IsPlayerAdmin(playernum)))
|
||||||
{
|
{
|
||||||
|
@ -858,72 +858,6 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handles key input and string input
|
|
||||||
//
|
|
||||||
static inline boolean HU_keyInChatString(char *s, char ch)
|
|
||||||
{
|
|
||||||
size_t l;
|
|
||||||
|
|
||||||
if ((ch >= HU_FONTSTART && ch <= HU_FONTEND && hu_font[ch-HU_FONTSTART])
|
|
||||||
|| ch == ' ') // Allow spaces, of course
|
|
||||||
{
|
|
||||||
l = strlen(s);
|
|
||||||
if (l < HU_MAXMSGLEN - 1)
|
|
||||||
{
|
|
||||||
if (c_input >= strlen(s)) // don't do anything complicated
|
|
||||||
{
|
|
||||||
s[l++] = ch;
|
|
||||||
s[l]=0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
|
|
||||||
// move everything past c_input for new characters:
|
|
||||||
size_t m = HU_MAXMSGLEN-1;
|
|
||||||
while (m>=c_input)
|
|
||||||
{
|
|
||||||
if (s[m])
|
|
||||||
s[m+1] = (s[m]);
|
|
||||||
if (m == 0) // prevent overflow
|
|
||||||
break;
|
|
||||||
m--;
|
|
||||||
}
|
|
||||||
s[c_input] = ch; // and replace this.
|
|
||||||
}
|
|
||||||
c_input++;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else if (ch == KEY_BACKSPACE)
|
|
||||||
{
|
|
||||||
size_t i = c_input;
|
|
||||||
|
|
||||||
if (c_input <= 0)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (!s[i-1])
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (i >= strlen(s)-1)
|
|
||||||
{
|
|
||||||
s[strlen(s)-1] = 0;
|
|
||||||
c_input--;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (; (i < HU_MAXMSGLEN); i++)
|
|
||||||
{
|
|
||||||
s[i-1] = s[i];
|
|
||||||
}
|
|
||||||
c_input--;
|
|
||||||
}
|
|
||||||
else if (ch != KEY_ENTER)
|
|
||||||
return false; // did not eat key
|
|
||||||
|
|
||||||
return true; // ate the key
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -945,151 +879,123 @@ void HU_Ticker(void)
|
||||||
#ifndef NONET
|
#ifndef NONET
|
||||||
|
|
||||||
static boolean teamtalk = false;
|
static boolean teamtalk = false;
|
||||||
|
static boolean justscrolleddown;
|
||||||
|
static boolean justscrolledup;
|
||||||
|
static INT16 typelines = 1; // number of drawfill lines we need when drawing the chat. it's some weird hack and might be one frame off but I'm lazy to make another loop.
|
||||||
|
// It's up here since it has to be reset when we open the chat.
|
||||||
|
|
||||||
// Clear spaces so we don't end up with messages only made out of emptiness
|
static boolean HU_chatboxContainsOnlySpaces(void)
|
||||||
static boolean HU_clearChatSpaces(void)
|
|
||||||
{
|
{
|
||||||
size_t i = 0; // Used to just check our message
|
size_t i;
|
||||||
char c; // current character we're iterating.
|
|
||||||
boolean nothingbutspaces = true;
|
|
||||||
|
|
||||||
for (; i < strlen(w_chat); i++) // iterate through message and eradicate all spaces that don't belong.
|
for (i = 0; w_chat[i]; i++)
|
||||||
{
|
if (w_chat[i] != ' ')
|
||||||
c = w_chat[i];
|
return false;
|
||||||
if (!c)
|
|
||||||
break; // if there's nothing, it's safe to assume our message has ended, so let's not waste any more time here.
|
|
||||||
|
|
||||||
if (c != ' ') // Isn't a space
|
return true;
|
||||||
{
|
|
||||||
nothingbutspaces = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nothingbutspaces;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
static void HU_sendChatMessage(void)
|
||||||
//
|
|
||||||
static void HU_queueChatChar(char c)
|
|
||||||
{
|
{
|
||||||
// send automaticly the message (no more chat char)
|
char buf[2 + HU_MAXMSGLEN + 1];
|
||||||
if (c == KEY_ENTER)
|
char *msg = &buf[2];
|
||||||
|
size_t ci;
|
||||||
|
INT32 target = 0;
|
||||||
|
|
||||||
|
// if our message was nothing but spaces, don't send it.
|
||||||
|
if (HU_chatboxContainsOnlySpaces())
|
||||||
|
return;
|
||||||
|
|
||||||
|
// copy printable characters and terminating '\0' only.
|
||||||
|
for (ci = 2; w_chat[ci-2]; ci++)
|
||||||
{
|
{
|
||||||
char buf[2+256];
|
char c = w_chat[ci-2];
|
||||||
char *msg = &buf[2];
|
if (c >= ' ' && !(c & 0x80))
|
||||||
size_t i = 0;
|
buf[ci] = c;
|
||||||
size_t ci = 2;
|
};
|
||||||
INT32 target = 0;
|
buf[ci] = '\0';
|
||||||
|
|
||||||
if (HU_clearChatSpaces()) // Avoids being able to send empty messages, or something.
|
memset(w_chat, '\0', sizeof(w_chat));
|
||||||
return; // If this returns true, that means our message was NOTHING but spaces, so don't send it period.
|
c_input = 0;
|
||||||
|
|
||||||
do {
|
// last minute mute check
|
||||||
c = w_chat[-2+ci++];
|
if (CHAT_MUTE)
|
||||||
if (!c || (c >= ' ' && !(c & 0x80))) // copy printable characters and terminating '\0' only.
|
{
|
||||||
buf[ci-1]=c;
|
HU_AddChatText(va("%s>ERROR: The chat is muted. You can't say anything.", "\x85"), false);
|
||||||
} while (c);
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (;(i<HU_MAXMSGLEN);i++)
|
if (strlen(msg) > 4 && strnicmp(msg, "/pm", 3) == 0) // used /pm
|
||||||
w_chat[i] = 0; // reset this.
|
{
|
||||||
|
INT32 spc = 1; // used if playernum[1] is a space.
|
||||||
|
char playernum[3];
|
||||||
|
const char *newmsg;
|
||||||
|
|
||||||
c_input = 0;
|
// what we're gonna do now is check if the player exists
|
||||||
|
// with that logic, characters 4 and 5 are our numbers:
|
||||||
|
|
||||||
// last minute mute check
|
// teamtalk can't send PMs, just don't send it, else everyone would be able to see it, and no one wants to see your sex RP sicko.
|
||||||
if (CHAT_MUTE)
|
if (teamtalk)
|
||||||
{
|
{
|
||||||
HU_AddChatText(va("%s>ERROR: The chat is muted. You can't say anything.", "\x85"), false);
|
HU_AddChatText(va("%sCannot send sayto in Say-Team.", "\x85"), false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strlen(msg) > 4 && strnicmp(msg, "/pm", 3) == 0) // used /pm
|
strncpy(playernum, msg+3, 3);
|
||||||
|
// check for undesirable characters in our "number"
|
||||||
|
if (!(isdigit(playernum[0]) && isdigit(playernum[1])))
|
||||||
{
|
{
|
||||||
INT32 spc = 1; // used if playernum[1] is a space.
|
// check if playernum[1] is a space
|
||||||
char playernum[3];
|
if (playernum[1] == ' ')
|
||||||
const char *newmsg;
|
spc = 0;
|
||||||
|
// let it slide
|
||||||
// what we're gonna do now is check if the player exists
|
|
||||||
// with that logic, characters 4 and 5 are our numbers:
|
|
||||||
|
|
||||||
// teamtalk can't send PMs, just don't send it, else everyone would be able to see it, and no one wants to see your sex RP sicko.
|
|
||||||
if (teamtalk)
|
|
||||||
{
|
|
||||||
HU_AddChatText(va("%sCannot send sayto in Say-Team.", "\x85"), false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
strncpy(playernum, msg+3, 3);
|
|
||||||
// check for undesirable characters in our "number"
|
|
||||||
if (((playernum[0] < '0') || (playernum[0] > '9')) || ((playernum[1] < '0') || (playernum[1] > '9')))
|
|
||||||
{
|
|
||||||
// check if playernum[1] is a space
|
|
||||||
if (playernum[1] == ' ')
|
|
||||||
spc = 0;
|
|
||||||
// let it slide
|
|
||||||
else
|
|
||||||
{
|
|
||||||
HU_AddChatText("\x82NOTICE: \x80Invalid command format. Correct format is \'/pm<player num> \'.", false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// I'm very bad at C, I swear I am, additional checks eww!
|
|
||||||
if (spc != 0)
|
|
||||||
{
|
|
||||||
if (msg[5] != ' ')
|
|
||||||
{
|
|
||||||
HU_AddChatText("\x82NOTICE: \x80Invalid command format. Correct format is \'/pm<player num> \'.", false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
target = atoi(playernum); // turn that into a number
|
|
||||||
//CONS_Printf("%d\n", target);
|
|
||||||
|
|
||||||
// check for target player, if it doesn't exist then we can't send the message!
|
|
||||||
if (target < MAXPLAYERS && playeringame[target]) // player exists
|
|
||||||
target++; // even though playernums are from 0 to 31, target is 1 to 32, so up that by 1 to have it work!
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
HU_AddChatText(va("\x82NOTICE: \x80Player %d does not exist.", target), false); // same
|
HU_AddChatText("\x82NOTICE: \x80Invalid command format. Correct format is \'/pm<player num> \'.", false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// we need to get rid of the /pm<player num>
|
|
||||||
newmsg = msg+5+spc;
|
|
||||||
strlcpy(msg, newmsg, 255);
|
|
||||||
}
|
}
|
||||||
if (ci > 3) // don't send target+flags+empty message.
|
// I'm very bad at C, I swear I am, additional checks eww!
|
||||||
|
if (spc != 0 && msg[5] != ' ')
|
||||||
{
|
{
|
||||||
if (teamtalk)
|
HU_AddChatText("\x82NOTICE: \x80Invalid command format. Correct format is \'/pm<player num> \'.", false);
|
||||||
buf[0] = -1; // target
|
return;
|
||||||
else
|
|
||||||
buf[0] = target;
|
|
||||||
|
|
||||||
buf[1] = 0; // flags
|
|
||||||
SendNetXCmd(XD_SAY, buf, 2 + strlen(&buf[2]) + 1);
|
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
|
target = atoi(playernum); // turn that into a number
|
||||||
|
|
||||||
|
// check for target player, if it doesn't exist then we can't send the message!
|
||||||
|
if (target < MAXPLAYERS && playeringame[target]) // player exists
|
||||||
|
target++; // even though playernums are from 0 to 31, target is 1 to 32, so up that by 1 to have it work!
|
||||||
|
else
|
||||||
|
{
|
||||||
|
HU_AddChatText(va("\x82NOTICE: \x80Player %d does not exist.", target), false); // same
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// we need to get rid of the /pm<player num>
|
||||||
|
newmsg = msg+5+spc;
|
||||||
|
strlcpy(msg, newmsg, HU_MAXMSGLEN + 1);
|
||||||
|
}
|
||||||
|
if (ci > 2) // don't send target+flags+empty message.
|
||||||
|
{
|
||||||
|
buf[0] = teamtalk ? -1 : target; // target
|
||||||
|
buf[1] = 0; // flags
|
||||||
|
SendNetXCmd(XD_SAY, buf, 2 + strlen(&buf[2]) + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void HU_clearChatChars(void)
|
void HU_clearChatChars(void)
|
||||||
{
|
{
|
||||||
size_t i = 0;
|
memset(w_chat, '\0', sizeof(w_chat));
|
||||||
for (;i<HU_MAXMSGLEN;i++)
|
|
||||||
w_chat[i] = 0; // reset this.
|
|
||||||
chat_on = false;
|
chat_on = false;
|
||||||
c_input = 0;
|
c_input = 0;
|
||||||
|
|
||||||
I_UpdateMouseGrab();
|
I_UpdateMouseGrab();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NONET
|
|
||||||
static boolean justscrolleddown;
|
|
||||||
static boolean justscrolledup;
|
|
||||||
static INT16 typelines = 1; // number of drawfill lines we need when drawing the chat. it's some weird hack and might be one frame off but I'm lazy to make another loop.
|
|
||||||
// It's up here since it has to be reset when we open the chat.
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Returns true if key eaten
|
// Returns true if key eaten
|
||||||
//
|
//
|
||||||
|
@ -1171,21 +1077,23 @@ boolean HU_Responder(event_t *ev)
|
||||||
if (shiftdown ^ capslock)
|
if (shiftdown ^ capslock)
|
||||||
c = shiftxform[c];
|
c = shiftxform[c];
|
||||||
}
|
}
|
||||||
else // if we're holding shift we should still shift non letter symbols
|
else // if we're holding shift we should still shift non letter symbols
|
||||||
{
|
{
|
||||||
if (shiftdown)
|
if (shiftdown)
|
||||||
c = shiftxform[c];
|
c = shiftxform[c];
|
||||||
}
|
}
|
||||||
|
|
||||||
// pasting. pasting is cool. chat is a bit limited, though :(
|
// pasting. pasting is cool. chat is a bit limited, though :(
|
||||||
if (((c == 'v' || c == 'V') && ctrldown) && !CHAT_MUTE)
|
if ((c == 'v' || c == 'V') && ctrldown)
|
||||||
{
|
{
|
||||||
const char *paste = I_ClipboardPaste();
|
const char *paste;
|
||||||
size_t chatlen;
|
size_t chatlen;
|
||||||
size_t pastelen;
|
size_t pastelen;
|
||||||
|
|
||||||
// create a dummy string real quickly
|
if (CHAT_MUTE)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
paste = I_ClipboardPaste();
|
||||||
if (paste == NULL)
|
if (paste == NULL)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -1194,40 +1102,16 @@ boolean HU_Responder(event_t *ev)
|
||||||
if (chatlen+pastelen > HU_MAXMSGLEN)
|
if (chatlen+pastelen > HU_MAXMSGLEN)
|
||||||
return true; // we can't paste this!!
|
return true; // we can't paste this!!
|
||||||
|
|
||||||
if (c_input >= strlen(w_chat)) // add it at the end of the string.
|
memmove(&w_chat[c_input + pastelen], &w_chat[c_input], pastelen);
|
||||||
{
|
memcpy(&w_chat[c_input], paste, pastelen); // copy all of that.
|
||||||
memcpy(&w_chat[chatlen], paste, pastelen); // copy all of that.
|
c_input += pastelen;
|
||||||
c_input += pastelen;
|
return true;
|
||||||
/*size_t i = 0;
|
|
||||||
for (;i<pastelen;i++)
|
|
||||||
{
|
|
||||||
HU_queueChatChar(paste[i]); // queue it so that it's actually sent. (this chat write thing is REALLY messy.)
|
|
||||||
}*/
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else // otherwise, we need to shift everything and make space, etc etc
|
|
||||||
{
|
|
||||||
size_t i = HU_MAXMSGLEN-1;
|
|
||||||
while (i >= c_input)
|
|
||||||
{
|
|
||||||
if (w_chat[i])
|
|
||||||
w_chat[i+pastelen] = w_chat[i];
|
|
||||||
if (i == 0) // prevent overflow
|
|
||||||
break;
|
|
||||||
i--;
|
|
||||||
}
|
|
||||||
memcpy(&w_chat[c_input], paste, pastelen); // copy all of that.
|
|
||||||
c_input += pastelen;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else if (c == KEY_ENTER)
|
||||||
|
{
|
||||||
|
if (!CHAT_MUTE)
|
||||||
|
HU_sendChatMessage();
|
||||||
|
|
||||||
if (!CHAT_MUTE && HU_keyInChatString(w_chat,c))
|
|
||||||
{
|
|
||||||
HU_queueChatChar(c);
|
|
||||||
}
|
|
||||||
if (c == KEY_ENTER)
|
|
||||||
{
|
|
||||||
chat_on = false;
|
chat_on = false;
|
||||||
c_input = 0; // reset input cursor
|
c_input = 0; // reset input cursor
|
||||||
chat_scrollmedown = true; // you hit enter, so you might wanna autoscroll to see what you just sent. :)
|
chat_scrollmedown = true; // you hit enter, so you might wanna autoscroll to see what you just sent. :)
|
||||||
|
@ -1268,6 +1152,32 @@ boolean HU_Responder(event_t *ev)
|
||||||
else
|
else
|
||||||
c_input++;
|
c_input++;
|
||||||
}
|
}
|
||||||
|
else if ((c >= HU_FONTSTART && c <= HU_FONTEND && hu_font[c-HU_FONTSTART])
|
||||||
|
|| c == ' ') // Allow spaces, of course
|
||||||
|
{
|
||||||
|
if (CHAT_MUTE || strlen(w_chat) >= HU_MAXMSGLEN)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
memmove(&w_chat[c_input + 1], &w_chat[c_input], strlen(w_chat) - c_input + 1);
|
||||||
|
w_chat[c_input] = c;
|
||||||
|
c_input++;
|
||||||
|
}
|
||||||
|
else if (c == KEY_BACKSPACE)
|
||||||
|
{
|
||||||
|
if (CHAT_MUTE || c_input <= 0)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
memmove(&w_chat[c_input - 1], &w_chat[c_input], strlen(w_chat) - c_input + 1);
|
||||||
|
c_input--;
|
||||||
|
}
|
||||||
|
else if (c == KEY_DEL)
|
||||||
|
{
|
||||||
|
if (CHAT_MUTE || c_input >= strlen(w_chat))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
memmove(&w_chat[c_input], &w_chat[c_input + 1], strlen(w_chat) - c_input);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -1863,64 +1773,25 @@ static void HU_DrawChat_Old(void)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// draw the Crosshair, at the exact center of the view.
|
// Draw crosshairs at the exact center of the view.
|
||||||
//
|
// In splitscreen, crosshairs are stretched vertically to compensate for V_PERPLAYER squishing them.
|
||||||
// Crosshairs are pre-cached at HU_Init
|
// Crosshairs are pre-cached at HU_Init
|
||||||
|
|
||||||
static inline void HU_DrawCrosshair(void)
|
static inline void HU_DrawCrosshairs(void)
|
||||||
{
|
{
|
||||||
INT32 i, y, dupz;
|
INT32 cross1 = cv_crosshair.value & 3;
|
||||||
|
INT32 cross2 = cv_crosshair2.value & 3;
|
||||||
|
|
||||||
i = cv_crosshair.value & 3;
|
if (automapactive || demoplayback)
|
||||||
if (!i)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ((netgame || multiplayer) && players[displayplayer].spectator)
|
stplyr = ((stplyr == &players[displayplayer]) ? &players[secondarydisplayplayer] : &players[displayplayer]);
|
||||||
return;
|
if (!players[displayplayer].spectator && (!camera.chase || ticcmd_ztargetfocus[0]) && cross1)
|
||||||
|
V_DrawStretchyFixedPatch((BASEVIDWIDTH/2)<<FRACBITS, (BASEVIDHEIGHT/2)<<FRACBITS, FRACUNIT, splitscreen ? 2*FRACUNIT : FRACUNIT, V_TRANSLUCENT|V_PERPLAYER, crosshair[cross1 - 1], NULL);
|
||||||
|
|
||||||
#ifdef HWRENDER
|
stplyr = ((stplyr == &players[displayplayer]) ? &players[secondarydisplayplayer] : &players[displayplayer]);
|
||||||
if (rendermode != render_soft)
|
if (!players[secondarydisplayplayer].spectator && (!camera2.chase || ticcmd_ztargetfocus[1]) && cross2 && splitscreen)
|
||||||
y = (INT32)gl_basewindowcentery;
|
V_DrawStretchyFixedPatch((BASEVIDWIDTH/2)<<FRACBITS, (BASEVIDHEIGHT/2)<<FRACBITS, FRACUNIT, 2*FRACUNIT, V_TRANSLUCENT|V_PERPLAYER, crosshair[cross2 - 1], NULL);
|
||||||
else
|
|
||||||
#endif
|
|
||||||
y = viewwindowy + (viewheight>>1);
|
|
||||||
|
|
||||||
dupz = (vid.dupx < vid.dupy ? vid.dupx : vid.dupy);
|
|
||||||
|
|
||||||
V_DrawFixedPatch(vid.width<<(FRACBITS-1), y<<FRACBITS, FRACUNIT/dupz, V_TRANSLUCENT, crosshair[i - 1], NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void HU_DrawCrosshair2(void)
|
|
||||||
{
|
|
||||||
INT32 i, y, dupz;
|
|
||||||
|
|
||||||
i = cv_crosshair2.value & 3;
|
|
||||||
if (!i)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if ((netgame || multiplayer) && players[secondarydisplayplayer].spectator)
|
|
||||||
return;
|
|
||||||
|
|
||||||
#ifdef HWRENDER
|
|
||||||
if (rendermode != render_soft)
|
|
||||||
y = (INT32)gl_basewindowcentery;
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
y = viewwindowy + (viewheight>>1);
|
|
||||||
|
|
||||||
if (!splitscreen)
|
|
||||||
return;
|
|
||||||
|
|
||||||
#ifdef HWRENDER
|
|
||||||
if (rendermode != render_soft)
|
|
||||||
y += (INT32)gl_viewheight;
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
y += viewheight;
|
|
||||||
|
|
||||||
dupz = (vid.dupx < vid.dupy ? vid.dupx : vid.dupy);
|
|
||||||
|
|
||||||
V_DrawFixedPatch(vid.width<<(FRACBITS-1), y<<FRACBITS, FRACUNIT/dupz, V_TRANSLUCENT, crosshair[i - 1], NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void HU_DrawCEcho(void)
|
static void HU_DrawCEcho(void)
|
||||||
|
@ -2114,19 +1985,9 @@ void HU_Drawer(void)
|
||||||
if (gamestate != GS_LEVEL)
|
if (gamestate != GS_LEVEL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// draw the crosshair, not when viewing demos nor with chasecam
|
// draw the crosshair
|
||||||
if (LUA_HudEnabled(hud_crosshair))
|
if (LUA_HudEnabled(hud_crosshair))
|
||||||
{
|
HU_DrawCrosshairs();
|
||||||
if (!automapactive && cv_crosshair.value && !demoplayback &&
|
|
||||||
(!camera.chase || ticcmd_ztargetfocus[0])
|
|
||||||
&& !players[displayplayer].spectator)
|
|
||||||
HU_DrawCrosshair();
|
|
||||||
|
|
||||||
if (!automapactive && cv_crosshair2.value && !demoplayback &&
|
|
||||||
(!camera2.chase || ticcmd_ztargetfocus[1])
|
|
||||||
&& !players[secondarydisplayplayer].spectator)
|
|
||||||
HU_DrawCrosshair2();
|
|
||||||
}
|
|
||||||
|
|
||||||
// draw desynch text
|
// draw desynch text
|
||||||
if (hu_redownloadinggamestate)
|
if (hu_redownloadinggamestate)
|
||||||
|
|
|
@ -62,7 +62,7 @@ typedef struct
|
||||||
//------------------------------------
|
//------------------------------------
|
||||||
// chat stuff
|
// chat stuff
|
||||||
//------------------------------------
|
//------------------------------------
|
||||||
#define HU_MAXMSGLEN 224
|
#define HU_MAXMSGLEN 223
|
||||||
#define CHAT_BUFSIZE 64 // that's enough messages, right? We'll delete the older ones when that gets out of hand.
|
#define CHAT_BUFSIZE 64 // that's enough messages, right? We'll delete the older ones when that gets out of hand.
|
||||||
#ifdef NETSPLITSCREEN
|
#ifdef NETSPLITSCREEN
|
||||||
#define OLDCHAT (cv_consolechat.value == 1 || dedicated || vid.width < 640)
|
#define OLDCHAT (cv_consolechat.value == 1 || dedicated || vid.width < 640)
|
||||||
|
|
|
@ -98,6 +98,7 @@ void AddMServCommands(void)
|
||||||
CV_RegisterVar(&cv_servername);
|
CV_RegisterVar(&cv_servername);
|
||||||
#ifdef MASTERSERVER
|
#ifdef MASTERSERVER
|
||||||
COM_AddCommand("listserv", Command_Listserv_f);
|
COM_AddCommand("listserv", Command_Listserv_f);
|
||||||
|
COM_AddCommand("masterserver_update", Update_parameters); // allows people to updates manually in case you were delisted by accident
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -2512,7 +2512,10 @@ static boolean P_LoadExtendedSubsectorsAndSegs(UINT8 **data, nodetype_t nodetype
|
||||||
P_InitializeSeg(seg);
|
P_InitializeSeg(seg);
|
||||||
seg->angle = R_PointToAngle2(v1->x, v1->y, v2->x, v2->y);
|
seg->angle = R_PointToAngle2(v1->x, v1->y, v2->x, v2->y);
|
||||||
if (seg->linedef)
|
if (seg->linedef)
|
||||||
segs[i].offset = FixedHypot(v1->x - seg->linedef->v1->x, v1->y - seg->linedef->v1->y);
|
{
|
||||||
|
vertex_t *v = (seg->side == 1) ? seg->linedef->v2 : seg->linedef->v1;
|
||||||
|
segs[i].offset = FixedHypot(v1->x - v->x, v1->y - v->y);
|
||||||
|
}
|
||||||
seg->length = P_SegLength(seg);
|
seg->length = P_SegLength(seg);
|
||||||
#ifdef HWRENDER
|
#ifdef HWRENDER
|
||||||
seg->flength = (rendermode == render_opengl) ? P_SegLengthFloat(seg) : 0;
|
seg->flength = (rendermode == render_opengl) ? P_SegLengthFloat(seg) : 0;
|
||||||
|
@ -4373,7 +4376,7 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate)
|
||||||
|
|
||||||
// internal game map
|
// internal game map
|
||||||
maplumpname = G_BuildMapName(gamemap);
|
maplumpname = G_BuildMapName(gamemap);
|
||||||
lastloadedmaplumpnum = W_CheckNumForName(maplumpname);
|
lastloadedmaplumpnum = W_CheckNumForMap(maplumpname);
|
||||||
if (lastloadedmaplumpnum == LUMPERROR)
|
if (lastloadedmaplumpnum == LUMPERROR)
|
||||||
I_Error("Map %s not found.\n", maplumpname);
|
I_Error("Map %s not found.\n", maplumpname);
|
||||||
|
|
||||||
|
|
|
@ -170,6 +170,7 @@ void R_DrawViewBorder(void);
|
||||||
void R_DrawColumn_8(void);
|
void R_DrawColumn_8(void);
|
||||||
void R_DrawShadeColumn_8(void);
|
void R_DrawShadeColumn_8(void);
|
||||||
void R_DrawTranslucentColumn_8(void);
|
void R_DrawTranslucentColumn_8(void);
|
||||||
|
void R_DrawDropShadowColumn_8(void);
|
||||||
void R_DrawTranslatedColumn_8(void);
|
void R_DrawTranslatedColumn_8(void);
|
||||||
void R_DrawTranslatedTranslucentColumn_8(void);
|
void R_DrawTranslatedTranslucentColumn_8(void);
|
||||||
void R_Draw2sMultiPatchColumn_8(void);
|
void R_Draw2sMultiPatchColumn_8(void);
|
||||||
|
|
|
@ -416,6 +416,39 @@ void R_DrawTranslucentColumn_8(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Hack: A cut-down copy of R_DrawTranslucentColumn_8 that does not read texture
|
||||||
|
// data since something about calculating the texture reading address for drop shadows is broken.
|
||||||
|
// dc_texturemid and dc_iscale get wrong values for drop shadows, however those are not strictly
|
||||||
|
// needed for the current design of the shadows, so this function bypasses the issue
|
||||||
|
// by not using those variables at all.
|
||||||
|
void R_DrawDropShadowColumn_8(void)
|
||||||
|
{
|
||||||
|
register INT32 count;
|
||||||
|
register UINT8 *dest;
|
||||||
|
|
||||||
|
count = dc_yh - dc_yl + 1;
|
||||||
|
|
||||||
|
if (count <= 0) // Zero length, column does not exceed a pixel.
|
||||||
|
return;
|
||||||
|
|
||||||
|
dest = &topleft[dc_yl*vid.width + dc_x];
|
||||||
|
|
||||||
|
{
|
||||||
|
#define DSCOLOR 31 // palette index for the color of the shadow
|
||||||
|
register const UINT8 *transmap_offset = dc_transmap + (dc_colormap[DSCOLOR] << 8);
|
||||||
|
#undef DSCOLOR
|
||||||
|
while ((count -= 2) >= 0)
|
||||||
|
{
|
||||||
|
*dest = *(transmap_offset + (*dest));
|
||||||
|
dest += vid.width;
|
||||||
|
*dest = *(transmap_offset + (*dest));
|
||||||
|
dest += vid.width;
|
||||||
|
}
|
||||||
|
if (count & 1)
|
||||||
|
*dest = *(transmap_offset + (*dest));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** \brief The R_DrawTranslatedTranslucentColumn_8 function
|
/** \brief The R_DrawTranslatedTranslucentColumn_8 function
|
||||||
Spiffy function. Not only does it colormap a sprite, but does translucency as well.
|
Spiffy function. Not only does it colormap a sprite, but does translucency as well.
|
||||||
Uber-kudos to Cyan Helkaraxe
|
Uber-kudos to Cyan Helkaraxe
|
||||||
|
|
|
@ -992,6 +992,9 @@ void R_DrawTiltedFloorSprite_NPO2_8(void)
|
||||||
double endz, endu, endv;
|
double endz, endu, endv;
|
||||||
UINT32 stepu, stepv;
|
UINT32 stepu, stepv;
|
||||||
|
|
||||||
|
struct libdivide_u32_t x_divider = libdivide_u32_gen(ds_flatwidth);
|
||||||
|
struct libdivide_u32_t y_divider = libdivide_u32_gen(ds_flatheight);
|
||||||
|
|
||||||
iz = ds_szp->z + ds_szp->y*(centery-ds_y) + ds_szp->x*(ds_x1-centerx);
|
iz = ds_szp->z + ds_szp->y*(centery-ds_y) + ds_szp->x*(ds_x1-centerx);
|
||||||
uz = ds_sup->z + ds_sup->y*(centery-ds_y) + ds_sup->x*(ds_x1-centerx);
|
uz = ds_sup->z + ds_sup->y*(centery-ds_y) + ds_sup->x*(ds_x1-centerx);
|
||||||
vz = ds_svp->z + ds_svp->y*(centery-ds_y) + ds_svp->x*(ds_x1-centerx);
|
vz = ds_svp->z + ds_svp->y*(centery-ds_y) + ds_svp->x*(ds_x1-centerx);
|
||||||
|
@ -1033,12 +1036,13 @@ void R_DrawTiltedFloorSprite_NPO2_8(void)
|
||||||
|
|
||||||
// Carefully align all of my Friends.
|
// Carefully align all of my Friends.
|
||||||
if (x < 0)
|
if (x < 0)
|
||||||
x = ds_flatwidth - ((UINT32)(ds_flatwidth - x) % ds_flatwidth);
|
x += (libdivide_u32_do((UINT32)(-x-1), &x_divider) + 1) * ds_flatwidth;
|
||||||
|
else
|
||||||
|
x -= libdivide_u32_do((UINT32)x, &x_divider) * ds_flatwidth;
|
||||||
if (y < 0)
|
if (y < 0)
|
||||||
y = ds_flatheight - ((UINT32)(ds_flatheight - y) % ds_flatheight);
|
y += (libdivide_u32_do((UINT32)(-y-1), &y_divider) + 1) * ds_flatheight;
|
||||||
|
else
|
||||||
x %= ds_flatwidth;
|
y -= libdivide_u32_do((UINT32)y, &y_divider) * ds_flatheight;
|
||||||
y %= ds_flatheight;
|
|
||||||
|
|
||||||
val = source[((y * ds_flatwidth) + x)];
|
val = source[((y * ds_flatwidth) + x)];
|
||||||
if (val & 0xFF00)
|
if (val & 0xFF00)
|
||||||
|
@ -1065,12 +1069,13 @@ void R_DrawTiltedFloorSprite_NPO2_8(void)
|
||||||
|
|
||||||
// Carefully align all of my Friends.
|
// Carefully align all of my Friends.
|
||||||
if (x < 0)
|
if (x < 0)
|
||||||
x = ds_flatwidth - ((UINT32)(ds_flatwidth - x) % ds_flatwidth);
|
x += (libdivide_u32_do((UINT32)(-x-1), &x_divider) + 1) * ds_flatwidth;
|
||||||
|
else
|
||||||
|
x -= libdivide_u32_do((UINT32)x, &x_divider) * ds_flatwidth;
|
||||||
if (y < 0)
|
if (y < 0)
|
||||||
y = ds_flatheight - ((UINT32)(ds_flatheight - y) % ds_flatheight);
|
y += (libdivide_u32_do((UINT32)(-y-1), &y_divider) + 1) * ds_flatheight;
|
||||||
|
else
|
||||||
x %= ds_flatwidth;
|
y -= libdivide_u32_do((UINT32)y, &y_divider) * ds_flatheight;
|
||||||
y %= ds_flatheight;
|
|
||||||
|
|
||||||
val = source[((y * ds_flatwidth) + x)];
|
val = source[((y * ds_flatwidth) + x)];
|
||||||
if (val & 0xFF00)
|
if (val & 0xFF00)
|
||||||
|
@ -1101,12 +1106,13 @@ void R_DrawTiltedFloorSprite_NPO2_8(void)
|
||||||
|
|
||||||
// Carefully align all of my Friends.
|
// Carefully align all of my Friends.
|
||||||
if (x < 0)
|
if (x < 0)
|
||||||
x = ds_flatwidth - ((UINT32)(ds_flatwidth - x) % ds_flatwidth);
|
x += (libdivide_u32_do((UINT32)(-x-1), &x_divider) + 1) * ds_flatwidth;
|
||||||
|
else
|
||||||
|
x -= libdivide_u32_do((UINT32)x, &x_divider) * ds_flatwidth;
|
||||||
if (y < 0)
|
if (y < 0)
|
||||||
y = ds_flatheight - ((UINT32)(ds_flatheight - y) % ds_flatheight);
|
y += (libdivide_u32_do((UINT32)(-y-1), &y_divider) + 1) * ds_flatheight;
|
||||||
|
else
|
||||||
x %= ds_flatwidth;
|
y -= libdivide_u32_do((UINT32)y, &y_divider) * ds_flatheight;
|
||||||
y %= ds_flatheight;
|
|
||||||
|
|
||||||
val = source[((y * ds_flatwidth) + x)];
|
val = source[((y * ds_flatwidth) + x)];
|
||||||
if (val & 0xFF00)
|
if (val & 0xFF00)
|
||||||
|
@ -1142,6 +1148,9 @@ void R_DrawTiltedTranslucentFloorSprite_NPO2_8(void)
|
||||||
double endz, endu, endv;
|
double endz, endu, endv;
|
||||||
UINT32 stepu, stepv;
|
UINT32 stepu, stepv;
|
||||||
|
|
||||||
|
struct libdivide_u32_t x_divider = libdivide_u32_gen(ds_flatwidth);
|
||||||
|
struct libdivide_u32_t y_divider = libdivide_u32_gen(ds_flatheight);
|
||||||
|
|
||||||
iz = ds_szp->z + ds_szp->y*(centery-ds_y) + ds_szp->x*(ds_x1-centerx);
|
iz = ds_szp->z + ds_szp->y*(centery-ds_y) + ds_szp->x*(ds_x1-centerx);
|
||||||
uz = ds_sup->z + ds_sup->y*(centery-ds_y) + ds_sup->x*(ds_x1-centerx);
|
uz = ds_sup->z + ds_sup->y*(centery-ds_y) + ds_sup->x*(ds_x1-centerx);
|
||||||
vz = ds_svp->z + ds_svp->y*(centery-ds_y) + ds_svp->x*(ds_x1-centerx);
|
vz = ds_svp->z + ds_svp->y*(centery-ds_y) + ds_svp->x*(ds_x1-centerx);
|
||||||
|
@ -1183,12 +1192,13 @@ void R_DrawTiltedTranslucentFloorSprite_NPO2_8(void)
|
||||||
|
|
||||||
// Carefully align all of my Friends.
|
// Carefully align all of my Friends.
|
||||||
if (x < 0)
|
if (x < 0)
|
||||||
x = ds_flatwidth - ((UINT32)(ds_flatwidth - x) % ds_flatwidth);
|
x += (libdivide_u32_do((UINT32)(-x-1), &x_divider) + 1) * ds_flatwidth;
|
||||||
|
else
|
||||||
|
x -= libdivide_u32_do((UINT32)x, &x_divider) * ds_flatwidth;
|
||||||
if (y < 0)
|
if (y < 0)
|
||||||
y = ds_flatheight - ((UINT32)(ds_flatheight - y) % ds_flatheight);
|
y += (libdivide_u32_do((UINT32)(-y-1), &y_divider) + 1) * ds_flatheight;
|
||||||
|
else
|
||||||
x %= ds_flatwidth;
|
y -= libdivide_u32_do((UINT32)y, &y_divider) * ds_flatheight;
|
||||||
y %= ds_flatheight;
|
|
||||||
|
|
||||||
val = source[((y * ds_flatwidth) + x)];
|
val = source[((y * ds_flatwidth) + x)];
|
||||||
if (val & 0xFF00)
|
if (val & 0xFF00)
|
||||||
|
@ -1215,12 +1225,13 @@ void R_DrawTiltedTranslucentFloorSprite_NPO2_8(void)
|
||||||
|
|
||||||
// Carefully align all of my Friends.
|
// Carefully align all of my Friends.
|
||||||
if (x < 0)
|
if (x < 0)
|
||||||
x = ds_flatwidth - ((UINT32)(ds_flatwidth - x) % ds_flatwidth);
|
x += (libdivide_u32_do((UINT32)(-x-1), &x_divider) + 1) * ds_flatwidth;
|
||||||
|
else
|
||||||
|
x -= libdivide_u32_do((UINT32)x, &x_divider) * ds_flatwidth;
|
||||||
if (y < 0)
|
if (y < 0)
|
||||||
y = ds_flatheight - ((UINT32)(ds_flatheight - y) % ds_flatheight);
|
y += (libdivide_u32_do((UINT32)(-y-1), &y_divider) + 1) * ds_flatheight;
|
||||||
|
else
|
||||||
x %= ds_flatwidth;
|
y -= libdivide_u32_do((UINT32)y, &y_divider) * ds_flatheight;
|
||||||
y %= ds_flatheight;
|
|
||||||
|
|
||||||
val = source[((y * ds_flatwidth) + x)];
|
val = source[((y * ds_flatwidth) + x)];
|
||||||
if (val & 0xFF00)
|
if (val & 0xFF00)
|
||||||
|
@ -1251,12 +1262,13 @@ void R_DrawTiltedTranslucentFloorSprite_NPO2_8(void)
|
||||||
|
|
||||||
// Carefully align all of my Friends.
|
// Carefully align all of my Friends.
|
||||||
if (x < 0)
|
if (x < 0)
|
||||||
x = ds_flatwidth - ((UINT32)(ds_flatwidth - x) % ds_flatwidth);
|
x += (libdivide_u32_do((UINT32)(-x-1), &x_divider) + 1) * ds_flatwidth;
|
||||||
|
else
|
||||||
|
x -= libdivide_u32_do((UINT32)x, &x_divider) * ds_flatwidth;
|
||||||
if (y < 0)
|
if (y < 0)
|
||||||
y = ds_flatheight - ((UINT32)(ds_flatheight - y) % ds_flatheight);
|
y += (libdivide_u32_do((UINT32)(-y-1), &y_divider) + 1) * ds_flatheight;
|
||||||
|
else
|
||||||
x %= ds_flatwidth;
|
y -= libdivide_u32_do((UINT32)y, &y_divider) * ds_flatheight;
|
||||||
y %= ds_flatheight;
|
|
||||||
|
|
||||||
val = source[((y * ds_flatwidth) + x)];
|
val = source[((y * ds_flatwidth) + x)];
|
||||||
if (val & 0xFF00)
|
if (val & 0xFF00)
|
||||||
|
|
|
@ -482,7 +482,7 @@ static void R_RasterizeFloorSplat(floorsplat_t *pSplat, vector2_t *verts, visspr
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for (i = x1; i <= x2; i++)
|
for (i = x1; i <= x2; i++)
|
||||||
cliptab[i] = (y >= mfloorclip[i]);
|
cliptab[i] = (y >= mfloorclip[i] || y <= mceilingclip[i]);
|
||||||
|
|
||||||
// clip left
|
// clip left
|
||||||
while (cliptab[x1])
|
while (cliptab[x1])
|
||||||
|
|
|
@ -837,6 +837,12 @@ static void R_DrawVisSprite(vissprite_t *vis)
|
||||||
else if (vis->mobj->sprite == SPR_PLAY) // Looks like a player, but doesn't have a color? Get rid of green sonic syndrome.
|
else if (vis->mobj->sprite == SPR_PLAY) // Looks like a player, but doesn't have a color? Get rid of green sonic syndrome.
|
||||||
colfunc = colfuncs[COLDRAWFUNC_TRANS];
|
colfunc = colfuncs[COLDRAWFUNC_TRANS];
|
||||||
|
|
||||||
|
// Hack: Use a special column function for drop shadows that bypasses
|
||||||
|
// invalid memory access crashes caused by R_ProjectDropShadow putting wrong values
|
||||||
|
// in dc_texturemid and dc_iscale when the shadow is sloped.
|
||||||
|
if (vis->cut & SC_SHADOW)
|
||||||
|
colfunc = R_DrawDropShadowColumn_8;
|
||||||
|
|
||||||
if (vis->extra_colormap && !(vis->renderflags & RF_NOCOLORMAPS))
|
if (vis->extra_colormap && !(vis->renderflags & RF_NOCOLORMAPS))
|
||||||
{
|
{
|
||||||
if (!dc_colormap)
|
if (!dc_colormap)
|
||||||
|
@ -3001,13 +3007,25 @@ void R_ClipVisSprite(vissprite_t *spr, INT32 x1, INT32 x2, drawseg_t* dsstart, p
|
||||||
|
|
||||||
if (portal)
|
if (portal)
|
||||||
{
|
{
|
||||||
for (x = x1; x <= x2; x++)
|
INT32 start_index = max(portal->start, x1);
|
||||||
|
INT32 end_index = min(portal->start + portal->end - portal->start, x2);
|
||||||
|
for (x = x1; x < start_index; x++)
|
||||||
|
{
|
||||||
|
spr->clipbot[x] = -1;
|
||||||
|
spr->cliptop[x] = -1;
|
||||||
|
}
|
||||||
|
for (x = start_index; x <= end_index; x++)
|
||||||
{
|
{
|
||||||
if (spr->clipbot[x] > portal->floorclip[x - portal->start])
|
if (spr->clipbot[x] > portal->floorclip[x - portal->start])
|
||||||
spr->clipbot[x] = portal->floorclip[x - portal->start];
|
spr->clipbot[x] = portal->floorclip[x - portal->start];
|
||||||
if (spr->cliptop[x] < portal->ceilingclip[x - portal->start])
|
if (spr->cliptop[x] < portal->ceilingclip[x - portal->start])
|
||||||
spr->cliptop[x] = portal->ceilingclip[x - portal->start];
|
spr->cliptop[x] = portal->ceilingclip[x - portal->start];
|
||||||
}
|
}
|
||||||
|
for (x = end_index + 1; x <= x2; x++)
|
||||||
|
{
|
||||||
|
spr->clipbot[x] = -1;
|
||||||
|
spr->cliptop[x] = -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -358,9 +358,10 @@ static void I_ReportSignal(int num, int coredumped)
|
||||||
|
|
||||||
I_OutputMsg("\nProcess killed by signal: %s\n\n", sigmsg);
|
I_OutputMsg("\nProcess killed by signal: %s\n\n", sigmsg);
|
||||||
|
|
||||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR,
|
if (!M_CheckParm("-dedicated"))
|
||||||
"Process killed by signal",
|
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR,
|
||||||
sigmsg, NULL);
|
"Process killed by signal",
|
||||||
|
sigmsg, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NEWSIGNALHANDLER
|
#ifndef NEWSIGNALHANDLER
|
||||||
|
@ -2202,9 +2203,10 @@ static void newsignalhandler_Warn(const char *pr)
|
||||||
|
|
||||||
I_OutputMsg("%s\n", text);
|
I_OutputMsg("%s\n", text);
|
||||||
|
|
||||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR,
|
if (!M_CheckParm("-dedicated"))
|
||||||
"Startup error",
|
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR,
|
||||||
text, NULL);
|
"Startup error",
|
||||||
|
text, NULL);
|
||||||
|
|
||||||
I_ShutdownConsole();
|
I_ShutdownConsole();
|
||||||
exit(-1);
|
exit(-1);
|
||||||
|
@ -2405,9 +2407,10 @@ void I_Error(const char *error, ...)
|
||||||
// Implement message box with SDL_ShowSimpleMessageBox,
|
// Implement message box with SDL_ShowSimpleMessageBox,
|
||||||
// which should fail gracefully if it can't put a message box up
|
// which should fail gracefully if it can't put a message box up
|
||||||
// on the target system
|
// on the target system
|
||||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR,
|
if (!M_CheckParm("-dedicated"))
|
||||||
"SRB2 "VERSIONSTRING" Recursive Error",
|
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR,
|
||||||
buffer, NULL);
|
"SRB2 "VERSIONSTRING" Recursive Error",
|
||||||
|
buffer, NULL);
|
||||||
|
|
||||||
W_Shutdown();
|
W_Shutdown();
|
||||||
exit(-1); // recursive errors detected
|
exit(-1); // recursive errors detected
|
||||||
|
@ -2449,9 +2452,10 @@ void I_Error(const char *error, ...)
|
||||||
// Implement message box with SDL_ShowSimpleMessageBox,
|
// Implement message box with SDL_ShowSimpleMessageBox,
|
||||||
// which should fail gracefully if it can't put a message box up
|
// which should fail gracefully if it can't put a message box up
|
||||||
// on the target system
|
// on the target system
|
||||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR,
|
if (!M_CheckParm("-dedicated"))
|
||||||
"SRB2 "VERSIONSTRING" Error",
|
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR,
|
||||||
buffer, NULL);
|
"SRB2 "VERSIONSTRING" Error",
|
||||||
|
buffer, NULL);
|
||||||
// Note that SDL_ShowSimpleMessageBox does *not* require SDL to be
|
// Note that SDL_ShowSimpleMessageBox does *not* require SDL to be
|
||||||
// initialized at the time, so calling it after SDL_Quit() is
|
// initialized at the time, so calling it after SDL_Quit() is
|
||||||
// perfectly okay! In addition, we do this on purpose so the
|
// perfectly okay! In addition, we do this on purpose so the
|
||||||
|
|
10
src/w_wad.c
10
src/w_wad.c
|
@ -1463,8 +1463,14 @@ lumpnum_t W_CheckNumForMap(const char *name)
|
||||||
continue;
|
continue;
|
||||||
// Now look for the specified map.
|
// Now look for the specified map.
|
||||||
for (; lumpNum < end; lumpNum++)
|
for (; lumpNum < end; lumpNum++)
|
||||||
if (!strnicmp(name, (wadfiles[i]->lumpinfo + lumpNum)->name, 8))
|
{
|
||||||
return (i<<16) + lumpNum;
|
if (!strnicmp(name, wadfiles[i]->lumpinfo[lumpNum].name, 8))
|
||||||
|
{
|
||||||
|
const char *extension = strrchr(wadfiles[i]->lumpinfo[lumpNum].fullname, '.');
|
||||||
|
if (!(extension && stricmp(extension, ".wad")))
|
||||||
|
return (i<<16) + lumpNum;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return LUMPERROR;
|
return LUMPERROR;
|
||||||
|
|
Loading…
Reference in a new issue