Merge branch 'next' of https://github.com/STJr/SRB2 into next-luacolors

This commit is contained in:
SwitchKaze 2020-02-29 23:41:16 -05:00
commit 21b28b6295
10 changed files with 51 additions and 21 deletions

View file

@ -613,15 +613,6 @@ void CON_Ticker(void)
con_tick++; con_tick++;
con_tick &= 7; con_tick &= 7;
// if the menu is open then close the console.
if (menuactive && con_destlines)
{
consoletoggle = false;
con_destlines = 0;
CON_ClearHUD();
I_UpdateMouseGrab();
}
// console key was pushed // console key was pushed
if (consoletoggle) if (consoletoggle)
{ {
@ -793,7 +784,7 @@ boolean CON_Responder(event_t *ev)
// check other keys only if console prompt is active // check other keys only if console prompt is active
if (!consoleready && key < NUMINPUTS) // metzgermeister: boundary check!! if (!consoleready && key < NUMINPUTS) // metzgermeister: boundary check!!
{ {
if (bindtable[key]) if (! menuactive && bindtable[key])
{ {
COM_BufAddText(bindtable[key]); COM_BufAddText(bindtable[key]);
COM_BufAddText("\n"); COM_BufAddText("\n");

View file

@ -508,13 +508,11 @@ static void D_Display(void)
// vid size change is now finished if it was on... // vid size change is now finished if it was on...
vid.recalc = 0; vid.recalc = 0;
// FIXME: draw either console or menu, not the two
if (gamestate != GS_TIMEATTACK)
CON_Drawer();
M_Drawer(); // menu is drawn even on top of everything M_Drawer(); // menu is drawn even on top of everything
// focus lost moved to M_Drawer // focus lost moved to M_Drawer
CON_Drawer();
// //
// wipe update // wipe update
// //

View file

@ -759,6 +759,7 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum)
} }
else else
{ {
<<<<<<< HEAD
UINT16 chatcolor = skincolors[players[playernum].skincolor].chatcolor; UINT16 chatcolor = skincolors[players[playernum].skincolor].chatcolor;
if (!chatcolor || chatcolor%0x1000 || chatcolor>V_INVERTMAP) if (!chatcolor || chatcolor%0x1000 || chatcolor>V_INVERTMAP)

View file

@ -142,6 +142,7 @@ static int lib_addHook(lua_State *L)
case hook_HurtMsg: case hook_HurtMsg:
case hook_MobjMoveBlocked: case hook_MobjMoveBlocked:
case hook_MapThingSpawn: case hook_MapThingSpawn:
case hook_FollowMobj:
hook.s.mt = MT_NULL; hook.s.mt = MT_NULL;
if (lua_isnumber(L, 2)) if (lua_isnumber(L, 2))
hook.s.mt = lua_tonumber(L, 2); hook.s.mt = lua_tonumber(L, 2);
@ -203,6 +204,7 @@ static int lib_addHook(lua_State *L)
case hook_MobjRemoved: case hook_MobjRemoved:
case hook_MobjMoveBlocked: case hook_MobjMoveBlocked:
case hook_MapThingSpawn: case hook_MapThingSpawn:
case hook_FollowMobj:
lastp = &mobjhooks[hook.s.mt]; lastp = &mobjhooks[hook.s.mt];
break; break;
case hook_JumpSpecial: case hook_JumpSpecial:
@ -210,7 +212,6 @@ static int lib_addHook(lua_State *L)
case hook_SpinSpecial: case hook_SpinSpecial:
case hook_JumpSpinSpecial: case hook_JumpSpinSpecial:
case hook_PlayerSpawn: case hook_PlayerSpawn:
case hook_FollowMobj:
case hook_PlayerCanDamage: case hook_PlayerCanDamage:
case hook_TeamSwitch: case hook_TeamSwitch:
case hook_ViewpointSwitch: case hook_ViewpointSwitch:
@ -1364,7 +1365,34 @@ boolean LUAh_FollowMobj(player_t *player, mobj_t *mobj)
lua_settop(gL, 0); lua_settop(gL, 0);
for (hookp = playerhooks; hookp; hookp = hookp->next) // Look for all generic mobj follow item hooks
for (hookp = mobjhooks[MT_NULL]; hookp; hookp = hookp->next)
{
if (hookp->type != hook_FollowMobj)
continue;
if (lua_gettop(gL) == 0)
{
LUA_PushUserdata(gL, player, META_PLAYER);
LUA_PushUserdata(gL, mobj, META_MOBJ);
}
lua_pushfstring(gL, FMT_HOOKID, hookp->id);
lua_gettable(gL, LUA_REGISTRYINDEX);
lua_pushvalue(gL, -3);
lua_pushvalue(gL, -3);
if (lua_pcall(gL, 2, 1, 0)) {
if (!hookp->error || cv_debug & DBG_LUA)
CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1));
lua_pop(gL, 1);
hookp->error = true;
continue;
}
if (lua_toboolean(gL, -1))
hooked = true;
lua_pop(gL, 1);
}
for (hookp = mobjhooks[mobj->type]; hookp; hookp = hookp->next)
{ {
if (hookp->type != hook_FollowMobj) if (hookp->type != hook_FollowMobj)
continue; continue;

View file

@ -97,6 +97,10 @@ static int player_get(lua_State *L)
lua_pushboolean(L, true); lua_pushboolean(L, true);
else if (fastcmp(field,"name")) else if (fastcmp(field,"name"))
lua_pushstring(L, player_names[plr-players]); lua_pushstring(L, player_names[plr-players]);
else if (fastcmp(field,"realmo"))
LUA_PushUserdata(L, plr->mo, META_MOBJ);
// Kept for backward-compatibility
// Should be fixed to work like "realmo" later
else if (fastcmp(field,"mo")) else if (fastcmp(field,"mo"))
{ {
if (plr->spectator) if (plr->spectator)
@ -398,7 +402,7 @@ static int player_set(lua_State *L)
if (hud_running) if (hud_running)
return luaL_error(L, "Do not alter player_t in HUD rendering code!"); return luaL_error(L, "Do not alter player_t in HUD rendering code!");
if (fastcmp(field,"mo")) { if (fastcmp(field,"mo") || fastcmp(field,"realmo")) {
mobj_t *newmo = *((mobj_t **)luaL_checkudata(L, 3, META_MOBJ)); mobj_t *newmo = *((mobj_t **)luaL_checkudata(L, 3, META_MOBJ));
plr->mo->player = NULL; // remove player pointer from old mobj plr->mo->player = NULL; // remove player pointer from old mobj
(newmo->player = plr)->mo = newmo; // set player pointer for new mobj, and set new mobj as the player's mobj (newmo->player = plr)->mo = newmo; // set player pointer for new mobj, and set new mobj as the player's mobj

View file

@ -3153,6 +3153,9 @@ boolean M_Responder(event_t *ev)
if (gamestate == GS_TITLESCREEN && finalecount < TICRATE) if (gamestate == GS_TITLESCREEN && finalecount < TICRATE)
return false; return false;
if (CON_Ready())
return false;
if (noFurtherInput) if (noFurtherInput)
{ {
// Ignore input after enter/escape/other buttons // Ignore input after enter/escape/other buttons
@ -3512,6 +3515,7 @@ boolean M_Responder(event_t *ev)
return false; return false;
default: default:
CON_Responder(ev);
break; break;
} }

View file

@ -18,7 +18,7 @@
#include <time.h> #include <time.h>
#if (defined (NOMD5) || defined (NOMSERV)) && !defined (NONET) #if (defined (NOMSERV)) && !defined (NONET)
#define NONET #define NONET
#endif #endif

View file

@ -8001,8 +8001,9 @@ static void P_MobjSceneryThink(mobj_t *mobj)
} }
if (mobj->fuse < 0) if (mobj->fuse < 0)
return; return;
if ((--mobj->fuse) < 6) if (mobj->fuse < 6)
mobj->frame = (mobj->frame & ~FF_TRANSMASK) | ((10 - (mobj->fuse*2)) << (FF_TRANSSHIFT)); mobj->frame = (mobj->frame & ~FF_TRANSMASK) | ((10 - (mobj->fuse*2)) << (FF_TRANSSHIFT));
mobj->fuse--;
} }
break; break;
case MT_FINISHFLAG: case MT_FINISHFLAG:

View file

@ -3096,7 +3096,7 @@ static void P_InitTagGametype(void)
//Also, you'd never have to loop through all 32 players slots to find anything ever again. //Also, you'd never have to loop through all 32 players slots to find anything ever again.
for (i = 0; i < MAXPLAYERS; i++) for (i = 0; i < MAXPLAYERS; i++)
{ {
if (playeringame[i] && !(players[i].spectator && players[i].quittime)) if (playeringame[i] && !(players[i].spectator || players[i].quittime))
{ {
playersactive[realnumplayers] = i; //stores the player's node in the array. playersactive[realnumplayers] = i; //stores the player's node in the array.
realnumplayers++; realnumplayers++;

View file

@ -384,6 +384,9 @@ void P_GiveFinishFlags(player_t *player)
if (!player->mo) if (!player->mo)
return; return;
if (!(netgame||multiplayer))
return;
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
{ {
angle_t fa = (angle >> ANGLETOFINESHIFT) & FINEMASK; angle_t fa = (angle >> ANGLETOFINESHIFT) & FINEMASK;