Merge branch 'Saturn-Next' into nametags

This commit is contained in:
Alug committed 2024-02-28 22:09:07 +01:00
commit 29ffb4200e
78 files changed
+760 -9174

No files matched your search

-1
View File
@@ -466,7 +466,6 @@ if(${SRB2_CONFIG_HWRENDER})
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md2load.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md3load.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_model.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_trick.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/u_list.c
)
+3 -5
View File
@@ -272,7 +272,7 @@ ifdef NOHW
else
OPTS+=-DHWRENDER
OBJS+=$(OBJDIR)/hw_bsp.o $(OBJDIR)/hw_draw.o $(OBJDIR)/hw_light.o \
$(OBJDIR)/hw_main.o $(OBJDIR)/hw_clip.o $(OBJDIR)/hw_md2.o $(OBJDIR)/hw_cache.o $(OBJDIR)/hw_trick.o \
$(OBJDIR)/hw_main.o $(OBJDIR)/hw_clip.o $(OBJDIR)/hw_md2.o $(OBJDIR)/hw_cache.o \
$(OBJDIR)/hw_md2load.o $(OBJDIR)/hw_md3load.o $(OBJDIR)/hw_model.o $(OBJDIR)/u_list.o $(OBJDIR)/hw_batching.o $(OBJDIR)/hw_shaders.o
endif
@@ -389,9 +389,7 @@ CFLAGS+=-DHAVE_DISCORDRPC -DUSE_STUN
OBJS+=$(OBJDIR)/discord.o $(OBJDIR)/stun.o
endif
ifndef NO_LUA
include blua/Makefile.cfg
endif
ifdef NOMD5
OPTS+=-DNOMD5
@@ -721,9 +719,9 @@ $(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"
-4
View File
@@ -35,11 +35,9 @@ static inline void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cm
if (!sonic || sonic->health <= 0)
return;
#ifdef HAVE_BLUA
// Lua can handle it!
if (LUAh_BotAI(sonic, tails, cmd))
return;
#endif
if (tails->player->pflags & (PF_MACESPIN|PF_ITEMHANG))
{
@@ -123,11 +121,9 @@ void B_BuildTiccmd(player_t *player, ticcmd_t *cmd)
// Bot AI isn't programmed in analog.
//CV_SetValue(&cv_analog2, 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)
-2
View File
@@ -10,8 +10,6 @@ WFLAGS+=-Wno-logical-op
endif
endif
OPTS+=-DHAVE_BLUA
OBJS:=$(OBJS) \
$(OBJDIR)/lapi.o \
$(OBJDIR)/lbaselib.o \
+2 -17
View File
@@ -459,13 +459,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;
@@ -479,7 +477,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.
*
@@ -512,7 +509,6 @@ int COM_AddLuaCommand(const char *name)
com_commands = cmd;
return 0;
}
#endif
/** Tests if a command exists.
*
@@ -1445,17 +1441,6 @@ found:
var->value = atoi(var->string);
finish:
// See the note above.
/* if (var->flags & CV_CHEAT)
{
boolean newcheats = CV_CheatsEnabled();
if (!prevcheats && newcheats)
CONS_Printf(M_GetText("Cheats have been enabled.\n"));
else if (prevcheats && !newcheats)
CONS_Printf(M_GetText("Cheats have been disabled.\n"));
} */
if (var->flags & CV_SHOWMODIFONETIME || var->flags & CV_SHOWMODIF)
{
CONS_Printf(M_GetText("%s set to %s\n"), var->name, var->string);
@@ -1466,10 +1451,10 @@ finish:
DEBFILE(va("%s set to %s\n", var->name, var->string));
}
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();
+14 -17
View File
@@ -66,8 +66,8 @@ static INT32 con_curlines; // vid lines currently used by console
INT32 con_clipviewtop; // (useless)
static INT32 con_hudlines; // number of console heads up message lines
static INT32 con_hudtime[MAXHUDLINES]; // remaining time of display for hud msg lines
static UINT8 con_hudlines; // number of console heads up message lines
static UINT32 con_hudtime[MAXHUDLINES]; // remaining time of display for hud msg lines
INT32 con_clearlines; // top screen lines to refresh when view reduced
boolean con_hudupdate; // when messages scroll, we need a backgrnd refresh
@@ -117,11 +117,13 @@ static void CONS_backcolor_Change(void);
static char con_buffer[CON_BUFFERSIZE];
// how many seconds the hud messages lasts on the screen
static consvar_t cons_msgtimeout = {"con_hudtime", "5", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL};
// CV_Unsigned can overflow when multiplied by TICRATE later, so let's use a 3-year limit instead
static CV_PossibleValue_t hudtime_cons_t[] = {{0, "MIN"}, {99999999, "MAX"}, {0, NULL}};
static consvar_t cons_hudtime = {"con_hudtime", "5", CV_SAVE, hudtime_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
// number of lines displayed on the HUD
static consvar_t cons_hudlines = {"con_hudlines", "5", CV_CALL|CV_SAVE, CV_Unsigned, CONS_hudlines_Change, 0, NULL, NULL, 0, 0, NULL};
static CV_PossibleValue_t hudlines_cons_t[] = {{0, "MIN"}, {MAXHUDLINES, "MAX"}, {0, NULL}};
static consvar_t cons_hudlines = {"con_hudlines", "5", CV_CALL|CV_SAVE, hudlines_cons_t, CONS_hudlines_Change, 0, NULL, NULL, 0, 0, NULL};
// number of lines console move per frame
// (con_speed needs a limit, apparently)
@@ -181,11 +183,6 @@ static void CONS_hudlines_Change(void)
for (i = 0; i < con_hudlines; i++)
con_hudtime[i] = 0;
if (cons_hudlines.value < 1)
cons_hudlines.value = 1;
else if (cons_hudlines.value > MAXHUDLINES)
cons_hudlines.value = MAXHUDLINES;
con_hudlines = cons_hudlines.value;
Unlock_state();
@@ -426,7 +423,7 @@ void CON_Init(void)
Unlock_state();
CV_RegisterVar(&cons_msgtimeout);
CV_RegisterVar(&cons_hudtime);
CV_RegisterVar(&cons_hudlines);
CV_RegisterVar(&cons_speed);
CV_RegisterVar(&cons_height);
@@ -743,9 +740,8 @@ void CON_Ticker(void)
// make overlay messages disappear after a while
for (i = 0; i < con_hudlines; i++)
{
con_hudtime[i]--;
if (con_hudtime[i] < 0)
con_hudtime[i] = 0;
if (con_hudtime[i])
con_hudtime[i]--;
}
Unlock_state();
@@ -1244,7 +1240,8 @@ boolean CON_Responder(event_t *ev)
static void CON_Linefeed(void)
{
// set time for heads up messages
con_hudtime[con_cy%con_hudlines] = cons_msgtimeout.value*TICRATE;
if (con_hudlines)
con_hudtime[con_cy%con_hudlines] = cons_hudtime.value*TICRATE;
con_cy++;
con_cx = 0;
@@ -1600,7 +1597,7 @@ static void CON_DrawHudlines(void)
INT32 charwidth = 8 * con_scalefactor;
INT32 charheight = 8 * con_scalefactor;
if (con_hudlines <= 0)
if (!con_hudlines)
return;
if (chat_on && OLDCHAT)
@@ -1608,7 +1605,7 @@ static void CON_DrawHudlines(void)
else
y = 0;
for (i = con_cy - con_hudlines+1; i <= con_cy; i++)
for (i = con_cy - con_hudlines; i <= con_cy; i++)
{
size_t c;
INT32 x;
+1 -13
View File
@@ -3186,11 +3186,7 @@ void CL_RemovePlayer(INT32 playernum, INT32 reason)
}
}
#ifdef HAVE_BLUA
LUAh_PlayerQuit(&players[playernum], reason); // Lua hook for player quitting
#else
(void)reason;
#endif
// Reset player data
CL_ClearPlayer(playernum);
@@ -3214,13 +3210,9 @@ void CL_RemovePlayer(INT32 playernum, INT32 reason)
if (playernum == displayplayers[0] && !demo.playback)
displayplayers[0] = consoleplayer; // don't look through someone's view who isn't there
#ifdef HAVE_BLUA
LUA_InvalidatePlayer(&players[playernum]);
#endif
/*if (G_TagGametype()) //Check if you still have a game. Location flexible. =P
P_CheckSurvivors();
else*/ if (G_BattleGametype()) // SRB2Kart
if (G_BattleGametype()) // SRB2Kart
K_CheckBumpers();
else if (G_RaceGametype())
P_CheckRacers();
@@ -4097,9 +4089,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;
sprintf(player_names[i], "Player %d", i + 1);
@@ -4285,9 +4275,7 @@ 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
LUAh_PlayerJoin(newplayernum);
#endif
#ifdef HAVE_DISCORDRPC
DRPC_UpdatePresence();
+2 -6
View File
@@ -70,6 +70,8 @@
#include "d_protocol.h"
#include "m_perfstats.h"
#include "lua_script.h"
#ifdef CMAKECONFIG
#include "config.h"
#else
@@ -84,10 +86,6 @@
#include "hardware/hw3sound.h"
#endif
#ifdef HAVE_BLUA
#include "lua_script.h"
#endif
#ifdef HAVE_DISCORDRPC
#include "discord.h"
#endif
@@ -771,9 +769,7 @@ void D_SRB2Loop(void)
HW3S_EndFrameUpdate();
#endif
#ifdef HAVE_BLUA
LUA_Step();
#endif
#ifdef HAVE_DISCORDRPC
if (! dedicated)
+5 -107
View File
@@ -73,9 +73,6 @@ static void Got_SetupVotecmd(UINT8 **cp, INT32 playernum);
static void Got_ModifyVotecmd(UINT8 **cp, INT32 playernum);
static void Got_PickVotecmd(UINT8 **cp, INT32 playernum);
static void Got_RequestAddfilecmd(UINT8 **cp, INT32 playernum);
#ifdef DELFILE
static void Got_Delfilecmd(UINT8 **cp, INT32 playernum);
#endif
static void Got_Addfilecmd(UINT8 **cp, INT32 playernum);
static void Got_Pause(UINT8 **cp, INT32 playernum);
static void Got_Respawn(UINT8 **cp, INT32 playernum);
@@ -144,9 +141,6 @@ static void Command_Addfile(void);
static void Command_Addskins(void);
static void Command_GLocalSkin(void);
static void Command_ListWADS_f(void);
#ifdef DELFILE
static void Command_Delfile(void);
#endif
static void Command_RunSOC(void);
static void Command_Pause(void);
static void Command_Respawn(void);
@@ -199,10 +193,8 @@ static void Command_SkinSearch(void);
#ifdef _DEBUG
static void Command_Togglemodified_f(void);
#ifdef HAVE_BLUA
static void Command_Archivetest_f(void);
#endif
#endif
// =========================================================================
// CLIENT VARIABLES
@@ -601,7 +593,7 @@ const char *netxcmdnames[MAXNETXCMD - 1] =
"RANDOMSEED",
"RUNSOC",
"REQADDFILE",
"DELFILE",
"DELFILE", // sigh well this prob needs to be still here to not screw up maxnetxcmd
"SETMOTD",
"RESPAWN",
"DEMOTED",
@@ -609,10 +601,8 @@ const char *netxcmdnames[MAXNETXCMD - 1] =
"MODIFYVOTE",
"PICKVOTE",
"REMOVEPLAYER",
#ifdef HAVE_BLUA
"LUACMD",
"LUAVAR"
#endif
};
// =========================================================================
@@ -650,15 +640,10 @@ void D_RegisterServerCommands(void)
RegisterNetXCmd(XD_EXITLEVEL, Got_ExitLevelcmd);
RegisterNetXCmd(XD_ADDFILE, Got_Addfilecmd);
RegisterNetXCmd(XD_REQADDFILE, Got_RequestAddfilecmd);
#ifdef DELFILE
RegisterNetXCmd(XD_DELFILE, Got_Delfilecmd);
#endif
RegisterNetXCmd(XD_PAUSE, Got_Pause);
RegisterNetXCmd(XD_RESPAWN, Got_Respawn);
RegisterNetXCmd(XD_RUNSOC, Got_RunSOCcmd);
#ifdef HAVE_BLUA
RegisterNetXCmd(XD_LUACMD, Got_Luacmd);
#endif
RegisterNetXCmd(XD_SETUPVOTE, Got_SetupVotecmd);
RegisterNetXCmd(XD_MODIFYVOTE, Got_ModifyVotecmd);
@@ -695,9 +680,6 @@ void D_RegisterServerCommands(void)
COM_AddCommand("localskin", Command_GLocalSkin);
COM_AddCommand("listwad", Command_ListWADS_f);
#ifdef DELFILE
COM_AddCommand("delfile", Command_Delfile);
#endif
COM_AddCommand("runsoc", Command_RunSOC);
COM_AddCommand("pause", Command_Pause);
COM_AddCommand("respawn", Command_Respawn);
@@ -718,9 +700,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
COM_AddCommand("replaymarker", Command_ReplayMarker);
@@ -760,19 +740,6 @@ void D_RegisterServerCommands(void)
CV_RegisterVar(&cv_competitionboxes);
CV_RegisterVar(&cv_matchboxes);
/*CV_RegisterVar(&cv_recycler);
CV_RegisterVar(&cv_teleporters);
CV_RegisterVar(&cv_superring);
CV_RegisterVar(&cv_supersneakers);
CV_RegisterVar(&cv_invincibility);
CV_RegisterVar(&cv_jumpshield);
CV_RegisterVar(&cv_watershield);
CV_RegisterVar(&cv_ringshield);
CV_RegisterVar(&cv_forceshield);
CV_RegisterVar(&cv_bombshield);
CV_RegisterVar(&cv_1up);
CV_RegisterVar(&cv_eggmanbox);*/
K_RegisterKartStuff(); // SRB2kart
CV_RegisterVar(&cv_ringslinger);
@@ -1190,7 +1157,7 @@ void D_RegisterClientCommands(void)
#ifdef _DEBUG
COM_AddCommand("causecfail", Command_CauseCfail_f);
#endif
#if defined(HAVE_BLUA) && defined(LUA_ALLOW_BYTECODE)
#if defined(LUA_ALLOW_BYTECODE)
COM_AddCommand("dumplua", Command_Dumplua_f);
#endif
@@ -2958,9 +2925,7 @@ static void Got_Mapcmd(UINT8 **cp, INT32 playernum)
INT32 resetplayer = 1, lastgametype;
UINT8 skipprecutscene, FLS;
boolean pencoremode;
/*#ifdef HAVE_BLUA
INT16 mapnumber;
#endif*/
//INT16 mapnumber;
forceresetplayers = deferencoremode = false;
@@ -3026,10 +2991,8 @@ static void Got_Mapcmd(UINT8 **cp, INT32 playernum)
if (modeattacking) // i remember moving this here in internal fixed a heisenbug so
SetPlayerSkinByNum(0, cv_chooseskin.value-1);
/*#ifdef HAVE_BLUA
mapnumber = M_MapNumber(mapname[3], mapname[4]);
LUAh_MapChange(mapnumber);
#endif*/
//mapnumber = M_MapNumber(mapname[3], mapname[4]);
//LUAh_MapChange(mapnumber);
demo.savemode = (cv_recordmultiplayerdemos.value == 2) ? DSM_WILLAUTOSAVE : DSM_NOTSAVING;
demo.savebutton = 0;
@@ -4788,42 +4751,6 @@ static void Command_GLocalSkin (void)
}
}
#ifdef DELFILE
/** removes the last added pwad at runtime.
* Searches for sounds, maps, music and images to remove
*/
static void Command_Delfile(void)
{
if (gamestate == GS_LEVEL)
{
CONS_Printf(M_GetText("You must NOT be in a level to use this.\n"));
return;
}
if (netgame && !(server || adminplayer == consoleplayer))
{
CONS_Printf(M_GetText("Only the server or a remote admin can use this.\n"));
return;
}
if (numwadfiles <= mainwads)
{
CONS_Printf(M_GetText("No additional WADs are loaded.\n"));
return;
}
if (!(netgame || multiplayer))
{
P_DelWadFile();
if (mainwads == numwadfiles && modifiedgame)
modifiedgame = false;
return;
}
SendNetXCmd(XD_DELFILE, NULL, 0);
}
#endif
static void Got_RequestAddfilecmd(UINT8 **cp, INT32 playernum)
{
char filename[241];
@@ -4892,33 +4819,6 @@ static void Got_RequestAddfilecmd(UINT8 **cp, INT32 playernum)
COM_BufAddText(va("addfile %s\n", filename));
}
#ifdef DELFILE
static void Got_Delfilecmd(UINT8 **cp, INT32 playernum)
{
if (playernum != serverplayer && playernum != adminplayer)
{
CONS_Alert(CONS_WARNING, M_GetText("Illegal delfile command received from %s\n"), player_names[playernum]);
if (server)
{
UINT8 buf[2];
buf[0] = (UINT8)playernum;
buf[1] = KICK_MSG_CON_FAIL;
SendNetXCmd(XD_KICK, &buf, 2);
}
return;
}
(void)cp;
if (numwadfiles <= mainwads) //sanity
return;
P_DelWadFile();
if (mainwads == numwadfiles && modifiedgame)
modifiedgame = false;
}
#endif
static void Got_Addfilecmd(UINT8 **cp, INT32 playernum)
{
char filename[241];
@@ -5833,7 +5733,6 @@ static void Command_Togglemodified_f(void)
modifiedgame = !modifiedgame;
}
#ifdef HAVE_BLUA
extern UINT8 *save_p;
static void Command_Archivetest_f(void)
{
@@ -5878,7 +5777,6 @@ static void Command_Archivetest_f(void)
CONS_Printf("Done. No crash.\n");
}
#endif
#endif
/** Makes a change to ::cv_forceskin take effect immediately.
*
-2
View File
@@ -248,10 +248,8 @@ typedef enum
XD_PICKVOTE, // 24
XD_REMOVEPLAYER,// 25
XD_DISCORD, // 26
#ifdef HAVE_BLUA
XD_LUACMD, // 27
XD_LUAVAR, // 28
#endif
MAXNETXCMD
} netxcmd_t;
+8 -674
View File
@@ -31,19 +31,19 @@
#include "r_data.h"
#include "r_patch.h"
#include "r_sky.h"
#include "r_draw.h" // translation colormap consts (for lua)
#include "fastcmp.h"
#include "lua_script.h"
#include "lua_glib.h"
#include "lua_hook.h"
#include "d_clisrv.h"
#include "v_video.h" // video flags (for lua)
#include "lua_script.h"
#include "lua_libs.h"
#include "m_cond.h"
#ifdef HAVE_BLUA
#include "v_video.h" // video flags (for lua)
#include "r_draw.h" // translation colormap consts (for lua)
#endif
#define REQUIRE_MATHLIB_GUID "{748fcbc8-6480-4013-ac4e-7afce6cab766}"
// Free slot names
@@ -67,104 +67,10 @@ static sfxenum_t get_sfx(const char *word);
static UINT16 get_mus(const char *word, UINT8 dehacked_mode);
#endif
static hudnum_t get_huditem(const char *word);
#ifndef HAVE_BLUA
static powertype_t get_power(const char *word);
#endif
boolean deh_loaded = false;
static int dbg_line;
#ifdef DELFILE
typedef struct undehacked_s
{
char *undata;
struct undehacked_s *next;
} undehacked_t;
static UINT16 unsocwad;
static undehacked_t *unsocdata[MAX_WADFILES];
static boolean disableundo = false;
void DEH_WriteUndoline(const char *value, const char *data, undotype_f flags)
{
const char *eqstr = " = ";
const char *space = " ";
const char *pader = eqstr;
undehacked_t *newdata;
if (disableundo || !unsocwad)
return;
if ((newdata = malloc(sizeof(*newdata))) == NULL)
I_Error("Out of memory for unsoc line");
if (flags & UNDO_SPACE)
pader = space;
if (flags & UNDO_ENDTEXT && !data)
data = space;
if (value)
{
const size_t plen = strlen(pader);
const char *pound = "#";
char *undata = NULL;
const size_t elen = strlen(pound);
size_t vlen = strlen(value), dlen = 0, len = 1;
if (*(value+vlen-1) == '\n')
vlen--; // lnet not copy the ending \n
if (flags & UNDO_ENDTEXT)
len += elen; // let malloc more space
if (flags & UNDO_NEWLINE)
len++; // more space for the beginning \n
if (data)
{
dlen = strlen(data);
if (flags & UNDO_CUTLINE && *(data+dlen-1) == '\n')
dlen--; // let not copy the ending \n
newdata->undata = malloc(vlen+plen+dlen+len);
newdata->undata[vlen+plen+dlen+len-1] = '\0';
}
else
{
newdata->undata = malloc(vlen+len);
newdata->undata[vlen+len-1] = '\0';
}
if (newdata->undata)
{
undata = newdata->undata;
*undata = '\0';
}
else
{
free(newdata);
I_Error("Out of memory for unsoc data");
}
if (flags & UNDO_NEWLINE) // let start with \n
strcat(undata, "\n");
strncat(undata, value, vlen);
if (data) // value+pader+data
strncat(strncat(undata, pader, plen), data, dlen);
if (flags & UNDO_ENDTEXT) // let end the text
strncat(undata, pound, elen);
}
else
newdata->undata = NULL;
newdata->next = unsocdata[unsocwad];
unsocdata[unsocwad] = newdata;
}
#endif
ATTRINLINE static FUNCINLINE char myfget_color(MYFILE *f)
{
char c = *f->curpos++;
@@ -361,56 +267,6 @@ static void clear_levels(void)
P_AllocMapHeader(gamemap-1);
}
/*
// Edits an animated texture slot on the array
// Tails 12-27-2003
static void readAnimTex(MYFILE *f, INT32 num)
{
char s[MAXLINELEN];
char *word;
char *word2;
INT32 i;
do {
if (myfgets(s, sizeof s, f) != NULL)
{
if (s[0] == '\n') break;
tmp = strchr(s, '#');
if (tmp)
*tmp = '\0';
// set the value in the appropriate field
word = strtok(s, " ");
if (word)
strupr(word);
else
break;
word2 = strtok(NULL, " = ");
if (word2)
strupr(word2);
else
break;
if (word2[strlen(word2)-1] == '\n')
word2[strlen(word2)-1] = '\0';
i = atoi(word2);
if (fastcmp(word, "START"))
strncpy(harddefs[num].startname, word2, 8);
if (fastcmp(word, "END"))
strncpy(harddefs[num].endname, word2, 8);
else if (fastcmp(word, "SPEED")) harddefs[num].speed = i;
else if (fastcmp(word, "ISTEXTURE")) harddefs[num].istexture = i;
else deh_warning("readAnimTex %d: unknown word '%s'", num, word);
}
} while (s[0] != '\n' && !myfeof(f)); //finish when the line is empty
}
*/
static boolean findFreeSlot(INT32 *num)
{
// Send the character select entry to a free slot.
@@ -502,29 +358,7 @@ static void readPlayer(MYFILE *f, INT32 num)
word2[strlen(word2)-1] = '\0';
i = atoi(word2);
/*if (fastcmp(word, "PLAYERNAME"))
{
if (!slotfound && (slotfound = findFreeSlot(&num)) == false)
goto done;
DEH_WriteUndoline(word, description[num].text, UNDO_NONE);
strlcpy(description[num].text, word2, sizeof (description[num].text));
for (word2 = description[num].text; *word2; word2++)
if (*word2 == '_')
*word2 = ' ';
PlayerMenu[num].text = description[num].text;
}*/
/* else if (fastcmp(word, "MENUPOSITION"))
{ // Make sure you make MENUPOSITION the first thing under CHARACTER if you're using it!
// This is to manually choose a slot and overwrite existing characters! It is NOT necessary for most individual character wads!!
#ifdef DELFILE
if (disableundo)
#endif
{
slotfound = true;
num = i;
}
} */
/*else*/ if (fastcmp(word, "PICNAME"))
if (fastcmp(word, "PICNAME"))
{
if (!slotfound && (slotfound = findFreeSlot(&num)) == false)
goto done;
@@ -571,11 +405,6 @@ static void readPlayer(MYFILE *f, INT32 num)
}
} while (!myfeof(f)); // finish when the line is empty
#ifdef DELFILE
if (slotfound)
DEH_WriteUndoline("MENUPOSITION", va("%d", num), UNDO_NONE);
#endif
done:
Z_Free(s);
}
@@ -963,7 +792,6 @@ static void readlevelheader(MYFILE *f, INT32 num, INT32 wadnum)
// Lua custom options also go above, contents may be case sensitive.
if (fastncmp(word, "LUA.", 4))
{
#ifdef HAVE_BLUA
UINT8 j;
customoption_t *modoption;
@@ -997,9 +825,6 @@ static void readlevelheader(MYFILE *f, INT32 num, INT32 wadnum)
modoption->option[31] = '\0';
strncpy(modoption->value, word2, 255);
modoption->value[255] = '\0';
#else
// Silently ignore.
#endif
continue;
}
@@ -1479,9 +1304,6 @@ static void readcutscene(MYFILE *f, INT32 num)
char *word2;
char *tmp;
INT32 value;
#ifdef DELFILE
const INT32 oldnumscenes = cutscenes[num]->numscenes;
#endif
// Allocate memory for this cutscene if we don't yet have any
if (!cutscenes[num])
@@ -1919,10 +1741,8 @@ 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))
@@ -1973,21 +1793,7 @@ static void readsound(MYFILE *f, INT32 num, const char *savesfxnames[])
else
break;
/* if (fastcmp(word, "OFFSET"))
{
value -= 150360;
if (value <= 64)
value /= 8;
else if (value <= 260)
value = (value+4)/8;
else
value = (value+8)/8;
if (value >= -1 && value < sfx_freeslot0 - 1)
S_sfx[num].name = savesfxnames[value+1];
else
deh_warning("Sound %d: offset out of bounds", num);
}
else */if (fastcmp(word, "SINGULAR"))
if (fastcmp(word, "SINGULAR"))
{
DEH_WriteUndoline(word, va("%d", S_sfx[num].singularity), UNDO_NONE);
S_sfx[num].singularity = value;
@@ -2171,10 +1977,6 @@ static void reademblemdata(MYFILE *f, INT32 num)
// Default sprite and color definitions for lazy people like me
if (!emblemlocations[num-1].sprite) switch (emblemlocations[num-1].type)
{
/*case ET_RINGS:
emblemlocations[num-1].sprite = 'R'; break;
case ET_SCORE: case ET_NGRADE:
emblemlocations[num-1].sprite = 'S'; break;*/
case ET_TIME: //case ET_NTIME:
emblemlocations[num-1].sprite = 'B'; break;
default:
@@ -2182,12 +1984,6 @@ static void reademblemdata(MYFILE *f, INT32 num)
}
if (!emblemlocations[num-1].color) switch (emblemlocations[num-1].type)
{
/*case ET_RINGS:
emblemlocations[num-1].color = SKINCOLOR_GOLD; break;
case ET_SCORE:
emblemlocations[num-1].color = SKINCOLOR_BROWN; break;
case ET_NGRADE:
emblemlocations[num-1].color = SKINCOLOR_TEAL; break;*/
case ET_TIME: //case ET_NTIME:
emblemlocations[num-1].color = SKINCOLOR_GREY; break;
default:
@@ -2494,34 +2290,6 @@ static void readcondition(UINT8 set, UINT32 id, char *word2)
return;
}
}
/*else if ((offset=0) || fastcmp(params[0], "NIGHTSSCORE")
|| (++offset && fastcmp(params[0], "NIGHTSTIME"))
|| (++offset && fastcmp(params[0], "NIGHTSGRADE")))
{
PARAMCHECK(2); // one optional one
ty = UC_NIGHTSSCORE + offset;
re = atoi(params[2 + !!(params[3])]);
// Convert to map number if it appears to be one
if (params[1][0] >= 'A' && params[1][0] <= 'Z')
x1 = (INT16)M_MapNumber(params[1][0], params[1][1]);
else
x1 = (INT16)atoi(params[1]);
if (x1 < 0 || x1 >= NUMMAPS)
{
deh_warning("Level number %d out of range (1 - %d)", re, NUMMAPS);
return;
}
// Mare number (0 for overall)
if (params[3]) // Only if we actually got 3 params (so the second one == mare and not requirement)
x2 = (INT16)atoi(params[2]);
else
x2 = 0;
}*/
else if (fastcmp(params[0], "TRIGGER"))
{
PARAMCHECK(1);
@@ -2719,15 +2487,6 @@ static void readpatch(MYFILE *f, const char *name, UINT16 wad)
}
} while (!myfeof(f));
// Error checking.
/* // Irrelevant. Origins cannot be unsigned.
if (patch.originx == UINT16_MAX)
I_Error("Patch %s on texture %s has no X position!\n", name, textures[i]->name);
if (patch.originy == UINT16_MAX)
I_Error("Patch %s on texture %s has no Y position!\n", name, textures[i]->name);
*/
// Set the patch as that patch number.
textures[i]->patches[j] = patch;
@@ -3338,29 +3097,6 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad)
}
DEH_WriteUndoline(word, word2, UNDO_HEADER);
}
// <Callum> Added translations to this just in case its re-enabled
/* else if (fastcmp(word, "POINTER"))
{
word = strtok(NULL, " "); // get frame
word = strtok(NULL, ")");
if (word)
{
i = atoi(word);
if (i < NUMSTATES && i >= 0)
{
if (myfgets(s, MAXLINELEN, f))
states[i].action = saveactions[searchvalue(s)];
}
else
{
deh_warning("Pointer: Frame %d doesn't exist", i);
ignorelines(f);
}
}
else
deh_warning("pointer (Frame %d) : missing ')'", i);
G_SetGameModified(multiplayer, true);
}*/
else if (fastcmp(word, "SOUND"))
{
if (i == 0 && word2[0] != '0') // If word2 isn't a number
@@ -3375,27 +3111,6 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad)
DEH_WriteUndoline(word, word2, UNDO_HEADER);
// This is not a major mod.
}
/* else if (fastcmp(word, "SPRITE"))
{
if (i < NUMSPRITES && i >= 0)
{
if (myfgets(s, MAXLINELEN, f))
{
INT32 k;
k = (searchvalue(s) - 151328)/8;
if (k >= 0 && k < NUMSPRITES)
sprnames[i] = savesprnames[k];
else
{
deh_warning("Sprite %d: offset out of bounds", i);
ignorelines(f);
}
}
}
else
deh_warning("Sprite %d doesn't exist",i);
// This is not a major mod.
}*/
else if (fastcmp(word, "HUDITEM"))
{
if (i == 0 && word2[0] != '0') // If word2 isn't a number
@@ -3540,9 +3255,6 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad)
deh_warning("No word in this line: %s", s);
} // end while
/*if (gamedataadded) -- REFRESHDIR_GAMEDATA murdered this
G_LoadGameData();*/
dbg_line = -1;
if (deh_num_warning)
{
@@ -3563,9 +3275,6 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad)
void DEH_LoadDehackedLumpPwad(UINT16 wad, UINT16 lump)
{
MYFILE f;
#ifdef DELFILE
unsocwad = wad;
#endif
f.wad = wad;
f.size = W_LumpLengthPwad(wad, lump);
f.data = Z_Malloc(f.size + 1, PU_STATIC, NULL);
@@ -3582,67 +3291,6 @@ void DEH_LoadDehackedLump(lumpnum_t lumpnum)
DEH_LoadDehackedLumpPwad(WADFILENUM(lumpnum),LUMPNUM(lumpnum));
}
#ifdef DELFILE
#define DUMPUNDONE
// read (un)dehacked lump in wad's memory
void DEH_UnloadDehackedWad(UINT16 wad)
{
undehacked_t *tmp, *curundo = unsocdata[wad];
MYFILE f;
size_t len = 0;
char *data;
#ifdef DUMPUNDONE
FILE *UNDO = fopen("undo.soc", "wt");
#endif
CONS_Printf(M_GetText("Unloading WAD SOC edits\n"));
while (curundo)
{
data = curundo->undata;
curundo = curundo->next;
if (data)
len += strlen(data);
len += 1;
#ifdef DUMPUNDONE
if (UNDO)
{
if (data)
fprintf(UNDO, "%s\n", data);
else
fprintf(UNDO, "\n");
}
#endif
}
#ifndef DUMPUNDONE
if (UNDO) fclose(UNDO);
#endif
if (!len) return;
f.size = len;
data = f.data = Z_Malloc(f.size + 1, PU_STATIC, NULL);
curundo = unsocdata[wad];
unsocdata[wad] = NULL;
while (curundo)
{
tmp = curundo;
curundo = curundo->next;
if (tmp->undata)
data += sprintf(data, "%s\n", tmp->undata);
else
data += sprintf(data, "\n");
if (tmp->undata) free(tmp->undata);
free(tmp);
}
f.wad = wad;
f.curpos = f.data;
f.data[f.size] = 0;
disableundo = true;
DEH_LoadDehackedFile(&f);
disableundo = false;
Z_Free(f.data);
}
#endif //DELFILE
////////////////////////////////////////////////////////////////////////////////
// CRAZY LIST OF STATE NAMES AND ALL FROM HERE DOWN
// TODO: Make this all a seperate file or something, like part of info.c??
@@ -3696,63 +3344,6 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
"S_KART_SPIN",
"S_KART_PAIN",
"S_KART_SQUISH",
/*
"S_PLAY_STND",
"S_PLAY_TAP1",
"S_PLAY_TAP2",
"S_PLAY_RUN1",
"S_PLAY_RUN2",
"S_PLAY_RUN3",
"S_PLAY_RUN4",
"S_PLAY_RUN5",
"S_PLAY_RUN6",
"S_PLAY_RUN7",
"S_PLAY_RUN8",
"S_PLAY_SPD1",
"S_PLAY_SPD2",
"S_PLAY_SPD3",
"S_PLAY_SPD4",
"S_PLAY_ATK1",
"S_PLAY_ATK2",
"S_PLAY_ATK3",
"S_PLAY_ATK4",
"S_PLAY_SPRING",
"S_PLAY_FALL1",
"S_PLAY_FALL2",
"S_PLAY_ABL1",
"S_PLAY_ABL2",
"S_PLAY_SPC1",
"S_PLAY_SPC2",
"S_PLAY_SPC3",
"S_PLAY_SPC4",
"S_PLAY_CLIMB1",
"S_PLAY_CLIMB2",
"S_PLAY_CLIMB3",
"S_PLAY_CLIMB4",
"S_PLAY_CLIMB5",
"S_PLAY_GASP",
"S_PLAY_PAIN",
"S_PLAY_DIE",
"S_PLAY_TEETER1",
"S_PLAY_TEETER2",
"S_PLAY_CARRY",
"S_PLAY_SUPERSTAND",
"S_PLAY_SUPERWALK1",
"S_PLAY_SUPERWALK2",
"S_PLAY_SUPERFLY1",
"S_PLAY_SUPERFLY2",
"S_PLAY_SUPERTEETER",
"S_PLAY_SUPERHIT",
"S_PLAY_SUPERTRANS1",
"S_PLAY_SUPERTRANS2",
"S_PLAY_SUPERTRANS3",
"S_PLAY_SUPERTRANS4",
"S_PLAY_SUPERTRANS5",
"S_PLAY_SUPERTRANS6",
"S_PLAY_SUPERTRANS7",
"S_PLAY_SUPERTRANS8",
"S_PLAY_SUPERTRANS9", // This has special significance in the code. If you add more frames, search for it and make the appropriate changes.
*/
// technically the player goes here but it's an infinite tic state
"S_OBJPLACE_DUMMY",
@@ -7803,14 +7394,12 @@ static const char *const MOBJEFLAG_LIST[] = {
NULL
};
#ifdef HAVE_BLUA
static const char *const MAPTHINGFLAG_LIST[4] = {
NULL,
"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[] = {
// Flip camera angle with gravity flip prefrence.
@@ -7883,7 +7472,6 @@ static const char *const PLAYERFLAG_LIST[] = {
NULL // stop loop here.
};
#ifdef HAVE_BLUA
// Linedef flags
static const char *const ML_LIST[16] = {
"IMPASSIBLE",
@@ -7903,7 +7491,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
@@ -8110,7 +7697,6 @@ static const char *const POWERS_LIST[] = {
"INGOOP" // In goop
};
#ifdef HAVE_BLUA
static const char *const KARTSTUFF_LIST[] = {
"POSITION",
"OLDPOSITION",
@@ -8197,7 +7783,6 @@ static const char *const KARTSTUFF_LIST[] = {
"SPECTATEWAIT",
"GROWCANCEL"
};
#endif
static const char *const HUDITEMS_LIST[] = {
"LIVESNAME",
@@ -8240,11 +7825,7 @@ static const char *const HUDITEMS_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
@@ -8433,7 +8014,6 @@ struct {
{"SF_NOINTERRUPT",SF_NOINTERRUPT},
{"SF_X2AWAYSOUND",SF_X2AWAYSOUND},
#ifdef HAVE_BLUA
// p_local.h constants
{"FLOATSPEED",FLOATSPEED},
{"MAXSTEPMOVE",MAXSTEPMOVE},
@@ -8741,7 +8321,6 @@ struct {
// Custom client features exposed to lua
{"FEATURE_INTERMISSIONHUD",1},
{"FEATURE_VOTEHUD",1},
#endif
{NULL,0}
};
@@ -8870,249 +8449,10 @@ static hudnum_t get_huditem(const char *word)
return HUD_LIVESNAME;
}
#ifndef HAVE_BLUA
static powertype_t get_power(const char *word)
{ // Returns the vlaue of pw_ enumerations
powertype_t i;
if (*word >= '0' && *word <= '9')
return atoi(word);
if (fastncmp("PW_",word,3))
word += 3; // take off the pw_
for (i = 0; i < NUMPOWERS; i++)
if (fastcmp(word, POWERS_LIST[i]))
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; }
static fixed_t op_div(fixed_t a, fixed_t b) { return a/b; }
static fixed_t op_add(fixed_t a, fixed_t b) { return a+b; }
static fixed_t op_sub(fixed_t a, fixed_t b) { return a-b; }
static fixed_t op_or(fixed_t a, fixed_t b) { return a|b; }
static fixed_t op_and(fixed_t a, fixed_t b) { return a&b; }
static fixed_t op_lshift(fixed_t a, fixed_t b) { return a<<b; }
static fixed_t op_rshift(fixed_t a, fixed_t b) { return a>>b; }
struct {
const char c;
fixed_t (*v)(fixed_t,fixed_t);
} OPERATIONS[] = {
{'*',op_mul},
{'/',op_div},
{'+',op_add},
{'-',op_sub},
{'|',op_or},
{'&',op_and},
{'<',op_lshift},
{'>',op_rshift},
{0,NULL}
};
// Returns the full word, cut at the first symbol or whitespace
static char *read_word(const char *line)
{
// Part 1: You got the start of the word, now find the end.
const char *p;
INT32 i;
for (p = line+1; *p; p++) {
if (*p == ' ' || *p == '\t')
break;
for (i = 0; OPERATIONS[i].c; i++)
if (*p == OPERATIONS[i].c) {
i = -1;
break;
}
if (i == -1)
break;
}
// Part 2: Make a copy of the word and return it.
{
size_t len = (p-line);
char *word = malloc(len+1);
M_Memcpy(word,line,len);
word[len] = '\0';
return word;
}
}
static INT32 operation_pad(const char **word)
{ // Brings word the next operation and returns the operation number.
INT32 i;
for (; **word; (*word)++) {
if (**word == ' ' || **word == '\t')
continue;
for (i = 0; OPERATIONS[i].c; i++)
if (**word == OPERATIONS[i].c)
{
if ((**word == '<' && *(*word+1) == '<') || (**word == '>' && *(*word+1) == '>')) (*word)++; // These operations are two characters long.
else if (**word == '<' || **word == '>') continue; // ... do not accept one character long.
(*word)++;
return i;
}
deh_warning("Unknown operation '%c'",**word);
return -1;
}
return -1;
}
static void const_warning(const char *type, const char *word)
{
deh_warning("Couldn't find %s named '%s'",type,word);
}
static fixed_t find_const(const char **rword)
{ // Finds the value of constants and returns it, bringing word to the next operation.
INT32 i;
fixed_t r;
char *word = read_word(*rword);
*rword += strlen(word);
if ((*word >= '0' && *word <= '9') || *word == '-') { // Parse a number
r = atoi(word);
free(word);
return r;
}
if (!*(word+1) && // Turn a single A-z symbol into numbers, like sprite frames.
((*word >= 'A' && *word <= 'Z') || (*word >= 'a' && *word <= 'z'))) {
r = R_Char2Frame(*word);
free(word);
return r;
}
if (fastncmp("MF_", word, 3)) {
char *p = word+3;
for (i = 0; MOBJFLAG_LIST[i]; i++)
if (fastcmp(p, MOBJFLAG_LIST[i])) {
free(word);
return (1<<i);
}
// Not found error
const_warning("mobj flag",word);
free(word);
return 0;
}
else if (fastncmp("MF2_", word, 4)) {
char *p = word+4;
for (i = 0; MOBJFLAG2_LIST[i]; i++)
if (fastcmp(p, MOBJFLAG2_LIST[i])) {
free(word);
return (1<<i);
}
// Not found error
const_warning("mobj flag2",word);
free(word);
return 0;
}
else if (fastncmp("MFE_", word, 4)) {
char *p = word+4;
for (i = 0; MOBJEFLAG_LIST[i]; i++)
if (fastcmp(p, MOBJEFLAG_LIST[i])) {
free(word);
return (1<<i);
}
// Not found error
const_warning("mobj eflag",word);
free(word);
return 0;
}
else if (fastncmp("PF_", word, 3)) {
char *p = word+3;
for (i = 0; PLAYERFLAG_LIST[i]; i++)
if (fastcmp(p, PLAYERFLAG_LIST[i])) {
free(word);
return (1<<i);
}
if (fastcmp(p, "FULLSTASIS"))
return PF_FULLSTASIS;
// Not found error
const_warning("player flag",word);
free(word);
return 0;
}
else if (fastncmp("S_",word,2)) {
r = get_state(word);
free(word);
return r;
}
else if (fastncmp("MT_",word,3)) {
r = get_mobjtype(word);
free(word);
return r;
}
else if (fastncmp("SPR_",word,4)) {
r = get_sprite(word);
free(word);
return r;
}
else if (fastncmp("SFX_",word,4) || fastncmp("DS",word,2)) {
r = get_sfx(word);
free(word);
return r;
}
#ifdef MUSICSLOT_COMPATIBILITY
else if (fastncmp("MUS_",word,4) || fastncmp("O_",word,2)) {
r = get_mus(word, true);
free(word);
return r;
}
#endif
else if (fastncmp("PW_",word,3)) {
r = get_power(word);
free(word);
return r;
}
else if (fastncmp("HUD_",word,4)) {
r = get_huditem(word);
free(word);
return r;
}
else if (fastncmp("SKINCOLOR_",word,10)) {
char *p = word+10;
for (i = 0; i < MAXTRANSLATIONS; i++)
if (fastcmp(p, COLOR_ENUMS[i])) {
free(word);
return i;
}
const_warning("color",word);
free(word);
return 0;
}
for (i = 0; INT_CONST[i].n; i++)
if (fastcmp(word,INT_CONST[i].n)) {
free(word);
return INT_CONST[i].v;
}
// Not found error.
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
fixed_t i = find_const(&word);
INT32 o;
while(*word) {
o = operation_pad(&word);
if (o != -1)
i = OPERATIONS[o].v(i,find_const(&word));
else
break;
}
return i;
#endif
}
void DEH_Check(void)
@@ -9141,10 +8481,6 @@ void DEH_Check(void)
#endif
}
#ifdef HAVE_BLUA
#include "lua_script.h"
#include "lua_libs.h"
// freeslot takes a name (string only!)
// and allocates it to the appropriate free slot.
// Returns the slot number allocated for it or nil if failed.
@@ -10082,6 +9418,4 @@ void LUA_SetActionByName(void *state, const char *actiontocompare)
return;
}
}
}
#endif // HAVE_BLUA
}
-7
View File
@@ -27,12 +27,7 @@ typedef enum
UNDO_DONE = 0,
} undotype_f;
#ifdef DELFILE
void DEH_WriteUndoline(const char *value, const char *data, undotype_f flags);
void DEH_UnloadDehackedWad(UINT16 wad);
#else // null the undo lines
#define DEH_WriteUndoline(a,b,c)
#endif
void DEH_LoadDehackedLump(lumpnum_t lumpnum);
void DEH_LoadDehackedLumpPwad(UINT16 wad, UINT16 lump);
@@ -43,11 +38,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;
-24
View File
@@ -561,17 +561,6 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
/// Undefine to use the new method of Gamma correction see colour cube in v_video.c
#define BACKWARDSCOMPATCORRECTION
/// Kalaron/Eternity Engine slope code (SRB2CB ported)
#define ESLOPE
/// Backwards compatibility with SRB2CB's slope linedef types.
/// \note A simple shim that prints a warning.
#define ESLOPE_TYPESHIM
/// Delete file while the game is running.
/// \note EXTREMELY buggy, tends to crash game.
//#define DELFILE
/// Allows the use of devmode in multiplayer. AKA "fishcake"
//#define NETGAME_DEVMODE
@@ -581,16 +570,9 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
/// Dumps the contents of a network save game upon consistency failure for debugging.
//#define DUMPCONSISTENCY
/// Polyobject fake flat code
#define POLYOBJECTS_PLANES
/// See name of player in your crosshair
#define SEENAMES
/// Who put weights on my recycler? ... Inuyasha did.
/// \note XMOD port.
//#define WEIGHTEDRECYCLER
/// Allow loading of savegames between different versions of the game.
/// \note XMOD port.
/// Most modifications should probably enable this.
@@ -608,9 +590,6 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
#define CLIENT_LOADINGSCREEN
#endif
/// Experimental tweaks to analog mode. (Needs a lot of work before it's ready for primetime.)
//#define REDSANALOG
/// Backwards compatibility with musicslots.
/// \note You should leave this enabled unless you're working with a future SRB2 version.
#define MUSICSLOT_COMPATIBILITY
@@ -630,9 +609,6 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
#define ROTANGLES 72 // Needs to be a divisor of 360 (45, 60, 90, 120...)
#define ROTANGDIFF (360 / ROTANGLES)
/// Hardware renderer: OpenGL
#define GL_SHADERS
#if defined (HAVE_CURL) && ! defined (NONET)
#define MASTERSERVER
#define HOLEPUNCH
+1 -1
View File
@@ -57,7 +57,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
+2 -22
View File
@@ -1621,10 +1621,8 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
-Making some galaxy brain autopilot Lua if you're a masochist
-Making a Mario Kart 8 Deluxe tier baby mode that steers you away from walls and whatnot. You know what, do what you want!
*/
#ifdef HAVE_BLUA
if (gamestate == GS_LEVEL)
LUAh_PlayerCmd(player, cmd);
#endif
//Reset away view if a command is given.
if ((cmd->forwardmove || cmd->sidemove || cmd->buttons)
@@ -2954,9 +2952,7 @@ void G_SpawnPlayer(INT32 playernum, boolean starpost)
if (starpost) //Don't even bother with looking for a place to spawn.
{
P_MovePlayerToStarpost(playernum);
#ifdef HAVE_BLUA
LUAh_PlayerSpawn(&players[playernum]); // Lua hook for player spawning :)
#endif
return;
}
@@ -3012,10 +3008,7 @@ void G_SpawnPlayer(INT32 playernum, boolean starpost)
}
P_MovePlayerToSpawn(playernum, spawnpoint);
#ifdef HAVE_BLUA
LUAh_PlayerSpawn(&players[playernum]); // Lua hook for player spawning :)
#endif
}
mapthing_t *G_FindCTFStart(INT32 playernum)
@@ -3310,9 +3303,7 @@ void G_DoReborn(INT32 playernum)
}
else
{
#ifdef HAVE_BLUA
LUAh_MapChange(gamemap);
#endif
G_DoLoadLevel(true);
}
}*/
@@ -4784,9 +4775,7 @@ void G_InitNew(UINT8 pencoremode, const char *mapname, boolean resetplayer, bool
F_StartCustomCutscene(mapheaderinfo[gamemap-1]->precutscenenum-1, true, resetplayer);
else
{
#ifdef HAVE_BLUA
LUAh_MapChange(gamemap);
#endif
G_DoLoadLevel(resetplayer);
}
@@ -5109,9 +5098,7 @@ INT32 G_FindMapByNameOrCode(const char *mapname, char **realmapnamep)
#define DF_NIGHTSATTACK 0x04 // This demo is from NiGHTS attack and contains its time left, score, and mares!
#define DF_ATTACKMASK 0x06 // This demo is from ??? attack and contains ???
#ifdef HAVE_BLUA
#define DF_LUAVARS 0x20 // this demo contains extra lua vars; this is mostly used for backwards compability
#endif
#define DF_ATTACKSHIFT 1
#define DF_ENCORE 0x40
@@ -6780,11 +6767,9 @@ void G_BeginRecording(void)
if (encoremode)
demoflags |= DF_ENCORE;
#ifdef HAVE_BLUA
if (!modeattacking && gL) // Ghosts don't read luavars, and you shouldn't ever need to save Lua in replays, you doof!
// SERIOUSLY THOUGH WHY WOULD YOU LOAD HOSTMOD AND RECORD A GHOST WITH IT !????
demoflags |= DF_LUAVARS;
#endif
// Setup header.
M_Memcpy(demo_p, DEMOHEADER, 12); demo_p += 12;
@@ -6892,11 +6877,9 @@ void G_BeginRecording(void)
WRITEUINT8(demo_p, 0xFF); // Denote the end of the player listing
#ifdef HAVE_BLUA
// player lua vars, always saved even if empty... Unless it's record attack.
if (demoflags & DF_LUAVARS)
LUA_ArchiveDemo();
#endif
memset(&oldcmd,0,sizeof(oldcmd));
memset(&oldghost,0,sizeof(oldghost));
@@ -7882,9 +7865,8 @@ void G_DoPlayDemo(char *defdemoname)
// didn't start recording right away.
demo.deferstart = false;
/*#ifdef HAVE_BLUA
LUAh_MapChange(gamemap);
#endif*/
//LUAh_MapChange(gamemap);
displayplayers[0] = consoleplayer = 0;
memset(playeringame,0,sizeof(playeringame));
@@ -7971,7 +7953,6 @@ void G_DoPlayDemo(char *defdemoname)
// end of player read (the 0xFF marker)
// so this is where we are to read our lua variables (if possible!)
#ifdef HAVE_BLUA
if (demoflags & DF_LUAVARS) // again, used for compability, lua shit will be saved to replays regardless of if it's even been loaded
{
if (!gL) // No Lua state! ...I guess we'll just start one...
@@ -7980,7 +7961,6 @@ void G_DoPlayDemo(char *defdemoname)
// No modeattacking check, DF_LUAVARS won't be present here.
LUA_UnArchiveDemo();
}
#endif
splitscreen = 0;
+1 -15
View File
@@ -383,21 +383,7 @@ void HWR_RenderBatches(void)
changeState = true;
changePolyFlags = true;
}
if ((cv_grshaders.value && gr_shadersavailable) && (HWR_ShouldUsePaletteRendering()))
{
if (currentSurfaceInfo.PolyColor.rgba != nextSurfaceInfo.PolyColor.rgba ||
currentSurfaceInfo.TintColor.rgba != nextSurfaceInfo.TintColor.rgba ||
currentSurfaceInfo.FadeColor.rgba != nextSurfaceInfo.FadeColor.rgba ||
currentSurfaceInfo.LightInfo.light_level != nextSurfaceInfo.LightInfo.light_level ||
currentSurfaceInfo.LightInfo.fade_start != nextSurfaceInfo.LightInfo.fade_start ||
currentSurfaceInfo.LightInfo.fade_end != nextSurfaceInfo.LightInfo.fade_end ||
currentSurfaceInfo.LightTableId != nextSurfaceInfo.LightTableId)
{
changeState = true;
changeSurfaceInfo = true;
}
}
else if (cv_grshaders.value && gr_shadersavailable)
if (cv_grshaders.value && gr_shadersavailable)
{
if (currentSurfaceInfo.PolyColor.rgba != nextSurfaceInfo.PolyColor.rgba ||
currentSurfaceInfo.TintColor.rgba != nextSurfaceInfo.TintColor.rgba ||
-2
View File
@@ -809,12 +809,10 @@ static void AdjustSegs(void)
float distv1,distv2,tmp;
nearv1 = nearv2 = MYMAX;
#ifdef POLYOBJECTS
// Don't touch polyobject segs. We'll compensate
// for this when we go about drawing them.
if (lseg->polyseg)
continue;
#endif
if (p) {
for (j = 0; j < p->numpts; j++)
+7 -3
View File
@@ -502,6 +502,9 @@ static void FreeMipmapColormap(INT32 patchnum, void *patch)
// Set the first colormap to the one that comes after it.
next = pat->mipmap->nextcolormap;
if (!next)
break;
pat->mipmap->nextcolormap = next->nextcolormap;
// Free image data from memory.
@@ -646,6 +649,9 @@ static void HWR_CacheFlat(GLMipmap_t *grMipmap, lumpnum_t flatlumpnum)
void HWR_GetFlat(lumpnum_t flatlumpnum, boolean noencoremap)
{
GLMipmap_t *grmip;
if (flatlumpnum == LUMPERROR)
return;
grmip = HWR_GetCachedGLPatch(flatlumpnum)->mipmap;
@@ -662,7 +668,6 @@ void HWR_GetFlat(lumpnum_t flatlumpnum, boolean noencoremap)
// If hardware does not have the texture, then call pfnSetTexture to upload it
if (!grmip->downloaded)
HWD.pfnSetTexture(grmip);
HWR_SetCurrentTexture(grmip);
// The system-memory data can be purged now.
@@ -1085,8 +1090,7 @@ UINT32 HWR_GetLightTableID(extracolormap_t *colormap)
// call become invalid and must not be used.
void HWR_ClearLightTables(void)
{
//if (vid.glstate == VID_GL_LIBRARY_LOADED) // we have pfnInit which is essentially the same, but it doesent work here for whatever reason, since this should not be done in software renderer ever!
if (rendermode == render_opengl)
if (vid.glstate == VID_GL_LIBRARY_LOADED)
HWD.pfnClearLightTables();
}
-2
View File
@@ -165,7 +165,6 @@ typedef struct
FLOAT s,t;
} FOutVector;
#ifdef GL_SHADERS
// Shader targets used to render specific types of geometry.
// A shader target is resolved to an actual shader with HWR_GetShaderFromTarget.
// The shader returned may be a base shader or a custom shader.
@@ -203,7 +202,6 @@ enum hwdshaderstage
typedef enum hwdshaderstage hwdshaderstage_t;
#endif
// ==========================================================================
// RENDER MODES
+1 -1
View File
@@ -59,7 +59,7 @@ EXPORT void HWRAPI(FlushScreenTextures) (void);
EXPORT void HWRAPI(DoScreenWipe) (int wipeStart, int wipeEnd);
EXPORT void HWRAPI(DrawScreenTexture) (int tex, FSurfaceInfo *surf, FBITFIELD polyflags);
EXPORT void HWRAPI(MakeScreenTexture) (int tex);
EXPORT void HWRAPI(DrawScreenFinalTexture) (int tex, int width, int height);
EXPORT void HWRAPI(DrawScreenFinalTexture) (int tex, INT32 width, INT32 height);
EXPORT void HWRAPI(RenderVhsEffect) (fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize);
+202 -530
View File
File diff suppressed because it is too large. Load diff
+1 -10
View File
@@ -115,19 +115,15 @@ void HWR_DrawIntermissionBG(void);
void HWR_DoWipe(UINT8 wipenum, UINT8 scrnnum);
void HWR_RenderVhsEffect(fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize);
void HWR_MakeScreenFinalTexture(void);
void HWR_DrawScreenFinalTexture(int width, int height);
void HWR_DrawScreenFinalTexture(INT32 width, INT32 height);
// hw_main.c: Planes
void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, boolean isceiling, fixed_t fixedheight, FBITFIELD PolyFlags, INT32 lightlevel, lumpnum_t lumpnum, sector_t *FOFsector, UINT8 alpha, extracolormap_t *planecolormap);
void HWR_AddTransparentFloor(lumpnum_t lumpnum, extrasubsector_t *xsub, boolean isceiling, fixed_t fixedheight, INT32 lightlevel, INT32 alpha, sector_t *FOFSector, FBITFIELD blend, boolean fogplane, extracolormap_t *planecolormap);
#ifdef POLYOBJECTS
#ifdef POLYOBJECTS_PLANES
void HWR_RenderPolyObjectPlane(polyobj_t *polysector, boolean isceiling, fixed_t fixedheight, FBITFIELD blendmode, UINT8 lightlevel, lumpnum_t lumpnum, sector_t *FOFsector, UINT8 alpha, extracolormap_t *planecolormap);
void HWR_AddPolyObjectPlanes(void);
void HWR_AddTransparentPolyobjectFloor(lumpnum_t lumpnum, polyobj_t *polysector, boolean isceiling, fixed_t fixedheight, INT32 lightlevel, INT32 alpha, sector_t *FOFSector, FBITFIELD blend, extracolormap_t *planecolormap);
#endif
#endif
// hw_main.c: Segs
void HWR_ProcessSeg(void); // Sort of like GLWall::Process in GZDoom
@@ -138,9 +134,7 @@ void HWR_AddTransparentWall(FOutVector *wallVerts, FSurfaceInfo * pSurf, INT32 t
void HWR_DrawSkyWall(FOutVector *wallVerts, FSurfaceInfo *Surf);
void HWR_DrawSkyBackground(float fpov);
#ifdef POLYOBJECTS
void HWR_AddPolyObjectSegs(void);
#endif
// hw_main.c: BSP
void HWR_RenderBSPNode(INT32 bspnum);
@@ -163,9 +157,6 @@ extern boolean gr_maphasportals;
void HWR_LoadTextures(size_t pnumtextures);
RGBA_t *HWR_GetTexturePalette(void);
// hw_trick.c
void HWR_CorrectSWTricks(void);
void HWR_SetShaderState(void);
// Console variables
+1 -1
View File
@@ -1163,7 +1163,7 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
angle_t ang;
interpmobjstate_t interp;
if (R_UsingFrameInterpolation() && !paused)
if (R_UsingFrameInterpolation() && !paused && (!cv_grmaxinterpdist.value || R_QuickCamDist(spr->mobj->x, spr->mobj->y) < cv_grmaxinterpdist.value))
{
R_InterpolateMobjState(spr->mobj, rendertimefrac, &interp);
}
+1 -1
View File
@@ -76,7 +76,7 @@
#define GLSL_SOFTWARE_TINT_EQUATION \
"if (tint_color.a > 0.0) {\n" \
"float color_bright = sqrt((base_color.r * base_color.r) + (base_color.g * base_color.g) + (base_color.b * base_color.b));\n" \
"float strength = sqrt(9.0 * tint_color.a);\n" \
"float strength = sqrt(tint_color.a);\n" \
"final_color.r = clamp((color_bright * (tint_color.r * strength)) + (base_color.r * (1.0 - strength)), 0.0, 1.0);\n" \
"final_color.g = clamp((color_bright * (tint_color.g * strength)) + (base_color.g * (1.0 - strength)), 0.0, 1.0);\n" \
"final_color.b = clamp((color_bright * (tint_color.b * strength)) + (base_color.b * (1.0 - strength)), 0.0, 1.0);\n" \
-919
View File
@@ -1,919 +0,0 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// Copyright (C) 1998-2001 by DooM Legacy Team.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//-----------------------------------------------------------------------------
/// \file
/// \brief special trick routines to make some SW tricks look OK with
/// HW rendering. This includes:
/// - deepwatereffect (e.g. tnt/map02)
/// - invisible staircase (e.g. eternal/map02)
/// - floating ceilings (e.g. eternal/map03)
///
/// It is not guaranteed that it looks identical to the SW mode,
/// but it looks in most of the cases far better than having
/// holes in the architecture, HOM, etc.
///
/// It fixes as well missing textures, which are replaced by either
/// a default texture or the midtexture.
///
/// words of notice:
/// pseudosectors, as mentioned in this file, are sectors where both
/// sidedefs point to the same sector. This expression is also used
/// for sectors which are enclosed by another sector but have no
/// correct sidedefs at all
///
/// if a vertex is inside a poly is determined by the angles between
/// this vertex and all angles on the linedefs (imagine walking along
/// a circle always facing a certain point inside/outside the circle;
/// if inside, angle have taken all values [0..pi), otherwise the
/// range was < pi/2
#include <math.h>
#include "../doomdef.h"
#include "../doomstat.h"
#ifdef HWRENDER
#include "hw_main.h"
#include "hw_glob.h"
#include "hw_dll.h"
#include "../r_local.h"
#include "../i_system.h"
//
// add a line to a sectors list of lines
//
static void addLineToChain(sector_t *sector, line_t *line)
{
linechain_t *thisElem = NULL, *nextElem;
if (!sector)
return;
nextElem = sector->sectorLines;
while (nextElem) // walk through chain
{
thisElem = nextElem;
nextElem = thisElem->next;
}
// add a new element into the chain
if (thisElem)
{
thisElem->next = malloc(sizeof (linechain_t));
if (thisElem->next)
{
thisElem->next->line = line;
thisElem->next->next = NULL;
}
else
{
I_Error("Out of memory in addLineToChain(.)\n");
}
}
else // first element in chain
{
sector->sectorLines = malloc(sizeof (linechain_t));
if (sector->sectorLines)
{
sector->sectorLines->line = line;
sector->sectorLines->next = NULL;
}
else
{
I_Error("Out of memory in addLineToChain(.)\n");
}
}
}
//
// We dont want a memory hole, do we?;-)
//
static void releaseLineChains(void)
{
linechain_t *thisElem, *nextElem;
sector_t *sector;
size_t i;
for (i = 0; i < numsectors; i++)
{
sector = &sectors[i];
nextElem = sector->sectorLines;
while (nextElem)
{
thisElem = nextElem;
nextElem = thisElem->next;
free(thisElem);
}
sector->sectorLines = NULL;
}
}
//
// check if a pseudo sector is valid by checking all its linedefs
//
static boolean isPSectorValid(sector_t *sector)
{
linechain_t *thisElem, *nextElem;
if (!sector->pseudoSector) // check only pseudosectors, others dont care
{
#ifdef PARANOIA
CONS_Debug(DBG_RENDER, "Alert! non-pseudosector fed to isPSectorClosed()\n");
#endif
return false;
}
nextElem = sector->sectorLines;
while (nextElem)
{
thisElem = nextElem;
nextElem = thisElem->next;
if (thisElem->line->frontsector != thisElem->line->backsector)
return false;
}
return true;
}
//
// angles are always phiMax-phiMin [0...2\pi)
//
FUNCMATH static double phiDiff(double phiMin, double phiMax)
{
double result;
result = phiMax-phiMin;
if (result < 0.0l)
result += 2.0l*M_PIl;
return result;
}
//
// sort phi's so that enclosed angle < \pi
//
static void sortPhi(double phi1, double phi2, double *phiMin, double *phiMax)
{
if (phiDiff(phi1, phi2) < M_PIl)
{
*phiMin = phi1;
*phiMax = phi2;
}
else
{
*phiMin = phi2;
*phiMax = phi1;
}
}
//
// return if angle(phi1, phi2) is bigger than \pi
// if so, the vertex lies inside the poly
//
FUNCMATH static boolean biggerThanPi(double phi1, double phi2)
{
if (phiDiff(phi1, phi2) > M_PIl)
return true;
return false;
}
#define DELTAPHI (M_PIl/100.0l) // some small phi << \pi
//
// calculate bounds for minimum angle
//
static void phiBounds(double phi1, double phi2, double *phiMin, double *phiMax)
{
double phi1Tmp, phi2Tmp;
double psi1, psi2, psi3, psi4, psi5, psi6, psi7; // for optimization
sortPhi(phi1, phi2, &phi1Tmp, &phi2Tmp);
phi1 = phi1Tmp;
phi2 = phi2Tmp;
// check start condition
if (*phiMin > M_PIl || *phiMax > M_PIl)
{
*phiMin = phi1;
*phiMax = phi2;
return;
}
// 6 cases:
// new angles inbetween phiMin, phiMax -> forget it
// new angles enclose phiMin -> set phiMin
// new angles enclose phiMax -> set phiMax
// new angles completely outside phiMin, phiMax -> leave largest area free
// new angles close the range completely!
// new angles enlarges range on both sides
psi1 = phiDiff(*phiMin, phi1);
psi2 = phiDiff(*phiMin, phi2);
psi3 = phiDiff(*phiMax, phi1);
psi4 = phiDiff(*phiMax, phi2);
psi5 = phiDiff(*phiMin, *phiMax);
psi6 = (double)(2.0l*M_PIl - psi5); // phiDiff(*phiMax, *phiMin);
psi7 = (double)(2.0l*M_PIl - psi2); // phiDiff(phi2, *phiMin);
// case 1 & 5!
if ((psi1 <= psi5) && (psi2 <= psi5))
{
if (psi1 <= psi2) // case 1
{
return;
}
else // case 5
{
// create some artificial interval here not to get into numerical trouble
// in fact we know now the sector is completely enclosed -> base for computational optimization
*phiMax = 0.0l;
*phiMin = DELTAPHI;
return;
}
}
// case 2
if ((psi1 >= psi5) && (psi2 <= psi5))
{
*phiMin = phi1;
return;
}
// case 3
if ((psi3 >= psi6) && (psi4 <= psi6))
{
*phiMax = phi2;
return;
}
// case 4 & 6
#ifdef PARANOIA
if ((psi3 <= psi6) && (psi4 <= psi6)) // FIXME: isn't this case implicitly true anyway??
#endif
{
if (psi3 <= psi4) //case 4
{
if (psi3 >= psi7)
{
*phiMin = phi1;
return;
}
else
{
*phiMax = phi2;
return;
}
}
else // case 6
{
*phiMin = phi1;
*phiMax = phi2;
return;
}
}
#ifdef PARANOIA
CONS_Debug(DBG_RENDER, "phiMin = %f, phiMax = %f, phi1 = %f, phi2 = %f\n", *phiMin, *phiMax, phi1, phi2);
I_Error("phiBounds() out of range!\n");
#endif
}
//
// Check if a vertex lies inside a sector
// This works for "well-behaved" convex polygons
// If we need it mathematically correct, we need to sort the
// linedefs first so we have them in a row, then walk along the linedefs,
// but this is a bit overdone
//
static inline boolean isVertexInside(vertex_t *vertex, sector_t *sector)
{
double xa, ya, xe, ye;
linechain_t *chain;
double phiMin, phiMax;
double phi1, phi2;
chain = sector->sectorLines;
phiMin = phiMax = 10.0l*M_PIl; // some value > \pi
while (chain)
{
// start and end vertex
xa = (double)chain->line->v1->x - (double)vertex->x;
ya = (double)chain->line->v1->y - (double)vertex->y;
xe = (double)chain->line->v2->x - (double)vertex->x;
ye = (double)chain->line->v2->y - (double)vertex->y;
// angle phi of connection between the vertices and the x-axis
phi1 = atan2(ya, xa);
phi2 = atan2(ye, xe);
// if we have just started, we can have to create start bounds for phi
phiBounds(phi1, phi2, &phiMin, &phiMax);
chain = chain->next;
}
return biggerThanPi(phiMin, phiMax);
}
#define MAXSTACK 256 // Not more than 256 polys in each other?
//
// generate a list of sectors which enclose the given sector
//
static void generateStacklist(sector_t *thisSector)
{
size_t i, stackCnt = 0;
sector_t *locStacklist[MAXSTACK];
sector_t *checkSector;
for (i = 0; i < numsectors; i++)
{
checkSector = &sectors[i];
if (checkSector == thisSector) // dont check self
continue;
// buggy sector?
if (!thisSector->sectorLines)
continue;
// check if an arbitrary vertex of thisSector lies inside the checkSector
if (isVertexInside(thisSector->sectorLines->line->v1, checkSector))
{
// if so, the thisSector lies inside the checkSector
locStacklist[stackCnt] = checkSector;
stackCnt++;
if (MAXSTACK-1 == stackCnt) // beware of the SIGSEGV! and consider terminating NULL!
break;
}
}
thisSector->stackList = malloc(sizeof (sector_t *) * (stackCnt+1));
if (NULL == thisSector->stackList)
{
I_Error("Out of memory error in generateStacklist()");
}
locStacklist[stackCnt] = NULL; // terminating NULL
memcpy(thisSector->stackList, locStacklist, sizeof (sector_t *) * (stackCnt+1));
}
//
// Bubble sort the stacklist with rising lineoutlengths
//
static void sortStacklist(sector_t *sector)
{
sector_t **list;
sector_t *sec1, *sec2;
boolean finished;
size_t i;
list = sector->stackList;
finished = false;
if (!*list)
return; // nothing to sort
while (!finished)
{
i = 0;
finished = true;
while (*(list+i+1))
{
sec1 = *(list+i);
sec2 = *(list+i+1);
if (sec1->lineoutLength > sec2->lineoutLength)
{
*(list+i) = sec2;
*(list+i+1) = sec1;
finished = false;
}
i++;
}
}
}
//
// length of a line in euclidian sense
//
static double lineLength(line_t *line)
{
double dx, dy, length;
dx = (double) line->v1->x - (double) line->v2->x;
dy = (double) line->v1->y - (double) line->v2->y;
length = hypot(dx, dy);
return length;
}
//
// length of the sector lineout
//
static double calcLineoutLength(sector_t *sector)
{
linechain_t *chain;
double length = 0.0L;
chain = sector->sectorLines;
while (chain) // sum up lengths of all lines
{
length += lineLength(chain->line);
chain = chain->next;
}
return length;
}
//
// Calculate length of the sectors lineout
//
static void calcLineouts(sector_t *sector)
{
size_t secCount = 0;
sector_t *encSector = *(sector->stackList);
while (encSector)
{
if (encSector->lineoutLength < 0.0L) // if length has not yet been calculated
{
encSector->lineoutLength = calcLineoutLength(encSector);
}
secCount++;
encSector = *((sector->stackList) + secCount);
}
}
//
// Free Stacklists of all sectors
//
static void freeStacklists(void)
{
size_t i;
for (i = 0; i < numsectors; i++)
{
if (sectors[i].stackList)
{
free(sectors[i].stackList);
sectors[i].stackList = NULL;
}
}
}
//
// if more than half of the toptextures are missing
//
static boolean areToptexturesMissing(sector_t *thisSector)
{
linechain_t *thisElem, *nextElem = thisSector->sectorLines;
sector_t *frontSector, *backSector;
size_t nomiss = 0;
side_t *sidel, *sider;
while (nextElem) // walk through chain
{
thisElem = nextElem;
nextElem = thisElem->next;
frontSector = thisElem->line->frontsector;
backSector = thisElem->line->backsector;
if (frontSector == backSector) // skip damn renderer tricks here
continue;
if (!frontSector || !backSector)
continue;
sider = &sides[thisElem->line->sidenum[0]];
sidel = &sides[thisElem->line->sidenum[1]];
if (backSector->ceilingheight < frontSector->ceilingheight)
{
if (sider->toptexture != 0)
{
nomiss++;
break; // we can stop here if decision criterium is ==0
}
}
else if (backSector->ceilingheight > frontSector->ceilingheight)
{
if (sidel->toptexture != 0)
{
nomiss++;
break; // we can stop here if decision criterium is ==0
}
}
}
return nomiss == 0;
}
//
// are more textures missing than present?
//
static boolean areBottomtexturesMissing(sector_t *thisSector)
{
linechain_t *thisElem, *nextElem = thisSector->sectorLines;
sector_t *frontSector, *backSector;
size_t nomiss = 0;
side_t *sidel, *sider;
while (nextElem) // walk through chain
{
thisElem = nextElem;
nextElem = thisElem->next;
frontSector = thisElem->line->frontsector;
backSector = thisElem->line->backsector;
if (frontSector == backSector) // skip damn renderer tricks here
continue;
if (!frontSector || !backSector)
continue;
sider = &sides[thisElem->line->sidenum[0]];
sidel = &sides[thisElem->line->sidenum[1]];
if (backSector->floorheight > frontSector->floorheight)
{
if (sider->bottomtexture != 0)
{
nomiss++;
break; // we can stop here if decision criterium is ==0
}
}
else if (backSector->floorheight < frontSector->floorheight)
{
if (sidel->bottomtexture != 0)
{
nomiss++;
break; // we can stop here if decision criterium is ==0
}
}
}
// return missing >= nomiss;
return nomiss == 0;
}
//
// check if no adjacent sector has same ceiling height
//
static boolean isCeilingFloating(sector_t *thisSector)
{
sector_t *adjSector, *refSector = NULL, *frontSector, *backSector;
linechain_t *thisElem, *nextElem;
if (!thisSector)
return false;
nextElem = thisSector->sectorLines;
while (nextElem) // walk through chain
{
thisElem = nextElem;
nextElem = thisElem->next;
frontSector = thisElem->line->frontsector;
backSector = thisElem->line->backsector;
if (frontSector == thisSector)
adjSector = backSector;
else
adjSector = frontSector;
if (!adjSector) // assume floating sectors have surrounding sectors
return false;
#ifdef ESLOPE
if (adjSector->c_slope) // Don't bother with slopes
return false;
#endif
if (!refSector)
{
refSector = adjSector;
continue;
}
// if adjacent sector has same height or more than one adjacent sector exists -> stop
if (thisSector->ceilingheight == adjSector->ceilingheight || refSector != adjSector)
return false;
}
// now check for walltextures
if (!areToptexturesMissing(thisSector))
return false;
return true;
}
//
// check if no adjacent sector has same ceiling height
// FIXME: throw that together with isCeilingFloating??
//
static boolean isFloorFloating(sector_t *thisSector)
{
sector_t *adjSector, *refSector = NULL, *frontSector, *backSector;
linechain_t *thisElem, *nextElem;
if (!thisSector)
return false;
nextElem = thisSector->sectorLines;
while (nextElem) // walk through chain
{
thisElem = nextElem;
nextElem = thisElem->next;
frontSector = thisElem->line->frontsector;
backSector = thisElem->line->backsector;
if (frontSector == thisSector)
adjSector = backSector;
else
adjSector = frontSector;
if (!adjSector) // assume floating sectors have surrounding sectors
return false;
#ifdef ESLOPE
if (adjSector->f_slope) // Don't bother with slopes
return false;
#endif
if (!refSector)
{
refSector = adjSector;
continue;
}
// if adjacent sector has same height or more than one adjacent sector exists -> stop
if (thisSector->floorheight == adjSector->floorheight || refSector != adjSector)
return false;
}
// now check for walltextures
if (!areBottomtexturesMissing(thisSector))
return false;
return true;
}
//
// estimate ceilingheight according to height of adjacent sector
//
static fixed_t estimateCeilHeight(sector_t *thisSector)
{
sector_t *adjSector;
if (!thisSector || !thisSector->sectorLines || !thisSector->sectorLines->line)
return 0;
adjSector = thisSector->sectorLines->line->frontsector;
if (adjSector == thisSector)
adjSector = thisSector->sectorLines->line->backsector;
if (!adjSector)
return 0;
return adjSector->ceilingheight;
}
//
// estimate ceilingheight according to height of adjacent sector
//
static fixed_t estimateFloorHeight(sector_t *thisSector)
{
sector_t *adjSector;
if (!thisSector || !thisSector->sectorLines || !thisSector->sectorLines->line)
return 0;
adjSector = thisSector->sectorLines->line->frontsector;
if (adjSector == thisSector)
adjSector = thisSector->sectorLines->line->backsector;
if (!adjSector)
return 0;
return adjSector->floorheight;
}
#define CORRECT_FLOAT_EXPERIMENTAL
// --------------------------------------------------------------------------
// Some levels have missing sidedefs, which produces HOM, so lets try to compensate for that
// and some levels have deep water trick, invisible staircases etc.
// --------------------------------------------------------------------------
// FIXME: put some nice default texture in legacy.dat and use it
void HWR_CorrectSWTricks(void)
{
size_t i;
size_t k;
line_t *ld;
side_t *sidel = NULL, *sider;
sector_t *secl, *secr;
sector_t **sectorList;
sector_t *outSector;
if ((0 == cv_grcorrecttricks.value))
return;
// determine lines for sectors
for (i = 0; i < numlines; i++)
{
ld = &lines[i];
secr = ld->frontsector;
secl = ld->backsector;
if (secr == secl)
{
secr->pseudoSector = true; // special renderer trick?
addLineToChain(secr, ld);
}
else
{
addLineToChain(secr, ld);
addLineToChain(secl, ld);
}
}
// preprocessing
for (i = 0; i < numsectors; i++)
{
sector_t *checkSector;
checkSector = &sectors[i];
// identify real pseudosectors first
if (checkSector->pseudoSector)
{
if (!isPSectorValid(checkSector)) // drop invalid pseudo sectors
{
checkSector->pseudoSector = false;
}
}
// determine enclosing sectors for pseudosectors ... used later
if (checkSector->pseudoSector)
{
generateStacklist(checkSector);
calcLineouts(checkSector);
sortStacklist(checkSector);
}
}
// set virtual floor heights for pseudo sectors
// required for deep water effect e.g.
for (i = 0; i < numsectors; i++)
{
if (sectors[i].pseudoSector)
{
sectorList = sectors[i].stackList;
k = 0;
while (*(sectorList+k))
{
outSector = *(sectorList+k);
if (!outSector->pseudoSector)
{
sectors[i].virtualFloorheight = outSector->floorheight;
sectors[i].virtualCeilingheight = outSector->ceilingheight;
break;
}
k++;
}
if (*(sectorList+k) == NULL) // sorry, did not work :(
{
sectors[i].virtualFloorheight = sectors[i].floorheight;
sectors[i].virtualCeilingheight = sectors[i].ceilingheight;
}
}
}
#ifdef CORRECT_FLOAT_EXPERIMENTAL
// correct ceiling/floor heights of totally floating sectors
for (i = 0; i < numsectors; i++)
{
sector_t *floatSector;
floatSector = &sectors[i];
// correct height of floating sectors
if (isCeilingFloating(floatSector))
{
floatSector->virtualCeilingheight = estimateCeilHeight(floatSector);
floatSector->virtualCeiling = true;
}
if (isFloorFloating(floatSector))
{
floatSector->virtualFloorheight = estimateFloorHeight(floatSector);
floatSector->virtualFloor = true;
}
}
#endif
// now for the missing textures
for (i = 0; i < numlines; i++)
{
ld = &lines[i];
sider = &sides[ld->sidenum[0]];
if (ld->sidenum[1] != 0xffff)
sidel = &sides[ld->sidenum[1]];
secr = ld->frontsector;
secl = ld->backsector;
if (secr == secl) // special renderer trick
continue; // we cant correct missing textures here
if (secl) // only if there is a backsector
{
if (secr->pseudoSector || secl->pseudoSector)
continue;
if (!secr->virtualFloor && !secl->virtualFloor)
{
if (secl->floorheight > secr->floorheight)
{
// now check if r-sidedef is correct
if (sider->bottomtexture == 0)
{
if (sider->midtexture == 0)
sider->bottomtexture = 0; // Tails // More redwall sky shenanigans
else
sider->bottomtexture = sider->midtexture;
}
}
else if (secl->floorheight < secr->floorheight)
{
// now check if l-sidedef is correct
if (sidel->bottomtexture == 0)
{
if (sidel->midtexture == 0)
sidel->bottomtexture = 0; // Tails // More redwall sky shenanigans
else
sidel->bottomtexture = sidel->midtexture;
}
}
}
if (!secr->virtualCeiling && !secl->virtualCeiling)
{
if (secl->ceilingheight < secr->ceilingheight)
{
// now check if r-sidedef is correct
if (sider->toptexture == 0)
{
if (sider->midtexture == 0)
sider->toptexture = 0; // Tails // When this was REDWALL it was causing issues in the sky sometimes
else
sider->toptexture = sider->midtexture;
}
}
else if (secl->ceilingheight > secr->ceilingheight)
{
// now check if l-sidedef is correct
if (sidel->toptexture == 0)
{
if (sidel->midtexture == 0)
sidel->toptexture = 0; // Tails // When this was REDWALL it was causing issues in the sky sometimes
else
sidel->toptexture = sidel->midtexture;
}
}
}
} // if (NULL != secl)
} // for (i = 0; i < numlines; i++)
// release all linechains
releaseLineChains();
freeStacklists();
}
#endif // HWRENDER
-37
View File
@@ -567,7 +567,6 @@ static PFNglStencilFuncSeparate pglStencilFuncSeparate;
typedef void (APIENTRY *PFNglStencilOpSeparate) (GLenum, GLenum, GLenum, GLenum);
static PFNglStencilOpSeparate pglStencilOpSeparate;
#ifdef GL_SHADERS
typedef GLuint (APIENTRY *PFNglCreateShader) (GLenum);
typedef void (APIENTRY *PFNglShaderSource) (GLuint, GLsizei, const GLchar**, GLint*);
typedef void (APIENTRY *PFNglCompileShader) (GLuint);
@@ -698,7 +697,6 @@ static GLRGBAFloat shader_defaultcolor = {1.0f, 1.0f, 1.0f, 1.0f};
"gl_FragColor = texture2D(tex, gl_TexCoord[0].st) * poly_color;\n" \
"}\0"
#endif // GL_SHADERS
void SetupGLFunc4(void)
{
@@ -720,7 +718,6 @@ void SetupGLFunc4(void)
pglStencilFuncSeparate = GetGLFunc("glStencilFuncSeparate");
pglStencilOpSeparate = GetGLFunc("glStencilOpSeparate");
#ifdef GL_SHADERS
pglCreateShader = GetGLFunc("glCreateShader");
pglShaderSource = GetGLFunc("glShaderSource");
pglCompileShader = GetGLFunc("glCompileShader");
@@ -742,7 +739,6 @@ void SetupGLFunc4(void)
pglUniform2fv = GetGLFunc("glUniform2fv");
pglUniform3fv = GetGLFunc("glUniform3fv");
pglGetUniformLocation = GetGLFunc("glGetUniformLocation");
#endif
#ifdef GL_VERSION_3_0
pglGenerateMipmap = GetGLFunc("glGenerateMipmap");
@@ -751,7 +747,6 @@ void SetupGLFunc4(void)
EXPORT boolean HWRAPI(InitShaders) (void)
{
#ifdef GL_SHADERS
if (!pglUseProgram)
return false;
@@ -765,14 +760,10 @@ EXPORT boolean HWRAPI(InitShaders) (void)
}
return true;
#else
return false;
#endif
}
EXPORT void HWRAPI(LoadShader) (int slot, char *code, hwdshaderstage_t stage)
{
#ifdef GL_SHADERS
gl_shader_t *shader;
if (slot < 0 || slot >= HWR_MAXSHADERS)
@@ -794,16 +785,10 @@ EXPORT void HWRAPI(LoadShader) (int slot, char *code, hwdshaderstage_t stage)
I_Error("LoadShader: invalid shader stage");
#undef LOADSHADER
#else
(void)slot;
(void)code;
(void)stage;
#endif
}
EXPORT boolean HWRAPI(CompileShader) (int slot)
{
#ifdef GL_SHADERS
if (slot < 0 || slot >= HWR_MAXSHADERS)
I_Error("CompileShader: Invalid slot %d", slot);
@@ -816,10 +801,6 @@ EXPORT boolean HWRAPI(CompileShader) (int slot)
gl_shaders[slot].program = 0;
return false;
}
#else
(void)slot;
return false;
#endif
}
//
@@ -829,7 +810,6 @@ EXPORT boolean HWRAPI(CompileShader) (int slot)
EXPORT void HWRAPI(SetShaderInfo) (hwdshaderinfo_t info, INT32 value)
{
#ifdef GL_SHADERS
switch (info)
{
case HWD_SHADERINFO_LEVELTIME:
@@ -838,15 +818,10 @@ EXPORT void HWRAPI(SetShaderInfo) (hwdshaderinfo_t info, INT32 value)
default:
break;
}
#else
(void)info;
(void)value;
#endif
}
EXPORT void HWRAPI(SetShader) (int slot)
{
#ifdef GL_SHADERS
if (gl_allowshaders)
{
gl_shader_t *next_shader = &gl_shaders[slot]; // the gl_shader_t we are going to switch to
@@ -867,22 +842,17 @@ EXPORT void HWRAPI(SetShader) (int slot)
return;
}
#else
(void)slot;
#endif
gl_shadersenabled = false;
}
EXPORT void HWRAPI(UnSetShader) (void)
{
#ifdef GL_SHADERS
gl_shaderstate.current = NULL;
gl_shaderstate.type = 0;
gl_shaderstate.program = 0;
if (pglUseProgram)
pglUseProgram(0);
#endif
gl_shadersenabled = false;
}
@@ -1639,7 +1609,6 @@ EXPORT void HWRAPI(SetTexture) (FTextureInfo *pTexInfo)
static void Shader_SetUniforms(FSurfaceInfo *Surface, GLRGBAFloat *poly, GLRGBAFloat *tint, GLRGBAFloat *fade)
{
#ifdef GL_SHADERS
gl_shader_t *shader = gl_shaderstate.current;
if (gl_shadersenabled && (shader != NULL) && pglUseProgram)
@@ -1699,12 +1668,6 @@ static void Shader_SetUniforms(FSurfaceInfo *Surface, GLRGBAFloat *poly, GLRGBAF
#undef UNIFORM_3
#undef UNIFORM_4
}
#else
(void)Surface;
(void)poly;
(void)tint;
(void)fade;
#endif
}
static boolean Shader_CompileProgram(gl_shader_t *shader, GLint i)
+13 -22
View File
@@ -42,19 +42,17 @@
#include "p_local.h" // camera[]
#include "p_tick.h"
#ifdef HWRENDER
#include "hardware/hw_main.h"
#endif
#ifdef HAVE_BLUA
#include "lua_hud.h"
#include "lua_hudlib_drawlist.h"
#include "lua_hook.h"
#endif
#include "s_sound.h" // song credits
#include "k_kart.h"
#ifdef HWRENDER
#include "hardware/hw_main.h"
#endif
// coords are scaled
#define HU_INPUTX 0
#define HU_INPUTY 0
@@ -94,9 +92,7 @@ static boolean headsupactive = false;
boolean hu_showscores; // draw rankings
static char hu_tick;
#ifdef HAVE_BLUA
static huddrawlist_h luahuddrawlist_scores;
#endif
patch_t *rflagico;
patch_t *bflagico;
@@ -349,9 +345,7 @@ void HU_Init(void)
// set shift translation table
shiftxform = english_shiftxform;
#ifdef HAVE_BLUA
luahuddrawlist_scores = LUA_HUD_CreateDrawList();
#endif
HU_LoadGraphics();
}
@@ -887,10 +881,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, spam_eatmsg))
return;
#endif
if (spam_eatmsg)
return; // don't proceed if we were supposed to eat the message.
@@ -2425,19 +2417,18 @@ void HU_Drawer(void)
{
if (netgame || multiplayer)
{
#ifdef HAVE_BLUA
if (LUA_HudEnabled(hud_rankings))
#endif
HU_DrawRankings();
#ifdef HAVE_BLUA
if (renderisnewtic)
{
LUA_HUD_ClearDrawList(luahuddrawlist_scores);
LUAh_ScoresHUD(luahuddrawlist_scores);
}
LUA_HUD_DrawList(luahuddrawlist_scores);
#endif
if (renderisnewtic)
{
LUA_HUD_ClearDrawList(luahuddrawlist_scores);
LUAh_ScoresHUD(luahuddrawlist_scores);
}
LUA_HUD_DrawList(luahuddrawlist_scores);
}
if (demo.playback)
{
HU_DrawDemoInfo();
+17 -79
View File
@@ -2227,7 +2227,6 @@ void K_SpinPlayer(player_t *player, mobj_t *source, INT32 type, mobj_t *inflicto
{
UINT8 scoremultiply = 1;
// PS: Inflictor is unused for all purposes here and is actually only ever relevant to Lua. It may be nil too.
#ifdef HAVE_BLUA
boolean force = false; // Used to check if Lua ShouldSpin should get us damaged reguardless of flashtics or heck knows what.
UINT8 shouldForce = LUAh_ShouldSpin(player, inflictor, source);
if (P_MobjWasRemoved(player->mo))
@@ -2236,11 +2235,6 @@ void K_SpinPlayer(player_t *player, mobj_t *source, INT32 type, mobj_t *inflicto
force = true;
else if (shouldForce == 2)
return;
#else
static const boolean force = false;
(void)inflictor; // in case some weirdo doesn't want Lua.
#endif
if (!trapitem && G_BattleGametype())
{
@@ -2264,10 +2258,8 @@ void K_SpinPlayer(player_t *player, mobj_t *source, INT32 type, mobj_t *inflicto
}
}
#ifdef HAVE_BLUA
if (LUAh_PlayerSpin(player, inflictor, source)) // Let Lua do its thing or overwrite if it wants to. Make sure to let any possible instashield happen because we didn't get "damaged" in this case.
return;
#endif
if (source && source != player->mo && source->player)
K_PlayHitEmSound(source);
@@ -2373,7 +2365,6 @@ void K_SquishPlayer(player_t *player, mobj_t *source, mobj_t *inflictor)
{
UINT8 scoremultiply = 1;
// PS: Inflictor is unused for all purposes here and is actually only ever relevant to Lua. It may be nil too.
#ifdef HAVE_BLUA
boolean force = false; // Used to check if Lua ShouldSquish should get us damaged reguardless of flashtics or heck knows what.
UINT8 shouldForce = LUAh_ShouldSquish(player, inflictor, source);
if (P_MobjWasRemoved(player->mo))
@@ -2382,10 +2373,6 @@ void K_SquishPlayer(player_t *player, mobj_t *source, mobj_t *inflictor)
force = true;
else if (shouldForce == 2)
return;
#else
static const boolean force = false;
(void)inflictor; // Please stop forgetting to put inflictor in yer functions thank -Lat'
#endif
if (G_BattleGametype())
{
@@ -2409,10 +2396,8 @@ void K_SquishPlayer(player_t *player, mobj_t *source, mobj_t *inflictor)
}
}
#ifdef HAVE_BLUA
if (LUAh_PlayerSquish(player, inflictor, source)) // Let Lua do its thing or overwrite if it wants to. Make sure to let any possible instashield happen because we didn't get "damaged" in this case.
return;
#endif
player->kartstuff[k_sneakertimer] = 0;
player->kartstuff[k_driftboost] = 0;
@@ -2491,7 +2476,6 @@ void K_ExplodePlayer(player_t *player, mobj_t *source, mobj_t *inflictor) // A b
{
fixed_t upgoer;
UINT8 scoremultiply = 1;
#ifdef HAVE_BLUA
boolean force = false; // Used to check if Lua ShouldExplode should get us damaged reguardless of flashtics or heck knows what.
UINT8 shouldForce = LUAh_ShouldExplode(player, inflictor, source);
@@ -2502,10 +2486,6 @@ void K_ExplodePlayer(player_t *player, mobj_t *source, mobj_t *inflictor) // A b
else if (shouldForce == 2)
return;
#else
static const boolean force = false;
#endif
if (G_BattleGametype())
{
if (K_IsPlayerWanted(player))
@@ -2528,10 +2508,8 @@ void K_ExplodePlayer(player_t *player, mobj_t *source, mobj_t *inflictor) // A b
}
}
#ifdef HAVE_BLUA
if (LUAh_PlayerExplode(player, inflictor, source)) // Same thing. Also make sure to let Instashield happen blah blah
return;
#endif
if (source && source != player->mo && source->player)
K_PlayHitEmSound(source);
@@ -7616,13 +7594,10 @@ static void K_drawKartStats(void)
if (stplyr == &players[displayplayers[splitnum]])
break;
}
#ifdef HAVE_BLUA
if (!LUA_HudEnabled(hud_statdisplay))
return;
#endif
// I tried my best, but this is still mess :/
if (splitscreen)
{
@@ -8364,10 +8339,8 @@ static boolean K_drawKartPositionFaces(void)
if (numplayersingame <= 1)
return true;
#ifdef HAVE_BLUA
if (!LUA_HudEnabled(hud_minirankings))
return false; // Don't proceed but still return true for free play above if HUD is disabled.
#endif
for (j = 0; j < numplayersingame; j++)
{
@@ -8391,9 +8364,6 @@ static boolean K_drawKartPositionFaces(void)
if (players+i == stplyr)
strank = ranklines;
//if (ranklines == 5)
//break; // Only draw the top 5 players -- we do this a different way now...
ranklines++;
}
@@ -8445,10 +8415,8 @@ static boolean K_drawKartPositionFaces(void)
V_DrawMappedPatch(FACE_X, Y, V_HUDTRANS|V_SNAPTOLEFT, R_GetSkinFaceRank(p), colormap);
}
#ifdef HAVE_BLUA
if (LUA_HudEnabled(hud_battlebumpers))
{
#endif
if (G_BattleGametype() && players[rankplayer[i]].kartstuff[k_bumper] > 0)
{
V_DrawMappedPatch(bumperx-2, Y, V_HUDTRANS|V_SNAPTOLEFT, kp_tinybumper[0], colormap);
@@ -8458,9 +8426,7 @@ static boolean K_drawKartPositionFaces(void)
V_DrawMappedPatch(bumperx, Y, V_HUDTRANS|V_SNAPTOLEFT, kp_tinybumper[1], colormap);
}
}
#ifdef HAVE_BLUA
} // A new level of stupidity: checking if lua is enabled to close a bracket. :Fascinating:
#endif
}
if (i == strank)
@@ -9687,10 +9653,9 @@ static void K_drawBattleFullscreen(void)
INT32 splitflags = V_SNAPTOTOP; // I don't feel like properly supporting non-green resolutions, so you can have a misuse of SNAPTO instead
fixed_t scale = FRACUNIT;
boolean drawcomebacktimer = true; // lazy hack because it's cleaner in the long run.
#ifdef HAVE_BLUA
if (!LUA_HudEnabled(hud_battlecomebacktimer))
drawcomebacktimer = false;
#endif
if (splitscreen)
{
@@ -9802,9 +9767,7 @@ static void K_drawBattleFullscreen(void)
return;
}
#ifdef HAVE_BLUA
if (LUA_HudEnabled(hud_freeplay))
#endif
K_drawKartFreePlay(leveltime);
}
}
@@ -10291,50 +10254,41 @@ void K_drawKartHUD(void)
if (!demo.title && (!battlefullscreen || splitscreen))
{
// Draw the CHECK indicator before the other items, so it's overlapped by everything else
#ifdef HAVE_BLUA
if (LUA_HudEnabled(hud_check)) // delete lua when?
#endif
{
if (cv_kartcheck.value && !splitscreen && !players[displayplayers[0]].exiting && !freecam)
K_drawKartPlayerCheck();
}
// Draw WANTED status
if (G_BattleGametype())
{
#ifdef HAVE_BLUA
if (LUA_HudEnabled(hud_wanted))
#endif
K_drawKartWanted();
}
if (cv_kartminimap.value)
{
#ifdef HAVE_BLUA
if (LUA_HudEnabled(hud_minimap))
#endif
K_drawKartMinimap();
}
}
if (battlefullscreen && !freecam)
{
#ifdef HAVE_BLUA
if (LUA_HudEnabled(hud_battlefullscreen))
#endif
K_drawBattleFullscreen();
return;
}
// Draw the item window
#ifdef HAVE_BLUA
if (LUA_HudEnabled(hud_item) && !freecam)
#endif
K_drawKartItem();
K_drawKartItem();
if (cv_nametag.value)
{
#ifdef HAVE_BLUA
if (LUA_HudEnabled(hud_nametags))
#endif
K_drawNameTags();
}
@@ -10342,17 +10296,13 @@ void K_drawKartHUD(void)
if (!splitscreen && !demo.title)
{
// Draw the timestamp
#ifdef HAVE_BLUA
if (LUA_HudEnabled(hud_time))
#endif
K_drawKartTimestamp(stplyr->realtime, TIME_X, TIME_Y, gamemap, 0);
if (!modeattacking)
{
// The top-four faces on the left
/*#ifdef HAVE_BLUA
if (LUA_HudEnabled(hud_minirankings))
#endif*/
//if (LUA_HudEnabled(hud_minirankings))
isfreeplay = K_drawKartPositionFaces();
}
}
@@ -10360,16 +10310,16 @@ void K_drawKartHUD(void)
if (!stplyr->spectator && !demo.freecam) // Bottom of the screen elements, don't need in spectate mode
{
if (!(splitscreen || demo.title))
#ifdef HAVE_BLUA
{
if (LUA_HudEnabled(hud_position))
#endif
K_drawInput();
}
if (!demo.title && cv_showstats.value)
#ifdef HAVE_BLUA
if (LUA_HudEnabled(hud_statdisplay))
#endif
K_drawKartStats();
{
if (LUA_HudEnabled(hud_statdisplay))
K_drawKartStats();
}
if (demo.title) // Draw title logo instead in demo.titles
{
@@ -10396,19 +10346,15 @@ void K_drawKartHUD(void)
else if (G_RaceGametype()) // Race-only elements
{
// Draw the lap counter
#ifdef HAVE_BLUA
if (LUA_HudEnabled(hud_gametypeinfo))
#endif
K_drawKartLaps();
if (!splitscreen)
{
// Draw the speedometer
// TODO: Make a better speedometer.
#ifdef HAVE_BLUA
if (LUA_HudEnabled(hud_speedometer))
#endif
K_drawKartSpeedometer();
// TODO: Make a better speedometer. << done :p
if (LUA_HudEnabled(hud_speedometer))
K_drawKartSpeedometer();
}
if (isfreeplay)
@@ -10416,26 +10362,20 @@ void K_drawKartHUD(void)
else if (!modeattacking)
{
// Draw the numerical position
#ifdef HAVE_BLUA
if (LUA_HudEnabled(hud_position))
#endif
K_DrawKartPositionNum(stplyr->kartstuff[k_position]);
}
else //if (!(demo.playback && hu_showscores))
{
// Draw the input UI
#ifdef HAVE_BLUA
if (LUA_HudEnabled(hud_position))
#endif
K_drawInput();
}
}
else if (G_BattleGametype()) // Battle-only
{
// Draw the hits left!
#ifdef HAVE_BLUA
if (LUA_HudEnabled(hud_gametypeinfo))
#endif
K_drawKartBumpersOrKarma();
}
}
@@ -10479,9 +10419,7 @@ void K_drawKartHUD(void)
// Draw FREE PLAY.
if (isfreeplay && !stplyr->spectator && timeinmap > 113)
{
#ifdef HAVE_BLUA
if (LUA_HudEnabled(hud_freeplay))
#endif
K_drawKartFreePlay(leveltime);
}
+1 -4
View File
@@ -11,7 +11,6 @@
/// \brief basic functions for Lua scripting
#include "doomdef.h"
#ifdef HAVE_BLUA
#include "p_local.h"
#include "p_setup.h" // So we can have P_SetupLevelSky
#include "p_slopes.h" // P_GetZAt
@@ -3267,6 +3266,4 @@ int LUA_BaseLib(lua_State *L)
lua_pushvalue(L, LUA_GLOBALSINDEX);
luaL_register(L, NULL, lib);
return 0;
}
#endif
}
+1 -4
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"
@@ -257,6 +256,4 @@ int LUA_BlockmapLib(lua_State *L)
{
lua_register(L, "searchBlockmap", lib_searchBlockmap);
return 0;
}
#endif
}
+1 -4
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"
@@ -600,6 +599,4 @@ int LUA_ConsoleLib(lua_State *L)
lua_pushvalue(L, LUA_GLOBALSINDEX);
luaL_register(L, NULL, lib);
return 0;
}
#endif
}
+1 -5
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,6 +110,4 @@ boolean LUAh_PlayerCmd(player_t *player, ticcmd_t *cmd); // Allows to write to p
void LUAh_IntermissionThinker(void); // Hook for Y_Ticker
void LUAh_VoteThinker(void); // Hook for Y_VoteTicker
#define LUAh_PlayerThink(player) LUAh_PlayerHook(player, hook_PlayerThink) // Hook for P_PlayerThink
#endif
#define LUAh_PlayerThink(player) LUAh_PlayerHook(player, hook_PlayerThink) // Hook for P_PlayerThink
+1 -4
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"
@@ -1740,6 +1739,4 @@ boolean LUAh_PlayerExplode(player_t *player, mobj_t *inflictor, mobj_t *source)
}
lua_settop(gL, 0);
return hooked;
}
#endif
}
+1 -4
View File
@@ -12,7 +12,6 @@
#include "doomdef.h"
#include "fastcmp.h"
#ifdef HAVE_BLUA
#include "r_defs.h"
#include "r_local.h"
#include "st_stuff.h" // hudinfo[]
@@ -1412,6 +1411,4 @@ void LUAh_VoteHUD(huddrawlist_h list)
lua_pushlightuserdata(gL, NULL);
lua_setfield(gL, LUA_REGISTRYINDEX, "HUD_DRAW_LIST");
}
#endif
}
+1 -4
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"
@@ -984,6 +983,4 @@ int LUA_InfoLib(lua_State *L)
lua_setglobal(L, "S_sfx");
lua_setglobal(L, "sfxinfo");
return 0;
}
#endif
}
+1 -5
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"
@@ -70,6 +68,4 @@ int LUA_SkinLib(lua_State *L);
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
int LUA_HudLib(lua_State *L);
+1 -4
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"
@@ -1689,6 +1688,4 @@ int LUA_MapLib(lua_State *L)
lua_setmetatable(L, -2);
lua_setglobal(L, "mapheaderinfo");
return 0;
}
#endif
}
+1 -4
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"
@@ -228,6 +227,4 @@ int LUA_MathLib(lua_State *L)
lua_pushvalue(L, LUA_GLOBALSINDEX);
luaL_register(L, NULL, lib);
return 0;
}
#endif
}
+1 -4
View File
@@ -13,7 +13,6 @@
#include <stddef.h>
#include "doomdef.h"
#ifdef HAVE_BLUA
#include "fastcmp.h"
#include "r_things.h"
#include "r_main.h"
@@ -926,6 +925,4 @@ int LUA_MobjLib(lua_State *L)
lua_setmetatable(L, -2);
lua_setglobal(L, "mapthings");
return 0;
}
#endif
}
+1 -4
View File
@@ -11,7 +11,6 @@
/// \brief player object library for Lua scripting
#include "doomdef.h"
#ifdef HAVE_BLUA
#include "fastcmp.h"
#include "r_main.h"
#include "r_things.h"
@@ -820,6 +819,4 @@ int LUA_PlayerLib(lua_State *L)
lua_setglobal(L, "displayplayers");
return 0;
}
#endif
}
+1 -4
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"
@@ -1688,6 +1687,4 @@ int Lua_optoption(lua_State *L, int narg,
if (fastcmp(lst[i], name))
return i;
return -1;
}
#endif // HAVE_BLUA
}
-4
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"
@@ -95,5 +93,3 @@ void COM_Lua_f(void);
CONS_Alert(CONS_WARNING,"%s\n", warningmsg);\
}\
}
#endif
+1 -4
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_things.h"
#include "sounds.h"
@@ -273,6 +272,4 @@ int LUA_SkinLib(lua_State *L)
lua_setglobal(L, "skins");
return 0;
}
#endif
}
+1 -4
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"
@@ -131,6 +130,4 @@ int LUA_ThinkerLib(lua_State *L)
lua_setfield(L, -2, "iterate");
lua_setglobal(L, "thinkers");
return 0;
}
#endif
}
+1 -5
View File
@@ -1,8 +1,6 @@
#ifndef __LUA_UDATALIB_H__
#define __LUA_UDATALIB_H__
#ifdef HAVE_BLUA
#include "doomdef.h"
#include "lua_script.h"
#include "lua_libs.h"
@@ -102,6 +100,4 @@ void udatalib_addfields(lua_State *L, int mt, const udata_field_t fields[]);
return 0; \
}
#endif
#endif
#endif
+1 -3
View File
@@ -647,7 +647,7 @@ void Command_CauseCfail_f(void)
}
#endif
#if defined(HAVE_BLUA) && defined(LUA_ALLOW_BYTECODE)
#if defined(LUA_ALLOW_BYTECODE)
void Command_Dumplua_f(void)
{
if (modifiedgame)
@@ -891,9 +891,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);
+1 -1
View File
@@ -67,7 +67,7 @@ void Command_Weather_f(void);
#ifdef _DEBUG
void Command_CauseCfail_f(void);
#endif
#if defined(HAVE_BLUA) && defined(LUA_ALLOW_BYTECODE)
#if defined(LUA_ALLOW_BYTECODE)
void Command_Dumplua_f(void);
#endif
+23 -17
View File
@@ -1411,31 +1411,39 @@ static menuitem_t OP_ColorOptionsMenu[] =
static menuitem_t OP_ExpOptionsMenu[] =
{
{IT_HEADER, NULL, "Experimental Options", NULL, 10},
{IT_STRING | IT_CVAR, NULL, "Weather Interpolation", &cv_precipinterp, 25},
{IT_STRING | IT_CVAR, NULL, "Less Weather Effects", &cv_lessprecip, 35},
{IT_STRING|IT_CVAR, NULL, "Interpolation Distance", &cv_grmaxinterpdist, 25},
{IT_STRING|IT_CVAR, NULL, "Mobj Subsector Interpolation", &cv_mobjssector, 35},
{IT_STRING | IT_CVAR, NULL, "Weather Interpolation", &cv_precipinterp, 45},
{IT_STRING | IT_CVAR, NULL, "Less Weather Effects", &cv_lessprecip, 55},
{IT_STRING | IT_CVAR, NULL, "VHS effect", &cv_vhseffect, 55},
{IT_STRING | IT_CVAR, NULL, "VHS effect", &cv_vhseffect, 75},
{IT_STRING | IT_CVAR, NULL, "FFloorclip", &cv_ffloorclip, 75},
{IT_STRING | IT_CVAR, NULL, "Spriteclip", &cv_spriteclip, 85},
{IT_STRING | IT_CVAR, NULL, "Clipping R_PointToAngle Version", &cv_pointoangleexor64, 85},
{IT_STRING | IT_CVAR, NULL, "FFloorclip", &cv_ffloorclip, 95},
{IT_STRING | IT_CVAR, NULL, "Spriteclip", &cv_spriteclip, 105},
#ifdef HWRENDER
{IT_STRING | IT_CVAR, NULL, "Screen Textures", &cv_grscreentextures, 75},
{IT_STRING | IT_CVAR, NULL, "Screen Textures", &cv_grscreentextures, 95},
{IT_STRING | IT_CVAR, NULL, "Palette Depth", &cv_grpalettedepth, 85},
{IT_STRING | IT_CVAR, NULL, "Palette Depth", &cv_grpalettedepth, 105},
{IT_STRING | IT_CVAR, NULL, "Splitwall/Slope texture fix", &cv_splitwallfix, 125},
{IT_STRING | IT_CVAR, NULL, "Slope midtexture peg fix", &cv_slopepegfix, 135},
{IT_STRING | IT_CVAR, NULL, "ZFighting fix for fofs", &cv_fofzfightfix, 145},
{IT_STRING | IT_CVAR, NULL, "FOF wall cutoff for slopes", &cv_grfofcut, 155},
{IT_STRING | IT_CVAR, NULL, "Splitwall/Slope texture fix", &cv_splitwallfix, 105},
{IT_STRING | IT_CVAR, NULL, "Slope midtexture peg fix", &cv_slopepegfix, 115},
{IT_STRING | IT_CVAR, NULL, "ZFighting fix for fofs", &cv_fofzfightfix, 125},
{IT_STRING | IT_CVAR, NULL, "FOF wall cutoff for slopes", &cv_grfofcut, 135},
#endif
};
static const char* OP_ExpTooltips[] =
{
NULL,
"How far Mobj interpolation should take effect.",
"Toggles Mobj Subsector Interpolation.",
"Should weather be interpolated? Weather should look about the\nsame but perform a bit better when disabled.",
"When weather is on this will cut the object amount used in half.",
"Show a VHS-like effect when the game is paused\n or youre rewinding replays.",
"Which version of R_PointToAngle should\nbe used for Sector Clipping?\n64 may fix rendering issues on larger maps\nat the cost of performance.",
"Hides 3DFloors which are not visible\npotentially resulting in a performance boost.",
"Hides Sprites which are not visible\npotentially resulting in a performance boost.",
#ifdef HWRENDER
@@ -1451,9 +1459,12 @@ static const char* OP_ExpTooltips[] =
enum
{
op_exp_header,
op_exp_interpdist,
op_exp_mobjssector,
op_exp_precipinter,
op_exp_lessprecip,
op_exp_vhs,
op_exp_angleshit,
op_exp_ffclip,
op_exp_sprclip,
#ifdef HWRENDER
@@ -6513,13 +6524,8 @@ static void M_HandleAddons(INT32 choice)
case EXT_CFG:
M_AddonExec(KEY_ENTER);
break;
case EXT_LUA:
#ifndef HAVE_BLUA
S_StartSound(NULL, sfx_s26d);
M_StartMessage(va("%c%s\x80\nThis version of SRB2Kart does not\nhave 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
// else intentional fallthrough
case EXT_LUA:
case EXT_SOC:
case EXT_WAD:
#ifdef USE_KART
+186 -549
View File
File diff suppressed because it is too large. Load diff
+3 -116
View File
@@ -288,43 +288,12 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
if (special->flags & MF_BOSS && special->flags2 & MF2_FRET)
return;
#ifdef HAVE_BLUA
if (LUAh_TouchSpecial(special, toucher) || P_MobjWasRemoved(special))
return;
#endif
if (special->flags & MF_BOSS)
{
/*if (special->type == MT_BLACKEGGMAN)
{
P_DamageMobj(toucher, special, special, 1); // ouch
return;
}
if (((player->pflags & PF_NIGHTSMODE) && (player->pflags & PF_DRILLING))
|| (player->pflags & (PF_JUMPED|PF_SPINNING|PF_GLIDING))
|| player->powers[pw_invulnerability] || player->powers[pw_super]) // Do you possess the ability to subdue the object?
{
if (P_MobjFlip(toucher)*toucher->momz < 0)
toucher->momz = -toucher->momz;
toucher->momx = -toucher->momx;
toucher->momy = -toucher->momy;
P_DamageMobj(special, toucher, toucher, 1);
}
else if (((toucher->z < special->z && !(toucher->eflags & MFE_VERTICALFLIP))
|| (toucher->z + toucher->height > special->z + special->height && (toucher->eflags & MFE_VERTICALFLIP)))
&& player->charability == CA_FLY
&& (player->powers[pw_tailsfly]
|| (toucher->state >= &states[S_PLAY_SPC1] && toucher->state <= &states[S_PLAY_SPC4]))) // Tails can shred stuff with his propeller.
{
toucher->momz = -toucher->momz/2;
P_DamageMobj(special, toucher, toucher, 1);
}
// SRB2kart - Removed: No more fly states
else*/
P_DamageMobj(toucher, special, special, 1);
P_DamageMobj(toucher, special, special, 1);
return;
}
else if ((special->flags & MF_ENEMY) && !(special->flags & MF_MISSILE)
@@ -2163,10 +2132,8 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source)
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) || P_MobjWasRemoved(target))
return;
#endif
// SRB2kart
// I wish I knew a better way to do this
@@ -3129,11 +3096,7 @@ static void P_RingDamage(player_t *player, mobj_t *inflictor, mobj_t *source, IN
boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage)
{
player_t *player;
#ifdef HAVE_BLUA
boolean force = false;
#else
static const boolean force = false;
#endif
if (objectplacing)
return false;
@@ -3153,7 +3116,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)
{
@@ -3165,7 +3127,6 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
else if (shouldForce == 2)
return false;
}
#endif
if (!force)
{
@@ -3199,10 +3160,8 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
if (!force && target->fuse) // Invincible
return false;
#ifdef HAVE_BLUA
if (LUAh_MobjDamage(target, inflictor, source, damage) || P_MobjWasRemoved(target))
return true;
#endif
if (target->health > 1)
{
@@ -3227,21 +3186,17 @@ 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) || P_MobjWasRemoved(target))
return true;
#endif
if (target->health > 1)
target->flags2 |= MF2_FRET;
}
#ifdef HAVE_BLUA
else if (target->flags & MF_ENEMY)
{
if (LUAh_MobjDamage(target, inflictor, source, damage) || P_MobjWasRemoved(target))
return true;
}
#endif
player = target->player;
@@ -3267,18 +3222,16 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|| (G_GametypeHasTeams() && target->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))
return true;
#endif
P_NiGHTSDamage(target, source); // -5s :(
return true;
}
#ifdef HAVE_BLUA // Add this back here for ACTUAL NORMAL DAMAGE. The funny shit is that the player is barely ever "actually" damaged.
if (LUAh_MobjDamage(target, inflictor, source, damage))
return true;
#endif
if (!force && inflictor && (inflictor->flags & MF_FIRE))
{
@@ -3341,72 +3294,6 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
}
return true;
}
/* // SRB2kart - don't need these
else if (metalrecording)
{
if (!inflictor)
inflictor = source;
if (inflictor && inflictor->flags & MF_ENEMY)
{ // Metal Sonic destroy enemy !!
P_KillMobj(inflictor, NULL, target);
return false;
}
else if (inflictor && inflictor->flags & MF_MISSILE)
return false; // Metal Sonic walk through flame !!
else
{ // Oh no! Metal Sonic is hit !!
P_ShieldDamage(player, inflictor, source, damage);
return true;
}
}
else if (player->powers[pw_invulnerability] || player->powers[pw_flashing] // ignore bouncing & such in invulnerability
|| (player->powers[pw_super] && !(ALL7EMERALDS(player->powers[pw_emeralds]) && inflictor && ((inflictor->flags & MF_MISSILE) || inflictor->player))))
{
if (force || (inflictor && (inflictor->flags & MF_MISSILE)
&& (inflictor->flags2 & MF2_SUPERFIRE)
&& player->powers[pw_super]))
{
#ifdef HAVE_BLUA
if (!LUAh_MobjDamage(target, inflictor, source, damage))
#endif
P_SuperDamage(player, inflictor, source, damage);
return true;
}
else
return false;
}
#ifdef HAVE_BLUA
else if (LUAh_MobjDamage(target, inflictor, source, damage))
return true;
#endif
else if (!player->powers[pw_super] && (player->powers[pw_shield] || player->bot)) //If One-Hit Shield
{
P_ShieldDamage(player, inflictor, source, damage);
damage = 0;
}
else if (player->mo->health > 1) // No shield but have rings.
{
damage = player->mo->health - 1;
P_RingDamage(player, inflictor, source, damage);
}
else // No shield, no rings, no invincibility.
{
// To reduce griefing potential, don't allow players to be killed
// by friendly fire. Spilling their rings and other items is enough.
if (force || !(G_GametypeHasTeams()
&& source && source->player && (source->player->ctfteam == player->ctfteam)
&& cv_friendlyfire.value))
{
damage = 1;
P_KillPlayer(player, source, damage);
}
else
{
damage = 0;
P_ShieldDamage(player, inflictor, source, damage);
}
}
*/
if (inflictor && ((inflictor->flags & MF_MISSILE) || inflictor->player) && player->powers[pw_super] && ALL7EMERALDS(player->powers[pw_emeralds]))
{
-9
View File
@@ -596,7 +596,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))
@@ -615,7 +614,6 @@ static boolean PIT_CheckThing(mobj_t *thing)
else if (shouldCollide == 2)
return true; // force no collide
}
#endif
// When solid spikes move, assume they just popped up and teleport things on top of them to hurt.
if (tmthing->type == MT_SPIKE && tmthing->flags & MF_SOLID)
@@ -3931,13 +3929,6 @@ static boolean PIT_ChangeSector(mobj_t *thing, boolean realcrush)
topheight = *rover->topheight;
bottomheight = *rover->bottomheight;
/*#ifdef ESLOPE
if (rover->t_slope)
topheight = P_GetZAt(rover->t_slope, thing->x, thing->y);
if (rover->b_slope)
bottomheight = P_GetZAt(rover->b_slope, thing->x, thing->y);
#endif*/
delta1 = thing->z - (bottomheight + topheight)/2;
delta2 = thingtop - (bottomheight + topheight)/2;
if (bottomheight <= thing->ceilingz && abs(delta1) >= abs(delta2))
-16
View File
@@ -546,22 +546,6 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
texheight = textures[texnum]->height << FRACBITS;
// Set texbottom and textop to the Z coordinates of the texture's boundaries
#if 0 // #ifdef POLYOBJECTS
// don't remove this code unless solid midtextures
// on non-solid polyobjects should NEVER happen in the future
if (linedef->polyobj && (linedef->polyobj->flags & POF_TESTHEIGHT)) {
if (linedef->flags & ML_EFFECT5 && !side->repeatcnt) { // "infinite" repeat
texbottom = back->floorheight + side->rowoffset;
textop = back->ceilingheight + side->rowoffset;
} else if (!!(linedef->flags & ML_DONTPEGBOTTOM) ^ !!(linedef->flags & ML_EFFECT3)) {
texbottom = back->floorheight + side->rowoffset;
textop = texbottom + texheight*(side->repeatcnt+1);
} else {
textop = back->ceilingheight + side->rowoffset;
texbottom = textop - texheight*(side->repeatcnt+1);
}
} else
#endif
{
if (linedef->flags & ML_EFFECT5 && !side->repeatcnt) { // "infinite" repeat
texbottom = openbottom + side->rowoffset;
+10 -36
View File
@@ -63,9 +63,8 @@ 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;
@@ -220,9 +219,8 @@ 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.
@@ -288,9 +286,8 @@ 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;
@@ -6414,12 +6411,12 @@ void P_MobjThinker(mobj_t *mobj)
// Special thinker for scenery objects
if (mobj->flags & MF_SCENERY)
{
#ifdef HAVE_BLUA
if (LUAh_MobjThinker(mobj))
return;
if (P_MobjWasRemoved(mobj))
return;
#endif
switch (mobj->type)
{
case MT_HOOP:
@@ -7120,10 +7117,8 @@ void P_MobjThinker(mobj_t *mobj)
mobj->fuse--;
if (!mobj->fuse)
{
#ifdef HAVE_BLUA
if (!LUAh_MobjFuse(mobj))
#endif
P_RemoveMobj(mobj);
P_RemoveMobj(mobj);
return;
}
}
@@ -7134,7 +7129,6 @@ void P_MobjThinker(mobj_t *mobj)
return;
}
#ifdef HAVE_BLUA
// Check for a Lua thinker first
if (!mobj->player)
{
@@ -7148,7 +7142,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))
@@ -7166,7 +7160,6 @@ void P_MobjThinker(mobj_t *mobj)
}
else if (mobj->flags & MF_BOSS)
{
#ifdef HAVE_BLUA
if (LUAh_BossThinker(mobj))
{
if (P_MobjWasRemoved(mobj))
@@ -7175,23 +7168,13 @@ void P_MobjThinker(mobj_t *mobj)
else if (P_MobjWasRemoved(mobj))
return;
else
#endif
switch (mobj->type)
{
case MT_EGGMOBILE:
if (mobj->health < mobj->info->damage+1 && leveltime & 1 && mobj->health > 0)
P_SpawnMobj(mobj->x, mobj->y, mobj->z, MT_SMOKE);
if (mobj->flags2 & MF2_SKULLFLY)
#if 1
P_SpawnGhostMobj(mobj);
#else
{
mobj_t *spawnmobj;
spawnmobj = P_SpawnMobj(mobj->x, mobj->y, mobj->z, mobj->info->painchance);
P_SetTarget(&spawnmobj->target, mobj);
spawnmobj->color = SKINCOLOR_GREY;
}
#endif
P_Boss1Thinker(mobj);
break;
case MT_EGGMOBILE2:
@@ -9141,9 +9124,7 @@ void P_MobjThinker(mobj_t *mobj)
fixed_t x, y, z;
mobj_t *flagmo, *newmobj;
#ifdef HAVE_BLUA
if (!LUAh_MobjFuse(mobj) && !P_MobjWasRemoved(mobj))
#endif
switch (mobj->type)
{
// gargoyle and snowman handled in P_PushableThinker, not here
@@ -9730,7 +9711,6 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
mobj->colorized = false;
#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))
@@ -9741,7 +9721,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_CYBRAKDEMON_NAPALM_BOMB_LARGE:
@@ -10063,9 +10042,8 @@ 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!
@@ -10178,9 +10156,8 @@ mobj_t *P_SpawnShadowMobj(mobj_t * caster)
{
var1 = st->var1;
var2 = st->var2;
#ifdef HAVE_BLUA
astate = st;
#endif
st->action.acp1(mobj);
// DANGER! This is the ONLY way for P_SpawnMobj to return NULL!
// Avoid using MF_RUNSPAWNFUNC on mobjs whose spawn state expects target or tracer to already be set!
@@ -10277,16 +10254,13 @@ 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 &&
+2 -5
View File
@@ -3487,10 +3487,8 @@ void P_SaveNetGame(void)
P_NetArchiveThinkers();
P_NetArchiveSpecials();
}
#ifdef HAVE_BLUA
LUA_Archive();
#endif
LUA_Archive();
WRITEUINT8(save_p, 0x1d); // consistency marker
}
@@ -3531,9 +3529,8 @@ 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());
-128
View File
@@ -752,15 +752,6 @@ static void P_LoadRawSectors(UINT8 *data, size_t i)
ss->floorspeed = 0;
ss->ceilspeed = 0;
#ifdef HWRENDER // ----- for special tricks with HW renderer -----
ss->pseudoSector = false;
ss->virtualFloor = false;
ss->virtualCeiling = false;
ss->sectorLines = NULL;
ss->stackList = NULL;
ss->lineoutLength = -1.0l;
#endif // ----- end special tricks -----
}
// set the sky flat num
@@ -2246,42 +2237,6 @@ static void P_LoadRawReject(UINT8 *data, size_t count, const char *lumpname)
}
}
#if 0
static char *levellumps[] =
{
"label", // ML_LABEL, A separator, name, MAPxx
"THINGS", // ML_THINGS, Enemies, items..
"LINEDEFS", // ML_LINEDEFS, Linedefs, from editing
"SIDEDEFS", // ML_SIDEDEFS, Sidedefs, from editing
"VERTEXES", // ML_VERTEXES, Vertices, edited and BSP splits generated
"SEGS", // ML_SEGS, Linesegs, from linedefs split by BSP
"SSECTORS", // ML_SSECTORS, Subsectors, list of linesegs
"NODES", // ML_NODES, BSP nodes
"SECTORS", // ML_SECTORS, Sectors, from editing
"REJECT", // ML_REJECT, LUT, sector-sector visibility
};
/** Checks a lump and returns whether it is a valid start-of-level marker.
*
* \param lumpnum Lump number to check.
* \return True if the lump is a valid level marker, false if not.
*/
static inline boolean P_CheckLevel(lumpnum_t lumpnum)
{
UINT16 file, lump;
size_t i;
for (i = ML_THINGS; i <= ML_REJECT; i++)
{
file = WADFILENUM(lumpnum);
lump = LUMPNUM(lumpnum+1);
if (file > numwadfiles || lump < LUMPNUM(lumpnum) || lump > wadfiles[file]->numlumps ||
memcmp(wadfiles[file]->lumpinfo[lump].name, levellumps[i], 8) != 0)
return false;
}
return true; // all right
}
#endif
/** Sets up a sky texture to use for the level.
* The sky texture is used instead of F_SKY1.
@@ -2365,15 +2320,7 @@ static void P_LevelInitStuff(void)
for (i = 0; i < MAXPLAYERS; i++)
{
#if 0
if ((netgame || multiplayer) && (gametype == GT_COMPETITION || players[i].lives <= 0))
{
// In Co-Op, replenish a user's lives if they are depleted.
players[i].lives = cv_startinglives.value;
}
#else
players[i].lives = 1; // SRB2Kart
#endif
players[i].realtime = racecountdown = exitcountdown = 0;
curlap = bestlap = 0; // SRB2Kart
@@ -2697,47 +2644,6 @@ static void P_LoadRecordGhosts(void)
free(gpath);
}
/*static void P_LoadNightsGhosts(void)
{
const size_t glen = strlen(srb2home)+1+strlen("replay")+1+strlen(timeattackfolder)+1+strlen("MAPXX")+1;
char *gpath = malloc(glen);
if (!gpath)
return;
sprintf(gpath,"%s"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s", srb2home, timeattackfolder, G_BuildMapName(gamemap));
// Best Score ghost
if (cv_ghost_bestscore.value && FIL_FileExists(va("%s-score-best.lmp", gpath)))
G_AddGhost(va("%s-score-best.lmp", gpath));
// Best Time ghost
if (cv_ghost_besttime.value && FIL_FileExists(va("%s-time-best.lmp", gpath)))
G_AddGhost(va("%s-time-best.lmp", gpath));
// Last ghost
if (cv_ghost_last.value && FIL_FileExists(va("%s-last.lmp", gpath)))
G_AddGhost(va("%s-last.lmp", gpath));
// Guest ghost
if (cv_ghost_guest.value && FIL_FileExists(va("%s-guest.lmp", gpath)))
G_AddGhost(va("%s-guest.lmp", gpath));
// Staff Attack ghosts
if (cv_ghost_staff.value)
{
lumpnum_t l;
UINT8 i = 1;
while (i <= 99 && (l = W_CheckNumForName(va("%sS%02u",G_BuildMapName(gamemap),i))) != LUMPERROR)
{
G_AddGhost(va("%sS%02u",G_BuildMapName(gamemap),i));
i++;
}
}
free(gpath);
}*/
static void P_SetupCamera(UINT8 pnum, camera_t *cam)
{
if (players[pnum].mo && (server || addedtogame))
@@ -2983,9 +2889,7 @@ boolean P_SetupLevel(boolean skipprecip)
I_UpdateNoVsync();
}*/
#ifdef HAVE_BLUA
LUA_InvalidateLevel();
#endif
for (ss = sectors; sectors+numsectors != ss; ss++)
{
@@ -3400,9 +3304,7 @@ boolean P_SetupLevel(boolean skipprecip)
G_CopyTiccmd(&players[i].cmd, &netcmds[buf][i], 1);
}
P_PreTicker(2);
#ifdef HAVE_BLUA
LUAh_MapLoad();
#endif
}
G_AddMapToBuffer(gamemap-1);
@@ -3414,8 +3316,6 @@ boolean P_SetupLevel(boolean skipprecip)
void HWR_LoadLevel(void)
{
HWR_FreeMipmapCache();
// Correct missing sidedefs & deep water trick
HWR_CorrectSWTricks();
HWR_CreatePlanePolygons((INT32)numnodes - 1);
if (HWR_ShouldUsePaletteRendering())
@@ -3680,31 +3580,3 @@ boolean P_MultiSetupWadFiles(boolean fullsetup)
return false;
}
}
#ifdef DELFILE
boolean P_DelWadFile(void)
{
sfxenum_t i;
const UINT16 wadnum = (UINT16)(numwadfiles - 1);
const lumpnum_t lumpnum = numwadfiles<<16;
//lumpinfo_t *lumpinfo = wadfiles[wadnum]->lumpinfo;
R_DelSkins(wadnum); // only used by DELFILE
R_DelSpriteDefs(wadnum); // only used by DELFILE
for (i = 0; i < NUMSFX; i++)
{
if (S_sfx[i].lumpnum != LUMPERROR && S_sfx[i].lumpnum >= lumpnum)
{
S_StopSoundByNum(i);
S_RemoveSoundFx(i);
if (S_sfx[i].lumpnum != LUMPERROR)
{
I_FreeSfx(&S_sfx[i]);
S_sfx[i].lumpnum = LUMPERROR;
}
}
}
W_UnloadWadFile(wadnum); // only used by DELFILE
R_LoadTextures();
return false;
}
#endif
-3
View File
@@ -65,9 +65,6 @@ void HWR_LoadLevel(void);
#endif
boolean P_AddWadFile(const char *wadfilename, boolean local);
boolean P_AddWadFileLocal(const char *wadfilename);
#ifdef DELFILE
boolean P_DelWadFile(void);
#endif
// WARNING: The following functions should be grouped as follows:
// any amount of PartialAdds followed by MultiSetups until returned true,
+1 -12
View File
@@ -636,8 +636,6 @@ pslope_t *P_SlopeById(UINT16 id)
// Reset the dynamic slopes pointer, and read all of the fancy schmancy slopes
void P_ResetDynamicSlopes(void) {
size_t i;
#ifdef ESLOPE_TYPESHIM // Rewrite old specials to new ones, and give a console warning
boolean warned = false;
slopelist = NULL;
slopecount = 0;
@@ -648,13 +646,10 @@ void P_ResetDynamicSlopes(void) {
{
switch (lines[i].special)
{
#ifdef ESLOPE_TYPESHIM // Rewrite old specials to new ones, and give a console warning
#define WARNME if (!warned) {warned = true; CONS_Alert(CONS_WARNING, "This level uses old slope specials.\nA conversion will be needed before 2.2's release.\n");}
case 386:
case 387:
case 388:
lines[i].special += 700-386;
WARNME
P_SpawnSlope_Line(i);
break;
@@ -663,13 +658,11 @@ void P_ResetDynamicSlopes(void) {
case 391:
case 392:
lines[i].special += 710-389;
WARNME
P_SpawnSlope_Line(i);
break;
case 393:
lines[i].special = 703;
WARNME
P_SpawnSlope_Line(i);
break;
@@ -677,11 +670,8 @@ void P_ResetDynamicSlopes(void) {
case 395:
case 396:
lines[i].special += 720-394;
WARNME
break;
#endif
case 700:
case 701:
case 702:
@@ -944,5 +934,4 @@ void P_ButteredSlope(mobj_t *mo)
P_Thrust(mo, mo->standingslope->xydirection, thrust);
}
// EOF
#endif // #ifdef ESLOPE
// EOF
-4
View File
@@ -3110,14 +3110,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
-26
View File
@@ -254,9 +254,7 @@ void P_RemoveThinkerDelayed(void *pthinker)
//
void P_RemoveThinker(thinker_t *thinker)
{
#ifdef HAVE_BLUA
LUA_InvalidateUserdata(thinker);
#endif
thinker->function.acp1 = P_RemoveThinkerDelayed;
}
@@ -661,13 +659,10 @@ void P_Ticker(boolean run)
ps_lua_mobjhooks.value.i = 0;
ps_checkposition_calls.value.i = 0;
#ifdef HAVE_BLUA
PS_START_TIMING(ps_lua_prethinkframe_time);
LUAh_PreThinkFrame();
PS_STOP_TIMING(ps_lua_prethinkframe_time);
#endif
PS_START_TIMING(ps_playerthink_time);
for (i = 0; i < MAXPLAYERS; i++)
if (playeringame[i] && players[i].mo && !P_MobjWasRemoved(players[i].mo))
@@ -679,12 +674,6 @@ void P_Ticker(boolean run)
if (!demo.playback) // Don't increment if a demo is playing.
totalplaytime++;
/*if (!useNightsSS && G_IsSpecialStage(gamemap))
P_DoSpecialStageStuff();
if (runemeraldmanager)
P_EmeraldManager(); // Power stone mode*/
if (run)
{
PS_START_TIMING(ps_thinkertime);
@@ -696,11 +685,9 @@ void P_Ticker(boolean run)
if (playeringame[i] && players[i].mo && !P_MobjWasRemoved(players[i].mo))
P_PlayerAfterThink(&players[i]);
#ifdef HAVE_BLUA
PS_START_TIMING(ps_lua_thinkframe_time);
LUAh_ThinkFrame();
PS_STOP_TIMING(ps_lua_thinkframe_time);
#endif
}
// Run shield positioning
@@ -825,13 +812,9 @@ void P_Ticker(boolean run)
&& server) // Remember: server uses it for mapchange, but EVERYONE ticks down for the animation
D_MapChange(gamemap, gametype, encoremode, true, 0, false, false);
#ifdef HAVE_BLUA
PS_START_TIMING(ps_lua_postthinkframe_time);
LUAh_PostThinkFrame();
PS_STOP_TIMING(ps_lua_postthinkframe_time);
#endif
}
// Always move the camera.
@@ -891,9 +874,7 @@ void P_PreTicker(INT32 frames)
R_UpdateMobjInterpolators();
#ifdef HAVE_BLUA
LUAh_PreThinkFrame();
#endif
for (i = 0; i < MAXPLAYERS; i++)
if (playeringame[i] && players[i].mo && !P_MobjWasRemoved(players[i].mo))
@@ -918,22 +899,15 @@ 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();
P_RunOverlays();
P_RunShadows();
P_UpdateSpecials();
P_RespawnSpecials();
#ifdef HAVE_BLUA
LUAh_PostThinkFrame();
#endif
R_UpdateLevelInterpolators();
R_UpdateViewInterpolation();
+9 -3977
View File
File diff suppressed because it is too large. Load diff
+22 -4
View File
@@ -410,8 +410,18 @@ static void R_AddLine(seg_t *line)
return;
// big room fix
angle1 = R_PointToAngle64(line->v1->x, line->v1->y);
angle2 = R_PointToAngle64(line->v2->x, line->v2->y);
if (cv_pointoangleexor64.value)
{
angle1 = R_PointToAngle64(line->v1->x, line->v1->y);
angle2 = R_PointToAngle64(line->v2->x, line->v2->y);
}
else
{
angle1 = R_PointToAngleEx(viewx, viewy, line->v1->x, line->v1->y);
angle2 = R_PointToAngleEx(viewx, viewy, line->v2->x, line->v2->y);
}
curline = line;
// Clip to view edges.
@@ -613,8 +623,16 @@ static boolean R_CheckBBox(const fixed_t *bspcoord)
check = checkcoord[boxpos];
// big room fix
angle1 = R_PointToAngle64(bspcoord[check[0]], bspcoord[check[1]]) - viewangle;
angle2 = R_PointToAngle64(bspcoord[check[2]], bspcoord[check[3]]) - viewangle;
if (cv_pointoangleexor64.value)
{
angle1 = R_PointToAngle64(bspcoord[check[0]], bspcoord[check[1]]) - viewangle;
angle2 = R_PointToAngle64(bspcoord[check[2]], bspcoord[check[3]]) - viewangle;
}
else
{
angle1 = R_PointToAngleEx(viewx, viewy, bspcoord[check[0]], bspcoord[check[1]]) - viewangle;
angle2 = R_PointToAngleEx(viewx, viewy, bspcoord[check[2]], bspcoord[check[3]]) - viewangle;
}
if ((signed)angle1 < (signed)angle2)
{
-25
View File
@@ -25,7 +25,6 @@
#include "screen.h" // MAXVIDWIDTH, MAXVIDHEIGHT
#define POLYOBJECTS
//
// ClipWallSegment
@@ -211,19 +210,6 @@ typedef struct r_lightlist_s
INT32 lightnum;
} r_lightlist_t;
// ----- for special tricks with HW renderer -----
//
// For creating a chain with the lines around a sector
//
typedef struct linechain_s
{
struct line_s *line;
struct linechain_s *next;
} linechain_t;
// ----- end special tricks -----
// Slopes
typedef enum {
@@ -352,17 +338,6 @@ typedef struct sector_s
// per-sector colormaps!
extracolormap_t *extra_colormap;
#ifdef HWRENDER // ----- for special tricks with HW renderer -----
boolean pseudoSector;
boolean virtualFloor;
fixed_t virtualFloorheight;
boolean virtualCeiling;
fixed_t virtualCeilingheight;
linechain_t *sectorLines;
struct sector_s **stackList;
double lineoutLength;
#endif // ----- end special tricks -----
// This points to the master's floorheight, so it can be changed in realtime!
fixed_t *gravity; // per-sector gravity
boolean verticalflip; // If gravity < 0, then allow flipped physics
+142 -50
View File
@@ -16,6 +16,7 @@
#include "r_main.h"
#include "g_game.h"
#include "k_kart.h" // saltyhop stuffs
#include "i_video.h"
#include "r_plane.h"
#include "p_spec.h"
@@ -39,6 +40,8 @@ consvar_t cv_fpscap = {"fpscap", "Match refresh rate", CV_SAVE, fpscap_cons_t, N
consvar_t cv_precipinterp = {"precipinterpolation", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_mobjssector = {"mobjsubsectorinterp", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
UINT32 R_GetFramerateCap(void)
{
if (rendermode == render_none)
@@ -95,7 +98,7 @@ static angle_t R_LerpAngle(angle_t from, angle_t to, fixed_t frac)
return from + FixedMul(frac, to - from);
}
static vector2_t *R_LerpVector2(const vector2_t *from, const vector2_t *to, fixed_t frac, vector2_t *out)
/*static vector2_t *R_LerpVector2(const vector2_t *from, const vector2_t *to, fixed_t frac, vector2_t *out)
{
FV2_SubEx(to, from, out);
FV2_MulEx(out, frac, out);
@@ -109,7 +112,7 @@ static vector3_t *R_LerpVector3(const vector3_t *from, const vector3_t *to, fixe
FV3_MulEx(out, frac, out);
FV3_AddEx(from, out, out);
return out;
}
}*/
// recalc necessary stuff for mouseaiming
// slopes are already calculated for the full possible view (which is 4*viewheight).
@@ -252,7 +255,7 @@ void R_SetViewContext(enum viewcontext_e _viewcontext)
}
}
fixed_t R_InterpolateFixed(fixed_t from, fixed_t to)
/*fixed_t R_InterpolateFixed(fixed_t from, fixed_t to)
{
if (!R_UsingFrameInterpolation())
{
@@ -270,7 +273,7 @@ angle_t R_InterpolateAngle(angle_t from, angle_t to)
}
return (R_LerpAngle(from, to, rendertimefrac));
}
}*/
void R_InterpolateMobjState(mobj_t *mobj, fixed_t frac, interpmobjstate_t *out)
{
@@ -293,46 +296,87 @@ void R_InterpolateMobjState(mobj_t *mobj, fixed_t frac, interpmobjstate_t *out)
return;
}
out->x = R_LerpFixed(mobj->old_x, mobj->x, frac);
out->y = R_LerpFixed(mobj->old_y, mobj->y, frac);
out->z = R_LerpFixed(mobj->old_z, mobj->z, frac);
out->spritexscale = mobj->resetinterp ? mobj->spritexscale : R_LerpFixed(mobj->old_spritexscale, mobj->spritexscale, frac);
out->spriteyscale = mobj->resetinterp ? mobj->spriteyscale : R_LerpFixed(mobj->old_spriteyscale, mobj->spriteyscale, frac);
out->spritexoffset = mobj->resetinterp ? mobj->spritexoffset : R_LerpFixed(mobj->old_spritexoffset, mobj->spritexoffset, frac);
out->spriteyoffset = mobj->resetinterp ? mobj->spriteyoffset : R_LerpFixed(mobj->old_spriteyoffset, mobj->spriteyoffset, frac);
if (mobj->x == mobj->old_x)
out->x = mobj->x;
else
out->x = R_LerpFixed(mobj->old_x, mobj->x, frac);
if (mobj->y == mobj->old_y)
out->y = mobj->y;
else
out->y = R_LerpFixed(mobj->old_y, mobj->y, frac);
if (mobj->z == mobj->old_z)
out->z = mobj->z;
else
out->z = R_LerpFixed(mobj->old_z, mobj->z, frac);
if (mobj->spritexscale == mobj->old_spritexscale)
out->spritexscale = mobj->spritexscale;
else
out->spritexscale = mobj->resetinterp ? mobj->spritexscale : R_LerpFixed(mobj->old_spritexscale, mobj->spritexscale, frac);
if (mobj->spriteyscale == mobj->old_spriteyscale)
out->spriteyscale = mobj->spriteyscale;
else
out->spriteyscale = mobj->resetinterp ? mobj->spriteyscale : R_LerpFixed(mobj->old_spriteyscale, mobj->spriteyscale, frac);
if (mobj->spritexoffset == mobj->old_spritexoffset)
out->spritexoffset = mobj->spritexoffset;
else
out->spritexoffset = mobj->resetinterp ? mobj->spritexoffset : R_LerpFixed(mobj->old_spritexoffset, mobj->spritexoffset, frac);
if (mobj->spriteyoffset == mobj->old_spriteyoffset)
out->spriteyoffset = mobj->spriteyoffset;
else
out->spriteyoffset = mobj->resetinterp ? mobj->spriteyoffset : R_LerpFixed(mobj->old_spriteyoffset, mobj->spriteyoffset, frac);
if (mobj->scale == mobj->old_scale) // Tiny optimisation - scale is usually unchanging, so let's skip a lerp, two FixedMuls, and two FixedDivs
{
out->scale = mobj->scale;
}
else
{
out->scale = mobj->resetinterp ? mobj->scale : R_LerpFixed(mobj->old_scale, mobj->scale, frac);
}
// Sprite offsets are not interpolated until we have a way to interpolate them explicitly in Lua.
// It seems existing mods visually break more often than not if it is interpolated.
//out->spritexoffset = mobj->spritexoffset;
//out->spriteyoffset = mobj->spriteyoffset;
out->subsector = R_PointInSubsector(out->x, out->y);
if (cv_mobjssector.value)
out->subsector = R_PointInSubsector(out->x, out->y);
else
out->subsector = mobj->subsector;
if (mobj->player)
{
out->angle = mobj->resetinterp ? mobj->player->frameangle : R_LerpAngle(mobj->player->old_frameangle, mobj->player->frameangle, frac);
if (mobj->angle == mobj->player->old_frameangle)
out->angle = mobj->player->frameangle;
else
out->angle = mobj->resetinterp ? mobj->player->frameangle : R_LerpAngle(mobj->player->old_frameangle, mobj->player->frameangle, frac);
}
else
{
out->angle = mobj->resetinterp ? mobj->angle : R_LerpAngle(mobj->old_angle, mobj->angle, frac);
if (mobj->angle == mobj->old_angle)
out->angle = mobj->angle;
else
out->angle = mobj->resetinterp ? mobj->angle : R_LerpAngle(mobj->old_angle, mobj->angle, frac);
}
// pitch roll stuff
out->pitch = mobj->resetinterp ? mobj->pitch : R_LerpAngle(mobj->old_pitch, mobj->pitch, frac);
out->roll = mobj->resetinterp ? mobj->roll : R_LerpAngle(mobj->old_roll, mobj->roll, frac);
if (mobj->pitch == mobj->old_pitch)
out->pitch = mobj->pitch;
else
out->pitch = mobj->resetinterp ? mobj->pitch : R_LerpAngle(mobj->old_pitch, mobj->pitch, frac);
if (mobj->roll == mobj->old_roll)
out->roll = mobj->roll;
else
out->roll = mobj->resetinterp ? mobj->roll : R_LerpAngle(mobj->old_roll, mobj->roll, frac);
// and the slope stuff
out->slopepitch = mobj->resetinterp ? mobj->slopepitch : R_LerpAngle(mobj->old_slopepitch, mobj->slopepitch, frac);
out->sloperoll = mobj->resetinterp ? mobj->sloperoll : R_LerpAngle(mobj->old_sloperoll, mobj->sloperoll, frac);
if (mobj->slopepitch == mobj->old_slopepitch)
out->slopepitch = mobj->slopepitch;
else
out->slopepitch = mobj->resetinterp ? mobj->slopepitch : R_LerpAngle(mobj->old_slopepitch, mobj->slopepitch, frac);
if (mobj->sloperoll == mobj->old_sloperoll)
out->sloperoll = mobj->sloperoll;
else
out->sloperoll = mobj->resetinterp ? mobj->sloperoll : R_LerpAngle(mobj->old_sloperoll, mobj->sloperoll, frac);
}
void R_InterpolatePrecipMobjState(precipmobj_t *mobj, fixed_t frac, interpmobjstate_t *out)
@@ -361,9 +405,15 @@ void R_InterpolatePrecipMobjState(precipmobj_t *mobj, fixed_t frac, interpmobjst
out->spritexoffset = mobj->spritexoffset;
out->spriteyoffset = mobj->spriteyoffset;
out->subsector = R_PointInSubsector(out->x, out->y);
if (cv_mobjssector.value)
out->subsector = R_PointInSubsector(out->x, out->y);
else
out->subsector = mobj->subsector;
out->angle = R_LerpAngle(mobj->old_angle, mobj->angle, frac);
if (mobj->angle == mobj->old_angle)
out->angle = mobj->angle;
else
out->angle = R_LerpAngle(mobj->old_angle, mobj->angle, frac);
}
static void AddInterpolator(levelinterpolator_t* interpolator)
@@ -463,7 +513,7 @@ void R_CreateInterpolator_Polyobj(thinker_t *thinker, polyobj_t *polyobj)
interp->polyobj.oldcy = interp->polyobj.bakcy = polyobj->centerPt.y;
}
void R_CreateInterpolator_DynSlope(thinker_t *thinker, pslope_t *slope)
/*void R_CreateInterpolator_DynSlope(thinker_t *thinker, pslope_t *slope)
{
levelinterpolator_t *interp = CreateInterpolator(LVLINTERP_DynSlope, thinker);
interp->dynslope.slope = slope;
@@ -475,7 +525,7 @@ void R_CreateInterpolator_DynSlope(thinker_t *thinker, pslope_t *slope)
FV2_Copy(&interp->dynslope.bakd, &slope->d);
interp->dynslope.oldzdelta = interp->dynslope.bakzdelta = slope->zdelta;
}
}*/
void R_InitializeLevelInterpolators(void)
{
@@ -519,7 +569,7 @@ static void UpdateLevelInterpolatorState(levelinterpolator_t *interp)
interp->polyobj.bakcx = interp->polyobj.polyobj->centerPt.x;
interp->polyobj.bakcy = interp->polyobj.polyobj->centerPt.y;
break;
case LVLINTERP_DynSlope:
/*case LVLINTERP_DynSlope:
FV3_Copy(&interp->dynslope.oldo, &interp->dynslope.bako);
FV2_Copy(&interp->dynslope.oldd, &interp->dynslope.bakd);
interp->dynslope.oldzdelta = interp->dynslope.bakzdelta;
@@ -527,7 +577,7 @@ static void UpdateLevelInterpolatorState(levelinterpolator_t *interp)
FV3_Copy(&interp->dynslope.bako, &interp->dynslope.slope->o);
FV2_Copy(&interp->dynslope.bakd, &interp->dynslope.slope->d);
interp->dynslope.bakzdelta = interp->dynslope.slope->zdelta;
break;
break;*/
}
}
@@ -573,44 +623,86 @@ void R_ApplyLevelInterpolators(fixed_t frac)
case LVLINTERP_SectorPlane:
if (interp->sectorplane.ceiling)
{
interp->sectorplane.sector->ceilingheight = R_LerpFixed(interp->sectorplane.oldheight, interp->sectorplane.bakheight, frac);
if (interp->sectorplane.sector->ceilingheight == interp->sectorplane.oldheight)
interp->sectorplane.sector->ceilingheight = interp->sectorplane.bakheight;
else
interp->sectorplane.sector->ceilingheight = R_LerpFixed(interp->sectorplane.oldheight, interp->sectorplane.bakheight, frac);
}
else
{
interp->sectorplane.sector->floorheight = R_LerpFixed(interp->sectorplane.oldheight, interp->sectorplane.bakheight, frac);
if (interp->sectorplane.sector->floorheight == interp->sectorplane.oldheight)
interp->sectorplane.sector->floorheight = interp->sectorplane.bakheight;
else
interp->sectorplane.sector->floorheight = R_LerpFixed(interp->sectorplane.oldheight, interp->sectorplane.bakheight, frac);
}
interp->sectorplane.sector->moved = true;
break;
case LVLINTERP_SectorScroll:
if (interp->sectorscroll.ceiling)
{
interp->sectorscroll.sector->ceiling_xoffs = R_LerpFixed(interp->sectorscroll.oldxoffs, interp->sectorscroll.bakxoffs, frac);
interp->sectorscroll.sector->ceiling_yoffs = R_LerpFixed(interp->sectorscroll.oldyoffs, interp->sectorscroll.bakyoffs, frac);
if (interp->sectorscroll.sector->ceiling_xoffs == interp->sectorscroll.oldxoffs)
interp->sectorscroll.sector->ceiling_xoffs = interp->sectorscroll.bakxoffs;
else
interp->sectorscroll.sector->ceiling_xoffs = R_LerpFixed(interp->sectorscroll.oldxoffs, interp->sectorscroll.bakxoffs, frac);
if (interp->sectorscroll.sector->ceiling_yoffs == interp->sectorscroll.oldyoffs)
interp->sectorscroll.sector->ceiling_yoffs = interp->sectorscroll.bakyoffs;
else
interp->sectorscroll.sector->ceiling_yoffs = R_LerpFixed(interp->sectorscroll.oldyoffs, interp->sectorscroll.bakyoffs, frac);
}
else
{
interp->sectorscroll.sector->floor_xoffs = R_LerpFixed(interp->sectorscroll.oldxoffs, interp->sectorscroll.bakxoffs, frac);
interp->sectorscroll.sector->floor_yoffs = R_LerpFixed(interp->sectorscroll.oldyoffs, interp->sectorscroll.bakyoffs, frac);
if (interp->sectorscroll.sector->floor_xoffs == interp->sectorscroll.oldxoffs)
interp->sectorscroll.sector->floor_xoffs = interp->sectorscroll.bakxoffs;
else
interp->sectorscroll.sector->floor_xoffs = R_LerpFixed(interp->sectorscroll.oldxoffs, interp->sectorscroll.bakxoffs, frac);
if (interp->sectorscroll.sector->floor_yoffs == interp->sectorscroll.oldyoffs)
interp->sectorscroll.sector->floor_yoffs = interp->sectorscroll.bakyoffs;
else
interp->sectorscroll.sector->floor_yoffs = R_LerpFixed(interp->sectorscroll.oldyoffs, interp->sectorscroll.bakyoffs, frac);
}
break;
case LVLINTERP_SideScroll:
interp->sidescroll.side->textureoffset = R_LerpFixed(interp->sidescroll.oldtextureoffset, interp->sidescroll.baktextureoffset, frac);
interp->sidescroll.side->rowoffset = R_LerpFixed(interp->sidescroll.oldrowoffset, interp->sidescroll.bakrowoffset, frac);
if (interp->sidescroll.side->textureoffset == interp->sidescroll.oldtextureoffset)
interp->sidescroll.side->textureoffset = interp->sidescroll.baktextureoffset;
else
interp->sidescroll.side->textureoffset = R_LerpFixed(interp->sidescroll.oldtextureoffset, interp->sidescroll.baktextureoffset, frac);
if (interp->sidescroll.side->rowoffset == interp->sidescroll.oldrowoffset)
interp->sidescroll.side->rowoffset = interp->sidescroll.bakrowoffset;
else
interp->sidescroll.side->rowoffset = R_LerpFixed(interp->sidescroll.oldrowoffset, interp->sidescroll.bakrowoffset, frac);
break;
case LVLINTERP_Polyobj:
for (ii = 0; ii < interp->polyobj.vertices_size; ii++)
{
interp->polyobj.polyobj->vertices[ii]->x = R_LerpFixed(interp->polyobj.oldvertices[ii * 2 ], interp->polyobj.bakvertices[ii * 2 ], frac);
interp->polyobj.polyobj->vertices[ii]->y = R_LerpFixed(interp->polyobj.oldvertices[ii * 2 + 1], interp->polyobj.bakvertices[ii * 2 + 1], frac);
if (interp->polyobj.polyobj->vertices[ii]->x == interp->polyobj.oldvertices[ii * 2 ])
interp->polyobj.polyobj->vertices[ii]->x = interp->polyobj.bakvertices[ii * 2 ];
else
interp->polyobj.polyobj->vertices[ii]->x = R_LerpFixed(interp->polyobj.oldvertices[ii * 2 ], interp->polyobj.bakvertices[ii * 2 ], frac);
if (interp->polyobj.polyobj->vertices[ii]->y == interp->polyobj.oldvertices[ii * 2 + 1])
interp->polyobj.polyobj->vertices[ii]->y = interp->polyobj.bakvertices[ii * 2 + 1];
else
interp->polyobj.polyobj->vertices[ii]->y = R_LerpFixed(interp->polyobj.oldvertices[ii * 2 + 1], interp->polyobj.bakvertices[ii * 2 + 1], frac);
}
interp->polyobj.polyobj->centerPt.x = R_LerpFixed(interp->polyobj.oldcx, interp->polyobj.bakcx, frac);
interp->polyobj.polyobj->centerPt.y = R_LerpFixed(interp->polyobj.oldcy, interp->polyobj.bakcy, frac);
if (interp->polyobj.polyobj->centerPt.x == interp->polyobj.oldcx)
interp->polyobj.polyobj->centerPt.x = interp->polyobj.bakcx;
else
interp->polyobj.polyobj->centerPt.x = R_LerpFixed(interp->polyobj.oldcx, interp->polyobj.bakcx, frac);
if (interp->polyobj.polyobj->centerPt.y == interp->polyobj.oldcy)
interp->polyobj.polyobj->centerPt.y = interp->polyobj.bakcy;
else
interp->polyobj.polyobj->centerPt.y = R_LerpFixed(interp->polyobj.oldcy, interp->polyobj.bakcy, frac);
break;
case LVLINTERP_DynSlope:
/*case LVLINTERP_DynSlope:
R_LerpVector3(&interp->dynslope.oldo, &interp->dynslope.bako, frac, &interp->dynslope.slope->o);
R_LerpVector2(&interp->dynslope.oldd, &interp->dynslope.bakd, frac, &interp->dynslope.slope->d);
interp->dynslope.slope->zdelta = R_LerpFixed(interp->dynslope.oldzdelta, interp->dynslope.bakzdelta, frac);
break;
break;*/
}
}
}
@@ -661,11 +753,11 @@ void R_RestoreLevelInterpolators(void)
interp->polyobj.polyobj->centerPt.x = interp->polyobj.bakcx;
interp->polyobj.polyobj->centerPt.y = interp->polyobj.bakcy;
break;
case LVLINTERP_DynSlope:
/*case LVLINTERP_DynSlope:
FV3_Copy(&interp->dynslope.slope->o, &interp->dynslope.bako);
FV2_Copy(&interp->dynslope.slope->d, &interp->dynslope.bakd);
interp->dynslope.slope->zdelta = interp->dynslope.bakzdelta;
break;
break;*/
}
}
}
+2 -1
View File
@@ -21,6 +21,7 @@
extern consvar_t cv_fpscap;
extern consvar_t cv_precipinterp;
extern consvar_t cv_mobjssector;
UINT32 R_GetFramerateCap(void);
boolean R_UsingFrameInterpolation(void);
@@ -77,7 +78,7 @@ typedef enum {
LVLINTERP_SectorScroll,
LVLINTERP_SideScroll,
LVLINTERP_Polyobj,
LVLINTERP_DynSlope,
//LVLINTERP_DynSlope,
} levelinterpolator_type_e;
// Tagged union of a level interpolator
+39 -5
View File
@@ -145,17 +145,20 @@ static CV_PossibleValue_t drawdist_cons_t[] = {
{3072, "3072"}, {4096, "4096"}, {6144, "6144"},
{8192, "8192"}, {0, "Infinite"}, {0, NULL}};
//static CV_PossibleValue_t precipdensity_cons_t[] = {{0, "None"}, {1, "Light"}, {2, "Moderate"}, {4, "Heavy"}, {6, "Thick"}, {8, "V.Thick"}, {0, NULL}};
static CV_PossibleValue_t drawdist_precip_cons_t[] = {
{256, "256"}, {512, "512"}, {768, "768"},
{1024, "1024"}, {1536, "1536"}, {2048, "2048"},
{3072, "3072"}, {0, "None"}, {0, NULL}};
static CV_PossibleValue_t maxinterpdist_cons_t[] = {
/*{256, "256"},*/ {512, "512"}, {768, "768"},
{1024, "1024"}, {1536, "1536"}, {2048, "2048"},
{3072, "3072"}, {4096, "4096"}, {6144, "6144"},
{8192, "8192"}, {0, "Infinite"}, {0, NULL}};
static CV_PossibleValue_t fov_cons_t[] = {{5*FRACUNIT, "MIN"}, {178*FRACUNIT, "MAX"}, {0, NULL}};
//static CV_PossibleValue_t precipdensity_cons_t[] = {{0, "None"}, {1, "Light"}, {2, "Moderate"}, {4, "Heavy"}, {6, "Thick"}, {8, "V.Thick"}, {0, NULL}};
static CV_PossibleValue_t translucenthud_cons_t[] = {{0, "MIN"}, {10, "MAX"}, {0, NULL}};
static CV_PossibleValue_t maxportals_cons_t[] = {{0, "MIN"}, {12, "MAX"}, {0, NULL}}; // lmao rendering 32 portals, you're a card
static CV_PossibleValue_t homremoval_cons_t[] = {{0, "No"}, {1, "Yes"}, {2, "Flash"}, {0, NULL}};
@@ -196,10 +199,10 @@ consvar_t cv_translucenthud = {"translucenthud", "10", CV_SAVE, translucenthud_c
consvar_t cv_translucency = {"translucency", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_drawdist = {"drawdist", "Infinite", CV_SAVE, drawdist_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
//consvar_t cv_drawdist_nights = {"drawdist_nights", "2048", CV_SAVE, drawdist_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_drawdist_precip = {"drawdist_precip", "1024", CV_SAVE, drawdist_precip_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_lessprecip = {"lessweathereffects", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
//consvar_t cv_precipdensity = {"precipdensity", "Moderate", CV_SAVE, precipdensity_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_grmaxinterpdist = {"gr_maxinterpdist", "Infinite", CV_SAVE, maxinterpdist_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
// cap fov, fov too high tears software apart.
consvar_t cv_fov = {"fov", "90", CV_FLOAT|CV_CALL|CV_SAVE, fov_cons_t, Fov_OnChange, 0, NULL, NULL, 0, 0, NULL};
@@ -209,6 +212,9 @@ consvar_t cv_homremoval = {"homremoval", "Yes", CV_SAVE, homremoval_cons_t, NULL
consvar_t cv_maxportals = {"maxportals", "2", CV_SAVE, maxportals_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
static CV_PossibleValue_t pointoangle_cons_t[] = {{0, "Ex"}, {1, "64"}, {0, NULL}};
consvar_t cv_pointoangleexor64 = {"r_pointtoangle", "Ex", CV_SAVE, pointoangle_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
void SplitScreen_OnChange(void)
{
UINT8 i;
@@ -412,6 +418,29 @@ angle_t R_PointToAngle64(INT64 x, INT64 y)
0;
}
angle_t R_PointToAngleEx(INT32 x2, INT32 y2, INT32 x1, INT32 y1)
{
INT64 dx = x1-x2;
INT64 dy = y1-y2;
if (dx < INT32_MIN || dx > INT32_MAX || dy < INT32_MIN || dy > INT32_MAX)
{
x1 = (int)(dx / 2 + x2);
y1 = (int)(dy / 2 + y2);
}
return (y1 -= y2, (x1 -= x2) || y1) ?
x1 >= 0 ?
y1 >= 0 ?
(x1 > y1) ? tantoangle[SlopeDivEx(y1,x1)] : // octant 0
ANGLE_90-tantoangle[SlopeDivEx(x1,y1)] : // octant 1
x1 > (y1 = -y1) ? 0-tantoangle[SlopeDivEx(y1,x1)] : // octant 8
ANGLE_270+tantoangle[SlopeDivEx(x1,y1)] : // octant 7
y1 >= 0 ? (x1 = -x1) > y1 ? ANGLE_180-tantoangle[SlopeDivEx(y1,x1)] : // octant 3
ANGLE_90 + tantoangle[SlopeDivEx(x1,y1)] : // octant 2
(x1 = -x1) > (y1 = -y1) ? ANGLE_180+tantoangle[SlopeDivEx(y1,x1)] : // octant 4
ANGLE_270-tantoangle[SlopeDivEx(x1,y1)] : // octant 5
0;
}
angle_t R_PointToAngle2(fixed_t pviewx, fixed_t pviewy, fixed_t x, fixed_t y)
{
return (y -= pviewy, (x -= pviewx) || y) ?
@@ -1861,6 +1890,10 @@ void R_RegisterEngineStuff(void)
CV_RegisterVar(&cv_translucenthud);
CV_RegisterVar(&cv_maxportals);
CV_RegisterVar(&cv_pointoangleexor64);
CV_RegisterVar(&cv_grmaxinterpdist);
// Default viewheight is changeable,
// initialized to standard viewheight
@@ -1869,4 +1902,5 @@ void R_RegisterEngineStuff(void)
// Frame interpolation/uncapped
CV_RegisterVar(&cv_fpscap);
CV_RegisterVar(&cv_precipinterp);
CV_RegisterVar(&cv_mobjssector);
}
+2
View File
@@ -69,6 +69,7 @@ INT32 R_PointOnSide(fixed_t x, fixed_t y, node_t *node);
INT32 R_PointOnSegSide(fixed_t x, fixed_t y, seg_t *line);
angle_t R_PointToAngle(fixed_t x, fixed_t y);
angle_t R_PointToAngle64(INT64 x, INT64 y);
angle_t R_PointToAngleEx(INT32 x2, INT32 y2, INT32 x1, INT32 y1);
angle_t R_PointToAngle2(fixed_t px2, fixed_t py2, fixed_t px1, fixed_t py1);
fixed_t R_PointToDist(fixed_t x, fixed_t y);
fixed_t R_PointToDist2(fixed_t px2, fixed_t py2, fixed_t px1, fixed_t py1);
@@ -116,6 +117,7 @@ extern consvar_t /*cv_precipdensity,*/ cv_drawdist, /*cv_drawdist_nights,*/ cv_d
extern consvar_t cv_fov;
extern consvar_t cv_skybox;
extern consvar_t cv_tailspickup;
extern consvar_t cv_grmaxinterpdist;
// Called by startup code.
void R_Init(void);
+2 -61
View File
@@ -622,62 +622,8 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
// draw the texture
col = (column_t *)((UINT8 *)R_GetColumn(texnum, maskedtexturecol[dc_x]) - 3);
//#ifdef POLYOBJECTS_PLANES
#if 0 // Disabling this allows inside edges to render below the planes, for until the clipping is fixed to work right when POs are near the camera. -Red
if (curline->dontrenderme && curline->polyseg && (curline->polyseg->flags & POF_RENDERPLANES))
{
fixed_t my_topscreen;
fixed_t my_bottomscreen;
fixed_t my_yl, my_yh;
my_topscreen = sprtopscreen + spryscale*col->topdelta;
my_bottomscreen = sprbotscreen == INT32_MAX ? my_topscreen + spryscale*col->length
: sprbotscreen + spryscale*col->length;
my_yl = (my_topscreen+FRACUNIT-1)>>FRACBITS;
my_yh = (my_bottomscreen-1)>>FRACBITS;
// CONS_Debug(DBG_RENDER, "my_topscreen: %d\nmy_bottomscreen: %d\nmy_yl: %d\nmy_yh: %d\n", my_topscreen, my_bottomscreen, my_yl, my_yh);
if (numffloors)
{
INT32 top = my_yl;
INT32 bottom = my_yh;
for (i = 0; i < numffloors; i++)
{
if (!ffloor[i].polyobj || ffloor[i].polyobj != curline->polyseg)
continue;
if (ffloor[i].height < viewz)
{
INT32 top_w = ffloor[i].plane->top[dc_x];
// CONS_Debug(DBG_RENDER, "Leveltime : %d\n", leveltime);
// CONS_Debug(DBG_RENDER, "Top is %d, top_w is %d\n", top, top_w);
if (top_w < top)
{
ffloor[i].plane->top[dc_x] = (INT16)top;
ffloor[i].plane->picnum = 0;
}
// CONS_Debug(DBG_RENDER, "top_w is now %d\n", ffloor[i].plane->top[dc_x]);
}
else if (ffloor[i].height > viewz)
{
INT32 bottom_w = ffloor[i].plane->bottom[dc_x];
if (bottom_w > bottom)
{
ffloor[i].plane->bottom[dc_x] = (INT16)bottom;
ffloor[i].plane->picnum = 0;
}
}
}
}
}
else
#endif
colfunc_2s(col);
colfunc_2s(col);
}
spryscale += rw_scalestep;
}
@@ -2634,13 +2580,8 @@ void R_StoreWallRange(INT32 start, INT32 stop)
}
else
{
#ifdef ESLOPE
ffloor[i].f_frac = (centeryfrac>>4) - FixedMul(ffloor[i].f_pos, rw_scale);
ffloor[i].f_step = ((centeryfrac>>4) - FixedMul(ffloor[i].f_pos_slope, ds_p->scale2) - ffloor[i].f_frac)/(range);
#else
ffloor[i].f_step = FixedMul(-rw_scalestep, ffloor[i].f_pos);
ffloor[i].f_frac = (centeryfrac>>4) - FixedMul(ffloor[i].f_pos, rw_scale);
#endif
}
}
}
+2
View File
@@ -102,6 +102,8 @@ extern INT32 portalclipstart, portalclipend;
extern consvar_t cv_allowmlook;
extern consvar_t cv_maxportals;
extern consvar_t cv_pointoangleexor64;
extern angle_t clipangle;
extern angle_t doubleclipangle;
+2 -231
View File
@@ -475,116 +475,6 @@ void R_AddSpriteDefs(UINT16 wadnum)
CONS_Printf(M_GetText("%s added %d frames in %s sprites\n"), wadname, end-start, sizeu1(addsprites));
}
#ifdef DELFILE
static void R_RemoveSpriteLump(UINT16 wad, // graphics patch
UINT16 lump,
size_t lumpid, // identifier
UINT8 frame,
UINT8 rotation,
UINT8 flipped)
{
(void)wad; /// \todo: how do I remove sprites?
(void)lump;
(void)lumpid;
(void)frame;
(void)rotation;
(void)flipped;
}
static boolean R_DelSingleSpriteDef(const char *sprname, spritedef_t *spritedef, UINT16 wadnum, UINT16 startlump, UINT16 endlump)
{
UINT16 l;
UINT8 frame;
UINT8 rotation;
lumpinfo_t *lumpinfo;
maxframe = (size_t)-1;
// scan the lumps,
// filling in the frames for whatever is found
lumpinfo = wadfiles[wadnum]->lumpinfo;
if (endlump > wadfiles[wadnum]->numlumps)
endlump = wadfiles[wadnum]->numlumps;
for (l = startlump; l < endlump; l++)
{
if (memcmp(lumpinfo[l].name,sprname,4)==0)
{
frame = (UINT8)(lumpinfo[l].name[4] - 'A');
rotation = (UINT8)(lumpinfo[l].name[5] - '0');
// skip NULL sprites from very old dmadds pwads
if (W_LumpLengthPwad(wadnum,l)<=8)
continue;
//----------------------------------------------------
R_RemoveSpriteLump(wadnum, l, numspritelumps, frame, rotation, 0);
if (lumpinfo[l].name[6])
{
frame = (UINT8)(lumpinfo[l].name[6] - 'A');
rotation = (UINT8)(lumpinfo[l].name[7] - '0');
R_RemoveSpriteLump(wadnum, l, numspritelumps, frame, rotation, 1);
}
}
}
if (maxframe == (size_t)-1)
return false;
spritedef->numframes = 0;
Z_Free(spritedef->spriteframes);
spritedef->spriteframes = NULL;
return true;
}
void R_DelSpriteDefs(UINT16 wadnum)
{
size_t i, delsprites = 0;
UINT16 start, end;
// find the sprites section in this pwad
// we need at least the S_END
// (not really, but for speedup)
start = W_CheckNumForNamePwad("S_START", wadnum, 0);
if (start == INT16_MAX)
start = W_CheckNumForNamePwad("SS_START", wadnum, 0); //deutex compatib.
if (start == INT16_MAX)
start = 0; //let say S_START is lump 0
else
start++; // just after S_START
end = W_CheckNumForNamePwad("S_END",wadnum,start);
if (end == INT16_MAX)
end = W_CheckNumForNamePwad("SS_END",wadnum,start); //deutex compatib.
if (end == INT16_MAX)
{
CONS_Debug(DBG_SETUP, "no sprites in pwad %d\n", wadnum);
return;
//I_Error("R_DelSpriteDefs: S_END, or SS_END missing for sprites "
// "in pwad %d\n",wadnum);
}
//
// scan through lumps, for each sprite, find all the sprite frames
//
for (i = 0; i < numsprites; i++)
{
spritename = sprnames[i];
if (R_DelSingleSpriteDef(spritename, &sprites[i], wadnum, start, end))
{
// if a new sprite was removed (not just replaced)
delsprites++;
CONS_Debug(DBG_SETUP, "sprite %s set in pwad %d\n", spritename, wadnum);
}
}
CONS_Printf(M_GetText("%s sprites removed from file %s\n"), sizeu1(delsprites), wadfiles[wadnum]->filename);
}
#endif
//
// GAME FUNCTIONS
@@ -1225,65 +1115,6 @@ fixed_t R_GetShadowZ(mobj_t *thing, pslope_t **shadowslope)
groundslope = NULL;
}
#if 0 // Unfortunately, this drops CEZ2 down to sub-17 FPS on my i7.
// NOTE: this section was not updated to reflect reverse gravity support
// Check polyobjects and see if groundz needs to be altered, for rings only because they don't update floorz
if (thing->type == MT_RING)
{
INT32 xl, xh, yl, yh, bx, by;
xl = (unsigned)(thing->x - thing->radius - bmaporgx)>>MAPBLOCKSHIFT;
xh = (unsigned)(thing->x + thing->radius - bmaporgx)>>MAPBLOCKSHIFT;
yl = (unsigned)(thing->y - thing->radius - bmaporgy)>>MAPBLOCKSHIFT;
yh = (unsigned)(thing->y + thing->radius - bmaporgy)>>MAPBLOCKSHIFT;
BMBOUNDFIX(xl, xh, yl, yh);
validcount++;
for (by = yl; by <= yh; by++)
for (bx = xl; bx <= xh; bx++)
{
INT32 offset;
polymaplink_t *plink; // haleyjd 02/22/06
if (bx < 0 || by < 0 || bx >= bmapwidth || by >= bmapheight)
continue;
offset = by*bmapwidth + bx;
// haleyjd 02/22/06: consider polyobject lines
plink = polyblocklinks[offset];
while (plink)
{
polyobj_t *po = plink->po;
if (po->validcount != validcount) // if polyobj hasn't been checked
{
po->validcount = validcount;
if (!P_MobjInsidePolyobj(po, thing) || !(po->flags & POF_RENDERPLANES))
{
plink = (polymaplink_t *)(plink->link.next);
continue;
}
// We're inside it! Yess...
z = po->lines[0]->backsector->ceilingheight;
if (z < thing->z+thing->height/2 && z > groundz)
{
groundz = z;
groundslope = NULL;
}
}
plink = (polymaplink_t *)(plink->link.next);
}
}
}
#endif
if (shadowslope != NULL)
*shadowslope = groundslope;
@@ -1357,7 +1188,7 @@ static void R_ProjectSprite(mobj_t *thing)
interpmobjstate_t interp = {0};
// do interpolation
if (R_UsingFrameInterpolation() && !paused)
if (R_UsingFrameInterpolation() && !paused && (!cv_grmaxinterpdist.value || R_QuickCamDist(thing->x, thing->y) < cv_grmaxinterpdist.value))
{
R_InterpolateMobjState(oldthing, rendertimefrac, &interp);
}
@@ -1881,7 +1712,7 @@ static void R_ProjectPrecipitationSprite(precipmobj_t *thing)
interpmobjstate_t interp = {0};
// do interpolation
if (R_UsingFrameInterpolation() && !paused)
if (R_UsingFrameInterpolation() && !paused && (!cv_grmaxinterpdist.value || R_QuickCamDist(thing->x, thing->y) < cv_grmaxinterpdist.value))
{
R_InterpolatePrecipMobjState(thing, rendertimefrac, &interp);
}
@@ -2495,20 +2326,6 @@ static void R_CreateDrawNodes(void)
}
else if (r2->seg)
{
#if 0 //#ifdef POLYOBJECTS_PLANES
if (r2->seg->curline->polyseg && rover->mobj && P_MobjInsidePolyobj(r2->seg->curline->polyseg, rover->mobj)) {
// Determine if we need to sort in front of the polyobj, based on the planes. This fixes the issue where
// polyobject planes render above the object standing on them. (A bit hacky... but it works.) -Red
mobj_t *mo = rover->mobj;
sector_t *po = r2->seg->curline->backsector;
if (po->ceilingheight < viewz && mo->z+mo->height > po->ceilingheight)
continue;
if (po->floorheight > viewz && mo->z < po->floorheight)
continue;
}
#endif
if (rover->x1 > r2->seg->x2 || rover->x2 < r2->seg->x1)
continue;
@@ -3776,49 +3593,3 @@ next_token:
return;
}
#ifdef DELFILE
void R_DelSkins(UINT16 wadnum)
{
UINT16 lump, lastlump = 0;
while ((lump = W_CheckForSkinMarkerInPwad(wadnum, lastlump)) != INT16_MAX)
{
if (skins[numskins].wadnum != wadnum)
break;
numskins--;
ST_UnLoadFaceGraphics(numskins); // only used by DELFILE
if (skins[numskins].sprite[0] != '\0')
{
const char *csprname = W_CheckNameForNumPwad(wadnum, lump);
// skip to end of this skin's frames
lastlump = lump;
while (W_CheckNameForNumPwad(wadnum,lastlump) && memcmp(W_CheckNameForNumPwad(wadnum, lastlump),csprname,4)==0)
lastlump++;
// allocate (or replace) sprite frames, and set spritedef
R_DelSingleSpriteDef(csprname, &skins[numskins].spritedef, wadnum, lump, lastlump);
}
else
{
// search in the normal sprite tables
size_t name;
boolean found = false;
const char *sprname = skins[numskins].sprite;
for (name = 0;sprnames[name][0] != '\0';name++)
if (strcmp(sprnames[name], sprname) == 0)
{
found = true;
skins[numskins].spritedef = sprites[name];
}
// not found so make a new one
if (!found)
R_DelSingleSpriteDef(sprname, &skins[numskins].spritedef, wadnum, 0, INT16_MAX);
while (W_CheckNameForNumPwad(wadnum,lastlump) && memcmp(W_CheckNameForNumPwad(wadnum, lastlump),sprname,4)==0)
lastlump++;
}
CONS_Printf(M_GetText("Removed skin '%s'\n"), skins[numskins].name);
}
}
#endif
+6 -8
View File
@@ -32,6 +32,12 @@
#define FEETADJUST (4<<FRACBITS) // R_AddSingleSpriteDef
// Takes 2 fixed-point coordinates, returns "distance" between them and camera,
// as an non-fixed-point integer.
// It is very rough, tho it is used only for optimizing out unnecessary
// interpolation, so it is kinda ok on big distances.
#define R_QuickCamDist(x, y) max(abs(((x)>>FRACBITS) - (viewx>>FRACBITS)), abs(((y)>>FRACBITS) - (viewy>>FRACBITS)))
// Constant arrays used for psprite clipping
// and initializing clipping.
extern INT16 negonearray[MAXVIDWIDTH];
@@ -55,10 +61,6 @@ void R_SortVisSprites(void);
// (only sprites from namelist are added or replaced)
void R_AddSpriteDefs(UINT16 wadnum);
#ifdef DELFILE
void R_DelSpriteDefs(UINT16 wadnum);
#endif
//SoM: 6/5/2000: Light sprites correctly!
void R_AddSprites(sector_t *sec, INT32 lightlevel);
void R_InitSprites(void);
@@ -223,10 +225,6 @@ INT32 R_AnySkinAvailable(const char *name);
INT32 R_LocalSkinAvailable(const char *name, boolean local);
void R_AddSkins(UINT16 wadnum, boolean local);
#ifdef DELFILE
void R_DelSkins(UINT16 wadnum);
#endif
void R_InitDrawNodes(void);
char *GetPlayerFacePic(INT32 skinnum);
+2 -4
View File
@@ -30,9 +30,7 @@
#include "m_cond.h" // for conditionsets
#include "m_menu.h" // bird music stuff
#ifdef HAVE_BLUA
#include "lua_hook.h" // MusicChange hook
#endif
#ifdef HW3SOUND
// 3D Sound Interface
@@ -1995,10 +1993,10 @@ void S_ChangeMusicEx(const char *mmusic, UINT16 mflags, boolean looping, UINT32
return;
strncpy(newmusic, mmusic, 7);
#ifdef HAVE_BLUA
if(LUAh_MusicChange(music_name, newmusic, &mflags, &looping, &position, &prefadems, &fadeinms))
return;
#endif
newmusic[6] = 0;
// No Music (empty string)
-4
View File
@@ -604,10 +604,6 @@ SOURCE=..\hardware\hw_md2.h
# End Source File
# Begin Source File
SOURCE=..\hardware\hw_trick.c
# End Source File
# Begin Source File
SOURCE=..\hardware\hws_data.h
# End Source File
# End Group
+3 -1208
View File
File diff suppressed because it is too large. Load diff
-3
View File
@@ -53,9 +53,6 @@ void ST_LoadGraphics(void);
void ST_LoadFaceGraphics(char *rankstr, char *wantstr, char *mmapstr, INT32 playernum);
void ST_LoadLocalFaceGraphics(char *rankstr, char *wantstr, char *mmapstr, INT32 playernum);
void ST_ReloadSkinFaceGraphics(void);
#ifdef DELFILE
void ST_UnLoadFaceGraphics(INT32 skinnum);
#endif
void ST_doPaletteStuff(void);
+1 -1
View File
@@ -86,7 +86,7 @@ extern angle_t tantoangle[SLOPERANGE+1];
// Utility function, called by R_PointToAngle.
FUNCMATH unsigned SlopeDiv(unsigned num, unsigned den);
// Only called by R_PointToAngleEx
UINT64 SlopeDivEx(unsigned int num, unsigned int den);
FUNCMATH UINT64 SlopeDivEx(unsigned int num, unsigned int den);
// 360 - angle_t(ANGLE_45) = ANGLE_315
FUNCMATH FUNCINLINE static ATTRINLINE angle_t InvAngle(angle_t a)
+1 -39
View File
@@ -222,7 +222,7 @@ FILE *W_OpenWadFile(const char **filename, boolean useerrors)
static inline void W_LoadDehackedLumpsPK3(UINT16 wadnum)
{
UINT16 posStart, posEnd;
#ifdef HAVE_BLUA
posStart = W_CheckNumForFolderStartPK3("Lua/", wadnum, 0);
if (posStart != INT16_MAX)
{
@@ -230,7 +230,6 @@ static inline void W_LoadDehackedLumpsPK3(UINT16 wadnum)
for (; posStart < posEnd; posStart++)
LUA_LoadLump(wadnum, posStart);
}
#endif
posStart = W_CheckNumForFolderStartPK3("SOC/", wadnum, 0);
if (posStart != INT16_MAX)
@@ -255,7 +254,6 @@ static inline void W_LoadDehackedLumps(UINT16 wadnum)
{
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;
@@ -263,7 +261,6 @@ static inline void W_LoadDehackedLumps(UINT16 wadnum)
if (memcmp(lump_p->name,"LUA_",4)==0)
LUA_LoadLump(wadnum, lump);
}
#endif
{
lumpinfo_t *lump_p = wadfiles[wadnum]->lumpinfo;
@@ -770,11 +767,9 @@ UINT16 W_InitFile(const char *filename, const char *lumpname, UINT16 *wadnump, b
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;
@@ -842,11 +837,9 @@ UINT16 W_InitFile(const char *filename, const char *lumpname, UINT16 *wadnump, b
CONS_Printf(M_GetText("Loading SOC from %s\n"), wadfile->filename);
DEH_LoadDehackedLumpPwad(numwadfiles - 1, 0);
break;
#ifdef HAVE_BLUA
case RET_LUA:
LUA_LoadLump(numwadfiles - 1, 0);
break;
#endif
default:
break;
}
@@ -859,37 +852,6 @@ UINT16 W_InitFile(const char *filename, const char *lumpname, UINT16 *wadnump, b
return wadfile->numlumps;
}
#ifdef DELFILE
void W_UnloadWadFile(UINT16 num)
{
INT32 i;
wadfile_t *delwad = wadfiles[num];
lumpcache_t *lumpcache;
if (num == 0)
return;
CONS_Printf(M_GetText("Removing WAD %s...\n"), wadfiles[num]->filename);
DEH_UnloadDehackedWad(num);
wadfiles[num] = NULL;
lumpcache = delwad->lumpcache;
numwadfiles--;
#ifdef HWRENDER
if (rendermode != render_soft && rendermode != render_none)
HWR_FreeTextureCache();
M_AATreeFree(delwad->hwrcache);
#endif
if (*lumpcache)
{
for (i = 0;i < delwad->numlumps;i++)
Z_ChangeTag(lumpcache[i], PU_PURGELEVEL);
}
Z_Free(lumpcache);
fclose(delwad->handle);
Z_Free(delwad->filename);
Z_Free(delwad);
CONS_Printf(M_GetText("Done unloading WAD.\n"));
}
#endif
/** Tries to load a series of files.
* All files are wads unless they have an extension of ".soc" or ".lua".
-3
View File
@@ -137,9 +137,6 @@ FILE *W_OpenWadFile(const char **filename, boolean useerrors);
// if local is true, it wouldn't check if file adds complex things, therefore
// allowing to still join server without the "you have wrong addons loaded" error
UINT16 W_InitFile(const char *filename, const char *lumpname, UINT16 *wadnump, boolean local);
#ifdef DELFILE
void W_UnloadWadFile(UINT16 num);
#endif
// W_InitMultipleFiles returns 1 if all is okay, 0 otherwise,
// so that it stops with a message if a file was not found, but not if all is okay.
-30
View File
@@ -125,11 +125,8 @@ static INT32 foundAnimVoteWideFrames = 0;
intertype_t intertype = int_none;
#ifdef HAVE_BLUA
static huddrawlist_h luahuddrawlist_intermission = NULL;
static huddrawlist_h luahuddrawlist_vote = NULL;
#endif
static void Y_FollowIntermission(void);
static void Y_UnloadData(void);
@@ -675,14 +672,12 @@ dotimer:
if (cv_scrambleonchange.value && cv_teamscramble.value && (intertic/TICRATE % 2 == 0))
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT/2, hilicol, M_GetText("Teams will be scrambled next round!"));
#ifdef HAVE_BLUA
if (renderisnewtic)
{
LUA_HUD_ClearDrawList(luahuddrawlist_intermission);
LUAh_IntermissionHUD(luahuddrawlist_intermission);
}
LUA_HUD_DrawList(luahuddrawlist_intermission);
#endif
}
//
@@ -710,22 +705,10 @@ void Y_Ticker(void)
if (paused || P_AutoPause())
return;
#ifdef HAVE_BLUA
LUAh_IntermissionThinker();
#endif
intertic++;
// Team scramble code for team match and CTF.
// Don't do this if we're going to automatically scramble teams next round.
/*if (G_GametypeHasTeams() && cv_teamscramble.value && !cv_scrambleonchange.value && server)
{
// If we run out of time in intermission, the beauty is that
// the P_Ticker() team scramble code will pick it up.
if ((intertic % (TICRATE/7)) == 0)
P_DoTeamscrambling();
}*/
// multiplayer uses timer (based on cv_inttime)
if (timer)
{
@@ -944,11 +927,6 @@ void Y_StartIntermission(void)
mapvisited[gamemap-1] |= MV_BEATEN;
if (ALL7EMERALDS(emeralds))
mapvisited[gamemap-1] |= MV_ALLEMERALDS;
/*if (ultimatemode)
mapvisited[gamemap-1] |= MV_ULTIMATE;
if (data.coop.gotperfbonus)
mapvisited[gamemap-1] |= MV_PERFECT;*/
if (modeattacking == ATTACKING_RECORD)
Y_UpdateRecordReplays();
}
@@ -970,10 +948,8 @@ void Y_StartIntermission(void)
usebuffer = true;
}
#ifdef HAVE_BLUA
LUA_HUD_DestroyDrawList(luahuddrawlist_intermission);
luahuddrawlist_intermission = LUA_HUD_CreateDrawList();
#endif
}
// ======
@@ -1366,14 +1342,12 @@ void Y_VoteDrawer(void)
lastvotetic = votetic;
#ifdef HAVE_BLUA
if (renderisnewtic)
{
LUA_HUD_ClearDrawList(luahuddrawlist_vote);
LUAh_VoteHUD(luahuddrawlist_vote);
}
LUA_HUD_DrawList(luahuddrawlist_vote);
#endif
}
//
@@ -1418,9 +1392,7 @@ void Y_VoteTicker(void)
if (paused || P_AutoPause() || !voteclient.loaded)
return;
#ifdef HAVE_BLUA
LUAh_VoteThinker();
#endif
votetic++;
@@ -1706,10 +1678,8 @@ void Y_StartVote(void)
voteclient.loaded = true;
#ifdef HAVE_BLUA
LUA_HUD_DestroyDrawList(luahuddrawlist_vote);
luahuddrawlist_vote = LUA_HUD_CreateDrawList();
#endif
}
//