Use HAVE_BLUA as fuel for my fireplace

This commit is contained in:
Louis-Antoine 2020-03-19 18:36:14 +01:00
parent 92016a742b
commit e3cbdf8fab
57 changed files with 513 additions and 1324 deletions

View file

@ -216,8 +216,6 @@ source_group("Assembly" FILES ${SRB2_ASM_SOURCES} ${SRB2_NASM_SOURCES})
### Configuration
set(SRB2_CONFIG_HAVE_BLUA ON CACHE BOOL
"Enable Lua interpreter support")
set(SRB2_CONFIG_HAVE_PNG ON CACHE BOOL
"Enable PNG support. Depends on zlib, so will be disabled if you don't enable that too.")
set(SRB2_CONFIG_HAVE_ZLIB ON CACHE BOOL
@ -241,93 +239,90 @@ if(${CMAKE_SYSTEM} MATCHES "Windows") ###set on Windows only
"Use SRB2's internal copies of required dependencies (SDL2, PNG, zlib, GME, OpenMPT).")
endif()
if(${SRB2_CONFIG_HAVE_BLUA})
add_definitions(-DHAVE_BLUA)
set(SRB2_LUA_SOURCES
lua_baselib.c
lua_blockmaplib.c
lua_consolelib.c
lua_hooklib.c
lua_hudlib.c
lua_infolib.c
lua_maplib.c
lua_mathlib.c
lua_mobjlib.c
lua_playerlib.c
lua_script.c
lua_skinlib.c
lua_thinkerlib.c
)
set(SRB2_LUA_HEADERS
lua_hook.h
lua_hud.h
lua_libs.h
lua_script.h
)
set(SRB2_LUA_SOURCES
lua_baselib.c
lua_blockmaplib.c
lua_consolelib.c
lua_hooklib.c
lua_hudlib.c
lua_infolib.c
lua_maplib.c
lua_mathlib.c
lua_mobjlib.c
lua_playerlib.c
lua_script.c
lua_skinlib.c
lua_thinkerlib.c
)
set(SRB2_LUA_HEADERS
lua_hook.h
lua_hud.h
lua_libs.h
lua_script.h
)
prepend_sources(SRB2_LUA_SOURCES)
prepend_sources(SRB2_LUA_HEADERS)
prepend_sources(SRB2_LUA_SOURCES)
prepend_sources(SRB2_LUA_HEADERS)
source_group("LUA" FILES ${SRB2_LUA_SOURCES} ${SRB2_LUA_HEADERS})
source_group("LUA" FILES ${SRB2_LUA_SOURCES} ${SRB2_LUA_HEADERS})
set(SRB2_BLUA_SOURCES
blua/lapi.c
blua/lauxlib.c
blua/lbaselib.c
blua/lcode.c
blua/ldebug.c
blua/ldo.c
blua/ldump.c
blua/lfunc.c
blua/lgc.c
blua/linit.c
blua/liolib.c
blua/llex.c
blua/lmem.c
blua/lobject.c
blua/lopcodes.c
blua/lparser.c
blua/lstate.c
blua/lstring.c
blua/lstrlib.c
blua/ltable.c
blua/ltablib.c
blua/ltm.c
blua/lundump.c
blua/lvm.c
blua/lzio.c
)
set(SRB2_BLUA_HEADERS
blua/lapi.h
blua/lauxlib.h
blua/lcode.h
blua/ldebug.h
blua/ldo.h
blua/lfunc.h
blua/lgc.h
blua/llex.h
blua/llimits.h
blua/lmem.h
blua/lobject.h
blua/lopcodes.h
blua/lparser.h
blua/lstate.h
blua/lstring.h
blua/ltable.h
blua/ltm.h
blua/lua.h
blua/luaconf.h
blua/lualib.h
blua/lundump.h
blua/lvm.h
blua/lzio.h
)
set(SRB2_BLUA_SOURCES
blua/lapi.c
blua/lauxlib.c
blua/lbaselib.c
blua/lcode.c
blua/ldebug.c
blua/ldo.c
blua/ldump.c
blua/lfunc.c
blua/lgc.c
blua/linit.c
blua/liolib.c
blua/llex.c
blua/lmem.c
blua/lobject.c
blua/lopcodes.c
blua/lparser.c
blua/lstate.c
blua/lstring.c
blua/lstrlib.c
blua/ltable.c
blua/ltablib.c
blua/ltm.c
blua/lundump.c
blua/lvm.c
blua/lzio.c
)
set(SRB2_BLUA_HEADERS
blua/lapi.h
blua/lauxlib.h
blua/lcode.h
blua/ldebug.h
blua/ldo.h
blua/lfunc.h
blua/lgc.h
blua/llex.h
blua/llimits.h
blua/lmem.h
blua/lobject.h
blua/lopcodes.h
blua/lparser.h
blua/lstate.h
blua/lstring.h
blua/ltable.h
blua/ltm.h
blua/lua.h
blua/luaconf.h
blua/lualib.h
blua/lundump.h
blua/lvm.h
blua/lzio.h
)
prepend_sources(SRB2_BLUA_SOURCES)
prepend_sources(SRB2_BLUA_HEADERS)
prepend_sources(SRB2_BLUA_SOURCES)
prepend_sources(SRB2_BLUA_HEADERS)
source_group("LUA\\Interpreter" FILES ${SRB2_BLUA_SOURCES} ${SRB2_BLUA_HEADERS})
endif()
source_group("LUA\\Interpreter" FILES ${SRB2_BLUA_SOURCES} ${SRB2_BLUA_HEADERS})
if(${SRB2_CONFIG_HAVE_GME})
if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES})

View file

@ -340,9 +340,7 @@ CFLAGS+=-DHAVE_MINIUPNPC
endif
endif
ifndef NO_LUA
include blua/Makefile.cfg
endif
include blua/Makefile.cfg
ifdef NOMD5
OPTS+=-DNOMD5
@ -683,9 +681,7 @@ $(OBJDIR)/depend.dep:
ifndef NOHW
$(CC) $(CFLAGS) -MM hardware/*.c >> $(OBJDIR)/depend.ped
endif
ifndef NO_LUA
$(CC) $(CFLAGS) -MM blua/*.c >> $(OBJDIR)/depend.ped
endif
@sed -e 's,\(.*\)\.o: ,$(subst /,\/,$(OBJDIR))\/&,g' < $(OBJDIR)/depend.ped > $(OBJDIR)/depend.dep
$(REMOVE) $(OBJDIR)/depend.ped
@echo "Created dependency file, depend.dep"

View file

@ -74,11 +74,9 @@ static void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd)
if (!sonic || sonic->health <= 0)
return;
#ifdef HAVE_BLUA
// Lua can handle it!
if (LUAh_BotAI(sonic, tails, cmd))
return;
#endif
if (tails->player->powers[pw_carry] == CR_MACESPIN || tails->player->powers[pw_carry] == CR_GENERIC)
{
@ -364,11 +362,9 @@ void B_BuildTiccmd(player_t *player, ticcmd_t *cmd)
// Bot AI isn't programmed in analog.
CV_SetValue(&cv_analog[1], false);
#ifdef HAVE_BLUA
// Let Lua scripts build ticcmds
if (LUAh_BotTiccmd(player, cmd))
return;
#endif
// We don't have any main character AI, sorry. D:
if (player-players == consoleplayer)

View file

@ -10,8 +10,6 @@ WFLAGS+=-Wno-logical-op
endif
endif
OPTS+=-DHAVE_BLUA
OBJS:=$(OBJS) \
$(OBJDIR)/lapi.o \
$(OBJDIR)/lbaselib.o \

View file

@ -481,13 +481,11 @@ void COM_AddCommand(const char *name, com_func_t func)
{
if (!stricmp(name, cmd->name)) //case insensitive now that we have lower and uppercase!
{
#ifdef HAVE_BLUA
// don't I_Error for Lua commands
// Lua commands can replace game commands, and they have priority.
// BUT, if for some reason we screwed up and made two console commands with the same name,
// it's good to have this here so we find out.
if (cmd->function != COM_Lua_f)
#endif
I_Error("Command %s already exists\n", name);
return;
@ -501,7 +499,6 @@ void COM_AddCommand(const char *name, com_func_t func)
com_commands = cmd;
}
#ifdef HAVE_BLUA
/** Adds a console command for Lua.
* No I_Errors allowed; return a negative code instead.
*
@ -534,7 +531,6 @@ int COM_AddLuaCommand(const char *name)
com_commands = cmd;
return 0;
}
#endif
/** Tests if a command exists.
*
@ -1427,9 +1423,7 @@ finish:
}
var->flags |= CV_MODIFIED;
// raise 'on change' code
#ifdef HAVE_BLUA
LUA_CVarChanged(var->name); // let consolelib know what cvar this is.
#endif
if (var->flags & CV_CALL && !stealth)
var->func();

View file

@ -2547,20 +2547,14 @@ static void CL_RemovePlayer(INT32 playernum, kickreason_t reason)
}
}
#ifdef HAVE_BLUA
LUAh_PlayerQuit(&players[playernum], reason); // Lua hook for player quitting
#else
(void)reason;
#endif
// don't look through someone's view who isn't there
if (playernum == displayplayer)
{
#ifdef HAVE_BLUA
// Call ViewpointSwitch hooks here.
// The viewpoint was forcibly changed.
LUAh_ViewpointSwitch(&players[consoleplayer], &players[consoleplayer], true);
#endif
displayplayer = consoleplayer;
}
@ -2581,9 +2575,7 @@ static void CL_RemovePlayer(INT32 playernum, kickreason_t reason)
RemoveAdminPlayer(playernum); // don't stay admin after you're gone
}
#ifdef HAVE_BLUA
LUA_InvalidatePlayer(&players[playernum]);
#endif
if (G_TagGametype()) //Check if you still have a game. Location flexible. =P
P_CheckSurvivors();
@ -3177,9 +3169,7 @@ void SV_ResetServer(void)
for (i = 0; i < MAXPLAYERS; i++)
{
#ifdef HAVE_BLUA
LUA_InvalidatePlayer(&players[i]);
#endif
playeringame[i] = false;
playernode[i] = UINT8_MAX;
memset(playeraddress[i], 0, sizeof(*playeraddress));
@ -3240,10 +3230,8 @@ void D_QuitNetGame(void)
// abort send/receive of files
CloseNetFile();
#ifdef HAVE_BLUA
RemoveAllLuaFileTransfers();
waitingforluafiletransfer = false;
#endif
if (server)
{
@ -3414,10 +3402,8 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum)
if (server && multiplayer && motd[0] != '\0')
COM_BufAddText(va("sayto %d %s\n", newplayernum, motd));
#ifdef HAVE_BLUA
if (!rejoined)
LUAh_PlayerJoin(newplayernum);
#endif
}
static boolean SV_AddWaitingPlayers(const char *name, const char *name2)
@ -3625,10 +3611,8 @@ static void HandleConnect(SINT8 node)
SV_SendRefuse(node, M_GetText("Too many players from\nthis node."));
else if (netgame && !netbuffer->u.clientcfg.localplayers) // Stealth join?
SV_SendRefuse(node, M_GetText("No players from\nthis node."));
#ifdef HAVE_BLUA
else if (luafiletransfers)
SV_SendRefuse(node, M_GetText("The server is broadcasting a file\nrequested by a Lua script.\nPlease wait a bit and then\ntry rejoining."));
#endif
else
{
#ifndef NONET
@ -4215,7 +4199,6 @@ static void HandlePacketFromPlayer(SINT8 node)
Net_CloseConnection(node);
nodeingame[node] = false;
break;
#ifdef HAVE_BLUA
case PT_ASKLUAFILE:
if (server && luafiletransfers && luafiletransfers->nodestatus[node] == LFTNS_ASKED)
{
@ -4228,7 +4211,6 @@ static void HandlePacketFromPlayer(SINT8 node)
if (server && luafiletransfers && luafiletransfers->nodestatus[node] == LFTNS_SENDING)
SV_HandleLuaFileSent(node);
break;
#endif
// -------------------------------------------- CLIENT RECEIVE ----------
case PT_RESYNCHEND:
// Only accept PT_RESYNCHEND from the server.
@ -4356,12 +4338,10 @@ static void HandlePacketFromPlayer(SINT8 node)
if (client)
Got_Filetxpak();
break;
#ifdef HAVE_BLUA
case PT_SENDINGLUAFILE:
if (client)
CL_PrepareDownloadLuaFile();
break;
#endif
default:
DEBFILE(va("UNKNOWN PACKET TYPE RECEIVED %d from host %d\n",
netbuffer->packettype, node));

View file

@ -67,11 +67,9 @@ typedef enum
PT_RESYNCHEND, // Player is now resynched and is being requested to remake the gametic
PT_RESYNCHGET, // Player got resynch packet
#ifdef HAVE_BLUA
PT_SENDINGLUAFILE, // Server telling a client Lua needs to open a file
PT_ASKLUAFILE, // Client telling the server they don't have the file
PT_HASLUAFILE, // Client telling the server they have the file
#endif
// Add non-PT_CANFAIL packet types here to avoid breaking MS compatibility.

View file

@ -91,9 +91,7 @@ int snprintf(char *str, size_t n, const char *fmt, ...);
#include "hardware/hw3sound.h"
#endif
#ifdef HAVE_BLUA
#include "lua_script.h"
#endif
// platform independant focus loss
UINT8 window_notinfocus = false;
@ -746,9 +744,7 @@ void D_SRB2Loop(void)
HW3S_EndFrameUpdate();
#endif
#ifdef HAVE_BLUA
LUA_Step();
#endif
}
}
@ -1124,9 +1120,7 @@ void D_SRB2Main(void)
// can't use sprintf since there is %u in savegamename
strcatbf(savegamename, srb2home, PATHSEP);
#ifdef HAVE_BLUA
snprintf(luafiledir, sizeof luafiledir, "%s" PATHSEP "luafiles", srb2home);
#endif
#else // DEFAULTDIR
snprintf(srb2home, sizeof srb2home, "%s", userhome);
snprintf(downloaddir, sizeof downloaddir, "%s", userhome);
@ -1138,9 +1132,7 @@ void D_SRB2Main(void)
// can't use sprintf since there is %u in savegamename
strcatbf(savegamename, userhome, PATHSEP);
#ifdef HAVE_BLUA
snprintf(luafiledir, sizeof luafiledir, "%s" PATHSEP "luafiles", userhome);
#endif
#endif // DEFAULTDIR
}

View file

@ -715,10 +715,8 @@ void Net_CloseConnection(INT32 node)
InitNode(&nodes[node]);
SV_AbortSendFiles(node);
#ifdef HAVE_BLUA
if (server)
SV_AbortLuaFileTransfer(node);
#endif
I_NetFreeNodenum(node);
#endif
}
@ -803,11 +801,9 @@ static const char *packettypename[NUMPACKETTYPE] =
"RESYNCHEND",
"RESYNCHGET",
#ifdef HAVE_BLUA
"SENDINGLUAFILE",
"ASKLUAFILE",
"HASLUAFILE",
#endif
"FILEFRAGMENT",
"TEXTCMD",

View file

@ -157,10 +157,8 @@ static void Command_Isgamemodified_f(void);
static void Command_Cheats_f(void);
#ifdef _DEBUG
static void Command_Togglemodified_f(void);
#ifdef HAVE_BLUA
static void Command_Archivetest_f(void);
#endif
#endif
// =========================================================================
// CLIENT VARIABLES
@ -415,11 +413,9 @@ const char *netxcmdnames[MAXNETXCMD - 1] =
"DELFILE", // replace next time we add an XD
"SETMOTD",
"SUICIDE",
#ifdef HAVE_BLUA
"LUACMD",
"LUAVAR",
"LUAFILE"
#endif
};
// =========================================================================
@ -452,10 +448,8 @@ void D_RegisterServerCommands(void)
RegisterNetXCmd(XD_PAUSE, Got_Pause);
RegisterNetXCmd(XD_SUICIDE, Got_Suicide);
RegisterNetXCmd(XD_RUNSOC, Got_RunSOCcmd);
#ifdef HAVE_BLUA
RegisterNetXCmd(XD_LUACMD, Got_Luacmd);
RegisterNetXCmd(XD_LUAFILE, Got_LuaFile);
#endif
// Remote Administration
COM_AddCommand("password", Command_Changepassword_f);
@ -504,9 +498,7 @@ void D_RegisterServerCommands(void)
COM_AddCommand("cheats", Command_Cheats_f); // test
#ifdef _DEBUG
COM_AddCommand("togglemodified", Command_Togglemodified_f);
#ifdef HAVE_BLUA
COM_AddCommand("archivetest", Command_Archivetest_f);
#endif
#endif
// for master server connection
@ -915,7 +907,7 @@ void D_RegisterClientCommands(void)
#ifdef _DEBUG
COM_AddCommand("causecfail", Command_CauseCfail_f);
#endif
#if defined(HAVE_BLUA) && defined(LUA_ALLOW_BYTECODE)
#ifdef LUA_ALLOW_BYTECODE
COM_AddCommand("dumplua", Command_Dumplua_f);
#endif
}
@ -2029,9 +2021,7 @@ static void Got_Mapcmd(UINT8 **cp, INT32 playernum)
UINT8 flags;
INT32 resetplayer = 1, lastgametype;
UINT8 skipprecutscene, FLS;
#ifdef HAVE_BLUA
INT16 mapnumber;
#endif
if (playernum != serverplayer && !IsPlayerAdmin(playernum))
{
@ -2093,10 +2083,8 @@ static void Got_Mapcmd(UINT8 **cp, INT32 playernum)
CV_StealthSetValue(&cv_playercolor, players[0].skincolor);
}
#ifdef HAVE_BLUA
mapnumber = M_MapNumber(mapname[3], mapname[4]);
LUAh_MapChange(mapnumber);
#endif
G_InitNew(ultimatemode, mapname, resetplayer, skipprecutscene, FLS);
if (demoplayback && !timingdemo)
@ -2680,11 +2668,9 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum)
return;
}
#ifdef HAVE_BLUA
// Don't switch team, just go away, please, go awaayyyy, aaauuauugghhhghgh
if (!LUAh_TeamSwitch(&players[playernum], NetPacket.packet.newteam, players[playernum].spectator, NetPacket.packet.autobalance, NetPacket.packet.scrambled))
return;
#endif
//no status changes after hidetime
if ((gametyperules & GTR_HIDEFROZEN) && (leveltime >= (hidetime * TICRATE)))
@ -2841,12 +2827,10 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum)
//reset view if you are changed, or viewing someone who was changed.
if (playernum == consoleplayer || displayplayer == playernum)
{
#ifdef HAVE_BLUA
// Call ViewpointSwitch hooks here.
// The viewpoint was forcibly changed.
if (displayplayer != consoleplayer) // You're already viewing yourself. No big deal.
LUAh_ViewpointSwitch(&players[consoleplayer], &players[consoleplayer], true);
#endif
displayplayer = consoleplayer;
}
@ -4332,7 +4316,6 @@ static void Command_Togglemodified_f(void)
modifiedgame = !modifiedgame;
}
#ifdef HAVE_BLUA
extern UINT8 *save_p;
static void Command_Archivetest_f(void)
{
@ -4377,7 +4360,6 @@ static void Command_Archivetest_f(void)
CONS_Printf("Done. No crash.\n");
}
#endif
#endif
/** Makes a change to ::cv_forceskin take effect immediately.
*

View file

@ -142,11 +142,9 @@ typedef enum
XD_SETMOTD, // 19
XD_SUICIDE, // 20
XD_DEMOTED, // 21
#ifdef HAVE_BLUA
XD_LUACMD, // 22
XD_LUAVAR, // 23
XD_LUAFILE, // 24
#endif
MAXNETXCMD
} netxcmd_t;

View file

@ -95,11 +95,9 @@ char downloaddir[512] = "DOWNLOAD";
INT32 lastfilenum = -1;
#endif
#ifdef HAVE_BLUA
luafiletransfer_t *luafiletransfers = NULL;
boolean waitingforluafiletransfer = false;
char luafiledir[256 + 16] = "luafiles";
#endif
/** Fills a serverinfo packet with information about wad files loaded.
@ -458,7 +456,6 @@ void CL_LoadServerFiles(void)
}
}
#ifdef HAVE_BLUA
void AddLuaFileTransfer(const char *filename, const char *mode)
{
luafiletransfer_t **prevnext; // A pointer to the "next" field of the last transfer in the list
@ -614,7 +611,6 @@ void CL_PrepareDownloadLuaFile(void)
// Make sure all directories in the file path exist
MakePathDirs(fileneeded[0].filename);
}
#endif
// Number of files to send
// Little optimization to quickly test if there is a file in the queue
@ -749,7 +745,6 @@ void SV_SendRam(INT32 node, void *data, size_t size, freemethod_t freemethod, UI
filestosend++;
}
#ifdef HAVE_BLUA
/** Adds a file requested by Lua to the file list for a node
*
* \param node The node to send the file to
@ -798,7 +793,6 @@ boolean SV_SendLuaFile(INT32 node, const char *filename, boolean textmode)
filestosend++;
return true;
}
#endif
/** Stops sending a file for a node, and removes the file request from the list,
* either because the file has been fully sent or because the node was disconnected
@ -1035,14 +1029,12 @@ void Got_Filetxpak(void)
file->status = FS_FOUND;
CONS_Printf(M_GetText("Downloading %s...(done)\n"),
filename);
#ifdef HAVE_BLUA
if (luafiletransfers)
{
// Tell the server we have received the file
netbuffer->packettype = PT_HASLUAFILE;
HSendPacket(servernode, true, 0, 0);
}
#endif
}
}
else

View file

@ -72,7 +72,6 @@ boolean CL_CheckDownloadable(void);
boolean CL_SendRequestFile(void);
boolean Got_RequestFilePak(INT32 node);
#ifdef HAVE_BLUA
typedef enum
{
LFTNS_WAITING, // This node is waiting for the server to send the file
@ -108,7 +107,6 @@ void Got_LuaFile(UINT8 **cp, INT32 playernum);
void StoreLuaFileCallback(INT32 id);
void RemoveLuaFileCallback(INT32 id);
void MakePathDirs(char *path);
#endif
void SV_AbortSendFiles(INT32 node);
void CloseNetFile(void);

View file

@ -40,9 +40,7 @@
#include "m_cond.h"
#ifdef HAVE_BLUA
#include "v_video.h" // video flags (for lua)
#endif
#ifdef HWRENDER
#include "hardware/hw_light.h"
@ -77,10 +75,8 @@ static UINT16 get_mus(const char *word, UINT8 dehacked_mode);
#endif
static hudnum_t get_huditem(const char *word);
static menutype_t get_menutype(const char *word);
#ifndef HAVE_BLUA
static INT16 get_gametype(const char *word);
static powertype_t get_power(const char *word);
#endif
//static INT16 get_gametype(const char *word);
//static powertype_t get_power(const char *word);
boolean deh_loaded = false;
static int dbg_line;
@ -1416,7 +1412,6 @@ static void readlevelheader(MYFILE *f, INT32 num)
// Lua custom options also go above, contents may be case sensitive.
if (fastncmp(word, "LUA.", 4))
{
#ifdef HAVE_BLUA
UINT8 j;
customoption_t *modoption;
@ -1450,9 +1445,6 @@ static void readlevelheader(MYFILE *f, INT32 num)
modoption->option[31] = '\0';
strncpy(modoption->value, word2, 255);
modoption->value[255] = '\0';
#else
// Silently ignore.
#endif
continue;
}
@ -3124,22 +3116,20 @@ static void readframe(MYFILE *f, INT32 num)
}
z = 0;
#ifdef HAVE_BLUA
found = LUA_SetLuaAction(&states[num], actiontocompare);
if (!found)
#endif
while (actionpointers[z].name)
{
if (fastcmp(actiontocompare, actionpointers[z].name))
while (actionpointers[z].name)
{
states[num].action = actionpointers[z].action;
states[num].action.acv = actionpointers[z].action.acv; // assign
states[num].action.acp1 = actionpointers[z].action.acp1;
found = true;
break;
if (fastcmp(actiontocompare, actionpointers[z].name))
{
states[num].action = actionpointers[z].action;
states[num].action.acv = actionpointers[z].action.acv; // assign
states[num].action.acp1 = actionpointers[z].action.acp1;
found = true;
break;
}
z++;
}
z++;
}
if (!found)
deh_warning("Unknown action %s", actiontocompare);
@ -8849,14 +8839,12 @@ static const char *const MOBJEFLAG_LIST[] = {
NULL
};
#ifdef HAVE_BLUA
static const char *const MAPTHINGFLAG_LIST[4] = {
"EXTRA", // Extra flag for objects.
"OBJECTFLIP", // Reverse gravity flag for objects.
"OBJECTSPECIAL", // Special flag used with certain objects.
"AMBUSH" // Deaf monsters/do not react to sound.
};
#endif
static const char *const PLAYERFLAG_LIST[] = {
@ -8953,7 +8941,6 @@ static const char *const GAMETYPERULE_LIST[] = {
NULL
};
#ifdef HAVE_BLUA
// Linedef flags
static const char *const ML_LIST[16] = {
"IMPASSIBLE",
@ -8973,7 +8960,6 @@ static const char *const ML_LIST[16] = {
"BOUNCY",
"TFERLINE"
};
#endif
// This DOES differ from r_draw's Color_Names, unfortunately.
// Also includes Super colors
@ -9272,11 +9258,7 @@ static const char *const MENUTYPES_LIST[] = {
struct {
const char *n;
// has to be able to hold both fixed_t and angle_t, so drastic measure!!
#ifdef HAVE_BLUA
lua_Integer v;
#else
INT64 v;
#endif
} const INT_CONST[] = {
// If a mod removes some variables here,
// please leave the names in-tact and just set
@ -9532,7 +9514,6 @@ struct {
{"ME_ULTIMATE",ME_ULTIMATE},
{"ME_PERFECT",ME_PERFECT},
#ifdef HAVE_BLUA
// p_local.h constants
{"FLOATSPEED",FLOATSPEED},
{"MAXSTEPMOVE",MAXSTEPMOVE},
@ -9865,7 +9846,6 @@ struct {
{"TC_RAINBOW",TC_RAINBOW},
{"TC_BLINK",TC_BLINK},
{"TC_DASHMODE",TC_DASHMODE},
#endif
{NULL,0}
};
@ -10022,8 +10002,7 @@ static menutype_t get_menutype(const char *word)
return MN_NONE;
}
#ifndef HAVE_BLUA
static INT16 get_gametype(const char *word)
/*static INT16 get_gametype(const char *word)
{ // Returns the value of GT_ enumerations
INT16 i;
if (*word >= '0' && *word <= '9')
@ -10049,7 +10028,7 @@ static powertype_t get_power(const char *word)
return i;
deh_warning("Couldn't find power named 'pw_%s'",word);
return pw_invulnerability;
}
}*/
/// \todo Make ANY of this completely over-the-top math craziness obey the order of operations.
static fixed_t op_mul(fixed_t a, fixed_t b) { return a*b; }
@ -10077,7 +10056,7 @@ struct {
};
// Returns the full word, cut at the first symbol or whitespace
static char *read_word(const char *line)
/*static char *read_word(const char *line)
{
// Part 1: You got the start of the word, now find the end.
const char *p;
@ -10307,16 +10286,14 @@ static fixed_t find_const(const char **rword)
const_warning("constant",word);
free(word);
return 0;
}
#endif
}*/
// Loops through every constant and operation in word and performs its calculations, returning the final value.
fixed_t get_number(const char *word)
{
#ifdef HAVE_BLUA
return LUA_EvalMath(word);
#else
// DESPERATELY NEEDED: Order of operations support! :x
/*// DESPERATELY NEEDED: Order of operations support! :x
fixed_t i = find_const(&word);
INT32 o;
while(*word) {
@ -10326,8 +10303,7 @@ fixed_t get_number(const char *word)
else
break;
}
return i;
#endif
return i;*/
}
void DEH_Check(void)
@ -10352,7 +10328,6 @@ void DEH_Check(void)
#endif
}
#ifdef HAVE_BLUA
#include "lua_script.h"
#include "lua_libs.h"
@ -10978,5 +10953,3 @@ void LUA_SetActionByName(void *state, const char *actiontocompare)
}
}
}
#endif // HAVE_BLUA

View file

@ -34,11 +34,9 @@ void DEH_Check(void);
fixed_t get_number(const char *word);
#ifdef HAVE_BLUA
boolean LUA_SetLuaAction(void *state, const char *actiontocompare);
const char *LUA_GetActionName(void *action);
void LUA_SetActionByName(void *state, const char *actiontocompare);
#endif
extern boolean deh_loaded;

View file

@ -493,7 +493,6 @@ extern UINT16 emeralds;
#define EMERALD7 64
#define ALL7EMERALDS(v) ((v & (EMERALD1|EMERALD2|EMERALD3|EMERALD4|EMERALD5|EMERALD6|EMERALD7)) == (EMERALD1|EMERALD2|EMERALD3|EMERALD4|EMERALD5|EMERALD6|EMERALD7))
// yes, even in non HAVE_BLUA
#define NUM_LUABANKS 16 // please only make this number go up between versions, never down. you'll break saves otherwise. also, must fit in UINT8
extern INT32 luabanks[NUM_LUABANKS];

View file

@ -39,9 +39,7 @@
#include "fastcmp.h"
#include "console.h"
#ifdef HAVE_BLUA
#include "lua_hud.h"
#endif
// Stage of animation:
// 0 = text, 1 = art screen
@ -2762,11 +2760,7 @@ void F_TitleScreenDrawer(void)
// rei|miru: use title pics?
hidepics = curhidepics;
if (hidepics)
#ifdef HAVE_BLUA
goto luahook;
#else
return;
#endif
switch(curttmode)
{
@ -3488,10 +3482,8 @@ void F_TitleScreenDrawer(void)
break;
}
#ifdef HAVE_BLUA
luahook:
LUAh_TitleHUD();
#endif
}
// separate animation timer for backgrounds, since we also count

View file

@ -33,9 +33,7 @@
#include "doomstat.h"
#ifdef HAVE_BLUA
#include "lua_hud.h" // level title
#endif
#ifdef HWRENDER
#include "hardware/hw_main.h"

View file

@ -60,7 +60,7 @@ typedef enum
#endif
EXT_PK3,
EXT_SOC,
EXT_LUA, // allowed even if not HAVE_BLUA so that we can yell on load attempt
EXT_LUA,
NUM_EXT,
NUM_EXT_TABLE = NUM_EXT-EXT_START,
EXT_LOADED = 0x80

View file

@ -47,9 +47,7 @@
#include "m_cond.h" // condition sets
#include "md5.h" // demo checksums
#ifdef HAVE_BLUA
#include "lua_hud.h"
#endif
gameaction_t gameaction;
gamestate_t gamestate = GS_NULL;
@ -177,7 +175,7 @@ static boolean retryingmodeattack = false;
UINT8 stagefailed; // Used for GEMS BONUS? Also to see if you beat the stage.
UINT16 emeralds;
INT32 luabanks[NUM_LUABANKS]; // yes, even in non HAVE_BLUA
INT32 luabanks[NUM_LUABANKS];
UINT32 token; // Number of tokens collected in a level
UINT32 tokenlist; // List of tokens collected
boolean gottoken; // Did you get a token? Used for end of act
@ -1714,11 +1712,9 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
if (ssplayer == 1 && (cmd->forwardmove || cmd->sidemove || cmd->buttons)
&& displayplayer != consoleplayer)
{
#ifdef HAVE_BLUA
// Call ViewpointSwitch hooks here.
// The viewpoint was forcibly changed.
LUAh_ViewpointSwitch(player, &players[consoleplayer], true);
#endif
displayplayer = consoleplayer;
}
}
@ -2048,9 +2044,7 @@ boolean G_Responder(event_t *ev)
&& (ev->data1 == KEY_F12 || ev->data1 == gamecontrol[gc_viewpoint][0] || ev->data1 == gamecontrol[gc_viewpoint][1]))
{
// ViewpointSwitch Lua hook.
#ifdef HAVE_BLUA
UINT8 canSwitchView = 0;
#endif
if (splitscreen || !netgame)
displayplayer = consoleplayer;
@ -2066,14 +2060,12 @@ boolean G_Responder(event_t *ev)
if (!playeringame[displayplayer])
continue;
#ifdef HAVE_BLUA
// Call ViewpointSwitch hooks here.
canSwitchView = LUAh_ViewpointSwitch(&players[consoleplayer], &players[displayplayer], false);
if (canSwitchView == 1) // Set viewpoint to this player
break;
else if (canSwitchView == 2) // Skip this player
continue;
#endif
if (players[displayplayer].spectator)
continue;
@ -2673,9 +2665,7 @@ void G_SpawnPlayer(INT32 playernum)
P_SpawnPlayer(playernum);
G_MovePlayerToSpawnOrStarpost(playernum);
#ifdef HAVE_BLUA
LUAh_PlayerSpawn(&players[playernum]); // Lua hook for player spawning :)
#endif
}
void G_MovePlayerToSpawnOrStarpost(INT32 playernum)
@ -3029,9 +3019,7 @@ void G_DoReborn(INT32 playernum)
}
else
{
#ifdef HAVE_BLUA
LUAh_MapChange(gamemap);
#endif
titlecardforreload = true;
G_DoLoadLevel(true);
titlecardforreload = false;
@ -6803,9 +6791,7 @@ void G_DoPlayDemo(char *defdemoname)
// Set skin
SetPlayerSkin(0, skin);
#ifdef HAVE_BLUA
LUAh_MapChange(gamemap);
#endif
displayplayer = consoleplayer = 0;
memset(playeringame,0,sizeof(playeringame));
playeringame[0] = true;

View file

@ -47,10 +47,8 @@
#include "hardware/hw_main.h"
#endif
#ifdef HAVE_BLUA
#include "lua_hud.h"
#include "lua_hook.h"
#endif
// coords are scaled
#define HU_INPUTX 0
@ -688,10 +686,8 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum)
// run the lua hook even if we were supposed to eat the msg, netgame consistency goes first.
#ifdef HAVE_BLUA
if (LUAh_PlayerMsg(playernum, target, flags, msg))
return;
#endif
if (spam_eatmsg)
return; // don't proceed if we were supposed to eat the message.
@ -2177,18 +2173,14 @@ void HU_Drawer(void)
{
if (netgame || multiplayer)
{
#ifdef HAVE_BLUA
if (LUA_HudEnabled(hud_rankings))
#endif
HU_DrawRankings();
HU_DrawRankings();
if (gametype == GT_COOP)
HU_DrawNetplayCoopOverlay();
}
else
HU_DrawCoopOverlay();
#ifdef HAVE_BLUA
LUAh_ScoresHUD();
#endif
}
if (gamestate != GS_LEVEL)
@ -3171,29 +3163,20 @@ static void HU_DrawRankings(void)
static void HU_DrawCoopOverlay(void)
{
if (token
#ifdef HAVE_BLUA
&& LUA_HudEnabled(hud_tokens)
#endif
)
if (token && LUA_HudEnabled(hud_tokens))
{
V_DrawString(168, 176, 0, va("- %d", token));
V_DrawSmallScaledPatch(148, 172, 0, tokenicon);
}
#ifdef HAVE_BLUA
if (LUA_HudEnabled(hud_tabemblems))
#endif
if (!modifiedgame || savemoddata)
if (LUA_HudEnabled(hud_tabemblems) && (!modifiedgame || savemoddata))
{
V_DrawString(160, 144, 0, va("- %d/%d", M_CountEmblems(), numemblems+numextraemblems));
V_DrawScaledPatch(128, 144 - SHORT(emblemicon->height)/4, 0, emblemicon);
}
#ifdef HAVE_BLUA
if (!LUA_HudEnabled(hud_coopemeralds))
return;
#endif
if (emeralds & EMERALD1)
V_DrawScaledPatch((BASEVIDWIDTH/2)-8 , (BASEVIDHEIGHT/3)-32, 0, emeraldpics[0][0]);
@ -3215,20 +3198,14 @@ static void HU_DrawNetplayCoopOverlay(void)
{
int i;
if (token
#ifdef HAVE_BLUA
&& LUA_HudEnabled(hud_tokens)
#endif
)
if (token && LUA_HudEnabled(hud_tokens))
{
V_DrawString(168, 10, 0, va("- %d", token));
V_DrawSmallScaledPatch(148, 6, 0, tokenicon);
}
#ifdef HAVE_BLUA
if (!LUA_HudEnabled(hud_coopemeralds))
return;
#endif
for (i = 0; i < 7; ++i)
{

View file

@ -11,7 +11,6 @@
/// \brief basic functions for Lua scripting
#include "doomdef.h"
#ifdef HAVE_BLUA
#include "fastcmp.h"
#include "p_local.h"
#include "p_setup.h" // So we can have P_SetupLevelSky
@ -3312,5 +3311,3 @@ int LUA_BaseLib(lua_State *L)
luaL_register(L, NULL, lib);
return 0;
}
#endif

View file

@ -11,7 +11,6 @@
/// \brief blockmap library for Lua scripting
#include "doomdef.h"
#ifdef HAVE_BLUA
#include "p_local.h"
#include "r_main.h" // validcount
#include "lua_script.h"
@ -264,5 +263,3 @@ int LUA_BlockmapLib(lua_State *L)
lua_register(L, "searchBlockmap", lib_searchBlockmap);
return 0;
}
#endif

View file

@ -11,7 +11,6 @@
/// \brief console modifying/etc library for Lua scripting
#include "doomdef.h"
#ifdef HAVE_BLUA
#include "fastcmp.h"
#include "p_local.h"
#include "g_game.h"
@ -551,5 +550,3 @@ int LUA_ConsoleLib(lua_State *L)
luaL_register(L, NULL, lib);
return 0;
}
#endif

View file

@ -10,8 +10,6 @@
/// \file lua_hook.h
/// \brief hooks for Lua scripting
#ifdef HAVE_BLUA
#include "r_defs.h"
#include "d_player.h"
@ -112,5 +110,3 @@ boolean LUAh_SeenPlayer(player_t *player, player_t *seenfriend); // Hook for MT_
#endif
#define LUAh_PlayerThink(player) LUAh_PlayerHook(player, hook_PlayerThink) // Hook for P_PlayerThink
boolean LUAh_ShouldJingleContinue(player_t *player, const char *musname); // Hook for whether a jingle of the given music should continue playing
#endif

View file

@ -11,7 +11,6 @@
/// \brief hooks for Lua scripting
#include "doomdef.h"
#ifdef HAVE_BLUA
#include "doomstat.h"
#include "p_mobj.h"
#include "g_game.h"
@ -1705,5 +1704,3 @@ boolean LUAh_ShouldJingleContinue(player_t *player, const char *musname)
return keepplaying;
}
#endif

View file

@ -11,7 +11,6 @@
/// \brief custom HUD rendering library for Lua scripting
#include "doomdef.h"
#ifdef HAVE_BLUA
#include "fastcmp.h"
#include "r_defs.h"
#include "r_local.h"
@ -1466,5 +1465,3 @@ void LUAh_IntermissionHUD(void)
lua_pop(gL, -1);
hud_running = false;
}
#endif

