mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-18 23:42:11 +00:00
Merge branch 'public_next'
This commit is contained in:
commit
66bc287688
13 changed files with 209 additions and 163 deletions
|
@ -148,6 +148,20 @@ void COM_BufInsertText(const char *ptext)
|
|||
}
|
||||
}
|
||||
|
||||
/** Progress the wait timer and flush waiting console commands when ready.
|
||||
*/
|
||||
void
|
||||
COM_BufTicker(void)
|
||||
{
|
||||
if (com_wait)
|
||||
{
|
||||
com_wait--;
|
||||
return;
|
||||
}
|
||||
|
||||
COM_BufExecute();
|
||||
}
|
||||
|
||||
/** Flushes (executes) console commands in the buffer.
|
||||
*/
|
||||
void COM_BufExecute(void)
|
||||
|
@ -157,12 +171,6 @@ void COM_BufExecute(void)
|
|||
char line[1024] = "";
|
||||
INT32 quotes;
|
||||
|
||||
if (com_wait)
|
||||
{
|
||||
com_wait--;
|
||||
return;
|
||||
}
|
||||
|
||||
while (com_text.cursize)
|
||||
{
|
||||
// find a '\n' or; line break
|
||||
|
@ -514,7 +522,6 @@ static void COM_ExecuteString(char *ptext)
|
|||
{
|
||||
if (!stricmp(com_argv[0], cmd->name)) //case insensitive now that we have lower and uppercase!
|
||||
{
|
||||
recursion = 0;
|
||||
cmd->function();
|
||||
return;
|
||||
}
|
||||
|
@ -526,19 +533,17 @@ static void COM_ExecuteString(char *ptext)
|
|||
if (!stricmp(com_argv[0], a->name))
|
||||
{
|
||||
if (recursion > MAX_ALIAS_RECURSION)
|
||||
{
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Alias recursion cycle detected!\n"));
|
||||
recursion = 0;
|
||||
return;
|
||||
else
|
||||
{ // Monster Iestyn: keep track of how many levels of recursion we're in
|
||||
recursion++;
|
||||
COM_BufInsertText(a->value);
|
||||
recursion--;
|
||||
}
|
||||
recursion++;
|
||||
COM_BufInsertText(a->value);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
recursion = 0;
|
||||
|
||||
// check cvars
|
||||
// Hurdler: added at Ebola's request ;)
|
||||
// (don't flood the console in software mode with bad gr_xxx command)
|
||||
|
|
|
@ -45,6 +45,9 @@ void COM_ImmedExecute(const char *ptext);
|
|||
// Execute commands in buffer, flush them
|
||||
void COM_BufExecute(void);
|
||||
|
||||
// As above; and progress the wait timer.
|
||||
void COM_BufTicker(void);
|
||||
|
||||
// setup command buffer, at game tartup
|
||||
void COM_Init(void);
|
||||
|
||||
|
|
|
@ -1115,16 +1115,6 @@ boolean CON_Responder(event_t *ev)
|
|||
else if (key == KEY_KPADSLASH)
|
||||
key = '/';
|
||||
|
||||
// capslock
|
||||
if (key == KEY_CAPSLOCK) // it's a toggle.
|
||||
{
|
||||
if (capslock)
|
||||
capslock = false;
|
||||
else
|
||||
capslock = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (key >= 'a' && key <= 'z')
|
||||
{
|
||||
if (capslock ^ shiftdown)
|
||||
|
|
|
@ -2614,7 +2614,10 @@ static void Command_Ban(void)
|
|||
else
|
||||
{
|
||||
if (server) // only the server is allowed to do this right now
|
||||
{
|
||||
Ban_Add(COM_Argv(2));
|
||||
D_SaveBan(); // save the ban list
|
||||
}
|
||||
|
||||
if (COM_Argc() == 2)
|
||||
{
|
||||
|
@ -2645,6 +2648,42 @@ static void Command_Ban(void)
|
|||
|
||||
}
|
||||
|
||||
static void Command_BanIP(void)
|
||||
{
|
||||
if (COM_Argc() < 2)
|
||||
{
|
||||
CONS_Printf(M_GetText("banip <ip> <reason>: ban an ip address\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (server) // Only the server can use this, otherwise does nothing.
|
||||
{
|
||||
const char *address = (COM_Argv(1));
|
||||
const char *reason;
|
||||
|
||||
if (COM_Argc() == 2)
|
||||
reason = NULL;
|
||||
else
|
||||
reason = COM_Argv(2);
|
||||
|
||||
|
||||
if (I_SetBanAddress && I_SetBanAddress(address, NULL))
|
||||
{
|
||||
if (reason)
|
||||
CONS_Printf("Banned IP address %s for: %s\n", address, reason);
|
||||
else
|
||||
CONS_Printf("Banned IP address %s\n", address);
|
||||
|
||||
Ban_Add(reason);
|
||||
D_SaveBan();
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void Command_Kick(void)
|
||||
{
|
||||
if (COM_Argc() < 2)
|
||||
|
@ -2924,6 +2963,7 @@ void D_ClientServerInit(void)
|
|||
COM_AddCommand("getplayernum", Command_GetPlayerNum);
|
||||
COM_AddCommand("kick", Command_Kick);
|
||||
COM_AddCommand("ban", Command_Ban);
|
||||
COM_AddCommand("banip", Command_BanIP);
|
||||
COM_AddCommand("clearbans", Command_ClearBans);
|
||||
COM_AddCommand("showbanlist", Command_ShowBan);
|
||||
COM_AddCommand("reloadbans", Command_ReloadBan);
|
||||
|
@ -4579,7 +4619,7 @@ void TryRunTics(tic_t realtics)
|
|||
|
||||
if (realtics >= 1)
|
||||
{
|
||||
COM_BufExecute();
|
||||
COM_BufTicker();
|
||||
if (mapchangepending)
|
||||
D_MapChange(-1, 0, ultimatemode, false, 2, false, fromlevelselect); // finish the map change
|
||||
}
|
||||
|
|
31
src/d_main.c
31
src/d_main.c
|
@ -157,37 +157,11 @@ void D_PostEvent_end(void) {};
|
|||
#endif
|
||||
|
||||
// modifier keys
|
||||
// Now handled in I_OsPolling
|
||||
UINT8 shiftdown = 0; // 0x1 left, 0x2 right
|
||||
UINT8 ctrldown = 0; // 0x1 left, 0x2 right
|
||||
UINT8 altdown = 0; // 0x1 left, 0x2 right
|
||||
boolean capslock = 0; // gee i wonder what this does.
|
||||
//
|
||||
// D_ModifierKeyResponder
|
||||
// Sets global shift/ctrl/alt variables, never actually eats events
|
||||
//
|
||||
static inline void D_ModifierKeyResponder(event_t *ev)
|
||||
{
|
||||
if (ev->type == ev_keydown || ev->type == ev_console) switch (ev->data1)
|
||||
{
|
||||
case KEY_LSHIFT: shiftdown |= 0x1; return;
|
||||
case KEY_RSHIFT: shiftdown |= 0x2; return;
|
||||
case KEY_LCTRL: ctrldown |= 0x1; return;
|
||||
case KEY_RCTRL: ctrldown |= 0x2; return;
|
||||
case KEY_LALT: altdown |= 0x1; return;
|
||||
case KEY_RALT: altdown |= 0x2; return;
|
||||
default: return;
|
||||
}
|
||||
else if (ev->type == ev_keyup) switch (ev->data1)
|
||||
{
|
||||
case KEY_LSHIFT: shiftdown &= ~0x1; return;
|
||||
case KEY_RSHIFT: shiftdown &= ~0x2; return;
|
||||
case KEY_LCTRL: ctrldown &= ~0x1; return;
|
||||
case KEY_RCTRL: ctrldown &= ~0x2; return;
|
||||
case KEY_LALT: altdown &= ~0x1; return;
|
||||
case KEY_RALT: altdown &= ~0x2; return;
|
||||
default: return;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// D_ProcessEvents
|
||||
|
@ -201,9 +175,6 @@ void D_ProcessEvents(void)
|
|||
{
|
||||
ev = &events[eventtail];
|
||||
|
||||
// Set global shift/ctrl/alt down variables
|
||||
D_ModifierKeyResponder(ev); // never eats events
|
||||
|
||||
// Screenshots over everything so that they can be taken anywhere.
|
||||
if (M_ScreenshotResponder(ev))
|
||||
continue; // ate the event
|
||||
|
|
|
@ -4265,10 +4265,43 @@ static void HWR_DrawSpriteShadow(gr_vissprite_t *spr, GLPatch_t *gpatch, float t
|
|||
}
|
||||
}
|
||||
|
||||
// This is expecting a pointer to an array containing 4 wallVerts for a sprite
|
||||
static void HWR_RotateSpritePolyToAim(gr_vissprite_t *spr, FOutVector *wallVerts)
|
||||
{
|
||||
if (cv_grspritebillboarding.value && spr && spr->mobj && wallVerts)
|
||||
{
|
||||
float basey = FIXED_TO_FLOAT(spr->mobj->z);
|
||||
float lowy = wallVerts[0].y;
|
||||
if (P_MobjFlip(spr->mobj) == -1)
|
||||
{
|
||||
basey = FIXED_TO_FLOAT(spr->mobj->z + spr->mobj->height);
|
||||
}
|
||||
// Rotate sprites to fully billboard with the camera
|
||||
// X, Y, AND Z need to be manipulated for the polys to rotate around the
|
||||
// origin, because of how the origin setting works I believe that should
|
||||
// be mobj->z or mobj->z + mobj->height
|
||||
wallVerts[2].y = wallVerts[3].y = (spr->ty - basey) * gr_viewludsin + basey;
|
||||
wallVerts[0].y = wallVerts[1].y = (lowy - basey) * gr_viewludsin + basey;
|
||||
// translate back to be around 0 before translating back
|
||||
wallVerts[3].x += ((spr->ty - basey) * gr_viewludcos) * gr_viewcos;
|
||||
wallVerts[2].x += ((spr->ty - basey) * gr_viewludcos) * gr_viewcos;
|
||||
|
||||
wallVerts[0].x += ((lowy - basey) * gr_viewludcos) * gr_viewcos;
|
||||
wallVerts[1].x += ((lowy - basey) * gr_viewludcos) * gr_viewcos;
|
||||
|
||||
wallVerts[3].z += ((spr->ty - basey) * gr_viewludcos) * gr_viewsin;
|
||||
wallVerts[2].z += ((spr->ty - basey) * gr_viewludcos) * gr_viewsin;
|
||||
|
||||
wallVerts[0].z += ((lowy - basey) * gr_viewludcos) * gr_viewsin;
|
||||
wallVerts[1].z += ((lowy - basey) * gr_viewludcos) * gr_viewsin;
|
||||
}
|
||||
}
|
||||
|
||||
static void HWR_SplitSprite(gr_vissprite_t *spr)
|
||||
{
|
||||
float this_scale = 1.0f;
|
||||
FOutVector wallVerts[4];
|
||||
FOutVector baseWallVerts[4]; // This is what the verts should end up as
|
||||
GLPatch_t *gpatch;
|
||||
FSurfaceInfo Surf;
|
||||
const boolean hires = (spr->mobj && spr->mobj->skin && ((skin_t *)spr->mobj->skin)->flags & SF_HIRES);
|
||||
|
@ -4281,11 +4314,13 @@ static void HWR_SplitSprite(gr_vissprite_t *spr)
|
|||
float realtop, realbot, top, bot;
|
||||
float towtop, towbot, towmult;
|
||||
float bheight;
|
||||
float realheight, heightmult;
|
||||
const sector_t *sector = spr->mobj->subsector->sector;
|
||||
const lightlist_t *list = sector->lightlist;
|
||||
#ifdef ESLOPE
|
||||
float endrealtop, endrealbot, endtop, endbot;
|
||||
float endbheight;
|
||||
float endrealheight;
|
||||
fixed_t temp;
|
||||
fixed_t v1x, v1y, v2x, v2y;
|
||||
#endif
|
||||
|
@ -4318,16 +4353,16 @@ static void HWR_SplitSprite(gr_vissprite_t *spr)
|
|||
HWR_DrawSpriteShadow(spr, gpatch, this_scale);
|
||||
}
|
||||
|
||||
wallVerts[0].x = wallVerts[3].x = spr->x1;
|
||||
wallVerts[2].x = wallVerts[1].x = spr->x2;
|
||||
wallVerts[0].z = wallVerts[3].z = spr->z1;
|
||||
wallVerts[1].z = wallVerts[2].z = spr->z2;
|
||||
baseWallVerts[0].x = baseWallVerts[3].x = spr->x1;
|
||||
baseWallVerts[2].x = baseWallVerts[1].x = spr->x2;
|
||||
baseWallVerts[0].z = baseWallVerts[3].z = spr->z1;
|
||||
baseWallVerts[1].z = baseWallVerts[2].z = spr->z2;
|
||||
|
||||
wallVerts[2].y = wallVerts[3].y = spr->ty;
|
||||
baseWallVerts[2].y = baseWallVerts[3].y = spr->ty;
|
||||
if (spr->mobj && fabsf(this_scale - 1.0f) > 1.0E-36f)
|
||||
wallVerts[0].y = wallVerts[1].y = spr->ty - gpatch->height * this_scale;
|
||||
baseWallVerts[0].y = baseWallVerts[1].y = spr->ty - gpatch->height * this_scale;
|
||||
else
|
||||
wallVerts[0].y = wallVerts[1].y = spr->ty - gpatch->height;
|
||||
baseWallVerts[0].y = baseWallVerts[1].y = spr->ty - gpatch->height;
|
||||
|
||||
v1x = FLOAT_TO_FIXED(spr->x1);
|
||||
v1y = FLOAT_TO_FIXED(spr->z1);
|
||||
|
@ -4336,44 +4371,56 @@ static void HWR_SplitSprite(gr_vissprite_t *spr)
|
|||
|
||||
if (spr->flip)
|
||||
{
|
||||
wallVerts[0].sow = wallVerts[3].sow = gpatch->max_s;
|
||||
wallVerts[2].sow = wallVerts[1].sow = 0;
|
||||
}else{
|
||||
wallVerts[0].sow = wallVerts[3].sow = 0;
|
||||
wallVerts[2].sow = wallVerts[1].sow = gpatch->max_s;
|
||||
baseWallVerts[0].sow = baseWallVerts[3].sow = gpatch->max_s;
|
||||
baseWallVerts[2].sow = baseWallVerts[1].sow = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
baseWallVerts[0].sow = baseWallVerts[3].sow = 0;
|
||||
baseWallVerts[2].sow = baseWallVerts[1].sow = gpatch->max_s;
|
||||
}
|
||||
|
||||
// flip the texture coords (look familiar?)
|
||||
if (spr->vflip)
|
||||
{
|
||||
wallVerts[3].tow = wallVerts[2].tow = gpatch->max_t;
|
||||
wallVerts[0].tow = wallVerts[1].tow = 0;
|
||||
}else{
|
||||
wallVerts[3].tow = wallVerts[2].tow = 0;
|
||||
wallVerts[0].tow = wallVerts[1].tow = gpatch->max_t;
|
||||
baseWallVerts[3].tow = baseWallVerts[2].tow = gpatch->max_t;
|
||||
baseWallVerts[0].tow = baseWallVerts[1].tow = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
baseWallVerts[3].tow = baseWallVerts[2].tow = 0;
|
||||
baseWallVerts[0].tow = baseWallVerts[1].tow = gpatch->max_t;
|
||||
}
|
||||
|
||||
// if it has a dispoffset, push it a little towards the camera
|
||||
if (spr->dispoffset) {
|
||||
float co = -gr_viewcos*(0.05f*spr->dispoffset);
|
||||
float si = -gr_viewsin*(0.05f*spr->dispoffset);
|
||||
wallVerts[0].z = wallVerts[3].z = wallVerts[0].z+si;
|
||||
wallVerts[1].z = wallVerts[2].z = wallVerts[1].z+si;
|
||||
wallVerts[0].x = wallVerts[3].x = wallVerts[0].x+co;
|
||||
wallVerts[1].x = wallVerts[2].x = wallVerts[1].x+co;
|
||||
baseWallVerts[0].z = baseWallVerts[3].z = baseWallVerts[0].z+si;
|
||||
baseWallVerts[1].z = baseWallVerts[2].z = baseWallVerts[1].z+si;
|
||||
baseWallVerts[0].x = baseWallVerts[3].x = baseWallVerts[0].x+co;
|
||||
baseWallVerts[1].x = baseWallVerts[2].x = baseWallVerts[1].x+co;
|
||||
}
|
||||
|
||||
realtop = top = wallVerts[3].y;
|
||||
realbot = bot = wallVerts[0].y;
|
||||
towtop = wallVerts[3].tow;
|
||||
towbot = wallVerts[0].tow;
|
||||
// Let dispoffset work first since this adjust each vertex
|
||||
HWR_RotateSpritePolyToAim(spr, baseWallVerts);
|
||||
|
||||
realtop = top = baseWallVerts[3].y;
|
||||
realbot = bot = baseWallVerts[0].y;
|
||||
towtop = baseWallVerts[3].tow;
|
||||
towbot = baseWallVerts[0].tow;
|
||||
towmult = (towbot - towtop) / (top - bot);
|
||||
|
||||
#ifdef ESLOPE
|
||||
endrealtop = endtop = wallVerts[2].y;
|
||||
endrealbot = endbot = wallVerts[1].y;
|
||||
endrealtop = endtop = baseWallVerts[2].y;
|
||||
endrealbot = endbot = baseWallVerts[1].y;
|
||||
#endif
|
||||
|
||||
// copy the contents of baseWallVerts into the drawn wallVerts array
|
||||
// baseWallVerts is used to know the final shape to easily get the vertex
|
||||
// co-ordinates
|
||||
memcpy(wallVerts, baseWallVerts, sizeof(baseWallVerts));
|
||||
|
||||
if (!cv_translucency.value) // translucency disabled
|
||||
{
|
||||
Surf.FlatColor.s.alpha = 0xFF;
|
||||
|
@ -4500,12 +4547,53 @@ static void HWR_SplitSprite(gr_vissprite_t *spr)
|
|||
wallVerts[2].y = endtop;
|
||||
wallVerts[0].y = bot;
|
||||
wallVerts[1].y = endbot;
|
||||
|
||||
// The x and y only need to be adjusted in the case that it's not a papersprite
|
||||
if (cv_grspritebillboarding.value && spr->mobj)
|
||||
{
|
||||
// Get the x and z of the vertices so billboarding draws correctly
|
||||
realheight = realbot - realtop;
|
||||
endrealheight = endrealbot - endrealtop;
|
||||
heightmult = (realtop - top) / realheight;
|
||||
wallVerts[3].x = baseWallVerts[3].x + (baseWallVerts[3].x - baseWallVerts[0].x) * heightmult;
|
||||
wallVerts[3].z = baseWallVerts[3].z + (baseWallVerts[3].z - baseWallVerts[0].z) * heightmult;
|
||||
|
||||
heightmult = (endrealtop - endtop) / endrealheight;
|
||||
wallVerts[2].x = baseWallVerts[2].x + (baseWallVerts[2].x - baseWallVerts[1].x) * heightmult;
|
||||
wallVerts[2].z = baseWallVerts[2].z + (baseWallVerts[2].z - baseWallVerts[1].z) * heightmult;
|
||||
|
||||
heightmult = (realtop - bot) / realheight;
|
||||
wallVerts[0].x = baseWallVerts[3].x + (baseWallVerts[3].x - baseWallVerts[0].x) * heightmult;
|
||||
wallVerts[0].z = baseWallVerts[3].z + (baseWallVerts[3].z - baseWallVerts[0].z) * heightmult;
|
||||
|
||||
heightmult = (endrealtop - endbot) / endrealheight;
|
||||
wallVerts[1].x = baseWallVerts[2].x + (baseWallVerts[2].x - baseWallVerts[1].x) * heightmult;
|
||||
wallVerts[1].z = baseWallVerts[2].z + (baseWallVerts[2].z - baseWallVerts[1].z) * heightmult;
|
||||
}
|
||||
#else
|
||||
wallVerts[3].tow = wallVerts[2].tow = towtop + ((realtop - top) * towmult);
|
||||
wallVerts[0].tow = wallVerts[1].tow = towtop + ((realtop - bot) * towmult);
|
||||
|
||||
wallVerts[2].y = wallVerts[3].y = top;
|
||||
wallVerts[0].y = wallVerts[1].y = bot;
|
||||
|
||||
// The x and y only need to be adjusted in the case that it's not a papersprite
|
||||
if (cv_grspritebillboarding.value && spr->mobj)
|
||||
{
|
||||
// Get the x and z of the vertices so billboarding draws correctly
|
||||
realheight = realbot - realtop;
|
||||
heightmult = (realtop - top) / realheight;
|
||||
wallVerts[3].x = baseWallVerts[3].x + (baseWallVerts[3].x - baseWallVerts[0].x) * heightmult;
|
||||
wallVerts[3].z = baseWallVerts[3].z + (baseWallVerts[3].z - baseWallVerts[0].z) * heightmult;
|
||||
wallVerts[2].x = baseWallVerts[2].x + (baseWallVerts[2].x - baseWallVerts[1].x) * heightmult;
|
||||
wallVerts[2].z = baseWallVerts[2].z + (baseWallVerts[2].z - baseWallVerts[1].z) * heightmult;
|
||||
|
||||
heightmult = (realtop - bot) / realheight;
|
||||
wallVerts[0].x = baseWallVerts[3].x + (baseWallVerts[3].x - baseWallVerts[0].x) * heightmult;
|
||||
wallVerts[0].z = baseWallVerts[3].z + (baseWallVerts[3].z - baseWallVerts[0].z) * heightmult;
|
||||
wallVerts[1].x = baseWallVerts[2].x + (baseWallVerts[2].x - baseWallVerts[1].x) * heightmult;
|
||||
wallVerts[1].z = baseWallVerts[2].z + (baseWallVerts[2].z - baseWallVerts[1].z) * heightmult;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (colormap)
|
||||
|
@ -4675,6 +4763,9 @@ static void HWR_DrawSprite(gr_vissprite_t *spr)
|
|||
wallVerts[1].x = wallVerts[2].x = wallVerts[1].x+co;
|
||||
}
|
||||
|
||||
// Let dispoffset work first since this adjust each vertex
|
||||
HWR_RotateSpritePolyToAim(spr, wallVerts);
|
||||
|
||||
// This needs to be AFTER the shadows so that the regular sprites aren't drawn completely black.
|
||||
// sprite lighting by modulating the RGB components
|
||||
/// \todo coloured
|
||||
|
@ -4756,6 +4847,9 @@ static inline void HWR_DrawPrecipitationSprite(gr_vissprite_t *spr)
|
|||
wallVerts[0].z = wallVerts[3].z = spr->z1;
|
||||
wallVerts[1].z = wallVerts[2].z = spr->z2;
|
||||
|
||||
// Let dispoffset work first since this adjust each vertex
|
||||
HWR_RotateSpritePolyToAim(spr, wallVerts);
|
||||
|
||||
wallVerts[0].sow = wallVerts[3].sow = 0;
|
||||
wallVerts[2].sow = wallVerts[1].sow = gpatch->max_s;
|
||||
|
||||
|
|
|
@ -95,6 +95,7 @@ extern consvar_t cv_grcorrecttricks;
|
|||
extern consvar_t cv_voodoocompatibility;
|
||||
extern consvar_t cv_grfovchange;
|
||||
extern consvar_t cv_grsolvetjoin;
|
||||
extern consvar_t cv_grspritebillboarding;
|
||||
|
||||
extern float gr_viewwidth, gr_viewheight, gr_baseviewwindowy;
|
||||
|
||||
|
|
|
@ -1095,7 +1095,9 @@ static INT16 typelines = 1; // number of drawfill lines we need when drawing the
|
|||
//
|
||||
boolean HU_Responder(event_t *ev)
|
||||
{
|
||||
#ifndef NONET
|
||||
INT32 c=0;
|
||||
#endif
|
||||
|
||||
if (ev->type != ev_keydown)
|
||||
return false;
|
||||
|
@ -1122,19 +1124,9 @@ boolean HU_Responder(event_t *ev)
|
|||
return false;
|
||||
}*/ //We don't actually care about that unless we get splitscreen netgames. :V
|
||||
|
||||
#ifndef NONET
|
||||
c = (INT32)ev->data1;
|
||||
|
||||
// capslock (now handled outside of chat on so that it works everytime......)
|
||||
if (c && c == KEY_CAPSLOCK) // it's a toggle.
|
||||
{
|
||||
if (capslock)
|
||||
capslock = false;
|
||||
else
|
||||
capslock = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifndef NONET
|
||||
if (!chat_on)
|
||||
{
|
||||
// enter chat mode
|
||||
|
|
|
@ -1322,6 +1322,7 @@ void R_RegisterEngineStuff(void)
|
|||
CV_RegisterVar(&cv_grcoronasize);
|
||||
#endif
|
||||
CV_RegisterVar(&cv_grmd2);
|
||||
CV_RegisterVar(&cv_grspritebillboarding);
|
||||
#endif
|
||||
|
||||
#ifdef HWRENDER
|
||||
|
|
|
@ -580,8 +580,6 @@ static void Impl_HandleWindowEvent(SDL_WindowEvent evt)
|
|||
if (cv_usemouse.value) I_StartupMouse();
|
||||
}
|
||||
//else firsttimeonmouse = SDL_FALSE;
|
||||
|
||||
capslock = !!( SDL_GetModState() & KMOD_CAPS );// in case CL changes
|
||||
}
|
||||
else if (!mousefocus && !kbfocus)
|
||||
{
|
||||
|
@ -939,6 +937,8 @@ void I_StartupMouse(void)
|
|||
//
|
||||
void I_OsPolling(void)
|
||||
{
|
||||
SDL_Keymod mod;
|
||||
|
||||
if (consolevent)
|
||||
I_GetConsoleEvents();
|
||||
if (SDL_WasInit(SDL_INIT_JOYSTICK) == SDL_INIT_JOYSTICK)
|
||||
|
@ -951,6 +951,18 @@ void I_OsPolling(void)
|
|||
I_GetMouseEvents();
|
||||
|
||||
I_GetEvent();
|
||||
|
||||
mod = SDL_GetModState();
|
||||
/* Handle here so that our state is always synched with the system. */
|
||||
shiftdown = ctrldown = altdown = 0;
|
||||
capslock = false;
|
||||
if (mod & KMOD_LSHIFT) shiftdown |= 1;
|
||||
if (mod & KMOD_RSHIFT) shiftdown |= 2;
|
||||
if (mod & KMOD_LCTRL) ctrldown |= 1;
|
||||
if (mod & KMOD_RCTRL) ctrldown |= 2;
|
||||
if (mod & KMOD_LALT) altdown |= 1;
|
||||
if (mod & KMOD_RALT) altdown |= 2;
|
||||
if (mod & KMOD_CAPS) capslock = true;
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -984,6 +996,7 @@ void I_UpdateNoBlit(void)
|
|||
// from PrBoom's src/SDL/i_video.c
|
||||
static inline boolean I_SkipFrame(void)
|
||||
{
|
||||
#if 0
|
||||
static boolean skip = false;
|
||||
|
||||
if (rendermode != render_soft)
|
||||
|
@ -1003,6 +1016,8 @@ static inline boolean I_SkipFrame(void)
|
|||
default:
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
@ -902,21 +902,10 @@ boolean I_LoadSong(char *data, size_t len)
|
|||
const char *key1 = "LOOP";
|
||||
const char *key2 = "POINT=";
|
||||
const char *key3 = "MS=";
|
||||
const char *key4 = "LENGTHMS=";
|
||||
const size_t key1len = strlen(key1);
|
||||
const size_t key2len = strlen(key2);
|
||||
const size_t key3len = strlen(key3);
|
||||
const size_t key4len = strlen(key4);
|
||||
|
||||
// for mp3 wide chars
|
||||
const char *key1w = "L\0O\0O\0P\0";
|
||||
const char *key2w = "P\0O\0I\0N\0T\0\0\0\xFF\xFE";
|
||||
const char *key3w = "M\0S\0\0\0\xFF\xFE";
|
||||
const char *key4w = "L\0E\0N\0G\0T\0H\0M\0S\0\0\0\xFF\xFE";
|
||||
const char *wterm = "\0\0";
|
||||
char wval[10];
|
||||
|
||||
size_t wstart, wp;
|
||||
char *p = data;
|
||||
SDL_RWops *rw;
|
||||
|
||||
|
@ -1062,61 +1051,8 @@ boolean I_LoadSong(char *data, size_t len)
|
|||
// Everything that uses LOOPMS will work perfectly with SDL_Mixer.
|
||||
}
|
||||
}
|
||||
else if (fpclassify(song_length) == FP_ZERO && !strncmp(p, key4, key4len)) // is it LENGTHMS=?
|
||||
{
|
||||
p += key4len; // skip LENGTHMS
|
||||
song_length = (float)(atoi(p) / 1000.0L);
|
||||
}
|
||||
// below: search MP3 or other tags that use wide char encoding
|
||||
else if (fpclassify(loop_point) == FP_ZERO && !memcmp(p, key1w, key1len*2)) // LOOP wide char
|
||||
{
|
||||
p += key1len*2;
|
||||
if (!memcmp(p, key2w, (key2len+1)*2)) // POINT= wide char
|
||||
{
|
||||
p += (key2len+1)*2;
|
||||
wstart = (size_t)p;
|
||||
wp = 0;
|
||||
while (wp < 9 && memcmp(p, wterm, 2))
|
||||
{
|
||||
wval[wp] = *p;
|
||||
p += 2;
|
||||
wp = ((size_t)(p-wstart))/2;
|
||||
}
|
||||
wval[min(wp, 9)] = 0;
|
||||
loop_point = (float)((44.1L+atoi(wval) / 44100.0L));
|
||||
}
|
||||
else if (!memcmp(p, key3w, (key3len+1)*2)) // MS= wide char
|
||||
{
|
||||
p += (key3len+1)*2;
|
||||
wstart = (size_t)p;
|
||||
wp = 0;
|
||||
while (wp < 9 && memcmp(p, wterm, 2))
|
||||
{
|
||||
wval[wp] = *p;
|
||||
p += 2;
|
||||
wp = ((size_t)(p-wstart))/2;
|
||||
}
|
||||
wval[min(wp, 9)] = 0;
|
||||
loop_point = (float)(atoi(wval) / 1000.0L);
|
||||
}
|
||||
}
|
||||
else if (fpclassify(song_length) == FP_ZERO && !memcmp(p, key4w, (key4len+1)*2)) // LENGTHMS= wide char
|
||||
{
|
||||
p += (key4len+1)*2;
|
||||
wstart = (size_t)p;
|
||||
wp = 0;
|
||||
while (wp < 9 && memcmp(p, wterm, 2))
|
||||
{
|
||||
wval[wp] = *p;
|
||||
p += 2;
|
||||
wp = ((size_t)(p-wstart))/2;
|
||||
}
|
||||
wval[min(wp, 9)] = 0;
|
||||
song_length = (float)(atoi(wval) / 1000.0L);
|
||||
}
|
||||
|
||||
if (fpclassify(loop_point) != FP_ZERO && fpclassify(song_length) != FP_ZERO && song_length > loop_point) // Got what we needed
|
||||
// the last case is a sanity check, in case the wide char searches were false matches.
|
||||
if (fpclassify(loop_point) != FP_ZERO) // Got what we needed
|
||||
break;
|
||||
else // continue searching
|
||||
p++;
|
||||
|
|
|
@ -111,6 +111,7 @@ consvar_t cv_grcoronasize = {"gr_coronasize", "1", CV_SAVE| CV_FLOAT, 0, NULL, 0
|
|||
static CV_PossibleValue_t CV_MD2[] = {{0, "Off"}, {1, "On"}, {2, "Old"}, {0, NULL}};
|
||||
// console variables in development
|
||||
consvar_t cv_grmd2 = {"gr_md2", "Off", CV_SAVE, CV_MD2, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_grspritebillboarding = {"gr_spritebillboarding", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
#endif
|
||||
|
||||
// local copy of the palette for V_GetColor()
|
||||
|
|
|
@ -639,9 +639,6 @@ void I_Error(const char *error, ...)
|
|||
if (!errorcount)
|
||||
{
|
||||
M_SaveConfig(NULL); // save game config, cvars..
|
||||
#ifndef NONET
|
||||
D_SaveBan(); // save the ban list
|
||||
#endif
|
||||
G_SaveGameData();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue