mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-01-14 22:00:50 +00:00
Mixed D&C fixes; replace a couple int's with INT32
This commit is contained in:
parent
245a125551
commit
7a92c9d3d0
3 changed files with 33 additions and 21 deletions
|
@ -727,9 +727,10 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
const UINT8 color = players[playernum].skincolor;
|
||||||
|
|
||||||
cstart = "\x83";
|
cstart = "\x83";
|
||||||
const UINT8 color = players[playernum].skincolor;
|
|
||||||
if (color <= SKINCOLOR_SILVER)
|
if (color <= SKINCOLOR_SILVER)
|
||||||
cstart = "\x80"; // White
|
cstart = "\x80"; // White
|
||||||
else if (color <= SKINCOLOR_BLACK)
|
else if (color <= SKINCOLOR_BLACK)
|
||||||
|
@ -856,9 +857,11 @@ static inline boolean HU_keyInChatString(char *s, char ch)
|
||||||
}
|
}
|
||||||
else if (ch == KEY_BACKSPACE)
|
else if (ch == KEY_BACKSPACE)
|
||||||
{
|
{
|
||||||
|
size_t i = c_input;
|
||||||
|
|
||||||
if (c_input <= 0)
|
if (c_input <= 0)
|
||||||
return false;
|
return false;
|
||||||
size_t i = c_input;
|
|
||||||
if (!s[i-1])
|
if (!s[i-1])
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -910,14 +913,17 @@ static void HU_queueChatChar(char c)
|
||||||
if (c == KEY_ENTER)
|
if (c == KEY_ENTER)
|
||||||
{
|
{
|
||||||
char buf[2+256];
|
char buf[2+256];
|
||||||
size_t ci = 2;
|
|
||||||
char *msg = &buf[2];
|
char *msg = &buf[2];
|
||||||
|
size_t i = 0;
|
||||||
|
size_t ci = 2;
|
||||||
|
INT32 target = 0;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
c = w_chat[-2+ci++];
|
c = w_chat[-2+ci++];
|
||||||
if (!c || (c >= ' ' && !(c & 0x80))) // copy printable characters and terminating '\0' only.
|
if (!c || (c >= ' ' && !(c & 0x80))) // copy printable characters and terminating '\0' only.
|
||||||
buf[ci-1]=c;
|
buf[ci-1]=c;
|
||||||
} while (c);
|
} while (c);
|
||||||
size_t i = 0;
|
|
||||||
for (;(i<HU_MAXMSGLEN);i++)
|
for (;(i<HU_MAXMSGLEN);i++)
|
||||||
w_chat[i] = 0; // reset this.
|
w_chat[i] = 0; // reset this.
|
||||||
|
|
||||||
|
@ -930,10 +936,12 @@ static void HU_queueChatChar(char c)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
INT32 target = 0;
|
|
||||||
|
|
||||||
if (strlen(msg) > 4 && strnicmp(msg, "/pm", 3) == 0) // used /pm
|
if (strlen(msg) > 4 && strnicmp(msg, "/pm", 3) == 0) // used /pm
|
||||||
{
|
{
|
||||||
|
INT32 spc = 1; // used if nodenum[1] is a space.
|
||||||
|
char *nodenum = (char*) malloc(3);
|
||||||
|
const char *newmsg = msg+5+spc;
|
||||||
|
|
||||||
// what we're gonna do now is check if the node exists
|
// what we're gonna do now is check if the node exists
|
||||||
// with that logic, characters 4 and 5 are our numbers:
|
// with that logic, characters 4 and 5 are our numbers:
|
||||||
|
|
||||||
|
@ -944,8 +952,6 @@ static void HU_queueChatChar(char c)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int spc = 1; // used if nodenum[1] is a space.
|
|
||||||
char *nodenum = (char*) malloc(3);
|
|
||||||
strncpy(nodenum, msg+3, 5);
|
strncpy(nodenum, msg+3, 5);
|
||||||
// check for undesirable characters in our "number"
|
// check for undesirable characters in our "number"
|
||||||
if (((nodenum[0] < '0') || (nodenum[0] > '9')) || ((nodenum[1] < '0') || (nodenum[1] > '9')))
|
if (((nodenum[0] < '0') || (nodenum[0] > '9')) || ((nodenum[1] < '0') || (nodenum[1] > '9')))
|
||||||
|
@ -981,8 +987,8 @@ static void HU_queueChatChar(char c)
|
||||||
HU_AddChatText(va("\x82NOTICE: \x80Player %d does not exist.", target), false); // same
|
HU_AddChatText(va("\x82NOTICE: \x80Player %d does not exist.", target), false); // same
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// we need to get rid of the /pm<node>
|
// we need to get rid of the /pm<node>
|
||||||
const char *newmsg = msg+5+spc;
|
|
||||||
memcpy(msg, newmsg, 255);
|
memcpy(msg, newmsg, 255);
|
||||||
}
|
}
|
||||||
if (ci > 3) // don't send target+flags+empty message.
|
if (ci > 3) // don't send target+flags+empty message.
|
||||||
|
@ -2158,6 +2164,8 @@ void HU_drawPing(INT32 x, INT32 y, INT32 ping, boolean notext)
|
||||||
UINT8 barcolor = 128; // color we use for the bars (green, yellow or red)
|
UINT8 barcolor = 128; // color we use for the bars (green, yellow or red)
|
||||||
SINT8 i = 0;
|
SINT8 i = 0;
|
||||||
SINT8 yoffset = 6;
|
SINT8 yoffset = 6;
|
||||||
|
INT32 dx = x+1 - (V_SmallStringWidth(va("%dms", ping), V_ALLOWLOWERCASE)/2);
|
||||||
|
|
||||||
if (ping < 128)
|
if (ping < 128)
|
||||||
{
|
{
|
||||||
numbars = 3;
|
numbars = 3;
|
||||||
|
@ -2169,7 +2177,6 @@ void HU_drawPing(INT32 x, INT32 y, INT32 ping, boolean notext)
|
||||||
barcolor = 103;
|
barcolor = 103;
|
||||||
}
|
}
|
||||||
|
|
||||||
INT32 dx = x+1 - (V_SmallStringWidth(va("%dms", ping), V_ALLOWLOWERCASE)/2);
|
|
||||||
if (!notext || vid.width >= 640) // how sad, we're using a shit resolution.
|
if (!notext || vid.width >= 640) // how sad, we're using a shit resolution.
|
||||||
V_DrawSmallString(dx, y+4, V_ALLOWLOWERCASE, va("%dms", ping));
|
V_DrawSmallString(dx, y+4, V_ALLOWLOWERCASE, va("%dms", ping));
|
||||||
|
|
||||||
|
|
|
@ -96,9 +96,11 @@ static int lib_chatprint(lua_State *L)
|
||||||
{
|
{
|
||||||
const char *str = luaL_checkstring(L, 1); // retrieve string
|
const char *str = luaL_checkstring(L, 1); // retrieve string
|
||||||
boolean sound = luaL_checkboolean(L, 2); // retrieve sound boolean
|
boolean sound = luaL_checkboolean(L, 2); // retrieve sound boolean
|
||||||
|
int len = strlen(str);
|
||||||
|
|
||||||
if (str == NULL) // error if we don't have a string!
|
if (str == NULL) // error if we don't have a string!
|
||||||
return luaL_error(L, LUA_QL("tostring") " must return a string to " LUA_QL("chatprint"));
|
return luaL_error(L, LUA_QL("tostring") " must return a string to " LUA_QL("chatprint"));
|
||||||
int len = strlen(str);
|
|
||||||
if (len > 255) // string is too long!!!
|
if (len > 255) // string is too long!!!
|
||||||
return luaL_error(L, "String exceeds the 255 characters limit of the chat buffer.");
|
return luaL_error(L, "String exceeds the 255 characters limit of the chat buffer.");
|
||||||
|
|
||||||
|
@ -110,7 +112,11 @@ static int lib_chatprint(lua_State *L)
|
||||||
static int lib_chatprintf(lua_State *L)
|
static int lib_chatprintf(lua_State *L)
|
||||||
{
|
{
|
||||||
int n = lua_gettop(L); /* number of arguments */
|
int n = lua_gettop(L); /* number of arguments */
|
||||||
|
const char *str = luaL_checkstring(L, 2); // retrieve string
|
||||||
|
boolean sound = luaL_checkboolean(L, 3); // sound?
|
||||||
|
int len = strlen(str);
|
||||||
player_t *plr;
|
player_t *plr;
|
||||||
|
|
||||||
if (n < 2)
|
if (n < 2)
|
||||||
return luaL_error(L, "chatprintf requires at least two arguments: player and text.");
|
return luaL_error(L, "chatprintf requires at least two arguments: player and text.");
|
||||||
|
|
||||||
|
@ -120,11 +126,9 @@ static int lib_chatprintf(lua_State *L)
|
||||||
if (plr != &players[consoleplayer])
|
if (plr != &players[consoleplayer])
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
const char *str = luaL_checkstring(L, 2); // retrieve string
|
|
||||||
boolean sound = luaL_checkboolean(L, 3); // sound?
|
|
||||||
if (str == NULL) // error if we don't have a string!
|
if (str == NULL) // error if we don't have a string!
|
||||||
return luaL_error(L, LUA_QL("tostring") " must return a string to " LUA_QL("chatprintf"));
|
return luaL_error(L, LUA_QL("tostring") " must return a string to " LUA_QL("chatprintf"));
|
||||||
int len = strlen(str);
|
|
||||||
if (len > 255) // string is too long!!!
|
if (len > 255) // string is too long!!!
|
||||||
return luaL_error(L, "String exceeds the 255 characters limit of the chat buffer.");
|
return luaL_error(L, "String exceeds the 255 characters limit of the chat buffer.");
|
||||||
|
|
||||||
|
|
15
src/m_menu.c
15
src/m_menu.c
|
@ -1315,13 +1315,14 @@ static menuitem_t OP_GameOptionsMenu[] =
|
||||||
|
|
||||||
static menuitem_t OP_ChatOptionsMenu[] =
|
static menuitem_t OP_ChatOptionsMenu[] =
|
||||||
{
|
{
|
||||||
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Chat Box Width", &cv_chatwidth, 10},
|
{IT_STRING | IT_CVAR, NULL, "Chat Mode", &cv_consolechat, 10},
|
||||||
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Chat Box Height", &cv_chatheight, 20},
|
|
||||||
{IT_STRING | IT_CVAR, NULL, "Message Fadeout Time", &cv_chattime, 30},
|
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Chat Box Width", &cv_chatwidth, 30},
|
||||||
{IT_STRING | IT_CVAR, NULL, "Chat Notifications", &cv_chatnotifications, 40},
|
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Chat Box Height", &cv_chatheight, 40},
|
||||||
{IT_STRING | IT_CVAR, NULL, "Spam Protection", &cv_chatspamprotection, 50},
|
{IT_STRING | IT_CVAR, NULL, "Message Fadeout Time", &cv_chattime, 50},
|
||||||
{IT_STRING | IT_CVAR, NULL, "Chat background tint", &cv_chatbacktint, 60},
|
{IT_STRING | IT_CVAR, NULL, "Chat Notifications", &cv_chatnotifications, 60},
|
||||||
{IT_STRING | IT_CVAR, NULL, "Chat Mode", &cv_consolechat, 70},
|
{IT_STRING | IT_CVAR, NULL, "Spam Protection", &cv_chatspamprotection, 70},
|
||||||
|
{IT_STRING | IT_CVAR, NULL, "Chat background tint", &cv_chatbacktint, 80},
|
||||||
};
|
};
|
||||||
|
|
||||||
static menuitem_t OP_ServerOptionsMenu[] =
|
static menuitem_t OP_ServerOptionsMenu[] =
|
||||||
|
|
Loading…
Reference in a new issue