View file

@ -11,7 +11,6 @@
/// \brief infotable editing library for Lua scripting
#include "doomdef.h"
#ifdef HAVE_BLUA
#include "fastcmp.h"
#include "info.h"
#include "dehacked.h"
@ -1651,5 +1650,3 @@ int LUA_InfoLib(lua_State *L)
return 0;
}
#endif

View file

@ -10,8 +10,6 @@
/// \file lua_libs.h
/// \brief libraries for Lua scripting
#ifdef HAVE_BLUA
extern lua_State *gL;
#define LREG_VALID "VALID_USERDATA"
@ -88,5 +86,3 @@ int LUA_ThinkerLib(lua_State *L);
int LUA_MapLib(lua_State *L);
int LUA_BlockmapLib(lua_State *L);
int LUA_HudLib(lua_State *L);
#endif

View file

@ -11,7 +11,6 @@
/// \brief game map library for Lua scripting
#include "doomdef.h"
#ifdef HAVE_BLUA
#include "r_state.h"
#include "p_local.h"
#include "p_setup.h"
@ -2337,5 +2336,3 @@ int LUA_MapLib(lua_State *L)
lua_setglobal(L, "mapheaderinfo");
return 0;
}
#endif

View file

@ -11,7 +11,6 @@
/// \brief basic math library for Lua scripting
#include "doomdef.h"
#ifdef HAVE_BLUA
//#include "fastcmp.h"
#include "tables.h"
#include "p_local.h"
@ -217,5 +216,3 @@ int LUA_MathLib(lua_State *L)
luaL_register(L, NULL, lib);
return 0;
}
#endif

View file

@ -11,7 +11,6 @@
/// \brief mobj/thing library for Lua scripting
#include "doomdef.h"
#ifdef HAVE_BLUA
#include "fastcmp.h"
#include "r_skins.h"
#include "p_local.h"
@ -915,5 +914,3 @@ int LUA_MobjLib(lua_State *L)
lua_setglobal(L, "mapthings");
return 0;
}
#endif

View file

@ -11,7 +11,6 @@
/// \brief player object library for Lua scripting
#include "doomdef.h"
#ifdef HAVE_BLUA
#include "fastcmp.h"
#include "p_mobj.h"
#include "d_player.h"
@ -878,5 +877,3 @@ int LUA_PlayerLib(lua_State *L)
lua_setglobal(L, "players");
return 0;
}
#endif

View file

@ -11,7 +11,6 @@
/// \brief Lua scripting basics
#include "doomdef.h"
#ifdef HAVE_BLUA
#include "fastcmp.h"
#include "dehacked.h"
#include "z_zone.h"
@ -1423,5 +1422,3 @@ int Lua_optoption(lua_State *L, int narg,
return i;
return -1;
}
#endif // HAVE_BLUA

View file

@ -10,8 +10,6 @@
/// \file lua_script.h
/// \brief Lua scripting basics
#ifdef HAVE_BLUA
#include "m_fixed.h"
#include "doomtype.h"
#include "d_player.h"
@ -102,5 +100,3 @@ void COM_Lua_f(void);
#define INLEVEL if (gamestate != GS_LEVEL && !titlemapinaction)\
return luaL_error(L, "This can only be used in a level!");
#endif

View file

@ -11,7 +11,6 @@
/// \brief player skin structure library for Lua scripting
#include "doomdef.h"
#ifdef HAVE_BLUA
#include "fastcmp.h"
#include "r_skins.h"
#include "sounds.h"
@ -358,5 +357,3 @@ int LUA_SkinLib(lua_State *L)
return 0;
}
#endif

View file

@ -11,7 +11,6 @@
/// \brief thinker library for Lua scripting
#include "doomdef.h"
#ifdef HAVE_BLUA
#include "p_local.h"
#include "lua_script.h"
#include "lua_libs.h"
@ -139,5 +138,3 @@ int LUA_ThinkerLib(lua_State *L)
lua_setglobal(L, "mobjs");
return 0;
}
#endif

View file

@ -788,7 +788,7 @@ void Command_CauseCfail_f(void)
}
#endif
#if defined(HAVE_BLUA) && defined(LUA_ALLOW_BYTECODE)
#ifdef LUA_ALLOW_BYTECODE
void Command_Dumplua_f(void)
{
if (modifiedgame)
@ -1062,9 +1062,7 @@ static mapthing_t *OP_CreateNewMapThing(player_t *player, UINT16 type, boolean c
mapthing_t *mt = mapthings;
sector_t *sec = player->mo->subsector->sector;
#ifdef HAVE_BLUA
LUA_InvalidateMapthings();
#endif
mapthings = Z_Realloc(mapthings, ++nummapthings * sizeof (*mapthings), PU_LEVEL, NULL);

View file

@ -68,7 +68,7 @@ void Command_Toggletwod_f(void);
#ifdef _DEBUG
void Command_CauseCfail_f(void);
#endif
#if defined(HAVE_BLUA) && defined(LUA_ALLOW_BYTECODE)
#ifdef LUA_ALLOW_BYTECODE
void Command_Dumplua_f(void);
#endif

View file

@ -6657,12 +6657,6 @@ static void M_HandleAddons(INT32 choice)
M_AddonExec(KEY_ENTER);
break;
case EXT_LUA:
#ifndef HAVE_BLUA
S_StartSound(NULL, sfx_lose);
M_StartMessage(va("%c%s\x80\nThis copy of SRB2 was compiled\nwithout support for .lua files.\n\n(Press a key)\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), dirmenu[dir_on[menudepthleft]]+DIR_STRING),NULL,MM_NOTHING);
break;
#endif
/* FALLTHRU */
case EXT_SOC:
case EXT_WAD:
#ifdef USE_KART

File diff suppressed because it is too large Load diff

View file

@ -365,10 +365,8 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
if (special->flags & (MF_ENEMY|MF_BOSS) && special->flags2 & MF2_FRET)
return;
#ifdef HAVE_BLUA
if (LUAh_TouchSpecial(special, toucher) || P_MobjWasRemoved(special))
return;
#endif
// 0 = none, 1 = elemental pierce, 2 = bubble bounce
elementalpierce = (((player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL || (player->powers[pw_shield] & SH_NOSTACK) == SH_BUBBLEWRAP) && (player->pflags & PF_SHIELDABILITY)
@ -1919,10 +1917,8 @@ static void P_HitDeathMessages(player_t *player, mobj_t *inflictor, mobj_t *sour
if (!netgame)
return; // Presumably it's obvious what's happening in splitscreen.
#ifdef HAVE_BLUA
if (LUAh_HurtMsg(player, inflictor, source, damagetype))
return;
#endif
deadtarget = (player->mo->health <= 0);
@ -2395,10 +2391,8 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget
target->flags2 &= ~(MF2_SKULLFLY|MF2_NIGHTSPULL);
target->health = 0; // This makes it easy to check if something's dead elsewhere.
#ifdef HAVE_BLUA
if (LUAh_MobjDeath(target, inflictor, source, damagetype) || P_MobjWasRemoved(target))
return;
#endif
// Let EVERYONE know what happened to a player! 01-29-2002 Tails
if (target->player && !target->player->spectator)
@ -3511,11 +3505,7 @@ void P_SpecialStageDamage(player_t *player, mobj_t *inflictor, mobj_t *source)
boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage, UINT8 damagetype)
{
player_t *player;
#ifdef HAVE_BLUA
boolean force = false;
#else
static const boolean force = false;
#endif
if (objectplacing)
return false;
@ -3533,7 +3523,6 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
return false;
}
#ifdef HAVE_BLUA
// Everything above here can't be forced.
if (!metalrecording)
{
@ -3545,7 +3534,6 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
else if (shouldForce == 2)
return false;
}
#endif
if (!force)
{
@ -3579,10 +3567,8 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
if (!force && target->flags2 & MF2_FRET) // Currently flashing from being hit
return false;
#ifdef HAVE_BLUA
if (LUAh_MobjDamage(target, inflictor, source, damage, damagetype) || P_MobjWasRemoved(target))
return true;
#endif
if (target->health > 1)
target->flags2 |= MF2_FRET;
@ -3631,10 +3617,8 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|| (G_GametypeHasTeams() && player->ctfteam == source->player->ctfteam)))
return false; // Don't run eachother over in special stages and team games and such
}
#ifdef HAVE_BLUA
if (LUAh_MobjDamage(target, inflictor, source, damage, damagetype))
return true;
#endif
P_NiGHTSDamage(target, source); // -5s :(
return true;
}
@ -3687,18 +3671,14 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
if (force
|| (inflictor && inflictor->flags & MF_MISSILE && inflictor->flags2 & MF2_SUPERFIRE)) // Super Sonic is stunned!
{
#ifdef HAVE_BLUA
if (!LUAh_MobjDamage(target, inflictor, source, damage, damagetype))
#endif
P_SuperDamage(player, inflictor, source, damage);
return true;
}
return false;
}
#ifdef HAVE_BLUA
else if (LUAh_MobjDamage(target, inflictor, source, damage, damagetype))
return true;
#endif
else if (player->powers[pw_shield] || (player->bot && !ultimatemode)) //If One-Hit Shield
{
P_ShieldDamage(player, inflictor, source, damage, damagetype);

View file

@ -756,11 +756,9 @@ static boolean PIT_CheckThing(mobj_t *thing)
if (tmthing->z + tmthing->height < thing->z)
return true; // underneath
#ifdef HAVE_BLUA
// REX HAS SEEN YOU
if (!LUAh_SeenPlayer(tmthing->target->player, thing->player))
return false;
#endif
seenplayer = thing->player;
return false;
@ -948,7 +946,6 @@ static boolean PIT_CheckThing(mobj_t *thing)
return true; // the line doesn't cross between either pair of opposite corners
}
#ifdef HAVE_BLUA
{
UINT8 shouldCollide = LUAh_MobjCollide(thing, tmthing); // checks hook for thing's type
if (P_MobjWasRemoved(tmthing) || P_MobjWasRemoved(thing))
@ -957,9 +954,8 @@ static boolean PIT_CheckThing(mobj_t *thing)
return false; // force collide
else if (shouldCollide == 2)
return true; // force no collide
}
{
UINT8 shouldCollide = LUAh_MobjMoveCollide(tmthing, thing); // checks hook for tmthing's type
shouldCollide = LUAh_MobjMoveCollide(tmthing, thing); // checks hook for tmthing's type
if (P_MobjWasRemoved(tmthing) || P_MobjWasRemoved(thing))
return true; // one of them was removed???
if (shouldCollide == 1)
@ -967,7 +963,6 @@ static boolean PIT_CheckThing(mobj_t *thing)
else if (shouldCollide == 2)
return true; // force no collide
}
#endif
if (tmthing->type == MT_LAVAFALL_LAVA && (thing->type == MT_RING || thing->type == MT_REDTEAMRING || thing->type == MT_BLUETEAMRING || thing->type == MT_FLINGRING))
{
@ -1946,7 +1941,6 @@ static boolean PIT_CheckLine(line_t *ld)
// this line is out of the if so upper and lower textures can be hit by a splat
blockingline = ld;
#ifdef HAVE_BLUA
{
UINT8 shouldCollide = LUAh_MobjLineCollide(tmthing, blockingline); // checks hook for thing's type
if (P_MobjWasRemoved(tmthing))
@ -1956,7 +1950,6 @@ static boolean PIT_CheckLine(line_t *ld)
else if (shouldCollide == 2)
return true; // force no collide
}
#endif
if (!ld->backsector) // one sided line
{

View file

@ -62,9 +62,7 @@ void P_RunCachedActions(void)
{
var1 = states[ac->statenum].var1;
var2 = states[ac->statenum].var2;
#ifdef HAVE_BLUA
astate = &states[ac->statenum];
#endif
if (ac->mobj && !P_MobjWasRemoved(ac->mobj)) // just in case...
states[ac->statenum].action.acp1(ac->mobj);
next = ac->next;
@ -459,9 +457,7 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state)
{
var1 = st->var1;
var2 = st->var2;
#ifdef HAVE_BLUA
astate = st;
#endif
st->action.acp1(mobj);
// woah. a player was removed by an action.
@ -585,9 +581,7 @@ boolean P_SetMobjState(mobj_t *mobj, statenum_t state)
{
var1 = st->var1;
var2 = st->var2;
#ifdef HAVE_BLUA
astate = st;
#endif
st->action.acp1(mobj);
if (P_MobjWasRemoved(mobj))
return false;
@ -1906,15 +1900,12 @@ void P_XYMovement(mobj_t *mo)
B_MoveBlocked(player);
}
#ifdef HAVE_BLUA
if (LUAh_MobjMoveBlocked(mo))
{
if (P_MobjWasRemoved(mo))
return;
}
else
#endif
if (P_MobjWasRemoved(mo))
else if (P_MobjWasRemoved(mo))
return;
else if (mo->flags & MF_BOUNCE)
{
@ -7643,12 +7634,10 @@ static void P_RosySceneryThink(mobj_t *mobj)
static void P_MobjSceneryThink(mobj_t *mobj)
{
#ifdef HAVE_BLUA
if (LUAh_MobjThinker(mobj))
return;
if (P_MobjWasRemoved(mobj))
return;
#endif
if ((mobj->flags2 & MF2_SHIELD) && !P_AddShield(mobj))
return;
@ -7993,9 +7982,7 @@ static void P_MobjSceneryThink(mobj_t *mobj)
if (!mobj->fuse)
{
#ifdef HAVE_BLUA
if (!LUAh_MobjFuse(mobj))
#endif
P_RemoveMobj(mobj);
return;
}
@ -8054,9 +8041,7 @@ static void P_MobjSceneryThink(mobj_t *mobj)
mobj->fuse--;
if (!mobj->fuse)
{
#ifdef HAVE_BLUA
if (!LUAh_MobjFuse(mobj))
#endif
P_RemoveMobj(mobj);
return;
}
@ -8085,7 +8070,6 @@ static boolean P_MobjPushableThink(mobj_t *mobj)
static boolean P_MobjBossThink(mobj_t *mobj)
{
#ifdef HAVE_BLUA
if (LUAh_BossThinker(mobj))
{
if (P_MobjWasRemoved(mobj))
@ -8094,7 +8078,6 @@ static boolean P_MobjBossThink(mobj_t *mobj)
else if (P_MobjWasRemoved(mobj))
return false;
else
#endif
switch (mobj->type)
{
case MT_EGGMOBILE:
@ -10004,113 +9987,110 @@ static boolean P_FuseThink(mobj_t *mobj)
if (mobj->fuse)
return true;
#ifdef HAVE_BLUA
if (LUAh_MobjFuse(mobj) || P_MobjWasRemoved(mobj))
;
else
#endif
if (mobj->info->flags & MF_MONITOR)
else if (mobj->info->flags & MF_MONITOR)
{
P_MonitorFuseThink(mobj);
return false;
}
else switch (mobj->type)
{
// gargoyle and snowman handled in P_PushableThinker, not here
case MT_THROWNGRENADE:
case MT_CYBRAKDEMON_NAPALM_BOMB_LARGE:
P_SetMobjState(mobj, mobj->info->deathstate);
break;
case MT_LHRT:
P_KillMobj(mobj, NULL, NULL, 0);
break;
case MT_BLUEFLAG:
case MT_REDFLAG:
P_FlagFuseThink(mobj);
P_RemoveMobj(mobj);
return false;
case MT_FANG:
if (mobj->flags2 & MF2_SLIDEPUSH)
{
P_MonitorFuseThink(mobj);
var1 = 0;
var2 = 0;
A_BossDeath(mobj);
return false;
}
else switch (mobj->type)
P_SetMobjState(mobj, mobj->state->nextstate);
if (P_MobjWasRemoved(mobj))
return false;
break;
case MT_METALSONIC_BATTLE:
break; // don't remove
case MT_SPIKE:
P_SetMobjState(mobj, mobj->state->nextstate);
mobj->fuse = mobj->info->speed;
if (mobj->spawnpoint)
mobj->fuse += mobj->spawnpoint->angle;
break;
case MT_WALLSPIKE:
P_SetMobjState(mobj, mobj->state->nextstate);
mobj->fuse = mobj->info->speed;
if (mobj->spawnpoint)
mobj->fuse += (mobj->spawnpoint->angle / 360);
break;
case MT_NIGHTSCORE:
P_RemoveMobj(mobj);
return false;
case MT_LAVAFALL:
if (mobj->state - states == S_LAVAFALL_DORMANT)
{
// gargoyle and snowman handled in P_PushableThinker, not here
case MT_THROWNGRENADE:
case MT_CYBRAKDEMON_NAPALM_BOMB_LARGE:
P_SetMobjState(mobj, mobj->info->deathstate);
mobj->fuse = 30;
P_SetMobjState(mobj, S_LAVAFALL_TELL);
S_StartSound(mobj, mobj->info->seesound);
}
else if (mobj->state - states == S_LAVAFALL_TELL)
{
mobj->fuse = 40;
P_SetMobjState(mobj, S_LAVAFALL_SHOOT);
S_StopSound(mobj);
S_StartSound(mobj, mobj->info->attacksound);
}
else
{
mobj->fuse = 30;
P_SetMobjState(mobj, S_LAVAFALL_DORMANT);
S_StopSound(mobj);
}
return false;
case MT_PYREFLY:
if (mobj->health <= 0)
break;
case MT_LHRT:
P_KillMobj(mobj, NULL, NULL, 0);
break;
case MT_BLUEFLAG:
case MT_REDFLAG:
P_FlagFuseThink(mobj);
P_RemoveMobj(mobj);
return false;
case MT_FANG:
if (mobj->flags2 & MF2_SLIDEPUSH)
{
var1 = 0;
var2 = 0;
A_BossDeath(mobj);
return false;
}
P_SetMobjState(mobj, mobj->state->nextstate);
if (P_MobjWasRemoved(mobj))
return false;
break;
case MT_METALSONIC_BATTLE:
break; // don't remove
case MT_SPIKE:
P_SetMobjState(mobj, mobj->state->nextstate);
mobj->fuse = mobj->info->speed;
if (mobj->spawnpoint)
mobj->fuse += mobj->spawnpoint->angle;
break;
case MT_WALLSPIKE:
P_SetMobjState(mobj, mobj->state->nextstate);
mobj->fuse = mobj->info->speed;
if (mobj->spawnpoint)
mobj->fuse += (mobj->spawnpoint->angle / 360);
break;
case MT_NIGHTSCORE:
P_RemoveMobj(mobj);
return false;
case MT_LAVAFALL:
if (mobj->state - states == S_LAVAFALL_DORMANT)
{
mobj->fuse = 30;
P_SetMobjState(mobj, S_LAVAFALL_TELL);
S_StartSound(mobj, mobj->info->seesound);
}
else if (mobj->state - states == S_LAVAFALL_TELL)
{
mobj->fuse = 40;
P_SetMobjState(mobj, S_LAVAFALL_SHOOT);
S_StopSound(mobj);
S_StartSound(mobj, mobj->info->attacksound);
}
else
{
mobj->fuse = 30;
P_SetMobjState(mobj, S_LAVAFALL_DORMANT);
S_StopSound(mobj);
}
return false;
case MT_PYREFLY:
if (mobj->health <= 0)
break;
mobj->extravalue2 = (mobj->extravalue2 + 1) % 3;
if (mobj->extravalue2 == 0)
{
P_SetMobjState(mobj, mobj->info->spawnstate);
mobj->fuse = 100;
S_StopSound(mobj);
S_StartSound(mobj, sfx_s3k8c);
}
else if (mobj->extravalue2 == 1)
{
mobj->fuse = 50;
S_StartSound(mobj, sfx_s3ka3);
}
else
{
P_SetMobjState(mobj, mobj->info->meleestate);
mobj->fuse = 100;
S_StopSound(mobj);
S_StartSound(mobj, sfx_s3kc2l);
}
return false;
case MT_PLAYER:
break; // don't remove
default:
P_SetMobjState(mobj, mobj->info->xdeathstate); // will remove the mobj if S_NULL.
break;
// Looking for monitors? They moved to a special condition above.
mobj->extravalue2 = (mobj->extravalue2 + 1) % 3;
if (mobj->extravalue2 == 0)
{
P_SetMobjState(mobj, mobj->info->spawnstate);
mobj->fuse = 100;
S_StopSound(mobj);
S_StartSound(mobj, sfx_s3k8c);
}
else if (mobj->extravalue2 == 1)
{
mobj->fuse = 50;
S_StartSound(mobj, sfx_s3ka3);
}
else
{
P_SetMobjState(mobj, mobj->info->meleestate);
mobj->fuse = 100;
S_StopSound(mobj);
S_StartSound(mobj, sfx_s3kc2l);
}
return false;
case MT_PLAYER:
break; // don't remove
default:
P_SetMobjState(mobj, mobj->info->xdeathstate); // will remove the mobj if S_NULL.
break;
// Looking for monitors? They moved to a special condition above.
}
return !P_MobjWasRemoved(mobj);
}
@ -10179,7 +10159,6 @@ void P_MobjThinker(mobj_t *mobj)
return;
}
#ifdef HAVE_BLUA
// Check for a Lua thinker first
if (!mobj->player)
{
@ -10193,7 +10172,7 @@ void P_MobjThinker(mobj_t *mobj)
if (P_MobjWasRemoved(mobj))
return;
}
#endif
// if it's pushable, or if it would be pushable other than temporary disablement, use the
// separate thinker
if (mobj->flags & MF_PUSHABLE || (mobj->info->flags & MF_PUSHABLE && mobj->fuse))
@ -10656,7 +10635,6 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
// Set shadowscale here, before spawn hook so that Lua can change it
mobj->shadowscale = P_DefaultMobjShadowScale(mobj);
#ifdef HAVE_BLUA
// DANGER! This can cause P_SpawnMobj to return NULL!
// Avoid using P_RemoveMobj on the newly created mobj in "MobjSpawn" Lua hooks!
if (LUAh_MobjSpawn(mobj))
@ -10667,7 +10645,6 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
else if (P_MobjWasRemoved(mobj))
return NULL;
else
#endif
switch (mobj->type)
{
case MT_ALTVIEWMAN:
@ -10937,9 +10914,7 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
{
var1 = st->var1;
var2 = st->var2;
#ifdef HAVE_BLUA
astate = st;
#endif
st->action.acp1(mobj);
// DANGER! This can cause P_SpawnMobj to return NULL!
// Avoid using MF_RUNSPAWNFUNC on mobjs whose spawn state expects target or tracer to already be set!
@ -11037,16 +11012,12 @@ size_t iquehead, iquetail;
void P_RemoveMobj(mobj_t *mobj)
{
I_Assert(mobj != NULL);
#ifdef HAVE_BLUA
if (P_MobjWasRemoved(mobj))
return; // something already removing this mobj.
mobj->thinker.function.acp1 = (actionf_p1)P_RemoveThinkerDelayed; // shh. no recursing.
LUAh_MobjRemoved(mobj);
mobj->thinker.function.acp1 = (actionf_p1)P_MobjThinker; // needed for P_UnsetThingPosition, etc. to work.
#else
I_Assert(!P_MobjWasRemoved(mobj));
#endif
// Rings only, please!
if (mobj->spawnpoint &&
@ -12710,7 +12681,6 @@ static boolean P_SetupBooster(mapthing_t* mthing, mobj_t* mobj, boolean strong)
static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean *doangle)
{
#ifdef HAVE_BLUA
boolean override = LUAh_MapThingSpawn(mobj, mthing);
if (P_MobjWasRemoved(mobj))
@ -12718,7 +12688,6 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean
if (override)
return true;
#endif
switch (mobj->type)
{

View file

@ -4183,8 +4183,6 @@ void P_SaveGame(void)
{
P_ArchiveMisc();
P_ArchivePlayer();
// yes, even in non HAVE_BLUA
P_ArchiveLuabanksAndConsistency();
}
@ -4220,9 +4218,7 @@ void P_SaveNetGame(void)
P_NetArchiveSpecials();
P_NetArchiveColormaps();
}
#ifdef HAVE_BLUA
LUA_Archive();
#endif
P_ArchiveLuabanksAndConsistency();
}
@ -4264,9 +4260,7 @@ boolean P_LoadNetGame(void)
P_RelinkPointers();
P_FinishMobjs();
}
#ifdef HAVE_BLUA
LUA_UnArchive();
#endif
// This is stupid and hacky, but maybe it'll work!
P_SetRandSeed(P_GetInitSeed());

View file

@ -57,9 +57,7 @@
#include "filesrch.h" // refreshdirmenu
#ifdef HAVE_BLUA
#include "lua_hud.h" // level title
#endif
#include "f_finale.h" // wipes
@ -3526,9 +3524,7 @@ boolean P_LoadLevel(boolean fromnetsave)
// Close text prompt before freeing the old level
F_EndTextPrompt(false, true);
#ifdef HAVE_BLUA
LUA_InvalidateLevel();
#endif
for (ss = sectors; sectors+numsectors != ss; ss++)
{
@ -3665,9 +3661,7 @@ boolean P_LoadLevel(boolean fromnetsave)
G_CopyTiccmd(&players[i].cmd, &netcmds[buf][i], 1);
}
P_PreTicker(2);
#ifdef HAVE_BLUA
LUAh_MapLoad();
#endif
}
// No render mode, stop here.
@ -3859,10 +3853,8 @@ boolean P_AddWadFile(const char *wadfilename)
// Update the detected resources.
// Note: ALWAYS load Lua scripts first, SOCs right after, and the remaining resources afterwards.
#ifdef HAVE_BLUA
// if (luaNum) // Lua scripts.
// P_LoadLuaScrRange(wadnum, luaPos, luaNum);
#endif
// if (socNum) // SOCs.
// P_LoadDehackRange(wadnum, socPos, socNum);
if (sfxNum) // Sounds. TODO: Function currently only updates already existing sounds, the rest is handled somewhere else.

View file

@ -3366,14 +3366,10 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
}
case 443: // Calls a named Lua function
#ifdef HAVE_BLUA
if (line->text)
LUAh_LinedefExecute(line, mo, callsec);
else
CONS_Alert(CONS_WARNING, "Linedef %s is missing the hook name of the Lua function to call! (This should be given in the front texture fields)\n", sizeu1(line-lines));
#else
CONS_Alert(CONS_ERROR, "The map is trying to run a Lua script, but this exe was not compiled with Lua support!\n");
#endif
break;
case 444: // Earthquake camera

View file

@ -269,9 +269,7 @@ void P_RemoveThinkerDelayed(thinker_t *thinker)
//
void P_RemoveThinker(thinker_t *thinker)
{
#ifdef HAVE_BLUA
LUA_InvalidateUserdata(thinker);
#endif
thinker->function.acp1 = (actionf_p1)P_RemoveThinkerDelayed;
}
@ -643,9 +641,7 @@ void P_Ticker(boolean run)
if (demoplayback)
G_ReadDemoTiccmd(&players[consoleplayer].cmd, 0);
#ifdef HAVE_BLUA
LUAh_PreThinkFrame();
#endif
for (i = 0; i < MAXPLAYERS; i++)
if (playeringame[i] && players[i].mo && !P_MobjWasRemoved(players[i].mo))
@ -671,9 +667,7 @@ void P_Ticker(boolean run)
if (playeringame[i] && players[i].mo && !P_MobjWasRemoved(players[i].mo))
P_PlayerAfterThink(&players[i]);
#ifdef HAVE_BLUA
LUAh_ThinkFrame();
#endif
}
// Run shield positioning
@ -745,9 +739,7 @@ void P_Ticker(boolean run)
if (modeattacking)
G_GhostTicker();
#ifdef HAVE_BLUA
LUAh_PostThinkFrame();
#endif
}
P_MapEnd();
@ -767,9 +759,8 @@ void P_PreTicker(INT32 frames)
{
P_MapStart();
#ifdef HAVE_BLUA
LUAh_PreThinkFrame();
#endif
for (i = 0; i < MAXPLAYERS; i++)
if (playeringame[i] && players[i].mo && !P_MobjWasRemoved(players[i].mo))
{
@ -793,9 +784,7 @@ void P_PreTicker(INT32 frames)
if (playeringame[i] && players[i].mo && !P_MobjWasRemoved(players[i].mo))
P_PlayerAfterThink(&players[i]);
#ifdef HAVE_BLUA
LUAh_ThinkFrame();
#endif
// Run shield positioning
P_RunShields();
@ -804,9 +793,7 @@ void P_PreTicker(INT32 frames)
P_UpdateSpecials();
P_RespawnSpecials();
#ifdef HAVE_BLUA
LUAh_PostThinkFrame();
#endif
P_MapEnd();
}

View file

@ -1109,7 +1109,6 @@ boolean P_PlayerCanDamage(player_t *player, mobj_t *thing)
if (!player->mo || player->spectator || !thing || P_MobjWasRemoved(thing))
return false;
#ifdef HAVE_BLUA
{
UINT8 shouldCollide = LUAh_PlayerCanDamage(player, thing);
if (P_MobjWasRemoved(thing))
@ -1119,7 +1118,6 @@ boolean P_PlayerCanDamage(player_t *player, mobj_t *thing)
else if (shouldCollide == 2)
return false; // force no
}
#endif
// Invinc/super. Not for Monitors.
if (!(thing->flags & MF_MONITOR) && (player->powers[pw_invulnerability] || player->powers[pw_super]))
@ -1521,7 +1519,7 @@ void P_PlayJingle(player_t *player, jingletype_t jingletype)
char newmusic[7];
strncpy(newmusic, musname, 7);
#if defined(HAVE_BLUA) && defined(HAVE_LUA_MUSICPLUS)
#ifdef HAVE_LUA_MUSICPLUS
if(LUAh_MusicJingle(jingletype, newmusic, &musflags, &looping))
return;
#endif
@ -1602,10 +1600,8 @@ boolean P_EvaluateMusicStatus(UINT16 status, const char *musname)
break;
case JT_OTHER: // Other state
#ifdef HAVE_BLUA
result = LUAh_ShouldJingleContinue(&players[i], musname);
break;
#endif
case JT_NONE: // Null state
case JT_MASTER: // Main level music
@ -1870,10 +1866,8 @@ void P_SpawnShieldOrb(player_t *player)
I_Error("P_SpawnShieldOrb: player->mo is NULL!\n");
#endif
#ifdef HAVE_BLUA
if (LUAh_ShieldSpawn(player))
return;
#endif
if (player->powers[pw_shield] & SH_FORCE)
orbtype = MT_FORCE_ORB;
@ -4638,13 +4632,11 @@ static void P_DoSpinAbility(player_t *player, ticcmd_t *cmd)
&& (player->pflags & PF_JUMPSTASIS || player->mo->state-states != S_PLAY_GLIDE_LANDING))
return;
#ifdef HAVE_BLUA
if (cmd->buttons & BT_USE)
{
if (LUAh_SpinSpecial(player))
return;
}
#endif
#ifdef ESLOPE
canstand = (!player->mo->standingslope || (player->mo->standingslope->flags & SL_NOPHYSICS) || abs(player->mo->standingslope->zdelta) < FRACUNIT/2);
@ -5130,11 +5122,7 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd)
}
}
}
if (cmd->buttons & BT_USE // Spin button effects
#ifdef HAVE_BLUA
&& !LUAh_ShieldSpecial(player)
#endif
)
if (cmd->buttons & BT_USE && !LUAh_ShieldSpecial(player)) // Spin button effects
{
// Force stop
if ((player->powers[pw_shield] & ~(SH_FORCEHP|SH_STACK)) == SH_FORCE)
@ -5212,51 +5200,48 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd)
// and you don't have a shield, do it!
P_DoSuperTransformation(player, false);
}
else
#ifdef HAVE_BLUA
if (!LUAh_JumpSpinSpecial(player))
#endif
switch (player->charability)
{
case CA_THOK:
if (player->powers[pw_super]) // Super Sonic float
{
if ((player->speed > 5*player->mo->scale) // FixedMul(5<<FRACBITS, player->mo->scale), but scale is FRACUNIT-based
&& (P_MobjFlip(player->mo)*player->mo->momz <= 0))
else if (!LUAh_JumpSpinSpecial(player))
switch (player->charability)
{
case CA_THOK:
if (player->powers[pw_super]) // Super Sonic float
{
if (player->panim != PA_RUN && player->panim != PA_WALK)
if ((player->speed > 5*player->mo->scale) // FixedMul(5<<FRACBITS, player->mo->scale), but scale is FRACUNIT-based
&& (P_MobjFlip(player->mo)*player->mo->momz <= 0))
{
if (player->speed >= FixedMul(player->runspeed, player->mo->scale))
P_SetPlayerMobjState(player->mo, S_PLAY_FLOAT_RUN);
else
P_SetPlayerMobjState(player->mo, S_PLAY_FLOAT);
}
if (player->panim != PA_RUN && player->panim != PA_WALK)
{
if (player->speed >= FixedMul(player->runspeed, player->mo->scale))
P_SetPlayerMobjState(player->mo, S_PLAY_FLOAT_RUN);
else
P_SetPlayerMobjState(player->mo, S_PLAY_FLOAT);
}
player->mo->momz = 0;
player->pflags &= ~(PF_STARTJUMP|PF_SPINNING);
player->mo->momz = 0;
player->pflags &= ~(PF_STARTJUMP|PF_SPINNING);
}
}
}
break;
case CA_TELEKINESIS:
if (!(player->pflags & (PF_THOKKED|PF_USEDOWN)) || (player->charflags & SF_MULTIABILITY))
{
P_Telekinesis(player,
-FixedMul(player->actionspd, player->mo->scale), // -ve thrust (pulling towards player)
FixedMul(384*FRACUNIT, player->mo->scale));
}
break;
case CA_TWINSPIN:
if ((player->charability2 == CA2_MELEE) && (!(player->pflags & (PF_THOKKED|PF_USEDOWN)) || player->charflags & SF_MULTIABILITY))
{
player->pflags |= PF_THOKKED;
S_StartSound(player->mo, sfx_s3k42);
player->mo->frame = 0;
P_SetPlayerMobjState(player->mo, S_PLAY_TWINSPIN);
}
break;
default:
break;
}
break;
case CA_TELEKINESIS:
if (!(player->pflags & (PF_THOKKED|PF_USEDOWN)) || (player->charflags & SF_MULTIABILITY))
{
P_Telekinesis(player,
-FixedMul(player->actionspd, player->mo->scale), // -ve thrust (pulling towards player)
FixedMul(384*FRACUNIT, player->mo->scale));
}
break;
case CA_TWINSPIN:
if ((player->charability2 == CA2_MELEE) && (!(player->pflags & (PF_THOKKED|PF_USEDOWN)) || player->charflags & SF_MULTIABILITY))
{
player->pflags |= PF_THOKKED;
S_StartSound(player->mo, sfx_s3k42);
player->mo->frame = 0;
P_SetPlayerMobjState(player->mo, S_PLAY_TWINSPIN);
}
break;
default:
break;
}
}
}
@ -5292,16 +5277,13 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd)
if (cmd->buttons & BT_JUMP && !player->exiting && !P_PlayerInPain(player))
{
#ifdef HAVE_BLUA
if (LUAh_JumpSpecial(player))
;
else
#endif
if (player->pflags & PF_JUMPDOWN) // all situations below this require jump button not to be pressed already
// all situations below this require jump button not to be pressed already
else if (player->pflags & PF_JUMPDOWN)
;
else
// Jump S3&K style while in quicksand.
if (P_InQuicksand(player->mo))
else if (P_InQuicksand(player->mo))
{
P_DoJump(player, true);
player->secondjump = 0;
@ -5313,9 +5295,8 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd)
P_SetTarget(&player->mo->tracer, NULL);
player->powers[pw_flashing] = TICRATE/4;
}
else
// can't jump while in air, can't jump while jumping
if (onground || player->climbing || player->powers[pw_carry])
else if (onground || player->climbing || player->powers[pw_carry])
{
P_DoJump(player, true);
player->secondjump = 0;
@ -5331,9 +5312,7 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd)
}*/
else if (player->pflags & PF_JUMPED)
{
#ifdef HAVE_BLUA
if (!LUAh_AbilitySpecial(player))
#endif
switch (player->charability)
{
case CA_THOK:
@ -5528,30 +5507,28 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd)
}
else if (player->pflags & PF_THOKKED)
{
#ifdef HAVE_BLUA
if (!LUAh_AbilitySpecial(player))
#endif
switch (player->charability)
{
case CA_FLY:
case CA_SWIM: // Swim
if (player->charability == CA_SWIM && !(player->mo->eflags & MFE_UNDERWATER))
; // Can't do anything if you're a fish out of water!
else if (player->powers[pw_tailsfly]) // If currently flying, give an ascend boost.
{
player->fly1 = 20;
switch (player->charability)
{
case CA_FLY:
case CA_SWIM: // Swim
if (player->charability == CA_SWIM && !(player->mo->eflags & MFE_UNDERWATER))
; // Can't do anything if you're a fish out of water!
else if (player->powers[pw_tailsfly]) // If currently flying, give an ascend boost.
{
player->fly1 = 20;
if (player->charability == CA_SWIM)
player->fly1 /= 2;
if (player->charability == CA_SWIM)
player->fly1 /= 2;
// Slow down!
if (player->speed > FixedMul(8*FRACUNIT, player->mo->scale) && player->speed > FixedMul(player->normalspeed>>1, player->mo->scale))
P_Thrust(player->mo, R_PointToAngle2(0,0,player->mo->momx,player->mo->momy), FixedMul(-4*FRACUNIT, player->mo->scale));
}
break;
default:
break;
}
// Slow down!
if (player->speed > FixedMul(8*FRACUNIT, player->mo->scale) && player->speed > FixedMul(player->normalspeed>>1, player->mo->scale))
P_Thrust(player->mo, R_PointToAngle2(0,0,player->mo->momx,player->mo->momy), FixedMul(-4*FRACUNIT, player->mo->scale));
}
break;
default:
break;
}
}
else if ((player->powers[pw_shield] & SH_NOSTACK) == SH_WHIRLWIND && !player->powers[pw_super])
P_DoJumpShield(player);
@ -10638,10 +10615,8 @@ boolean P_SpectatorJoinGame(player_t *player)
else
changeto = (P_RandomFixed() & 1) + 1;
#ifdef HAVE_BLUA
if (!LUAh_TeamSwitch(player, changeto, true, false, false))
return false;
#endif
if (player->mo)
{
@ -10655,11 +10630,9 @@ boolean P_SpectatorJoinGame(player_t *player)
//Reset away view
if (P_IsLocalPlayer(player) && displayplayer != consoleplayer)
{
#ifdef HAVE_BLUA
// Call ViewpointSwitch hooks here.
// The viewpoint was forcibly changed.
LUAh_ViewpointSwitch(player, &players[consoleplayer], true);
#endif
displayplayer = consoleplayer;
}
@ -10677,10 +10650,8 @@ boolean P_SpectatorJoinGame(player_t *player)
// respawn in place and sit there for the rest of the round.
if (!((gametyperules & GTR_HIDEFROZEN) && leveltime > (hidetime * TICRATE)))
{
#ifdef HAVE_BLUA
if (!LUAh_TeamSwitch(player, 3, true, false, false))
return false;
#endif
if (player->mo)
{
P_RemoveMobj(player->mo);
@ -10704,11 +10675,9 @@ boolean P_SpectatorJoinGame(player_t *player)
//Reset away view
if (P_IsLocalPlayer(player) && displayplayer != consoleplayer)
{
#ifdef HAVE_BLUA
// Call ViewpointSwitch hooks here.
// The viewpoint was forcibly changed.
LUAh_ViewpointSwitch(player, &players[consoleplayer], true);
#endif
displayplayer = consoleplayer;
}
@ -11631,9 +11600,7 @@ void P_PlayerThink(player_t *player)
}
if (player->playerstate == PST_REBORN)
{
#ifdef HAVE_BLUA
LUAh_PlayerThink(player);
#endif
return;
}
}
@ -11737,9 +11704,7 @@ void P_PlayerThink(player_t *player)
if (player->playerstate == PST_DEAD)
{
#ifdef HAVE_BLUA
LUAh_PlayerThink(player);
#endif
return;
}
}
@ -11862,9 +11827,7 @@ void P_PlayerThink(player_t *player)
{
player->mo->flags2 &= ~MF2_SHADOW;
P_DeathThink(player);
#ifdef HAVE_BLUA
LUAh_PlayerThink(player);
#endif
return;
}
@ -11906,9 +11869,7 @@ void P_PlayerThink(player_t *player)
{
if (P_SpectatorJoinGame(player))
{
#ifdef HAVE_BLUA
LUAh_PlayerThink(player);
#endif
return; // player->mo was removed.
}
}
@ -12013,9 +11974,7 @@ void P_PlayerThink(player_t *player)
if (!player->mo)
{
#ifdef HAVE_BLUA
LUAh_PlayerThink(player);
#endif
return; // P_MovePlayer removed player->mo.
}
@ -12457,9 +12416,7 @@ void P_PlayerThink(player_t *player)
}
#undef dashmode
#ifdef HAVE_BLUA
LUAh_PlayerThink(player);
#endif
/*
// Colormap verification
@ -13009,11 +12966,9 @@ void P_PlayerAfterThink(player_t *player)
if (player->followmobj)
{
#ifdef HAVE_BLUA
if (LUAh_FollowMobj(player, player->followmobj) || P_MobjWasRemoved(player->followmobj))
{;}
else
#endif
{
switch (player->followmobj->type)
{

View file

@ -40,7 +40,7 @@ extern INT32 msg_id;
#include "m_misc.h" // for tunes command
#include "m_cond.h" // for conditionsets
#if defined(HAVE_BLUA) && defined(HAVE_LUA_MUSICPLUS)
#ifdef HAVE_LUA_MUSICPLUS
#include "lua_hook.h" // MusicChange hook
#endif
@ -2314,7 +2314,7 @@ void S_ChangeMusicEx(const char *mmusic, UINT16 mflags, boolean looping, UINT32
return;
strncpy(newmusic, mmusic, 7);
#if defined(HAVE_BLUA) && defined(HAVE_LUA_MUSICPLUS)
#ifdef HAVE_LUA_MUSICPLUS
if(LUAh_MusicChange(music_name, newmusic, &mflags, &looping, &position, &prefadems, &fadeinms))
return;
#endif

View file

@ -50,7 +50,7 @@
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="&quot;$(ProjectDir)..\..\libs\libpng-src&quot;;&quot;$(ProjectDir)..\..\libs\zlib&quot;"
PreprocessorDefinitions="_DEBUG;USE_WGL_SWAP;DIRECTFULLSCREEN;HAVE_SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;USEASM;HAVE_PNG;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE"
PreprocessorDefinitions="_DEBUG;USE_WGL_SWAP;DIRECTFULLSCREEN;HAVE_SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;USEASM;HAVE_PNG;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
@ -145,7 +145,7 @@
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="&quot;$(ProjectDir)..\..\libs\libpng-src&quot;;&quot;$(ProjectDir)..\..\libs\zlib&quot;"
PreprocessorDefinitions="_DEBUG;USE_WGL_SWAP;DIRECTFULLSCREEN;HAVE_SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;HAVE_PNG;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE"
PreprocessorDefinitions="_DEBUG;USE_WGL_SWAP;DIRECTFULLSCREEN;HAVE_SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;HAVE_PNG;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
@ -248,7 +248,7 @@
FavorSizeOrSpeed="1"
OmitFramePointers="true"
AdditionalIncludeDirectories="&quot;$(ProjectDir)..\..\libs\libpng-src&quot;;&quot;$(ProjectDir)..\..\libs\zlib&quot;"
PreprocessorDefinitions="NDEBUG;SDLMAIN;NO_STDIO_REDIRECT;USE_WGL_SWAP;DIRECTFULLSCREEN;HAVE_SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;USEASM;HAVE_PNG;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE"
PreprocessorDefinitions="NDEBUG;SDLMAIN;NO_STDIO_REDIRECT;USE_WGL_SWAP;DIRECTFULLSCREEN;HAVE_SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;USEASM;HAVE_PNG;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE"
StringPooling="true"
RuntimeLibrary="0"
PrecompiledHeaderFile=".\..\..\objs\VC9\$(Platform)\$(Configuration)\SDL\Srb2SDL-vc9.pch"
@ -350,7 +350,7 @@
FavorSizeOrSpeed="1"
OmitFramePointers="true"
AdditionalIncludeDirectories="&quot;$(ProjectDir)..\..\libs\libpng-src&quot;;&quot;$(ProjectDir)..\..\libs\zlib&quot;"
PreprocessorDefinitions="NDEBUG;SDLMAIN;NO_STDIO_REDIRECT;USE_WGL_SWAP;DIRECTFULLSCREEN;HAVE_SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;HAVE_PNG;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE"
PreprocessorDefinitions="NDEBUG;SDLMAIN;NO_STDIO_REDIRECT;USE_WGL_SWAP;DIRECTFULLSCREEN;HAVE_SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;HAVE_PNG;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE"
StringPooling="true"
RuntimeLibrary="0"
PrecompiledHeaderFile=".\..\..\objs\VC9\$(Platform)\$(Configuration)\SDL\Srb2SDL-vc9.pch"

View file

@ -1272,7 +1272,6 @@
HAVE_SDL,
HAVE_MIXER,
HAVE_PNG,
HAVE_BLUA,
LUA_USE_POSIX,
COMPVERSION,
HWRENDER,
@ -1395,7 +1394,6 @@
HAVE_SDL,
HAVE_MIXER,
HAVE_PNG,
HAVE_BLUA,
LUA_USE_POSIX,
COMPVERSION,
HWRENDER,

View file

@ -42,9 +42,7 @@
#include "hardware/hw_main.h"
#endif
#ifdef HAVE_BLUA
#include "lua_hud.h"
#endif
UINT16 objectsdrawn = 0;
@ -969,11 +967,7 @@ static void ST_drawLivesArea(void)
V_DrawThinString(hudinfo[HUD_LIVES].x+18, hudinfo[HUD_LIVES].y, v_colmap, skins[stplyr->skin].hudname);
// Power Stones collected
if (G_RingSlingerGametype()
#ifdef HAVE_BLUA
&& LUA_HudEnabled(hud_powerstones)
#endif
)
if (G_RingSlingerGametype() && LUA_HudEnabled(hud_powerstones))
{
INT32 workx = hudinfo[HUD_LIVES].x+1, j;
if ((leveltime & 1) && stplyr->powers[pw_invulnerability] && (stplyr->powers[pw_sneakers] == stplyr->powers[pw_invulnerability])) // hack; extremely unlikely to be activated unintentionally
@ -1341,17 +1335,11 @@ void ST_drawTitleCard(void)
if (!G_IsTitleCardAvailable())
return;
#ifdef HAVE_BLUA
if (!LUA_HudEnabled(hud_stagetitle))
goto luahook;
#endif
if (lt_ticker >= (lt_endtime + TICRATE))
#ifdef HAVE_BLUA
goto luahook;
#else
return;
#endif
if ((lt_ticker-lt_lasttic) > 1)
lt_ticker = lt_lasttic+1;
@ -1396,10 +1384,8 @@ void ST_drawTitleCard(void)
lt_lasttic = lt_ticker;
#ifdef HAVE_BLUA
luahook:
LUAh_TitleCardHUD(stplyr);
#endif
}
//
@ -1444,7 +1430,7 @@ static void ST_drawPowerupHUD(void)
if (stplyr->spectator || stplyr->playerstate != PST_LIVE)
return;
// ---------
// Finish icon
// ---------
@ -1785,11 +1771,7 @@ static void ST_drawNiGHTSHUD(void)
const boolean oldspecialstage = (G_IsSpecialStage(gamemap) && !(maptol & TOL_NIGHTS));
// Drill meter
if (
#ifdef HAVE_BLUA
LUA_HudEnabled(hud_nightsdrill) &&
#endif
stplyr->powers[pw_carry] == CR_NIGHTSMODE)
if (LUA_HudEnabled(hud_nightsdrill) && stplyr->powers[pw_carry] == CR_NIGHTSMODE)
{
INT32 locx = 16, locy = 180;
INT32 dfill;
@ -1831,9 +1813,7 @@ static void ST_drawNiGHTSHUD(void)
if (!oldspecialstage
// Don't display when the score is showing (it popping up for a split second when exiting a map is intentional)
&& !(stplyr->texttimer && stplyr->textvar == 4)
#ifdef HAVE_BLUA
&& LUA_HudEnabled(hud_nightslink)
#endif
&& ((cv_debug & DBG_NIGHTSBASIC) || stplyr->linkcount > 1)) // When debugging, show "0 Link".
{
ST_drawNiGHTSLink();
@ -1847,10 +1827,8 @@ static void ST_drawNiGHTSHUD(void)
}
// Begin drawing brackets/chip display
#ifdef HAVE_BLUA
if (LUA_HudEnabled(hud_nightsspheres))
{
#endif
ST_DrawTopLeftOverlayPatch(16, 8, nbracket);
if (G_IsSpecialStage(gamemap))
ST_DrawTopLeftOverlayPatch(24, 16, (
@ -1987,24 +1965,14 @@ static void ST_drawNiGHTSHUD(void)
V_DrawTallNum((total_spherecount >= 1000) ? 76 : 72, 8 + 11, V_PERPLAYER|V_SNAPTOTOP|V_SNAPTOLEFT|V_HUDTRANS, total_spherecount);
else
V_DrawTallNum(68, 8 + 11, V_PERPLAYER|V_SNAPTOTOP|V_SNAPTOLEFT|V_HUDTRANS, total_spherecount);
#ifdef HAVE_BLUA
}
#endif
// Score
if (!stplyr->exiting && !oldspecialstage
#ifdef HAVE_BLUA
&& LUA_HudEnabled(hud_nightsscore)
#endif
)
if (!stplyr->exiting && !oldspecialstage && LUA_HudEnabled(hud_nightsscore))
ST_DrawNightsOverlayNum(304<<FRACBITS, 14<<FRACBITS, FRACUNIT, V_PERPLAYER|V_SNAPTOTOP|V_SNAPTORIGHT, stplyr->marescore, nightsnum, SKINCOLOR_AZURE);
if (!stplyr->exiting
#ifdef HAVE_BLUA
// TODO give this its own section for Lua
&& LUA_HudEnabled(hud_nightsscore)
#endif
)
if (!stplyr->exiting && LUA_HudEnabled(hud_nightsscore))
{
if (modeattacking == ATTACKING_NIGHTS)
{
@ -2027,11 +1995,7 @@ static void ST_drawNiGHTSHUD(void)
}
// Ideya time remaining
if (!stplyr->exiting && stplyr->nightstime > 0
#ifdef HAVE_BLUA
&& LUA_HudEnabled(hud_nightstime)
#endif
)
if (!stplyr->exiting && stplyr->nightstime > 0 && LUA_HudEnabled(hud_nightstime))
{
INT32 realnightstime = stplyr->nightstime/TICRATE;
INT32 numbersize;
@ -2122,10 +2086,8 @@ static void ST_drawNiGHTSHUD(void)
}
// Records/extra text
#ifdef HAVE_BLUA
if (LUA_HudEnabled(hud_nightsrecords))
#endif
ST_drawNightsRecords();
ST_drawNightsRecords();
}
}
@ -2403,20 +2365,16 @@ static void ST_drawTeamHUD(void)
else
p = bmatcico;
#ifdef HAVE_BLUA
if (LUA_HudEnabled(hud_teamscores))
#endif
V_DrawSmallScaledPatch(BASEVIDWIDTH/2 - SEP - SHORT(p->width)/4, 4, V_HUDTRANS|V_PERPLAYER|V_SNAPTOTOP, p);
V_DrawSmallScaledPatch(BASEVIDWIDTH/2 - SEP - SHORT(p->width)/4, 4, V_HUDTRANS|V_PERPLAYER|V_SNAPTOTOP, p);
if (gametyperules & GTR_TEAMFLAGS)
p = rflagico;
else
p = rmatcico;
#ifdef HAVE_BLUA
if (LUA_HudEnabled(hud_teamscores))
#endif
V_DrawSmallScaledPatch(BASEVIDWIDTH/2 + SEP - SHORT(p->width)/4, 4, V_HUDTRANS|V_PERPLAYER|V_SNAPTOTOP, p);
V_DrawSmallScaledPatch(BASEVIDWIDTH/2 + SEP - SHORT(p->width)/4, 4, V_HUDTRANS|V_PERPLAYER|V_SNAPTOTOP, p);
if (!(gametyperules & GTR_TEAMFLAGS))
goto num;
@ -2427,18 +2385,12 @@ static void ST_drawTeamHUD(void)
// Show which flags aren't at base.
for (i = 0; i < MAXPLAYERS; i++)
{
if (players[i].gotflag & GF_BLUEFLAG // Blue flag isn't at base
#ifdef HAVE_BLUA
&& LUA_HudEnabled(hud_teamscores)
#endif
)
// Blue flag isn't at base
if (players[i].gotflag & GF_BLUEFLAG && LUA_HudEnabled(hud_teamscores))
V_DrawScaledPatch(BASEVIDWIDTH/2 - SEP - SHORT(nonicon->width)/2, 0, V_HUDTRANS|V_PERPLAYER|V_SNAPTOTOP, nonicon);
if (players[i].gotflag & GF_REDFLAG // Red flag isn't at base
#ifdef HAVE_BLUA
&& LUA_HudEnabled(hud_teamscores)
#endif
)
// Red flag isn't at base
if (players[i].gotflag & GF_REDFLAG && LUA_HudEnabled(hud_teamscores))
V_DrawScaledPatch(BASEVIDWIDTH/2 + SEP - SHORT(nonicon2->width)/2, 0, V_HUDTRANS|V_PERPLAYER|V_SNAPTOTOP, nonicon2);
whichflag |= players[i].gotflag;
@ -2449,32 +2401,20 @@ static void ST_drawTeamHUD(void)
// Display a countdown timer showing how much time left until the flag returns to base.
{
if (blueflag && blueflag->fuse > 1
#ifdef HAVE_BLUA
&& LUA_HudEnabled(hud_teamscores)
#endif
)
if (blueflag && blueflag->fuse > 1 && LUA_HudEnabled(hud_teamscores))
V_DrawCenteredString(BASEVIDWIDTH/2 - SEP, 8, V_YELLOWMAP|V_HUDTRANS|V_PERPLAYER|V_SNAPTOTOP, va("%u", (blueflag->fuse / TICRATE)));
if (redflag && redflag->fuse > 1
#ifdef HAVE_BLUA
&& LUA_HudEnabled(hud_teamscores)
#endif
)
if (redflag && redflag->fuse > 1 && LUA_HudEnabled(hud_teamscores))
V_DrawCenteredString(BASEVIDWIDTH/2 + SEP, 8, V_YELLOWMAP|V_HUDTRANS|V_PERPLAYER|V_SNAPTOTOP, va("%u", (redflag->fuse / TICRATE)));
}
}
num:
#ifdef HAVE_BLUA
if (LUA_HudEnabled(hud_teamscores))
#endif
V_DrawCenteredString(BASEVIDWIDTH/2 - SEP, 16, V_HUDTRANS|V_PERPLAYER|V_SNAPTOTOP, va("%u", bluescore));
V_DrawCenteredString(BASEVIDWIDTH/2 - SEP, 16, V_HUDTRANS|V_PERPLAYER|V_SNAPTOTOP, va("%u", bluescore));
#ifdef HAVE_BLUA
if (LUA_HudEnabled(hud_teamscores))
#endif
V_DrawCenteredString(BASEVIDWIDTH/2 + SEP, 16, V_HUDTRANS|V_PERPLAYER|V_SNAPTOTOP, va("%u", redscore));
V_DrawCenteredString(BASEVIDWIDTH/2 + SEP, 16, V_HUDTRANS|V_PERPLAYER|V_SNAPTOTOP, va("%u", redscore));
#undef SEP
}
@ -2661,24 +2601,14 @@ static void ST_overlayDrawer(void)
ST_drawNiGHTSHUD();
else
{
#ifdef HAVE_BLUA
if (LUA_HudEnabled(hud_score))
#endif
ST_drawScore();
#ifdef HAVE_BLUA
ST_drawScore();
if (LUA_HudEnabled(hud_time))
#endif
ST_drawTime();
#ifdef HAVE_BLUA
ST_drawTime();
if (LUA_HudEnabled(hud_rings))
#endif
ST_drawRings();
ST_drawRings();
if (!modeattacking
#ifdef HAVE_BLUA
&& LUA_HudEnabled(hud_lives)
#endif
)
if (!modeattacking && LUA_HudEnabled(hud_lives))
ST_drawLivesArea();
}
}
@ -2753,11 +2683,7 @@ static void ST_overlayDrawer(void)
// Draw Match-related stuff
//\note Match HUD is drawn no matter what gametype.
// ... just not if you're a spectator.
if (!stplyr->spectator
#ifdef HAVE_BLUA
&& (LUA_HudEnabled(hud_weaponrings))
#endif
)
if (!stplyr->spectator && LUA_HudEnabled(hud_weaponrings))
ST_drawMatchHUD();
// Race HUD Stuff
@ -2798,20 +2724,14 @@ static void ST_overlayDrawer(void)
else if (!(netgame || multiplayer) && cv_powerupdisplay.value == 2)
ST_drawPowerupHUD(); // same as it ever was...
#ifdef HAVE_BLUA
if (!(netgame || multiplayer) || !hu_showscores)
LUAh_GameHUD(stplyr);
#endif
// draw level title Tails
if (stagetitle && (!WipeInAction) && (!WipeStageTitle))
ST_drawTitleCard();
if (!hu_showscores && (netgame || multiplayer)
#ifdef HAVE_BLUA
&& LUA_HudEnabled(hud_textspectator)
#endif
)
if (!hu_showscores && (netgame || multiplayer) && LUA_HudEnabled(hud_textspectator))
ST_drawTextHUD();
if (modeattacking && !(demoplayback && hu_showscores))

View file

@ -189,7 +189,7 @@ FILE *W_OpenWadFile(const char **filename, boolean useerrors)
static inline void W_LoadDehackedLumpsPK3(UINT16 wadnum, boolean mainfile)
{
UINT16 posStart, posEnd;
#ifdef HAVE_BLUA
posStart = W_CheckNumForFolderStartPK3("Lua/", wadnum, 0);
if (posStart != INT16_MAX)
{
@ -198,7 +198,7 @@ static inline void W_LoadDehackedLumpsPK3(UINT16 wadnum, boolean mainfile)
for (; posStart < posEnd; posStart++)
LUA_LoadLump(wadnum, posStart);
}
#endif
posStart = W_CheckNumForFolderStartPK3("SOC/", wadnum, 0);
if (posStart != INT16_MAX)
{
@ -224,7 +224,6 @@ static inline void W_LoadDehackedLumps(UINT16 wadnum, boolean mainfile)
{
UINT16 lump;
#ifdef HAVE_BLUA
// Find Lua scripts before SOCs to allow new A_Actions in SOC editing.
{
lumpinfo_t *lump_p = wadfiles[wadnum]->lumpinfo;
@ -232,7 +231,6 @@ static inline void W_LoadDehackedLumps(UINT16 wadnum, boolean mainfile)
if (memcmp(lump_p->name,"LUA_",4)==0)
LUA_LoadLump(wadnum, lump);
}
#endif
{
lumpinfo_t *lump_p = wadfiles[wadnum]->lumpinfo;
@ -749,11 +747,9 @@ UINT16 W_InitFile(const char *filename, boolean mainfile, boolean startup)
case RET_SOC:
lumpinfo = ResGetLumpsStandalone(handle, &numlumps, "OBJCTCFG");
break;
#ifdef HAVE_BLUA
case RET_LUA:
lumpinfo = ResGetLumpsStandalone(handle, &numlumps, "LUA_INIT");
break;
#endif
case RET_PK3:
lumpinfo = ResGetLumpsZip(handle, &numlumps);
break;
@ -818,11 +814,9 @@ UINT16 W_InitFile(const char *filename, boolean mainfile, boolean startup)
CONS_Printf(M_GetText("Loading SOC from %s\n"), wadfile->filename);
DEH_LoadDehackedLumpPwad(numwadfiles - 1, 0, mainfile);
break;
#ifdef HAVE_BLUA
case RET_LUA:
LUA_LoadLump(numwadfiles - 1, 0);
break;
#endif
default:
break;
}
@ -1860,10 +1854,7 @@ static int W_VerifyFile(const char *filename, lumpchecklist_t *checklist,
{
// detect wad file by the absence of the other supported extensions
if (stricmp(&filename[strlen(filename) - 4], ".soc")
#ifdef HAVE_BLUA
&& stricmp(&filename[strlen(filename) - 4], ".lua")
#endif
)
&& stricmp(&filename[strlen(filename) - 4], ".lua"))
{
goodfile = W_VerifyWAD(handle, checklist, status);
}

View file

@ -55,7 +55,7 @@
Optimization="0"
OmitFramePointers="false"
AdditionalIncludeDirectories="&quot;$(ProjectDir)..\..\libs\libpng-src&quot;;&quot;$(ProjectDir)..\..\libs\zlib&quot;"
PreprocessorDefinitions="_DEBUG;_WINDOWS;USEASM;HAVE_PNG;COMPVERSION;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE"
PreprocessorDefinitions="_DEBUG;_WINDOWS;USEASM;HAVE_PNG;COMPVERSION;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE"
MinimalRebuild="true"
RuntimeLibrary="1"
EnableFunctionLevelLinking="true"
@ -153,7 +153,7 @@
Optimization="0"
OmitFramePointers="false"
AdditionalIncludeDirectories="&quot;$(ProjectDir)..\..\libs\libpng-src&quot;;&quot;$(ProjectDir)..\..\libs\zlib&quot;"
PreprocessorDefinitions="_DEBUG;_WINDOWS;HAVE_PNG;COMPVERSION;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE"
PreprocessorDefinitions="_DEBUG;_WINDOWS;HAVE_PNG;COMPVERSION;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
SmallerTypeCheck="true"
@ -256,7 +256,7 @@
FavorSizeOrSpeed="1"
OmitFramePointers="true"
AdditionalIncludeDirectories="&quot;$(ProjectDir)..\..\libs\libpng-src&quot;;&quot;$(ProjectDir)..\..\libs\zlib&quot;"
PreprocessorDefinitions="NDEBUG;_WINDOWS;USEASM;HAVE_PNG;COMPVERSION;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE"
PreprocessorDefinitions="NDEBUG;_WINDOWS;USEASM;HAVE_PNG;COMPVERSION;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE"
StringPooling="true"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
@ -356,7 +356,7 @@
FavorSizeOrSpeed="1"
OmitFramePointers="true"
AdditionalIncludeDirectories="&quot;$(ProjectDir)..\..\libs\libpng-src&quot;;&quot;$(ProjectDir)..\..\libs\zlib&quot;"
PreprocessorDefinitions="NDEBUG;_WINDOWS;HAVE_PNG;COMPVERSION;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE"
PreprocessorDefinitions="NDEBUG;_WINDOWS;HAVE_PNG;COMPVERSION;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE"
StringPooling="true"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"

View file

@ -37,9 +37,7 @@
#include "m_cond.h" // condition sets
#include "lua_hook.h" // IntermissionThinker hook
#ifdef HAVE_BLUA
#include "lua_hud.h"
#endif
#ifdef HWRENDER
#include "hardware/hw_main.h"
@ -330,9 +328,7 @@ void Y_IntermissionDrawer(void)
if (intertype == int_none)
{
#ifdef HAVE_BLUA
LUAh_IntermissionHUD();
#endif
return;
}
@ -384,11 +380,9 @@ void Y_IntermissionDrawer(void)
else
V_DrawPatchFill(bgtile);
#ifdef HAVE_BLUA
LUAh_IntermissionHUD();
if (!LUA_HudEnabled(hud_intermissiontally))
goto skiptallydrawer;
#endif
dontdrawbg:
if (intertype == int_coop)
@ -944,11 +938,9 @@ dontdrawbg:
}
}
#ifdef HAVE_BLUA
skiptallydrawer:
if (!LUA_HudEnabled(hud_intermissionmessages))
return;
#endif
if (timer)
V_DrawCenteredString(BASEVIDWIDTH/2, 188, V_YELLOWMAP,
@ -973,9 +965,7 @@ void Y_Ticker(void)
if (paused || P_AutoPause())
return;
#ifdef HAVE_BLUA
LUAh_IntermissionThinker();
#endif
intertic++;

View file

@ -217,11 +217,9 @@ void Z_Free(void *ptr)
CONS_Debug(DBG_MEMORY, "Z_Free at %s:%d\n", file, line);
#endif
#ifdef HAVE_BLUA
// anything that isn't by lua gets passed to lua just in case.
if (block->tag != PU_LUA)
LUA_InvalidateUserdata(ptr);
#endif
// TODO: if zdebugging, make sure no other block has a user
// that is about to be freed.