Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a62ff684e0 | ||
|
|
4e89117d1d | ||
|
|
9cb413b41a | ||
|
|
b0af8c69c2 | ||
|
|
edefaf58c8 | ||
|
|
4af7a869b3 | ||
|
|
81aba34c6b | ||
|
|
fa64d48099 | ||
|
|
1583bf22c3 | ||
|
|
b593060266 | ||
|
|
b33e5fec6f | ||
|
|
f6f55c5790 | ||
|
|
644a4dae31 | ||
|
|
f3ad43d6f2 | ||
|
|
230e9e4a4c | ||
|
|
3936123398 | ||
|
|
d738cf04fc | ||
|
|
e7fc50cc45 | ||
|
|
78a7385ed2 | ||
|
|
5dc7bda605 | ||
|
|
6783e6c4c6 | ||
|
|
eceeddeff0 | ||
|
|
8f947e68e9 | ||
|
|
36cb5624be | ||
|
|
d6dcbb8ba8 | ||
|
|
b2b60a2648 | ||
|
|
c9cef60cfd | ||
|
|
09f840fbfc | ||
|
|
62849f2ba3 | ||
|
|
037185f8a0 | ||
|
|
b0feb32f8b | ||
|
|
9f26240211 | ||
|
|
e211afa9dd | ||
|
|
46da9bf98b | ||
|
|
a4f52ebd10 | ||
|
|
bfddbcde6d | ||
|
|
ef076b4576 | ||
|
|
8cc71fb13a | ||
|
|
f6f5b5caec | ||
|
|
a0ae100186 | ||
|
|
4a1eab5ccd | ||
|
|
8223ab07e4 | ||
|
|
015cf95f4e | ||
|
|
0df5f4530e | ||
|
|
c5461dca4b | ||
|
|
694a397ba4 | ||
|
|
06045a0751 | ||
|
|
fe22c7aba0 | ||
|
|
dd7252d9c1 | ||
|
|
3d46dcc277 | ||
|
|
10fd862992 | ||
|
|
3e48bfc8f5 | ||
|
|
0a62fd11a0 | ||
|
|
5d2b213f76 | ||
|
|
1be1e7fcbd | ||
|
|
cc4d44f806 | ||
|
|
47e045db06 | ||
|
|
05accd5aca | ||
|
|
622e0c12fe | ||
|
|
ec80a4ccda | ||
|
|
b49a46646c | ||
|
|
804b0c2d67 | ||
|
|
1e232eec3b | ||
|
|
69fe26847b | ||
|
|
253a7c3ee5 | ||
|
|
3a42398117 | ||
|
|
20bd4a8599 | ||
|
|
5d215ea633 | ||
|
|
e6adc50e2b | ||
|
|
913b374f9b | ||
|
|
9362d5abd4 | ||
|
|
2fb75f7739 | ||
|
|
ed1554de24 | ||
|
|
df4222e8dc | ||
|
|
2e4a11fc64 | ||
|
|
70f4b20161 | ||
|
|
0be50629c4 | ||
|
|
bee9aaee63 | ||
|
|
0184bd2779 | ||
|
|
2f410e59c7 | ||
|
|
ff258858c8 | ||
|
|
7bfb22d10d | ||
|
|
47960e5c17 | ||
|
|
c5f569eedc | ||
|
|
586cb358ba | ||
|
|
65b157cac0 | ||
|
|
0c864503a3 | ||
|
|
2f57137d11 | ||
|
|
13d4f9e7d7 | ||
|
|
c38d7c1672 | ||
|
|
0ddbaeb2a2 | ||
|
|
1e2ddebced | ||
|
|
acf1254494 | ||
|
|
007094e6d2 | ||
|
|
9c0f9b0637 | ||
|
|
cf0475dd94 | ||
|
|
afe57f1d05 | ||
|
|
a7b5df6793 | ||
|
|
a8eb9b2485 | ||
|
|
7fd123d604 | ||
|
|
0644ecd0c3 | ||
|
|
37cd0a596e | ||
|
|
499177c4b9 | ||
|
|
961e08ab75 | ||
|
|
178a59d3a1 | ||
|
|
6a4dc84a1f | ||
|
|
9930675c93 | ||
|
|
697f6994c9 | ||
|
|
5284ba6935 | ||
|
|
55752f3d68 | ||
|
|
2a69fa8f45 | ||
|
|
7c0c584c06 | ||
|
|
f3fea02e77 | ||
|
|
47e3616b4a | ||
|
|
f8a0eefa1a | ||
|
|
6bc4102dfd | ||
|
|
2cec2a5135 | ||
|
|
8d3a9abda3 | ||
|
|
f596bf07d5 | ||
|
|
75a4614acc | ||
|
|
4fb02a2175 | ||
|
|
0b315a8364 | ||
|
|
a5a43ec7a9 | ||
|
|
f783819278 | ||
|
|
8d6ca2646d | ||
|
|
a6e48de9a3 | ||
|
|
7c7d0ba9c3 | ||
|
|
eb631e1b09 | ||
|
|
d0da83e5cb | ||
|
|
9f9c81696d | ||
|
|
76f9907288 | ||
|
|
e3050c64bc | ||
|
|
607e0468ef | ||
|
|
f7fb8a1897 | ||
|
|
9ce1e0b0bc | ||
|
|
3957c04a9b | ||
|
|
e11fec1408 | ||
|
|
a2339b7a66 |
No files matched your search
+31
-2
@@ -2,7 +2,7 @@
|
||||
|
||||
## mobj.localskin and player.localskin fields
|
||||
|
||||
Allow reading and assigning localskins to players. Local skins for other objects aren't supported currently.
|
||||
Allow reading and assigning localskins.
|
||||
|
||||
## mobj.rollsum field
|
||||
|
||||
@@ -20,9 +20,38 @@ Changes vote background texture prefix (game looks for PREFIX + "W" or "C" (depe
|
||||
## hud.add(fn, "vote") and hud.add(fn, "intermission")
|
||||
|
||||
Hud hooks for vote screen and intermission screen. They only get drawer (`v`) as argument.
|
||||
To check if those hooks are available, check if globals FEATURE\_VOTEHUD and FEATURE\_INERMISSIONHUD
|
||||
To check if those hooks are available, check if globals FEATURE\_VOTEHUD and FEATURE\_INTERMISSIONHUD
|
||||
exist.
|
||||
|
||||
## x, y = hud.getOffsets(item)
|
||||
|
||||
Returns the values of the given HUD item's `xoffset`/`yoffset` cvars.
|
||||
Available for any HUD item with offset cvars.
|
||||
|
||||
## x, y, flags = v.getDrawInfo(item)
|
||||
|
||||
Returns the X, Y and flags where the given HUD item will be drawn for the current displayplayer.
|
||||
Available for `item`, `gametypeinfo` and `minimap`.
|
||||
|
||||
## patch, colormap = v.getColorHudPatch(item)
|
||||
|
||||
Returns the patch and colormap to use for the given HUD item. Colorization is based on the user's settings.
|
||||
Available for `item` and `itemmul`.
|
||||
Extra arguments for some items:
|
||||
### item
|
||||
* `small`: true for small item box, false for big item box.
|
||||
* `dark`: true to darken item box. Depends on `darkitembox`.
|
||||
### itemmul
|
||||
* `small`: true for small sticker, false for big sticker.
|
||||
|
||||
## hudcolor = v.getHudColor()
|
||||
|
||||
Returns the displayplayer's HUD color.
|
||||
|
||||
## colorize = v.useColorHud()
|
||||
|
||||
Returns true if colorization is enabled, false otherwise.
|
||||
|
||||
## mobj.spritexscale, mobj.spriteyscale, mobj.spritexoffset, mobj.spriteyoffset, mobj.rollangle, mobj.sloperoll, mobj.rollmodel fields
|
||||
|
||||
Same fields as in SRB2 2.2
|
||||
|
||||
@@ -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
|
||||
)
|
||||
|
||||
|
||||
+4
-5
@@ -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
|
||||
@@ -535,6 +533,7 @@ OBJS:=$(i_main_o) \
|
||||
$(OBJDIR)/i_time.o \
|
||||
$(OBJDIR)/lzf.o \
|
||||
$(OBJDIR)/b_bot.o \
|
||||
$(OBJDIR)/hashtable.o \
|
||||
$(i_net_o) \
|
||||
$(i_system_o) \
|
||||
$(i_sound_o) \
|
||||
@@ -721,9 +720,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"
|
||||
|
||||
@@ -233,11 +233,6 @@ INT32 I_mkdir(const char *dirname, INT32 unixright)
|
||||
return -1;
|
||||
}
|
||||
|
||||
const CPUInfoFlags *I_CPUInfo(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char *I_LocateWad(void)
|
||||
{
|
||||
return "/sdcard/srb2";
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -10,8 +10,6 @@ WFLAGS+=-Wno-logical-op
|
||||
endif
|
||||
endif
|
||||
|
||||
OPTS+=-DHAVE_BLUA
|
||||
|
||||
OBJS:=$(OBJS) \
|
||||
$(OBJDIR)/lapi.o \
|
||||
$(OBJDIR)/lbaselib.o \
|
||||
|
||||
+6
-19
@@ -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();
|
||||
|
||||
@@ -1493,6 +1478,7 @@ badinput:
|
||||
//
|
||||
|
||||
static boolean serverloading = false;
|
||||
static boolean serverloadingstealth = false;
|
||||
|
||||
static void Got_NetVar(UINT8 **p, INT32 playernum)
|
||||
{
|
||||
@@ -1520,7 +1506,7 @@ static void Got_NetVar(UINT8 **p, INT32 playernum)
|
||||
cvar = CV_FindNetVar(netid);
|
||||
svalue = (char *)*p;
|
||||
SKIPSTRING(*p);
|
||||
stealth = READUINT8(*p);
|
||||
stealth = READUINT8(*p) || (serverloading && serverloadingstealth);
|
||||
|
||||
if (!cvar)
|
||||
{
|
||||
@@ -1574,13 +1560,14 @@ void CV_SaveNetVars(UINT8 **p, boolean isdemorecording)
|
||||
WRITEUINT16(count_p, count);
|
||||
}
|
||||
|
||||
void CV_LoadNetVars(UINT8 **p)
|
||||
void CV_LoadNetVars(UINT8 **p, boolean onlyIfChanged)
|
||||
{
|
||||
consvar_t *cvar;
|
||||
UINT16 count;
|
||||
|
||||
// prevent "invalid command received"
|
||||
serverloading = true;
|
||||
serverloadingstealth = onlyIfChanged;
|
||||
|
||||
for (cvar = consvar_vars; cvar; cvar = cvar->next)
|
||||
if (cvar->flags & CV_NETVAR)
|
||||
|
||||
+1
-1
@@ -178,7 +178,7 @@ void CV_SaveVariables(FILE *f);
|
||||
|
||||
// load/save gamesate (load and save option and for network join in game)
|
||||
void CV_SaveNetVars(UINT8 **p, boolean isdemorecording);
|
||||
void CV_LoadNetVars(UINT8 **p);
|
||||
void CV_LoadNetVars(UINT8 **p, boolean onlyIfChanged);
|
||||
|
||||
// reset cheat netvars after cheats is deactivated
|
||||
void CV_ResetCheatNetVars(void);
|
||||
|
||||
+16
-18
@@ -54,6 +54,7 @@ static boolean con_started = false; // console has been initialised
|
||||
boolean con_startup = false; // true at game startup, screen need refreshing
|
||||
static boolean con_forcepic = true; // at startup toggle console translucency when first off
|
||||
boolean con_recalc; // set true when screen size has changed
|
||||
boolean con_muted = false;
|
||||
|
||||
static tic_t con_tick; // console ticker for anim or blinking prompt cursor
|
||||
// con_scrollup should use time (currenttime - lasttime)..
|
||||
@@ -66,8 +67,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 +118,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 +184,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 +424,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 +741,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 +1241,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;
|
||||
@@ -1263,7 +1261,7 @@ static void CON_Print(char *msg)
|
||||
INT32 controlchars = 0; // for color changing
|
||||
char color = '\x80'; // keep color across lines
|
||||
|
||||
if (msg == NULL)
|
||||
if (msg == NULL || con_muted)
|
||||
return;
|
||||
|
||||
if (*msg == '\3') // chat text, makes ding sound
|
||||
@@ -1600,7 +1598,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 +1606,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;
|
||||
|
||||
@@ -27,6 +27,9 @@ extern boolean con_recalc;
|
||||
|
||||
extern boolean con_startup;
|
||||
|
||||
// no messages will be printed while the console is muted
|
||||
extern boolean con_muted;
|
||||
|
||||
// top clip value for view render: do not draw part of view hidden by console
|
||||
extern INT32 con_clipviewtop;
|
||||
|
||||
|
||||
+861
-57
File diff suppressed because it is too large.
Load diff
@@ -41,6 +41,19 @@ applications may follow different packet versions.
|
||||
#define BACKUPTICS 32
|
||||
#define TICQUEUE 512 // more than enough for most timeouts....
|
||||
#define MAXTEXTCMD 256
|
||||
|
||||
// How many time bits to encode into ticcmds (aiming and angle components, respectively)
|
||||
#define ENCODE_TICCMD_TIMES
|
||||
#define TICCMD_TIMEBITS_AIMING 3
|
||||
#define TICCMD_TIMEBITS_ANGLE 2
|
||||
#define TICCMD_TIMEMASK_AIMING (~(0xFFFFFFFF<<TICCMD_TIMEBITS_AIMING))
|
||||
#define TICCMD_TIMEMASK_ANGLE (~(0xFFFFFFFF<<TICCMD_TIMEBITS_ANGLE))
|
||||
#define TICCMD_TIME_SIZE (1<<(TICCMD_TIMEBITS_AIMING+TICCMD_TIMEBITS_ANGLE))
|
||||
|
||||
// Maximum number of client-side simulations allowed. A simulation is a version of the game state extrapolated some frames ahead to cancel out network latency
|
||||
#define MAXSIMULATIONS TICRATE //one second of simulations
|
||||
#define MAXLOCALSAVESTATES 8
|
||||
|
||||
//
|
||||
// Packet structure
|
||||
//
|
||||
@@ -542,6 +555,17 @@ typedef enum
|
||||
|
||||
} kickreason_t;
|
||||
|
||||
// Player movement histories for simulated gamestates
|
||||
typedef struct
|
||||
{
|
||||
// stores historical simulated positions where 0 is the real game position and simtic-gametic is the latest simulated position
|
||||
fixed_t histx[MAXSIMULATIONS + 1], histy[MAXSIMULATIONS + 1], histz[MAXSIMULATIONS + 1];
|
||||
|
||||
// stores the final simulated position for each simulated gametic
|
||||
fixed_t simx[MAXSIMULATIONS], simy[MAXSIMULATIONS], simz[MAXSIMULATIONS];
|
||||
|
||||
} steadyplayer_t;
|
||||
|
||||
/* the max number of name changes in some time period */
|
||||
#define MAXNAMECHANGES (5)
|
||||
#define NAMECHANGERATE (60*TICRATE)
|
||||
@@ -555,6 +579,9 @@ extern boolean acceptnewnode;
|
||||
extern SINT8 servernode;
|
||||
extern char connectedservername[MAXSERVERNAME];
|
||||
|
||||
extern boolean issimulation; // whether the currently executed tic is part of a simulated gamestate
|
||||
extern steadyplayer_t steadyplayers[MAXPLAYERS];
|
||||
|
||||
void Command_Ping_f(void);
|
||||
extern tic_t connectiontimeout;
|
||||
extern tic_t jointimeout;
|
||||
|
||||
+26
-6
@@ -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
|
||||
@@ -138,6 +136,8 @@ char srb2path[256] = ".";
|
||||
boolean usehome = true;
|
||||
const char *pandf = "%s" PATHSEP "%s";
|
||||
|
||||
extern char netDebugText[10000];
|
||||
|
||||
//
|
||||
// EVENT HANDLING
|
||||
//
|
||||
@@ -596,6 +596,28 @@ static void D_Display(void)
|
||||
V_DrawRightAlignedString(BASEVIDWIDTH, BASEVIDHEIGHT-ST_HEIGHT-10, V_YELLOWMAP, s);
|
||||
}
|
||||
|
||||
//netsimstat srb2netplus
|
||||
if (cv_netsimstat.value && netDebugText[0] != 0)
|
||||
{
|
||||
const char *str = netDebugText;
|
||||
int y = 0;
|
||||
|
||||
while (str != NULL)
|
||||
{
|
||||
char temp[1024];
|
||||
const char *nextStr = strstr(str + 1, "\n");
|
||||
int len = nextStr ? nextStr - str : strlen(str);
|
||||
|
||||
memcpy(temp, str, len);
|
||||
temp[len] = 0;
|
||||
|
||||
V_DrawRightAlignedSmallString(BASEVIDWIDTH, y, V_YELLOWMAP, temp);
|
||||
|
||||
y += 5;
|
||||
str = nextStr ? nextStr + 1 : NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (cv_shittyscreen.value)
|
||||
V_DrawVhsEffect(cv_shittyscreen.value == 2);
|
||||
|
||||
@@ -771,9 +793,7 @@ void D_SRB2Loop(void)
|
||||
HW3S_EndFrameUpdate();
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
LUA_Step();
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
if (! dedicated)
|
||||
|
||||
+164
-110
@@ -50,6 +50,7 @@
|
||||
#include "y_inter.h"
|
||||
#include "fastcmp.h"
|
||||
#include "m_perfstats.h"
|
||||
#include "i_net.h"
|
||||
|
||||
#ifdef NETGAME_DEVMODE
|
||||
#define CV_RESTRICT CV_NETVAR
|
||||
@@ -73,9 +74,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);
|
||||
@@ -124,6 +122,10 @@ static void KartEncore_OnChange(void);
|
||||
static void KartComeback_OnChange(void);
|
||||
static void KartEliminateLast_OnChange(void);
|
||||
|
||||
//netplus stuff
|
||||
static void TimeFudge_OnChange(void);
|
||||
void Command_Autotimefudge(void);
|
||||
|
||||
#ifdef NETGAME_DEVMODE
|
||||
static void Fishcake_OnChange(void);
|
||||
#endif
|
||||
@@ -144,9 +146,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 +198,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
|
||||
@@ -466,6 +463,8 @@ consvar_t cv_allowexitlevel = {"allowexitlevel", "No", CV_NETVAR, CV_YesNo, NULL
|
||||
|
||||
consvar_t cv_killingdead = {"killingdead", "Off", CV_NETVAR|CV_NOSHOWHELP, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_netsimstat = { "netsimstat", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL }; //srb2netplus, shows simulation stats
|
||||
|
||||
consvar_t cv_netstat = {"netstat", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; // show bandwidth statistics
|
||||
static CV_PossibleValue_t nettimeout_cons_t[] = {{TICRATE/7, "MIN"}, {60*TICRATE, "MAX"}, {0, NULL}};
|
||||
consvar_t cv_nettimeout = {"nettimeout", "210", CV_CALL|CV_SAVE, nettimeout_cons_t, NetTimeout_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
@@ -551,6 +550,50 @@ boolean forceresetplayers = false;
|
||||
boolean deferencoremode = false;
|
||||
UINT8 splitscreen = 0;
|
||||
boolean circuitmap = true; // SRB2kart
|
||||
|
||||
consvar_t cv_simulate = { "sim", "Yes", 0, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL };
|
||||
|
||||
static CV_PossibleValue_t simulateTics_cons_t[] = { {0, "MIN"}, {MAXSIMULATIONS - 1, "MAX"}, {0, NULL} };
|
||||
consvar_t cv_simulatetics = { "simtics", "MAX", 0, simulateTics_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL };
|
||||
|
||||
consvar_t cv_simmisstics = { "simmisstics", "Yes", 0, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL };
|
||||
consvar_t cv_jittersmoothing = { "jittersmoothing", "Yes", 0, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL };
|
||||
|
||||
static CV_PossibleValue_t simulateculldistance_cons_t[] = { {0, "MIN"}, {10000, "MAX"}, {0, NULL} };
|
||||
consvar_t cv_simulateculldistance = { "simcull", "MIN", 0, simulateculldistance_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL };
|
||||
|
||||
static CV_PossibleValue_t siminaccuracy_cons_t[] = { {1, "MIN"}, {10, "MAX"}, {0, NULL} };
|
||||
consvar_t cv_siminaccuracy = { "siminaccuracy", "MIN", 0, siminaccuracy_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL };
|
||||
|
||||
static CV_PossibleValue_t netsteadyplayers_cons_t[] = { {0, "MIN"}, {MAXSIMULATIONS - 1, "MAX"}, {0, NULL} };
|
||||
consvar_t cv_netsteadyplayers = { "simsteadyplayers", "0", 0, netsteadyplayers_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL };
|
||||
|
||||
static CV_PossibleValue_t nettrails_cons_t[] = { {0, "MIN"}, {10, "MAX"}, {0, NULL} };
|
||||
consvar_t cv_nettrails = { "simtrails", "5", 0, nettrails_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL };
|
||||
|
||||
consvar_t cv_netslingdelay = { "simslingdelay", "No", 0, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL };
|
||||
|
||||
static CV_PossibleValue_t netdelay_cons_t[] = { {0, "MIN"}, {250, "MAX"}, {0, NULL} };
|
||||
consvar_t cv_netdelay = { "netdelay", "0", 0, netdelay_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL };
|
||||
|
||||
static CV_PossibleValue_t netjitter_cons_t[] = { {0, "MIN"}, {5, "MAX"}, {0, NULL} };
|
||||
consvar_t cv_netjitter = { "netjitter", "0", 0, netjitter_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL };
|
||||
|
||||
consvar_t cv_netsmoothing = { "netsmoothing", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL };
|
||||
|
||||
consvar_t cv_netspikes = { "netspikes", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL };
|
||||
|
||||
static CV_PossibleValue_t netvariabletime_cons_t[] = { {-1, "MIN"}, {100, "MAX"}, {0, NULL} };
|
||||
consvar_t cv_netvariabletime = { "netvariabletime", "-1", 0, netvariabletime_cons_t, NULL, -1, NULL, NULL, 0, 0, NULL };
|
||||
|
||||
static CV_PossibleValue_t debugsimulaterewind_cons_t[] = { {0, "MIN"}, {BACKUPTICS - 1, "MAX"}, {0, NULL} };
|
||||
consvar_t cv_debugsimulaterewind = { "debugsimulaterewind", "0", 0, debugsimulaterewind_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL };
|
||||
|
||||
static CV_PossibleValue_t timefudge_cons_t[] = { {0, "MIN"}, {100, "MAX"}, {0, NULL} };
|
||||
consvar_t cv_timefudge = { "timefudge", "0", CV_CALL, timefudge_cons_t, TimeFudge_OnChange, 0, NULL, NULL, 0, 0, NULL };
|
||||
|
||||
consvar_t cv_autoupdatetimefudge = {"autoupdatetimefudge", "No", 0, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
INT32 adminplayers[MAXPLAYERS];
|
||||
|
||||
/// \warning Keep this up-to-date if you add/remove/rename net text commands
|
||||
@@ -573,7 +616,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",
|
||||
@@ -581,10 +624,8 @@ const char *netxcmdnames[MAXNETXCMD - 1] =
|
||||
"MODIFYVOTE",
|
||||
"PICKVOTE",
|
||||
"REMOVEPLAYER",
|
||||
#ifdef HAVE_BLUA
|
||||
"LUACMD",
|
||||
"LUAVAR"
|
||||
#endif
|
||||
};
|
||||
|
||||
// =========================================================================
|
||||
@@ -622,15 +663,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);
|
||||
@@ -667,9 +703,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);
|
||||
@@ -690,13 +723,31 @@ 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);
|
||||
|
||||
COM_AddCommand("autotimefudge", Command_Autotimefudge);
|
||||
|
||||
CV_RegisterVar(&cv_simulate);
|
||||
CV_RegisterVar(&cv_simulatetics);
|
||||
CV_RegisterVar(&cv_simmisstics);
|
||||
CV_RegisterVar(&cv_jittersmoothing);
|
||||
CV_RegisterVar(&cv_simulateculldistance);
|
||||
CV_RegisterVar(&cv_siminaccuracy);
|
||||
CV_RegisterVar(&cv_netdelay);
|
||||
CV_RegisterVar(&cv_netjitter);
|
||||
CV_RegisterVar(&cv_netsmoothing);
|
||||
CV_RegisterVar(&cv_netspikes);
|
||||
CV_RegisterVar(&cv_netsteadyplayers);
|
||||
CV_RegisterVar(&cv_debugsimulaterewind);
|
||||
CV_RegisterVar(&cv_timefudge);
|
||||
CV_RegisterVar(&cv_autoupdatetimefudge);
|
||||
CV_RegisterVar(&cv_nettrails);
|
||||
CV_RegisterVar(&cv_netslingdelay);
|
||||
CV_RegisterVar(&cv_netvariabletime);
|
||||
|
||||
// for master server connection
|
||||
AddMServCommands();
|
||||
|
||||
@@ -732,19 +783,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);
|
||||
@@ -816,6 +854,83 @@ void D_RegisterServerCommands(void)
|
||||
CV_RegisterVar(&cv_maxdemosize);
|
||||
}
|
||||
|
||||
extern double netUpdateFudge;
|
||||
void Command_Autotimefudge(void)
|
||||
{
|
||||
// you can use SDL_GetPerformanceFrequency() instead of tic_frequency to get more precise timings
|
||||
double startTime = ((double)I_GetPreciseTime() / tic_frequency);
|
||||
double packetTimeFudge[64];
|
||||
int numReceivedPackets = 0;
|
||||
const double numSampleTics = 10;
|
||||
int i;
|
||||
double lastTimeReceivedPacket;
|
||||
|
||||
if (server && netgame)
|
||||
{
|
||||
CONS_Printf("Servers do not need time fudging!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
lastTimeReceivedPacket = (double)I_GetPreciseTime() / tic_frequency;
|
||||
while ((abs((double)I_GetPreciseTime() / tic_frequency - startTime) < numSampleTics) || numReceivedPackets < 10)
|
||||
{
|
||||
I_NetGet();
|
||||
if ((doomcom->remotenode != -1)) // Packet received
|
||||
{
|
||||
packetTimeFudge[numReceivedPackets] = 100 * abs(((double)I_GetPreciseTime() / tic_frequency - lastTimeReceivedPacket) - netUpdateFudge); // gets the time fudge offset (0-100)
|
||||
CONS_Printf("%i: %d\n", numReceivedPackets, packetTimeFudge[numReceivedPackets]);
|
||||
numReceivedPackets++;
|
||||
lastTimeReceivedPacket = (double)I_GetPreciseTime() / tic_frequency;
|
||||
}
|
||||
}
|
||||
|
||||
if (numReceivedPackets > 0)
|
||||
{
|
||||
UINT8 minOffset = 100, maxOffset = 0, averageOffset = 0;
|
||||
UINT8 newTimeFudge;
|
||||
UINT8 estimatedRange;
|
||||
|
||||
|
||||
for (i = 0; i < numReceivedPackets; i++)
|
||||
{
|
||||
if (packetTimeFudge[i] < 0)
|
||||
continue;
|
||||
minOffset = min(minOffset, packetTimeFudge[i]);
|
||||
maxOffset = max(maxOffset, packetTimeFudge[i]);
|
||||
}
|
||||
|
||||
if (maxOffset - minOffset > 50)
|
||||
{
|
||||
// say maxOffset = 90 and minOffset = 20, we want the average to be 30...
|
||||
maxOffset = maxOffset - 100;
|
||||
|
||||
if (minOffset > maxOffset)
|
||||
{
|
||||
int swap = maxOffset;
|
||||
maxOffset = minOffset;
|
||||
minOffset = swap;
|
||||
}
|
||||
}
|
||||
|
||||
estimatedRange = maxOffset - minOffset;
|
||||
averageOffset = (maxOffset + minOffset) / 2;
|
||||
|
||||
CONS_Printf("%i packets received\n Timer fluctuations:\nmin: %d max: %d avg: %d est. range: %d (network update time: %lf)\n", numReceivedPackets, minOffset, maxOffset, averageOffset,
|
||||
estimatedRange, netUpdateFudge);
|
||||
|
||||
if (averageOffset <= 0)
|
||||
{
|
||||
CONS_Printf("Timers are OK, no time fudging required\n");
|
||||
return;
|
||||
}
|
||||
|
||||
newTimeFudge = (cv_timefudge.value + averageOffset + 50) % 100;
|
||||
CONS_Printf("New time fudge: %i%%\n", newTimeFudge);
|
||||
|
||||
CV_SetValue(&cv_timefudge, newTimeFudge);
|
||||
}
|
||||
}
|
||||
|
||||
// =========================================================================
|
||||
// CLIENT STARTUP
|
||||
// =========================================================================
|
||||
@@ -922,6 +1037,7 @@ void D_RegisterClientCommands(void)
|
||||
CV_RegisterVar(&cv_rollingdemos);
|
||||
CV_RegisterVar(&cv_netstat);
|
||||
CV_RegisterVar(&cv_netticbuffer);
|
||||
CV_RegisterVar(&cv_netsimstat);
|
||||
|
||||
#ifdef NETGAME_DEVMODE
|
||||
CV_RegisterVar(&cv_fishcake);
|
||||
@@ -1147,7 +1263,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
|
||||
|
||||
@@ -2915,9 +3031,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;
|
||||
|
||||
@@ -2983,10 +3097,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;
|
||||
@@ -4745,42 +4857,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];
|
||||
@@ -4849,33 +4925,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];
|
||||
@@ -5080,6 +5129,7 @@ void ItemFinder_OnChange(void)
|
||||
* \sa cv_pointlimit, TimeLimit_OnChange
|
||||
* \author Graue <graue@oceanbase.org>
|
||||
*/
|
||||
|
||||
static void PointLimit_OnChange(void)
|
||||
{
|
||||
// Don't allow pointlimit in Single Player/Co-Op/Race!
|
||||
@@ -5098,7 +5148,7 @@ static void PointLimit_OnChange(void)
|
||||
cv_pointlimit.value > 1 ? "s" : "");
|
||||
}
|
||||
else if (netgame || multiplayer)
|
||||
CONS_Printf(M_GetText("Point limit disabled\n"));
|
||||
CONS_Printf(M_GetText("Point limit disabled\n"));
|
||||
}
|
||||
|
||||
static void NumLaps_OnChange(void)
|
||||
@@ -5343,6 +5393,12 @@ static void SoundTest_OnChange(void)
|
||||
S_StartSound(NULL, cv_soundtest.value);
|
||||
}
|
||||
|
||||
static void TimeFudge_OnChange(void)
|
||||
{
|
||||
I_SetTime(I_GetPreciseTime(), cv_timefudge.value, true);
|
||||
}
|
||||
|
||||
|
||||
static void AutoBalance_OnChange(void)
|
||||
{
|
||||
autobalance = (INT16)cv_autobalance.value;
|
||||
@@ -5790,7 +5846,6 @@ static void Command_Togglemodified_f(void)
|
||||
modifiedgame = !modifiedgame;
|
||||
}
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
extern UINT8 *save_p;
|
||||
static void Command_Archivetest_f(void)
|
||||
{
|
||||
@@ -5805,8 +5860,8 @@ static void Command_Archivetest_f(void)
|
||||
|
||||
// assign mobjnum
|
||||
i = 1;
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
if (th->function.acp1 == (actionf_p1)P_MobjThinker)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
if (th->function.acp1 != (actionf_p1)P_RemoveThinkerDelayed)
|
||||
((mobj_t *)th)->mobjnum = i++;
|
||||
|
||||
// allocate buffer
|
||||
@@ -5835,7 +5890,6 @@ static void Command_Archivetest_f(void)
|
||||
CONS_Printf("Done. No crash.\n");
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/** Makes a change to ::cv_forceskin take effect immediately.
|
||||
*
|
||||
|
||||
+20
-2
@@ -86,6 +86,7 @@ extern consvar_t cv_teamscramble;
|
||||
extern consvar_t cv_scrambleonchange;
|
||||
|
||||
extern consvar_t cv_netstat;
|
||||
extern consvar_t cv_netsimstat;
|
||||
#ifdef WALLSPLATS
|
||||
extern consvar_t cv_splats;
|
||||
#endif
|
||||
@@ -158,6 +159,25 @@ extern consvar_t cv_pingmeasurement;
|
||||
extern consvar_t cv_pingicon;
|
||||
extern consvar_t cv_pingstyle;
|
||||
|
||||
//netplus stuff
|
||||
extern consvar_t cv_simulate;
|
||||
extern consvar_t cv_simulatetics;
|
||||
extern consvar_t cv_simmisstics;
|
||||
extern consvar_t cv_jittersmoothing;
|
||||
extern consvar_t cv_simulateculldistance;
|
||||
extern consvar_t cv_siminaccuracy;
|
||||
extern consvar_t cv_netdelay;
|
||||
extern consvar_t cv_netjitter;
|
||||
extern consvar_t cv_netsmoothing;
|
||||
extern consvar_t cv_netspikes;
|
||||
extern consvar_t cv_netsteadyplayers;
|
||||
extern consvar_t cv_debugsimulaterewind;
|
||||
extern consvar_t cv_timefudge;
|
||||
extern consvar_t cv_autoupdatetimefudge;
|
||||
extern consvar_t cv_nettrails;
|
||||
extern consvar_t cv_netslingdelay;
|
||||
extern consvar_t cv_netvariabletime;
|
||||
|
||||
//extern consvar_t cv_smallpos;
|
||||
extern consvar_t cv_showminimapnames;
|
||||
extern consvar_t cv_minihead;
|
||||
@@ -233,10 +253,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
@@ -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
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
|
||||
+1
-25
@@ -468,7 +468,7 @@ void M_StartupLocale(void);
|
||||
// M_GetText function that just returns the string.
|
||||
#define M_GetText(x) (x)
|
||||
#endif
|
||||
extern void *(*M_Memcpy)(void* dest, const void* src, size_t n) FUNCNONNULL;
|
||||
void *M_Memcpy(void* dest, const void* src, size_t n);
|
||||
char *va(const char *format, ...) FUNCPRINTF;
|
||||
char *M_GetToken(const char *inputString);
|
||||
char *sizeu1(size_t num);
|
||||
@@ -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
|
||||
|
||||
@@ -505,6 +505,14 @@ extern UINT32 timesBeatenWithEmeralds;
|
||||
extern tic_t gametic;
|
||||
#define localgametic leveltime
|
||||
|
||||
//extern tic_t neededtic;
|
||||
extern tic_t simtic; // current tic at simulation, if applicable (if no simulation happened, this=gametic)
|
||||
extern tic_t targetsimtic; // the target sim tic, if applicable
|
||||
extern tic_t smoothedTic; // current game tic when smoothing is enabled (\todo: could cause problems if game objects care about gametic)
|
||||
extern boolean canSimulate;
|
||||
// extern boolean canPlaySounds;
|
||||
extern tic_t finaltargetsimtic;
|
||||
|
||||
// Player spawn spots.
|
||||
extern mapthing_t *playerstarts[MAXPLAYERS]; // Cooperative
|
||||
extern mapthing_t *bluectfstarts[MAXPLAYERS]; // CTF
|
||||
|
||||
@@ -137,11 +137,6 @@ INT32 I_mkdir(const char *dirname, INT32 unixright)
|
||||
return -1;
|
||||
}
|
||||
|
||||
const CPUInfoFlags *I_CPUInfo(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char *I_LocateWad(void)
|
||||
{
|
||||
return NULL;
|
||||
|
||||
+1
-1
@@ -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
|
||||
|
||||
+20
-33
@@ -130,6 +130,14 @@ UINT32 totalrings; // for intermission
|
||||
INT16 lastmap; // last level you were at (returning from special stages)
|
||||
tic_t timeinmap; // Ticker for time spent in level (used for levelcard display)
|
||||
|
||||
tic_t simtic; // simulated tic
|
||||
tic_t neededtic;
|
||||
tic_t targetsimtic; // target simulated tic
|
||||
tic_t smoothedTic;
|
||||
boolean canSimulate;
|
||||
tic_t finaltargetsimtic;
|
||||
// boolean canPlaySounds;
|
||||
|
||||
INT16 spstage_start;
|
||||
INT16 sstage_start;
|
||||
INT16 sstage_end;
|
||||
@@ -1621,10 +1629,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 +2960,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 +3016,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)
|
||||
@@ -3201,9 +3202,9 @@ void G_ChangePlayerReferences(mobj_t *oldmo, mobj_t *newmo)
|
||||
I_Assert((oldmo != NULL) && (newmo != NULL));
|
||||
|
||||
// scan all thinkers
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
@@ -3310,9 +3311,7 @@ void G_DoReborn(INT32 playernum)
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef HAVE_BLUA
|
||||
LUAh_MapChange(gamemap);
|
||||
#endif
|
||||
G_DoLoadLevel(true);
|
||||
}
|
||||
}*/
|
||||
@@ -4784,9 +4783,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 +5106,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
|
||||
@@ -5966,16 +5961,15 @@ void G_ConsGhostTic(INT32 playernum)
|
||||
demo_p += sizeof(angle_t); // angle, unnecessary for cons.
|
||||
|
||||
mobj = NULL;
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
mobj = (mobj_t *)th;
|
||||
if (mobj->type == (mobjtype_t)type && mobj->x == x && mobj->y == y && mobj->z == z)
|
||||
break;
|
||||
mobj = NULL; // wasn't this one, keep searching.
|
||||
}
|
||||
if (mobj && mobj->health != health) // Wasn't damaged?! This is desync! Fix it!
|
||||
if (th != &thlist[THINK_MOBJ] && mobj->health != health) // Wasn't damaged?! This is desync! Fix it!
|
||||
{
|
||||
if (demosynced)
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Demo playback has desynced!\n"));
|
||||
@@ -6780,11 +6774,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 +6884,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));
|
||||
@@ -7799,7 +7789,7 @@ void G_DoPlayDemo(char *defdemoname)
|
||||
}
|
||||
|
||||
// net var data
|
||||
CV_LoadNetVars(&demo_p);
|
||||
CV_LoadNetVars(&demo_p, false);
|
||||
|
||||
// Sigh ... it's an empty demo.
|
||||
if (*demo_p == DEMOMARKER)
|
||||
@@ -7843,7 +7833,7 @@ void G_DoPlayDemo(char *defdemoname)
|
||||
#endif
|
||||
|
||||
// net var data
|
||||
CV_LoadNetVars(&demo_p);
|
||||
CV_LoadNetVars(&demo_p, false);
|
||||
|
||||
// Sigh ... it's an empty demo.
|
||||
if (*demo_p == DEMOMARKER)
|
||||
@@ -7882,9 +7872,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 +7960,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 +7968,6 @@ void G_DoPlayDemo(char *defdemoname)
|
||||
// No modeattacking check, DF_LUAVARS won't be present here.
|
||||
LUA_UnArchiveDemo();
|
||||
}
|
||||
#endif
|
||||
|
||||
splitscreen = 0;
|
||||
|
||||
@@ -8476,16 +8463,16 @@ void G_DoPlayMetal(void)
|
||||
metalbuffer = metal_p = W_CacheLumpNum(l, PU_STATIC);
|
||||
|
||||
// find metal sonic
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
|
||||
mo = (mobj_t *)th;
|
||||
if (mo->type == MT_METALSONIC_RACE)
|
||||
break;
|
||||
}
|
||||
if (!mo)
|
||||
if (th == &thlist[THINK_MOBJ])
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, M_GetText("Failed to find bot entity.\n"));
|
||||
Z_Free(metalbuffer);
|
||||
|
||||
@@ -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 ||
|
||||
|
||||
@@ -34,6 +34,4 @@ void HWR_SetCurrentTexture(GLMipmap_t *texture);
|
||||
void HWR_ProcessPolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags, int shader, boolean horizonSpecial);
|
||||
void HWR_RenderBatches(void);
|
||||
|
||||
extern boolean currently_batching;
|
||||
|
||||
#endif
|
||||
@@ -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++)
|
||||
|
||||
+11
-27
@@ -32,6 +32,7 @@ INT32 patchformat = GL_TEXFMT_AP_88; // use alpha for holes
|
||||
INT32 textureformat = GL_TEXFMT_P_8; // use chromakey for hole
|
||||
|
||||
RGBA_t mapPalette[256] = {0}; // the palette for the currently loaded level or menu etc.
|
||||
|
||||
// Returns a pointer to the palette which should be used for caching textures.
|
||||
RGBA_t *HWR_GetTexturePalette(void)
|
||||
{
|
||||
@@ -85,7 +86,6 @@ static void HWR_DrawColumnInCache(const column_t *patchcol, UINT8 *block, GLMipm
|
||||
position = originy + topdelta;
|
||||
|
||||
yfrac = 0;
|
||||
//yfracstep = (patchcol->length << FRACBITS) / count;
|
||||
if (position < 0)
|
||||
{
|
||||
yfrac = -position<<FRACBITS;
|
||||
@@ -107,18 +107,14 @@ static void HWR_DrawColumnInCache(const column_t *patchcol, UINT8 *block, GLMipm
|
||||
count--;
|
||||
|
||||
texel = source[yfrac>>FRACBITS];
|
||||
|
||||
alpha = 0xff;
|
||||
|
||||
//Hurdler: not perfect, but better than holes
|
||||
if (texel == HWR_PATCHES_CHROMAKEY_COLORINDEX && (mipmap->flags & TF_CHROMAKEYED))
|
||||
alpha = 0x00;
|
||||
|
||||
//texel = HWR_CHROMAKEY_EQUIVALENTCOLORINDEX;
|
||||
// Lat: Don't do that, some weirdos still use CYAN on their WALLTEXTURES for translucency :V
|
||||
|
||||
//Hurdler: 25/04/2000: now support colormap in hardware mode
|
||||
else if (mipmap->colormap)
|
||||
if (mipmap->colormap)
|
||||
texel = mipmap->colormap[texel];
|
||||
|
||||
// hope compiler will get this switch out of the loops (dreams...)
|
||||
@@ -172,15 +168,10 @@ static void HWR_DrawPatchInCache(GLMipmap_t *mipmap,
|
||||
|
||||
palette = HWR_GetTexturePalette();
|
||||
|
||||
//ncols = (pwidth * pblockwidth) / pwidth;
|
||||
ncols = pwidth;
|
||||
|
||||
// source advance
|
||||
xfrac = 0;
|
||||
//xfracstep = (pwidth << FRACBITS) / pblockwidth;
|
||||
//yfracstep = (pheight << FRACBITS) / pblockheight;
|
||||
//scale_y = (pblockheight << FRACBITS) / pheight;
|
||||
|
||||
xfracstep = FRACUNIT;
|
||||
yfracstep = FRACUNIT;
|
||||
scale_y = FRACUNIT;
|
||||
@@ -254,14 +245,6 @@ static void HWR_DrawTexturePatchInCache(GLMipmap_t *mipmap,
|
||||
col = x * pblockwidth / texture->width;
|
||||
ncols = ((x2 - x) * pblockwidth) / texture->width;
|
||||
|
||||
/*
|
||||
CONS_Debug(DBG_RENDER, "patch %dx%d texture %dx%d block %dx%d\n",
|
||||
width, height,
|
||||
texture->width, texture->height,
|
||||
pblockwidth, pblockheight);
|
||||
CONS_Debug(DBG_RENDER, " col %d ncols %d x %d\n", col, ncols, x);
|
||||
*/
|
||||
|
||||
// source advance
|
||||
xfrac = 0;
|
||||
if (x1 < 0)
|
||||
@@ -291,7 +274,6 @@ static void HWR_DrawTexturePatchInCache(GLMipmap_t *mipmap,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static UINT8 *MakeBlock(GLMipmap_t *grMipmap)
|
||||
{
|
||||
UINT8 *block;
|
||||
@@ -299,8 +281,8 @@ static UINT8 *MakeBlock(GLMipmap_t *grMipmap)
|
||||
UINT16 bu16 = ((0x00 <<8) | HWR_PATCHES_CHROMAKEY_COLORINDEX);
|
||||
INT32 blocksize = (grMipmap->width * grMipmap->height);
|
||||
|
||||
bpp = format2bpp(grMipmap->format);
|
||||
block = Z_Malloc(blocksize*bpp, PU_HWRCACHE, &(grMipmap->data));;
|
||||
bpp = format2bpp(grMipmap->format);
|
||||
block = Z_Malloc(blocksize*bpp, PU_HWRCACHE, &(grMipmap->data));
|
||||
|
||||
switch (bpp)
|
||||
{
|
||||
@@ -309,7 +291,6 @@ bpp = format2bpp(grMipmap->format);
|
||||
// fill background with chromakey, alpha = 0
|
||||
for (i = 0; i < blocksize; i++)
|
||||
memcpy(block+i*sizeof(UINT16), &bu16, sizeof(UINT16));
|
||||
|
||||
break;
|
||||
case 4: memset(block, 0x00, blocksize*sizeof(UINT32)); break;
|
||||
}
|
||||
@@ -502,6 +483,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 +630,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 +649,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.
|
||||
@@ -888,7 +874,6 @@ static void HWR_CacheFadeMask(GLMipmap_t *grMipmap, lumpnum_t fademasklumpnum)
|
||||
// I DO need to convert this because it isn't power of 2 and we need the alpha
|
||||
}
|
||||
|
||||
|
||||
void HWR_GetFadeMask(lumpnum_t fademasklumpnum)
|
||||
{
|
||||
GLMipmap_t *grmip;
|
||||
@@ -1085,8 +1070,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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -234,7 +234,7 @@ void HWR_DrawStretchyFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t
|
||||
}
|
||||
if (fabsf((float)vid.height - (float)BASEVIDHEIGHT * dupy) > 1.0E-36f)
|
||||
{
|
||||
if ((option & (V_SPLITSCREEN|V_SNAPTOBOTTOM)) == (V_SPLITSCREEN|V_SNAPTOBOTTOM))
|
||||
if ((option & (V_SPLITSCREEN|V_SNAPTOTOP)) == (V_SPLITSCREEN|V_SNAPTOTOP))
|
||||
cy += ((float)vid.height/2 - ((float)BASEVIDHEIGHT/2 * dupy));
|
||||
else if (option & V_SNAPTOBOTTOM)
|
||||
cy += ((float)vid.height - ((float)BASEVIDHEIGHT * dupy));
|
||||
@@ -385,7 +385,7 @@ void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscal
|
||||
}
|
||||
if (fabsf((float)vid.height - (float)BASEVIDHEIGHT * dupy) > 1.0E-36f)
|
||||
{
|
||||
if ((option & (V_SPLITSCREEN|V_SNAPTOBOTTOM)) == (V_SPLITSCREEN|V_SNAPTOBOTTOM))
|
||||
if ((option & (V_SPLITSCREEN|V_SNAPTOTOP)) == (V_SPLITSCREEN|V_SNAPTOTOP))
|
||||
cy += ((float)vid.height/2 - ((float)BASEVIDHEIGHT/2 * dupy));
|
||||
else if (option & V_SNAPTOBOTTOM)
|
||||
cy += ((float)vid.height - ((float)BASEVIDHEIGHT * dupy));
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
+192
-572
File diff suppressed because it is too large.
Load diff
+1
-10
@@ -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
|
||||
|
||||
@@ -439,7 +439,7 @@ void HWR_LoadAllCustomShaders(void)
|
||||
|
||||
// read every custom shader
|
||||
for (i = 0; i < numwadfiles; i++)
|
||||
HWR_LoadCustomShadersFromFile(i, (wadfiles[i]->type == RET_PK3));
|
||||
HWR_LoadCustomShadersFromFile(i, W_FileHasFolders(wadfiles[i]));
|
||||
}
|
||||
|
||||
void HWR_LoadCustomShadersFromFile(UINT16 wadnum, boolean PK3)
|
||||
@@ -454,7 +454,7 @@ void HWR_LoadCustomShadersFromFile(UINT16 wadnum, boolean PK3)
|
||||
int i;
|
||||
boolean modified_shaders[NUMSHADERTARGETS] = {0};
|
||||
|
||||
if (!HWR_UseShader())
|
||||
if (!gr_shadersavailable)
|
||||
return;
|
||||
|
||||
lump = HWR_FindShaderDefs(wadnum);
|
||||
|
||||
@@ -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" \
|
||||
|
||||
@@ -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 = §ors[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 = §ors[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 = §ors[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 = §ors[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
|
||||
@@ -8,7 +8,7 @@
|
||||
// terms of the GNU General Public License, version 2.
|
||||
// See the 'LICENSE' file for more details.
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file
|
||||
/// \file r_opengl.c
|
||||
/// \brief OpenGL API for Sonic Robo Blast 2
|
||||
|
||||
#if defined (_WIN32)
|
||||
@@ -26,7 +26,7 @@
|
||||
#include "../../r_local.h" // For rendertimefrac, used for the leveltime shader uniform
|
||||
#include "r_opengl.h"
|
||||
#include "r_vbo.h"
|
||||
|
||||
#include "../hw_shaders.h"
|
||||
#include "../hw_main.h"
|
||||
|
||||
// Eeeeh not sure is this right way, but it works < sry :c < sry again it had to go :c
|
||||
@@ -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);
|
||||
@@ -674,31 +673,6 @@ static void Shader_SetUniforms(FSurfaceInfo *Surface, GLRGBAFloat *poly, GLRGBAF
|
||||
|
||||
static GLRGBAFloat shader_defaultcolor = {1.0f, 1.0f, 1.0f, 1.0f};
|
||||
|
||||
//
|
||||
// Generic vertex shader
|
||||
//
|
||||
|
||||
#define GLSL_FALLBACK_VERTEX_SHADER \
|
||||
"void main()\n" \
|
||||
"{\n" \
|
||||
"gl_Position = gl_ProjectionMatrix * gl_ModelViewMatrix * gl_Vertex;\n" \
|
||||
"gl_FrontColor = gl_Color;\n" \
|
||||
"gl_TexCoord[0].xy = gl_MultiTexCoord0.xy;\n" \
|
||||
"gl_ClipVertex = gl_ModelViewMatrix * gl_Vertex;\n" \
|
||||
"}\0"
|
||||
|
||||
//
|
||||
// Generic fragment shader
|
||||
//
|
||||
|
||||
#define GLSL_FALLBACK_FRAGMENT_SHADER \
|
||||
"uniform sampler2D tex;\n" \
|
||||
"uniform vec4 poly_color;\n" \
|
||||
"void main(void) {\n" \
|
||||
"gl_FragColor = texture2D(tex, gl_TexCoord[0].st) * poly_color;\n" \
|
||||
"}\0"
|
||||
|
||||
#endif // GL_SHADERS
|
||||
|
||||
void SetupGLFunc4(void)
|
||||
{
|
||||
@@ -720,7 +694,6 @@ void SetupGLFunc4(void)
|
||||
pglStencilFuncSeparate = GetGLFunc("glStencilFuncSeparate");
|
||||
pglStencilOpSeparate = GetGLFunc("glStencilOpSeparate");
|
||||
|
||||
#ifdef GL_SHADERS
|
||||
pglCreateShader = GetGLFunc("glCreateShader");
|
||||
pglShaderSource = GetGLFunc("glShaderSource");
|
||||
pglCompileShader = GetGLFunc("glCompileShader");
|
||||
@@ -742,7 +715,6 @@ void SetupGLFunc4(void)
|
||||
pglUniform2fv = GetGLFunc("glUniform2fv");
|
||||
pglUniform3fv = GetGLFunc("glUniform3fv");
|
||||
pglGetUniformLocation = GetGLFunc("glGetUniformLocation");
|
||||
#endif
|
||||
|
||||
#ifdef GL_VERSION_3_0
|
||||
pglGenerateMipmap = GetGLFunc("glGenerateMipmap");
|
||||
@@ -751,7 +723,6 @@ void SetupGLFunc4(void)
|
||||
|
||||
EXPORT boolean HWRAPI(InitShaders) (void)
|
||||
{
|
||||
#ifdef GL_SHADERS
|
||||
if (!pglUseProgram)
|
||||
return false;
|
||||
|
||||
@@ -765,14 +736,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 +761,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 +777,6 @@ EXPORT boolean HWRAPI(CompileShader) (int slot)
|
||||
gl_shaders[slot].program = 0;
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
(void)slot;
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
//
|
||||
@@ -829,7 +786,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 +794,15 @@ 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 (slot == SHADER_NONE)
|
||||
{
|
||||
UnSetShader();
|
||||
return;
|
||||
}
|
||||
if (gl_allowshaders)
|
||||
{
|
||||
gl_shader_t *next_shader = &gl_shaders[slot]; // the gl_shader_t we are going to switch to
|
||||
@@ -867,26 +823,26 @@ 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 (gl_shadersenabled) // don't repeatedly call glUseProgram if not needed
|
||||
{
|
||||
gl_shaderstate.current = NULL;
|
||||
gl_shaderstate.type = 0;
|
||||
gl_shaderstate.program = 0;
|
||||
|
||||
if (pglUseProgram)
|
||||
pglUseProgram(0);
|
||||
#endif
|
||||
if (pglUseProgram)
|
||||
pglUseProgram(0);
|
||||
}
|
||||
|
||||
gl_shadersenabled = false;
|
||||
}
|
||||
|
||||
|
||||
// -----------------+
|
||||
// SetNoTexture : Disable texture
|
||||
// -----------------+
|
||||
@@ -914,7 +870,7 @@ static void GLPerspective(GLfloat fovy, GLfloat aspect)
|
||||
const GLfloat zNear = NEAR_CLIPPING_PLANE;
|
||||
const GLfloat zFar = FAR_CLIPPING_PLANE;
|
||||
const GLfloat radians = (GLfloat)(fovy / 2.0f * M_PIl / 180.0f);
|
||||
const GLfloat sine = sin(radians);
|
||||
const GLfloat sine = (GLfloat)sin(radians);
|
||||
const GLfloat deltaZ = zFar - zNear;
|
||||
GLfloat cotangent;
|
||||
|
||||
@@ -1639,7 +1595,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)
|
||||
@@ -1687,9 +1642,9 @@ static void Shader_SetUniforms(FSurfaceInfo *Surface, GLRGBAFloat *poly, GLRGBAF
|
||||
|
||||
if (Surface != NULL)
|
||||
{
|
||||
UNIFORM_1(shader->uniforms[gluniform_lighting], Surface->LightInfo.light_level, pglUniform1f);
|
||||
UNIFORM_1(shader->uniforms[gluniform_fade_start], Surface->LightInfo.fade_start, pglUniform1f);
|
||||
UNIFORM_1(shader->uniforms[gluniform_fade_end], Surface->LightInfo.fade_end, pglUniform1f);
|
||||
UNIFORM_1(shader->uniforms[gluniform_lighting], (GLfloat)Surface->LightInfo.light_level, pglUniform1f);
|
||||
UNIFORM_1(shader->uniforms[gluniform_fade_start], (GLfloat)Surface->LightInfo.fade_start, pglUniform1f);
|
||||
UNIFORM_1(shader->uniforms[gluniform_fade_end], (GLfloat)Surface->LightInfo.fade_end, pglUniform1f);
|
||||
}
|
||||
|
||||
UNIFORM_1(shader->uniforms[gluniform_leveltime], ((float)shader_leveltime) / TICRATE, pglUniform1f);
|
||||
@@ -1699,12 +1654,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)
|
||||
@@ -1843,7 +1792,7 @@ static boolean Shader_CompileProgram(gl_shader_t *shader, GLint i)
|
||||
// code that is common between DrawPolygon and DrawIndexedTriangles
|
||||
// DrawScreenTexture also can use this function for fancier screen texture drawing
|
||||
// the corona thing is there too, i have no idea if that stuff works with DrawIndexedTriangles and batching
|
||||
static void PreparePolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FBITFIELD PolyFlags)
|
||||
static void PreparePolygon(FSurfaceInfo *pSurf, FBITFIELD PolyFlags)
|
||||
{
|
||||
static GLRGBAFloat poly = {0,0,0,0};
|
||||
static GLRGBAFloat tint = {0,0,0,0};
|
||||
@@ -1851,39 +1800,41 @@ static void PreparePolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FBITFIELD
|
||||
|
||||
SetBlend(PolyFlags); //TODO: inline (#pragma..)
|
||||
|
||||
// PolyColor
|
||||
if (pSurf)
|
||||
{
|
||||
// If Modulated, mix the surface colour to the texture
|
||||
// If modulated, mix the surface colour to the texture
|
||||
if (CurrentPolyFlags & PF_Modulated)
|
||||
{
|
||||
// Poly color
|
||||
poly.red = byte2float[pSurf->PolyColor.s.red];
|
||||
poly.green = byte2float[pSurf->PolyColor.s.green];
|
||||
poly.blue = byte2float[pSurf->PolyColor.s.blue];
|
||||
poly.alpha = byte2float[pSurf->PolyColor.s.alpha];
|
||||
|
||||
pglColor4ubv((GLubyte*)&pSurf->PolyColor.s);
|
||||
|
||||
// If the surface is either modulated or colormapped, or both
|
||||
if (CurrentPolyFlags & (PF_Modulated | PF_ColorMapped))
|
||||
{
|
||||
poly.red = byte2float[pSurf->PolyColor.s.red];
|
||||
poly.green = byte2float[pSurf->PolyColor.s.green];
|
||||
poly.blue = byte2float[pSurf->PolyColor.s.blue];
|
||||
poly.alpha = byte2float[pSurf->PolyColor.s.alpha];
|
||||
}
|
||||
|
||||
// Tint color
|
||||
tint.red = byte2float[pSurf->TintColor.s.red];
|
||||
tint.green = byte2float[pSurf->TintColor.s.green];
|
||||
tint.blue = byte2float[pSurf->TintColor.s.blue];
|
||||
tint.alpha = byte2float[pSurf->TintColor.s.alpha];
|
||||
|
||||
// Fade color
|
||||
fade.red = byte2float[pSurf->FadeColor.s.red];
|
||||
fade.green = byte2float[pSurf->FadeColor.s.green];
|
||||
fade.blue = byte2float[pSurf->FadeColor.s.blue];
|
||||
fade.alpha = byte2float[pSurf->FadeColor.s.alpha];
|
||||
|
||||
if (pSurf->LightTableId && pSurf->LightTableId != lt_downloaded)
|
||||
// Only if the surface is colormapped
|
||||
if (CurrentPolyFlags & PF_ColorMapped)
|
||||
{
|
||||
pglActiveTexture(GL_TEXTURE2);
|
||||
pglBindTexture(GL_TEXTURE_2D, pSurf->LightTableId);
|
||||
pglActiveTexture(GL_TEXTURE0);
|
||||
lt_downloaded = pSurf->LightTableId;
|
||||
tint.red = byte2float[pSurf->TintColor.s.red];
|
||||
tint.green = byte2float[pSurf->TintColor.s.green];
|
||||
tint.blue = byte2float[pSurf->TintColor.s.blue];
|
||||
tint.alpha = byte2float[pSurf->TintColor.s.alpha];
|
||||
|
||||
fade.red = byte2float[pSurf->FadeColor.s.red];
|
||||
fade.green = byte2float[pSurf->FadeColor.s.green];
|
||||
fade.blue = byte2float[pSurf->FadeColor.s.blue];
|
||||
fade.alpha = byte2float[pSurf->FadeColor.s.alpha];
|
||||
|
||||
if (pSurf->LightTableId && pSurf->LightTableId != lt_downloaded)
|
||||
{
|
||||
pglActiveTexture(GL_TEXTURE2);
|
||||
pglBindTexture(GL_TEXTURE_2D, pSurf->LightTableId);
|
||||
pglActiveTexture(GL_TEXTURE0);
|
||||
lt_downloaded = pSurf->LightTableId;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1895,7 +1846,7 @@ static void PreparePolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FBITFIELD
|
||||
// -----------------+
|
||||
EXPORT void HWRAPI(DrawPolygon) (FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags)
|
||||
{
|
||||
PreparePolygon(pSurf, pOutVerts, PolyFlags);
|
||||
PreparePolygon(pSurf, PolyFlags);
|
||||
|
||||
pglVertexPointer(3, GL_FLOAT, sizeof(FOutVector), &pOutVerts[0].x);
|
||||
pglTexCoordPointer(2, GL_FLOAT, sizeof(FOutVector), &pOutVerts[0].s);
|
||||
@@ -1913,7 +1864,7 @@ EXPORT void HWRAPI(DrawPolygon) (FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUI
|
||||
|
||||
EXPORT void HWRAPI(DrawIndexedTriangles) (FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags, unsigned int *IndexArray)
|
||||
{
|
||||
PreparePolygon(pSurf, pOutVerts, PolyFlags);
|
||||
PreparePolygon(pSurf, PolyFlags);
|
||||
|
||||
pglVertexPointer(3, GL_FLOAT, sizeof(FOutVector), &pOutVerts[0].x);
|
||||
pglTexCoordPointer(2, GL_FLOAT, sizeof(FOutVector), &pOutVerts[0].s);
|
||||
@@ -2995,7 +2946,7 @@ EXPORT void HWRAPI(DrawScreenTexture)(int tex, FSurfaceInfo *surf, FBITFIELD pol
|
||||
|
||||
pglBindTexture(GL_TEXTURE_2D, screenTextures[tex]);
|
||||
|
||||
PreparePolygon(surf, NULL, surf ? polyflags : (PF_NoDepthTest));
|
||||
PreparePolygon(surf, surf ? polyflags : (PF_NoDepthTest));
|
||||
if (!surf)
|
||||
pglColor4ubv(white);
|
||||
|
||||
@@ -3305,7 +3256,7 @@ EXPORT void HWRAPI(DrawScreenFinalTexture)(int tex, int width, int height)
|
||||
pglDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||
|
||||
if (HWR_ShouldUsePaletteRendering())
|
||||
UnSetShader();
|
||||
pglUseProgram(0);
|
||||
|
||||
tex_downloaded = screenTextures[tex];
|
||||
}
|
||||
|
||||
+374
@@ -0,0 +1,374 @@
|
||||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// John FrostFox (john.frostfox@gmail.com)
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
// See the 'LICENSE' file for more details.
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file hashtable.c
|
||||
/// \brief Hashtable abstraction implementation
|
||||
|
||||
#include "hashtable.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define HT_NUMLISTS UINT8_MAX
|
||||
|
||||
typedef struct mobjnum_linkedList_s{
|
||||
thinker_t* thinker;
|
||||
struct mobjnum_linkedList_s* prev; //the first element must always be null
|
||||
struct mobjnum_linkedList_s* next; //the last element must always be null
|
||||
}
|
||||
mobjnum_linkedList;
|
||||
|
||||
mobjnum_linkedList mobjnum_Hashtable[HT_NUMLISTS]; //dumb and idiotic, there are up to UINT8_MAX linked lists.
|
||||
//Wish I could just simply make a mobj_t array with UINT64_MAX entries, LOL
|
||||
|
||||
void mobjnum_ht_linkedList_Wipe();
|
||||
/** Initializes simple mobjnum/thinker hashtable linked list.*/
|
||||
void mobjnum_ht_linkedList_Init()
|
||||
{
|
||||
mobjnum_ht_linkedList_Wipe();
|
||||
for (uint8_t i = 0; i < HT_NUMLISTS; i++)
|
||||
{
|
||||
mobjnum_Hashtable[i].thinker = NULL;
|
||||
mobjnum_Hashtable[i].prev = NULL;
|
||||
mobjnum_Hashtable[i].next = NULL;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/** Adds a thinker's address, determines in which list to add automatically
|
||||
*
|
||||
* \param mobj Which mobj's memory address to add
|
||||
*/
|
||||
void mobjnum_ht_linkedList_AddEntry (thinker_t* thinker)
|
||||
{
|
||||
|
||||
mobjnum_linkedList* currentEntry; // = &mobjnum_Hashtable[(UINT8)(mobj->mobjnum % HT_NUMLISTS)];
|
||||
mobjnum_linkedList* next;
|
||||
|
||||
currentEntry = &mobjnum_Hashtable[(UINT8)(((mobj_t*)thinker)->mobjnum % HT_NUMLISTS)];
|
||||
|
||||
if (!currentEntry->next) // check for the first entry
|
||||
{
|
||||
currentEntry->thinker = thinker;
|
||||
// CONS_Printf("next not exists, create\n");
|
||||
currentEntry->next = malloc(sizeof(mobjnum_linkedList));
|
||||
currentEntry->next->thinker = NULL;
|
||||
currentEntry->next->next = NULL;
|
||||
currentEntry->next->prev = currentEntry;
|
||||
return;
|
||||
}
|
||||
|
||||
for (currentEntry = &mobjnum_Hashtable[(UINT8)(((mobj_t*)thinker)->mobjnum % HT_NUMLISTS)]; currentEntry != NULL; currentEntry = next)
|
||||
{
|
||||
if (!currentEntry->thinker)
|
||||
{
|
||||
currentEntry->thinker = thinker;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!currentEntry->next)
|
||||
{
|
||||
currentEntry->next = malloc(sizeof(mobjnum_linkedList));
|
||||
currentEntry->next->thinker = thinker;
|
||||
currentEntry->next->next = NULL;
|
||||
currentEntry->next->prev = currentEntry;
|
||||
next = NULL;
|
||||
}
|
||||
else
|
||||
next = currentEntry->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Removes a thinker's address by its mobjnum, determines from which list to remove automatically
|
||||
*
|
||||
* \param mobjnum Which mobj's memory address to remove by itsmobjnum
|
||||
*/
|
||||
// void mobjnum_ht_linkedList_RemoveEntry (uint8_t mobjnumber)
|
||||
// {
|
||||
// mobjnum_linkedList* currentEntry = &mobjnum_Hashtable[(UINT8)(mobjnumber % HT_NUMLISTS)];
|
||||
// if (currentEntry->next == ¤tEntry)
|
||||
// currentEntry->mobj = &mobj;
|
||||
// else
|
||||
// {
|
||||
// currentEntry->next = malloc(sizeof(mobjnum_linkedList));
|
||||
|
||||
// }
|
||||
// }
|
||||
|
||||
/** Looks for a thinker by its mobjnum.
|
||||
*
|
||||
* \param mobjnumber mobj's mobjnum
|
||||
* \return thinker_t* if an object is found, otherwise NULL. Cast it to mobj_t* to get the mobj.
|
||||
*/
|
||||
thinker_t* mobjnum_ht_linkedList_Find (uint32_t mobjnumber)
|
||||
{
|
||||
// mobjnum_linkedList* currentEntry = &mobjnum_Hashtable[(UINT8)(mobjnumber % HT_NUMLISTS)];
|
||||
|
||||
mobjnum_linkedList* currentEntry; // = &mobjnum_Hashtable[(UINT8)(mobj->mobjnum % HT_NUMLISTS)];
|
||||
mobjnum_linkedList* next;
|
||||
|
||||
if (!mobjnumber)
|
||||
return NULL;
|
||||
|
||||
currentEntry = &mobjnum_Hashtable[(UINT8)(mobjnumber % HT_NUMLISTS)];
|
||||
|
||||
if (!currentEntry->next) // check for the first entry
|
||||
{
|
||||
if (!currentEntry->thinker)
|
||||
return NULL;
|
||||
|
||||
if (((mobj_t *)currentEntry->thinker)->mobjnum == mobjnumber)
|
||||
return currentEntry->thinker;
|
||||
}
|
||||
|
||||
for (currentEntry = &mobjnum_Hashtable[(UINT8)(mobjnumber % HT_NUMLISTS)]; currentEntry != NULL; currentEntry = next)
|
||||
{
|
||||
if (!currentEntry->thinker)
|
||||
return NULL;
|
||||
|
||||
if (((mobj_t *)currentEntry->thinker)->mobjnum == mobjnumber)
|
||||
return currentEntry->thinker;
|
||||
if (currentEntry->next)
|
||||
next = currentEntry->next;
|
||||
else
|
||||
next = NULL;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/** Wipes the entire list by iterating everything it has*/
|
||||
void mobjnum_ht_linkedList_Wipe()
|
||||
{
|
||||
mobjnum_linkedList* currentEntry; // = &mobjnum_Hashtable[(UINT8)(mobj->mobjnum % HT_NUMLISTS)];
|
||||
mobjnum_linkedList* next;
|
||||
|
||||
for (UINT8 i = 0; i < HT_NUMLISTS; i++)
|
||||
{
|
||||
if (!mobjnum_Hashtable[i].next)
|
||||
continue;
|
||||
for (currentEntry = &mobjnum_Hashtable[i]; currentEntry != NULL; currentEntry = next)
|
||||
{
|
||||
// bye!
|
||||
if (currentEntry->next)
|
||||
next = currentEntry->next;
|
||||
else
|
||||
next = NULL;
|
||||
if (currentEntry->next)
|
||||
{
|
||||
currentEntry->next = NULL;
|
||||
}
|
||||
if (currentEntry->thinker)
|
||||
{
|
||||
currentEntry->thinker = NULL;
|
||||
}
|
||||
if (currentEntry->prev) //prevents freeing the first element
|
||||
{
|
||||
currentEntry->prev = NULL;
|
||||
free(currentEntry);
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Simple hash table implemented in C.
|
||||
|
||||
// Hash table entry (slot may be filled or empty).
|
||||
typedef struct {
|
||||
const char* key; // key is NULL if this slot is empty
|
||||
void* value;
|
||||
} ht_entry;
|
||||
|
||||
// Hash table structure: create with ht_create, free with ht_destroy.
|
||||
struct hashtable {
|
||||
ht_entry* entries; // hash slots
|
||||
size_t capacity; // size of _entries array
|
||||
size_t length; // number of items in hash table
|
||||
};
|
||||
|
||||
#define INITIAL_CAPACITY 16 // must not be zero
|
||||
|
||||
hashtable* hashtable_Create(void) {
|
||||
// Allocate space for hash table struct.
|
||||
hashtable* table = malloc(sizeof(hashtable));
|
||||
if (table == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
table->length = 0;
|
||||
table->capacity = INITIAL_CAPACITY;
|
||||
|
||||
// Allocate (zero'd) space for entry buckets.
|
||||
table->entries = calloc(table->capacity, sizeof(ht_entry));
|
||||
if (table->entries == NULL) {
|
||||
free(table); // error, free table before we return!
|
||||
return NULL;
|
||||
}
|
||||
return table;
|
||||
}
|
||||
|
||||
void hashtable_Destroy(hashtable* table) {
|
||||
// First free allocated keys.
|
||||
for (size_t i = 0; i < table->capacity; i++) {
|
||||
if (table->entries[i].key != NULL) {
|
||||
free((void*)table->entries[i].key);
|
||||
}
|
||||
}
|
||||
|
||||
// Then free entries array and table itself.
|
||||
free(table->entries);
|
||||
free(table);
|
||||
}
|
||||
|
||||
#define FNV_OFFSET 14695981039346656037UL
|
||||
#define FNV_PRIME 1099511628211UL
|
||||
|
||||
// Return 64-bit FNV-1a hash for key (NUL-terminated). See description:
|
||||
// https://en.wikipedia.org/wiki/Fowler–Noll–Vo_hash_function
|
||||
static uint64_t hash_key(const char* key) {
|
||||
uint64_t hash = FNV_OFFSET;
|
||||
for (const char* p = key; *p; p++) {
|
||||
hash ^= (uint64_t)(unsigned char)(*p);
|
||||
hash *= FNV_PRIME;
|
||||
}
|
||||
return hash;
|
||||
}
|
||||
|
||||
void* hashtable_Get(hashtable* table, const UINT32* key) {
|
||||
// AND hash with capacity-1 to ensure it's within entries array.
|
||||
uint64_t hash = hash_key(key);
|
||||
size_t index = (size_t)(hash & (uint64_t)(table->capacity - 1));
|
||||
|
||||
// Loop till we find an empty entry.
|
||||
while (table->entries[index].key != NULL) {
|
||||
if (strcmp(key, table->entries[index].key) == 0) {
|
||||
// Found key, return value.
|
||||
return table->entries[index].value;
|
||||
}
|
||||
// Key wasn't in this slot, move to next (linear probing).
|
||||
index++;
|
||||
if (index >= table->capacity) {
|
||||
// At end of entries array, wrap around.
|
||||
index = 0;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Internal function to set an entry (without expanding table).
|
||||
static const char* ht_set_entry(ht_entry* entries, size_t capacity,
|
||||
const char* key, void* value, size_t* plength) {
|
||||
// AND hash with capacity-1 to ensure it's within entries array.
|
||||
uint64_t hash = hash_key(key);
|
||||
size_t index = (size_t)(hash & (uint64_t)(capacity - 1));
|
||||
|
||||
// Loop till we find an empty entry.
|
||||
while (entries[index].key != NULL) {
|
||||
if (strcmp(key, entries[index].key) == 0) {
|
||||
// Found key (it already exists), update value.
|
||||
entries[index].value = value;
|
||||
return entries[index].key;
|
||||
}
|
||||
// Key wasn't in this slot, move to next (linear probing).
|
||||
index++;
|
||||
if (index >= capacity) {
|
||||
// At end of entries array, wrap around.
|
||||
index = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Didn't find key, allocate+copy if needed, then insert it.
|
||||
if (plength != NULL) {
|
||||
key = strdup(key);
|
||||
if (key == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
(*plength)++;
|
||||
}
|
||||
entries[index].key = (char*)key;
|
||||
entries[index].value = value;
|
||||
return key;
|
||||
}
|
||||
|
||||
// Expand hash table to twice its current size. Return true on success,
|
||||
// false if out of memory.
|
||||
static boolean ht_expand(hashtable* table) {
|
||||
// Allocate new entries array.
|
||||
size_t new_capacity = table->capacity * 2;
|
||||
if (new_capacity < table->capacity) {
|
||||
return false; // overflow (capacity would be too big)
|
||||
}
|
||||
ht_entry* new_entries = calloc(new_capacity, sizeof(ht_entry));
|
||||
if (new_entries == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Iterate entries, move all non-empty ones to new table's entries.
|
||||
for (size_t i = 0; i < table->capacity; i++) {
|
||||
ht_entry entry = table->entries[i];
|
||||
if (entry.key != NULL) {
|
||||
ht_set_entry(new_entries, new_capacity, entry.key,
|
||||
entry.value, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
// Free old entries array and update this table's details.
|
||||
free(table->entries);
|
||||
table->entries = new_entries;
|
||||
table->capacity = new_capacity;
|
||||
return true;
|
||||
}
|
||||
|
||||
const char* hashtable_Set(hashtable* table, const UINT32* key, void* value) {
|
||||
assert(value != NULL);
|
||||
if (value == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// If length will exceed half of current capacity, expand it.
|
||||
if (table->length >= table->capacity / 2) {
|
||||
if (!ht_expand(table)) {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// Set entry and update length.
|
||||
return ht_set_entry(table->entries, table->capacity, key, value,
|
||||
&table->length);
|
||||
}
|
||||
|
||||
size_t hashtable_Length(hashtable* table) {
|
||||
return table->length;
|
||||
}
|
||||
|
||||
hashtable_iterator ht_iterator(hashtable* table) {
|
||||
hashtable_iterator it;
|
||||
it._table = table;
|
||||
it._index = 0;
|
||||
return it;
|
||||
}
|
||||
|
||||
boolean hashtable_Next(hashtable_iterator* it) {
|
||||
// Loop till we've hit end of entries array.
|
||||
hashtable* table = it->_table;
|
||||
while (it->_index < table->capacity) {
|
||||
size_t i = it->_index;
|
||||
it->_index++;
|
||||
if (table->entries[i].key != NULL) {
|
||||
// Found next non-empty item, update iterator key and value.
|
||||
ht_entry entry = table->entries[i];
|
||||
it->key = entry.key;
|
||||
it->value = entry.value;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// John FrostFox (john.frostfox@gmail.com)
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
// See the 'LICENSE' file for more details.
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file hashtable.h
|
||||
/// \brief Hashtable abstraction
|
||||
|
||||
#include "doomdef.h"
|
||||
#include "p_mobj.h"
|
||||
#include "d_think.h"
|
||||
|
||||
// extern uint16_t hashHits;
|
||||
// extern uint16_t hashMiss;
|
||||
|
||||
void mobjnum_ht_linkedList_Init();
|
||||
void mobjnum_ht_linkedList_AddEntry (thinker_t* thinker);
|
||||
thinker_t* mobjnum_ht_linkedList_Find (uint32_t mobjnumber);
|
||||
// void mobjnum_ht_linkedList_Wipe();
|
||||
|
||||
// Hash table iterator: create with ht_iterator, iterate with ht_next.
|
||||
typedef struct hashtable hashtable;
|
||||
|
||||
typedef struct {
|
||||
const UINT32* key;
|
||||
void* value;
|
||||
|
||||
hashtable* _table; // reference to hash table being iterated
|
||||
size_t _index; // current index into ht._entries
|
||||
} hashtable_iterator;
|
||||
|
||||
hashtable* hashtable_Create(void); //creates a hashtable and returns the pointer
|
||||
void* hashtable_Get(hashtable* table, const UINT32* key);
|
||||
|
||||
// Set item with given key (NUL-terminated) to value (which must not
|
||||
// be NULL). If not already present in table, key is copied to newly
|
||||
// allocated memory (keys are freed automatically when ht_destroy is
|
||||
// called). Return address of copied key, or NULL if out of memory.
|
||||
// const char* hashtable_Set(hashtable* table, UINT32* key, void* value);
|
||||
const char* hashtable_Set(hashtable* table, const UINT32* key, void* value);
|
||||
|
||||
size_t hashtable_Length(hashtable* table);
|
||||
|
||||
// Free memory allocated for hash table, including allocated keys.
|
||||
void hashtable_Destroy(hashtable* table);
|
||||
|
||||
// Return new hash table iterator (for use with ht_next).
|
||||
hashtable_iterator hashtable_Iterator(hashtable_iterator* table);
|
||||
|
||||
// Move iterator to next item in hash table, update iterator's key
|
||||
// and value to current item, and return true. If there are no more
|
||||
// items, return false. Don't call ht_set during iteration.
|
||||
boolean hashtable_Next(hashtable_iterator* it);
|
||||
+13
-22
@@ -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();
|
||||
|
||||
+2
-34
@@ -25,6 +25,7 @@
|
||||
*/
|
||||
#define MAX_QUIT_FUNCS 16
|
||||
|
||||
extern double tic_frequency;
|
||||
|
||||
/** \brief Graphic system had started up
|
||||
*/
|
||||
@@ -58,6 +59,7 @@ UINT64 I_GetPrecisePrecision(void);
|
||||
*/
|
||||
double I_GetFrameTime(void);
|
||||
|
||||
|
||||
/** \brief Sleeps for the given duration in milliseconds. Depending on the
|
||||
operating system's scheduler, the calling thread may give up its
|
||||
time slice for a longer duration. The implementation should give a
|
||||
@@ -296,40 +298,6 @@ char *I_GetUserName(void);
|
||||
*/
|
||||
INT32 I_mkdir(const char *dirname, INT32 unixright);
|
||||
|
||||
typedef struct {
|
||||
int FPU : 1; ///< FPU availabile
|
||||
int CPUID : 1; ///< CPUID instruction
|
||||
int RDTSC : 1; ///< RDTSC instruction
|
||||
int MMX : 1; ///< MMX features
|
||||
int MMXExt : 1; ///< MMX Ext. features
|
||||
int CMOV : 1; ///< Pentium Pro's "cmov"
|
||||
int AMD3DNow : 1; ///< 3DNow features
|
||||
int AMD3DNowExt: 1; ///< 3DNow! Ext. features
|
||||
int SSE : 1; ///< SSE features
|
||||
int SSE2 : 1; ///< SSE2 features
|
||||
int SSE3 : 1; ///< SSE3 features
|
||||
int IA64 : 1; ///< Running on IA64
|
||||
int AMD64 : 1; ///< Running on AMD64
|
||||
int AltiVec : 1; ///< AltiVec features
|
||||
int FPPE : 1; ///< floating-point precision error
|
||||
int PFC : 1; ///< TBD?
|
||||
int cmpxchg : 1; ///< ?
|
||||
int cmpxchg16b : 1; ///< ?
|
||||
int cmp8xchg16 : 1; ///< ?
|
||||
int FPE : 1; ///< FPU Emu
|
||||
int DEP : 1; ///< Data excution prevent
|
||||
int PPCMM64 : 1; ///< PowerPC Movemem 64bit ok?
|
||||
int ALPHAbyte : 1; ///< ?
|
||||
int PAE : 1; ///< Physical Address Extension
|
||||
int CPUs : 8;
|
||||
} CPUInfoFlags;
|
||||
|
||||
|
||||
/** \brief Info about CPU
|
||||
\return CPUInfo in bits
|
||||
*/
|
||||
const CPUInfoFlags *I_CPUInfo(void);
|
||||
|
||||
/** \brief Find main WAD
|
||||
\return path to main WAD
|
||||
*/
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ static CV_PossibleValue_t timescale_cons_t[] = {{FRACUNIT/20, "MIN"}, {20*FRACUN
|
||||
consvar_t cv_timescale = {"timescale", "1.0", CV_NETVAR|CV_CHEAT|CV_FLOAT, timescale_cons_t, NULL, FRACUNIT, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
static precise_t enterprecise, oldenterprecise;
|
||||
static fixed_t entertic, oldentertics;
|
||||
fixed_t entertic, oldentertics;
|
||||
static double tictimer;
|
||||
|
||||
tic_t I_GetTime(void)
|
||||
|
||||
@@ -29,6 +29,7 @@ typedef struct timestate_s {
|
||||
|
||||
extern timestate_t g_time;
|
||||
extern consvar_t cv_timescale;
|
||||
extern fixed_t entertic, oldentertics;
|
||||
|
||||
/** \brief Called by D_SRB2Loop, returns current time in game tics.
|
||||
*/
|
||||
|
||||
+162
-189
@@ -2210,7 +2210,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))
|
||||
@@ -2219,11 +2218,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())
|
||||
{
|
||||
@@ -2247,10 +2241,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);
|
||||
@@ -2356,7 +2348,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))
|
||||
@@ -2365,10 +2356,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())
|
||||
{
|
||||
@@ -2392,10 +2379,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;
|
||||
@@ -2474,7 +2459,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);
|
||||
|
||||
@@ -2485,10 +2469,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))
|
||||
@@ -2511,10 +2491,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);
|
||||
@@ -7500,7 +7478,7 @@ static void K_initKartHUD(void)
|
||||
ITEM2_X = BASEVIDWIDTH-39 + cv_item_xoffset.value;
|
||||
ITEM2_Y = -8 + cv_item_yoffset.value;
|
||||
|
||||
LAPS2_X = BASEVIDWIDTH-40 + cv_laps_xoffset.value;
|
||||
LAPS2_X = BASEVIDWIDTH-3 + cv_laps_xoffset.value;
|
||||
LAPS2_Y = (BASEVIDHEIGHT/2)-13 + cv_laps_yoffset.value;
|
||||
|
||||
POSI2_X = BASEVIDWIDTH -4 + cv_posi_xoffset.value;
|
||||
@@ -7567,6 +7545,91 @@ INT32 K_calcSplitFlags(INT32 snapflags)
|
||||
return (splitflags|snapflags);
|
||||
}
|
||||
|
||||
void K_getItemBoxDrawinfo(drawinfo_t *out)
|
||||
{
|
||||
INT32 fx, fy, fflags;
|
||||
|
||||
// pain and suffering defined below
|
||||
if (splitscreen < 2) // don't change shit for THIS splitscreen.
|
||||
{
|
||||
fx = ITEM_X;
|
||||
fy = ITEM_Y;
|
||||
fflags = K_calcSplitFlags(V_SNAPTOTOP|V_SNAPTOLEFT);
|
||||
}
|
||||
else // now we're having a fun game.
|
||||
{
|
||||
if (!(stplyrnum & 1)) // If we are P1 or P3...
|
||||
{
|
||||
fx = ITEM_X;
|
||||
fy = ITEM_Y;
|
||||
fflags = V_SNAPTOLEFT|(stplyrnum & 2 ? V_SPLITSCREEN : V_SNAPTOTOP); // flip P3 to the bottom.
|
||||
}
|
||||
else // else, that means we're P2 or P4.
|
||||
{
|
||||
fx = ITEM2_X;
|
||||
fy = ITEM2_Y;
|
||||
fflags = V_SNAPTORIGHT|(stplyrnum & 2 ? V_SPLITSCREEN : V_SNAPTOTOP); // flip P4 to the bottom
|
||||
}
|
||||
}
|
||||
|
||||
out->x = fx;
|
||||
out->y = fy;
|
||||
out->flags = fflags;
|
||||
}
|
||||
|
||||
void K_getLapsDrawinfo(drawinfo_t *out)
|
||||
{
|
||||
INT32 fx, fy, fflags;
|
||||
|
||||
// pain and suffering defined below
|
||||
if (splitscreen < 2) // don't change shit for THIS splitscreen.
|
||||
{
|
||||
fx = LAPS_X;
|
||||
fy = LAPS_Y;
|
||||
fflags = K_calcSplitFlags(V_SNAPTOBOTTOM|V_SNAPTOLEFT);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(stplyrnum & 1)) // If we are P1 or P3...
|
||||
{
|
||||
fx = LAPS_X;
|
||||
fy = LAPS_Y;
|
||||
fflags = V_SNAPTOLEFT|(stplyrnum & 2 ? V_SPLITSCREEN|V_SNAPTOBOTTOM : 0); // flip P3 to the bottom.
|
||||
}
|
||||
else // else, that means we're P2 or P4.
|
||||
{
|
||||
fx = LAPS2_X;
|
||||
fy = LAPS2_Y;
|
||||
fflags = V_SNAPTORIGHT|(stplyrnum & 2 ? V_SPLITSCREEN|V_SNAPTOBOTTOM : 0); // flip P4 to the bottom
|
||||
}
|
||||
}
|
||||
|
||||
out->x = fx;
|
||||
out->y = fy;
|
||||
out->flags = fflags;
|
||||
}
|
||||
|
||||
void K_getMinimapDrawinfo(drawinfo_t *out)
|
||||
{
|
||||
INT32 fx = MINI_X, fy = MINI_Y, fflags = (splitscreen == 3 ? 0 : V_SNAPTORIGHT); // flags should only be 0 when it's centered (4p split)
|
||||
|
||||
out->x = fx;
|
||||
out->y = fy;
|
||||
out->flags = fflags;
|
||||
}
|
||||
|
||||
patch_t *K_getItemBoxPatch(boolean small, boolean dark)
|
||||
{
|
||||
UINT8 ofs = (cv_darkitembox.value && dark ? 1 : 0) + (small ? 2 : 0);
|
||||
return (cv_colorizeditembox.value && K_UseColorHud()) ? kp_itembgclr[ofs] : kp_itembg[ofs];
|
||||
}
|
||||
|
||||
patch_t *K_getItemMulPatch(boolean small)
|
||||
{
|
||||
UINT8 ofs = small ? 1 : 0;
|
||||
return K_UseColorHud() ? kp_itemmulstickerclr[ofs] : kp_itemmulsticker[ofs];
|
||||
}
|
||||
|
||||
static void K_drawKartStats(void)
|
||||
{
|
||||
INT32 x, y, spdoffset, flags;
|
||||
@@ -7584,13 +7647,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)
|
||||
{
|
||||
@@ -7692,12 +7752,8 @@ static void K_drawKartItem(void)
|
||||
const UINT8 offset = ((splitscreen > 1) ? 1 : 0);
|
||||
patch_t *localpatch = kp_nodraw;
|
||||
patch_t *localbg;
|
||||
|
||||
if (cv_colorizeditembox.value && K_UseColorHud())
|
||||
localbg = ((offset) ? kp_itembgclr[2] : kp_itembgclr[0]);
|
||||
else
|
||||
localbg = ((offset) ? kp_itembg[2] : kp_itembg[0]);
|
||||
|
||||
boolean dark = false;
|
||||
|
||||
patch_t *localinv = ((offset) ? kp_invincibility[((leveltime % (6*3)) / 3) + 7] : kp_invincibility[(leveltime % (7*3)) / 3]);
|
||||
INT32 fx = 0, fy = 0, fflags = 0; // final coords for hud and flags...
|
||||
//INT32 splitflags = K_calcSplitFlags(V_SNAPTOTOP|V_SNAPTOLEFT);
|
||||
@@ -7708,9 +7764,9 @@ static void K_drawKartItem(void)
|
||||
UINT8 localcolor = SKINCOLOR_NONE;
|
||||
SINT8 colormode = TC_RAINBOW;
|
||||
UINT8 *colmap = NULL;
|
||||
UINT8 *colormap = R_GetTranslationColormap(TC_DEFAULT, K_GetHudColor(), GTC_CACHE);
|
||||
|
||||
boolean flipamount = false; // Used for 3P/4P splitscreen to flip item amount stuff
|
||||
UINT8 *colormap = NULL;
|
||||
|
||||
boolean flipamount = splitscreen > 1 && stplyrnum & 1; // Used for 3P/4P splitscreen to flip item amount stuff
|
||||
|
||||
if (stplyr->kartstuff[k_itemroulette])
|
||||
{
|
||||
@@ -7857,8 +7913,7 @@ static void K_drawKartItem(void)
|
||||
break;
|
||||
case KITEM_INVINCIBILITY:
|
||||
localpatch = localinv;
|
||||
if (cv_darkitembox.value)
|
||||
localbg = (cv_colorizeditembox.value && K_UseColorHud()) ? kp_itembgclr[offset + 1] : kp_itembg[offset + 1];
|
||||
dark = true;
|
||||
break;
|
||||
case KITEM_BANANA:
|
||||
localpatch = kp_banana[offset];
|
||||
@@ -7880,8 +7935,7 @@ static void K_drawKartItem(void)
|
||||
break;
|
||||
case KITEM_SPB:
|
||||
localpatch = kp_selfpropelledbomb[offset];
|
||||
if (cv_darkitembox.value)
|
||||
localbg = (cv_colorizeditembox.value && K_UseColorHud()) ? kp_itembgclr[offset + 1] : kp_itembg[offset + 1];
|
||||
dark = true;
|
||||
break;
|
||||
case KITEM_GROW:
|
||||
localpatch = kp_grow[offset];
|
||||
@@ -7891,8 +7945,7 @@ static void K_drawKartItem(void)
|
||||
break;
|
||||
case KITEM_THUNDERSHIELD:
|
||||
localpatch = kp_thundershield[offset];
|
||||
if (cv_darkitembox.value)
|
||||
localbg = (cv_colorizeditembox.value && K_UseColorHud()) ? kp_itembgclr[offset + 1] : kp_itembg[offset + 1];
|
||||
dark = true;
|
||||
break;
|
||||
case KITEM_HYUDORO:
|
||||
localpatch = kp_hyudoro[offset];
|
||||
@@ -7933,47 +7986,25 @@ static void K_drawKartItem(void)
|
||||
}
|
||||
}
|
||||
|
||||
// pain and suffering defined below
|
||||
if (splitscreen < 2) // don't change shit for THIS splitscreen.
|
||||
{
|
||||
fx = ITEM_X;
|
||||
fy = ITEM_Y;
|
||||
fflags = K_calcSplitFlags(V_SNAPTOTOP|V_SNAPTOLEFT);
|
||||
}
|
||||
else // now we're having a fun game.
|
||||
{
|
||||
if (stplyr == &players[displayplayers[0]] || stplyr == &players[displayplayers[2]]) // If we are P1 or P3...
|
||||
{
|
||||
fx = ITEM_X;
|
||||
fy = ITEM_Y;
|
||||
fflags = V_SNAPTOLEFT|((stplyr == &players[displayplayers[2]]) ? V_SPLITSCREEN : V_SNAPTOTOP); // flip P3 to the bottom.
|
||||
}
|
||||
else // else, that means we're P2 or P4.
|
||||
{
|
||||
fx = ITEM2_X;
|
||||
fy = ITEM2_Y;
|
||||
fflags = V_SNAPTORIGHT|((stplyr == &players[displayplayers[3]]) ? V_SPLITSCREEN : V_SNAPTOTOP); // flip P4 to the bottom
|
||||
flipamount = true;
|
||||
}
|
||||
}
|
||||
localbg = K_getItemBoxPatch((boolean)offset, dark);
|
||||
drawinfo_t info;
|
||||
K_getItemBoxDrawinfo(&info);
|
||||
fx = info.x;
|
||||
fy = info.y;
|
||||
fflags = info.flags;
|
||||
|
||||
if (localcolor != SKINCOLOR_NONE)
|
||||
colmap = R_GetTranslationColormap(colormode, localcolor, GTC_CACHE);
|
||||
if (K_UseColorHud())
|
||||
colormap = R_GetTranslationColormap(TC_DEFAULT, K_GetHudColor(), GTC_CACHE);
|
||||
|
||||
|
||||
if (cv_colorizeditembox.value && K_UseColorHud())
|
||||
V_DrawMappedPatch(fx, fy, V_HUDTRANS|fflags, localbg,colormap);
|
||||
else
|
||||
V_DrawScaledPatch(fx, fy, V_HUDTRANS|fflags, localbg);
|
||||
V_DrawMappedPatch(fx, fy, V_HUDTRANS|fflags, localbg, cv_colorizeditembox.value ? colormap : NULL);
|
||||
|
||||
// Then, the numbers:
|
||||
if (stplyr->kartstuff[k_itemamount] >= numberdisplaymin && !stplyr->kartstuff[k_itemroulette])
|
||||
{
|
||||
if (!K_UseColorHud())
|
||||
V_DrawScaledPatch(fx + (flipamount ? 48 : 0), fy, V_HUDTRANS|fflags|(flipamount ? V_FLIP : 0), kp_itemmulsticker[offset]);
|
||||
else //Colourized hud
|
||||
V_DrawMappedPatch(fx + (flipamount ? 48 : 0), fy, V_HUDTRANS|fflags|(flipamount ? V_FLIP : 0), kp_itemmulstickerclr[offset], colormap); // flip this graphic for p2 and p4 in split and shift it.
|
||||
|
||||
localbg = K_getItemMulPatch((boolean)offset);
|
||||
V_DrawMappedPatch(fx + (flipamount ? 48 : 0), fy, V_HUDTRANS|fflags|(flipamount ? V_FLIP : 0), localbg, colormap); // flip this graphic for p2 and p4 in split and shift it.
|
||||
V_DrawFixedPatch(fx<<FRACBITS, fy<<FRACBITS, FRACUNIT, V_HUDTRANS|fflags, localpatch, colmap);
|
||||
if (offset)
|
||||
if (flipamount) // reminder that this is for 3/4p's right end of the screen.
|
||||
@@ -8332,10 +8363,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++)
|
||||
{
|
||||
@@ -8359,9 +8388,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++;
|
||||
}
|
||||
|
||||
@@ -8413,10 +8439,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);
|
||||
@@ -8426,9 +8450,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)
|
||||
@@ -8578,35 +8600,17 @@ static void K_drawKartLaps(void)
|
||||
{
|
||||
INT32 splitflags = K_calcSplitFlags(V_SNAPTOBOTTOM|V_SNAPTOLEFT);
|
||||
INT32 fx = 0, fy = 0, fflags = 0; // stuff for 3p / 4p splitscreen.
|
||||
boolean flipstring = false; // used for 3p or 4p
|
||||
boolean flipstring = splitscreen > 1 && stplyrnum & 1; // used for 3p or 4p
|
||||
INT32 stringw = 0; // used with the above
|
||||
|
||||
|
||||
drawinfo_t info;
|
||||
K_getLapsDrawinfo(&info);
|
||||
fx = info.x;
|
||||
fy = info.y;
|
||||
fflags = info.flags;
|
||||
|
||||
if (splitscreen > 1)
|
||||
{
|
||||
// pain and suffering defined below
|
||||
if (splitscreen < 2) // don't change shit for THIS splitscreen.
|
||||
{
|
||||
fx = LAPS_X;
|
||||
fy = LAPS_Y;
|
||||
fflags = splitflags;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (stplyr == &players[displayplayers[0]] || stplyr == &players[displayplayers[2]]) // If we are P1 or P3...
|
||||
{
|
||||
fx = LAPS_X;
|
||||
fy = LAPS_Y;
|
||||
fflags = V_SNAPTOLEFT|((stplyr == &players[displayplayers[2]]) ? V_SPLITSCREEN|V_SNAPTOBOTTOM : 0); // flip P3 to the bottom.
|
||||
}
|
||||
else // else, that means we're P2 or P4.
|
||||
{
|
||||
fx = LAPS2_X;
|
||||
fy = LAPS2_Y;
|
||||
fflags = V_SNAPTORIGHT|((stplyr == &players[displayplayers[3]]) ? V_SPLITSCREEN|V_SNAPTOBOTTOM : 0); // flip P4 to the bottom
|
||||
flipstring = true; // make the string right aligned and other shit
|
||||
}
|
||||
}
|
||||
|
||||
if (stplyr->exiting) // draw stuff as god intended.
|
||||
{
|
||||
V_DrawScaledPatch(fx, fy, V_HUDTRANS|fflags, kp_splitlapflag);
|
||||
@@ -8617,8 +8621,8 @@ static void K_drawKartLaps(void)
|
||||
{
|
||||
stringw = V_StringWidth(va("%d/%d", stplyr->laps+1, cv_numlaps.value), 0);
|
||||
|
||||
V_DrawScaledPatch(BASEVIDWIDTH-stringw-16, fy, V_HUDTRANS|fflags, kp_splitlapflag);
|
||||
V_DrawRightAlignedString(BASEVIDWIDTH-3, fy+1, V_HUDTRANS|fflags, va("%d/%d", stplyr->laps+1, cv_numlaps.value));
|
||||
V_DrawScaledPatch(fx-stringw-13, fy, V_HUDTRANS|fflags, kp_splitlapflag);
|
||||
V_DrawRightAlignedString(fx, fy+1, V_HUDTRANS|fflags, va("%d/%d", stplyr->laps+1, cv_numlaps.value));
|
||||
}
|
||||
else // draw stuff NORMALLY.
|
||||
{
|
||||
@@ -8631,23 +8635,23 @@ static void K_drawKartLaps(void)
|
||||
if (!K_UseColorHud())
|
||||
{
|
||||
if (K_BigLapSticker())
|
||||
V_DrawScaledPatch(LAPS_X, LAPS_Y, V_HUDTRANS|splitflags, ((stplyr->laps + 1 > 9) ? kp_lapstickerbig2 : kp_lapstickerbig));
|
||||
V_DrawScaledPatch(fx, fy, V_HUDTRANS|splitflags, ((stplyr->laps + 1 > 9) ? kp_lapstickerbig2 : kp_lapstickerbig));
|
||||
else
|
||||
V_DrawScaledPatch(LAPS_X, LAPS_Y, V_HUDTRANS|splitflags, kp_lapsticker);
|
||||
V_DrawScaledPatch(fx, fy, V_HUDTRANS|splitflags, kp_lapsticker);
|
||||
}
|
||||
else //Colourized hud
|
||||
{
|
||||
UINT8 *colormap = R_GetTranslationColormap(TC_DEFAULT, K_GetHudColor(), GTC_CACHE);
|
||||
if (K_BigLapSticker())
|
||||
V_DrawMappedPatch(LAPS_X, LAPS_Y, V_HUDTRANS|splitflags, ((stplyr->laps + 1 > 9) ? kp_lapstickerbig2clr : kp_lapstickerbigclr), colormap);
|
||||
V_DrawMappedPatch(fx, fy, V_HUDTRANS|splitflags, ((stplyr->laps + 1 > 9) ? kp_lapstickerbig2clr : kp_lapstickerbigclr), colormap);
|
||||
else
|
||||
V_DrawMappedPatch(LAPS_X, LAPS_Y, V_HUDTRANS|splitflags, kp_lapstickerclr, colormap);
|
||||
V_DrawMappedPatch(fx, fy, V_HUDTRANS|splitflags, kp_lapstickerclr, colormap);
|
||||
}
|
||||
|
||||
if (stplyr->exiting)
|
||||
V_DrawKartString(LAPS_X+33, LAPS_Y+3, V_HUDTRANS|splitflags, "FIN");
|
||||
V_DrawKartString(fx+33, fy+3, V_HUDTRANS|splitflags, "FIN");
|
||||
else
|
||||
V_DrawKartString(LAPS_X+33, LAPS_Y+3, V_HUDTRANS|splitflags, va("%d/%d", stplyr->laps+1, cv_numlaps.value));
|
||||
V_DrawKartString(fx+33, fy+3, V_HUDTRANS|splitflags, va("%d/%d", stplyr->laps+1, cv_numlaps.value));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8799,31 +8803,22 @@ static void K_drawKartSpeedometer(void)
|
||||
static void K_drawKartBumpersOrKarma(void)
|
||||
{
|
||||
UINT8 *colormap = R_GetTranslationColormap(TC_DEFAULT, K_GetHudColor(), GTC_CACHE);
|
||||
INT32 splitflags = K_calcSplitFlags(V_SNAPTOBOTTOM|V_SNAPTOLEFT);
|
||||
INT32 fx = 0, fy = 0, fflags = 0;
|
||||
boolean flipstring = false; // same as laps, used for splitscreen
|
||||
INT32 fx, fy, fflags;
|
||||
boolean flipstring = splitscreen > 1 && stplyrnum & 1; // same as laps, used for splitscreen
|
||||
INT32 stringw = 0; // used with the above
|
||||
|
||||
drawinfo_t info;
|
||||
K_getLapsDrawinfo(&info);
|
||||
fx = info.x;
|
||||
fy = info.y;
|
||||
fflags = info.flags;
|
||||
|
||||
if (splitscreen > 1)
|
||||
{
|
||||
// we will reuse lap coords here since it's essentially the same shit.
|
||||
|
||||
if (stplyr == &players[displayplayers[0]] || stplyr == &players[displayplayers[2]]) // If we are P1 or P3...
|
||||
{
|
||||
fx = LAPS_X;
|
||||
fy = LAPS_Y;
|
||||
fflags = V_SNAPTOLEFT|((stplyr == &players[displayplayers[2]]) ? V_SPLITSCREEN|V_SNAPTOBOTTOM : 0); // flip P3 to the bottom.
|
||||
}
|
||||
else // else, that means we're P2 or P4.
|
||||
{
|
||||
fx = LAPS2_X;
|
||||
fy = LAPS2_Y;
|
||||
fflags = V_SNAPTORIGHT|((stplyr == &players[displayplayers[3]]) ? V_SPLITSCREEN|V_SNAPTOBOTTOM : 0); // flip P4 to the bottom
|
||||
flipstring = true;
|
||||
}
|
||||
|
||||
if (stplyr->kartstuff[k_bumper] <= 0)
|
||||
{
|
||||
if (flipstring)
|
||||
fx -= 37;
|
||||
V_DrawMappedPatch(fx, fy-1, V_HUDTRANS|fflags, kp_splitkarmabomb, colormap);
|
||||
V_DrawString(fx+13, fy+1, V_HUDTRANS|fflags, va("%d/2", stplyr->kartstuff[k_comebackpoints]));
|
||||
}
|
||||
@@ -8833,8 +8828,8 @@ static void K_drawKartBumpersOrKarma(void)
|
||||
{
|
||||
stringw = V_StringWidth(va("%d/%d", stplyr->kartstuff[k_bumper], cv_kartbumpers.value), 0);
|
||||
|
||||
V_DrawMappedPatch(BASEVIDWIDTH-stringw-16, fy-1, V_HUDTRANS|fflags, kp_rankbumper, colormap);
|
||||
V_DrawRightAlignedString(BASEVIDWIDTH-3, fy+1, V_HUDTRANS|fflags, va("%d/%d", stplyr->kartstuff[k_bumper], cv_kartbumpers.value));
|
||||
V_DrawMappedPatch(fx-stringw-13, fy-1, V_HUDTRANS|fflags, kp_rankbumper, colormap);
|
||||
V_DrawRightAlignedString(fx, fy+1, V_HUDTRANS|fflags, va("%d/%d", stplyr->kartstuff[k_bumper], cv_kartbumpers.value));
|
||||
}
|
||||
else // draw bumpers normally.
|
||||
{
|
||||
@@ -8847,17 +8842,17 @@ static void K_drawKartBumpersOrKarma(void)
|
||||
{
|
||||
if (stplyr->kartstuff[k_bumper] <= 0)
|
||||
{
|
||||
V_DrawMappedPatch(LAPS_X, LAPS_Y, V_HUDTRANS|splitflags, (K_UseColorHud() ? kp_karmastickerclr : kp_karmasticker), colormap);
|
||||
V_DrawKartString(LAPS_X+47, LAPS_Y+3, V_HUDTRANS|splitflags, va("%d/2", stplyr->kartstuff[k_comebackpoints]));
|
||||
V_DrawMappedPatch(fx, fy, V_HUDTRANS|fflags, (K_UseColorHud() ? kp_karmastickerclr : kp_karmasticker), colormap);
|
||||
V_DrawKartString(fx+47, fy+3, V_HUDTRANS|fflags, va("%d/2", stplyr->kartstuff[k_comebackpoints]));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (stplyr->kartstuff[k_bumper] > 9 && cv_kartbumpers.value > 9)
|
||||
V_DrawMappedPatch(LAPS_X, LAPS_Y, V_HUDTRANS|splitflags, (K_UseColorHud() ? kp_bumperstickerwideclr : kp_bumperstickerwide), colormap);
|
||||
V_DrawMappedPatch(fx, fy, V_HUDTRANS|fflags, (K_UseColorHud() ? kp_bumperstickerwideclr : kp_bumperstickerwide), colormap);
|
||||
else
|
||||
V_DrawMappedPatch(LAPS_X, LAPS_Y, V_HUDTRANS|splitflags, (K_UseColorHud() ? kp_bumperstickerclr : kp_bumpersticker), colormap);
|
||||
V_DrawMappedPatch(fx, fy, V_HUDTRANS|fflags, (K_UseColorHud() ? kp_bumperstickerclr : kp_bumpersticker), colormap);
|
||||
|
||||
V_DrawKartString(LAPS_X+47, LAPS_Y+3, V_HUDTRANS|splitflags, va("%d/%d", stplyr->kartstuff[k_bumper], cv_kartbumpers.value));
|
||||
V_DrawKartString(fx+47, fy+3, V_HUDTRANS|fflags, va("%d/%d", stplyr->kartstuff[k_bumper], cv_kartbumpers.value));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9120,7 +9115,7 @@ static void K_drawKartMinimap(void)
|
||||
patch_t *AutomapPic;
|
||||
INT32 i = 0;
|
||||
INT32 x, y;
|
||||
INT32 minimaptrans, splitflags = (splitscreen == 3 ? 0 : V_SNAPTORIGHT); // flags should only be 0 when it's centered (4p split)
|
||||
INT32 minimaptrans, splitflags;
|
||||
SINT8 localplayers[4];
|
||||
SINT8 numlocalplayers = 0;
|
||||
|
||||
@@ -9139,8 +9134,12 @@ static void K_drawKartMinimap(void)
|
||||
else
|
||||
return; // no pic, just get outta here
|
||||
|
||||
x = MINI_X - (AutomapPic->width/2);
|
||||
y = MINI_Y - (AutomapPic->height/2);
|
||||
drawinfo_t info;
|
||||
K_getMinimapDrawinfo(&info);
|
||||
x = info.x - (AutomapPic->width/2);
|
||||
y = info.y - (AutomapPic->height/2);
|
||||
splitflags = info.flags;
|
||||
|
||||
|
||||
if (timeinmap > 105)
|
||||
{
|
||||
@@ -9304,10 +9303,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)
|
||||
{
|
||||
@@ -9419,9 +9417,7 @@ static void K_drawBattleFullscreen(void)
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
if (LUA_HudEnabled(hud_freeplay))
|
||||
#endif
|
||||
K_drawKartFreePlay(leveltime);
|
||||
}
|
||||
}
|
||||
@@ -9908,60 +9904,49 @@ 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 not splitscreen, draw...
|
||||
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();
|
||||
}
|
||||
}
|
||||
@@ -9969,16 +9954,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
|
||||
{
|
||||
@@ -10005,19 +9990,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)
|
||||
@@ -10025,26 +10006,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();
|
||||
}
|
||||
}
|
||||
@@ -10088,9 +10063,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);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ void K_RainbowColormap(UINT8 *dest_colormap, UINT8 skincolor);
|
||||
void K_GenerateKartColormap(UINT8 *dest_colormap, INT32 skinnum, UINT8 color, boolean local);
|
||||
UINT8 K_GetKartColorByName(const char *name);
|
||||
UINT8 K_GetHudColor(void);
|
||||
boolean K_UseColorHud(void);
|
||||
|
||||
void K_RegisterKartStuff(void);
|
||||
|
||||
@@ -96,5 +97,18 @@ void K_drawKartHUD(void);
|
||||
void K_drawKartFreePlay(UINT32 flashtime);
|
||||
void K_drawKartTimestamp(tic_t drawtime, INT32 TX, INT32 TY, INT16 emblemmap, UINT8 mode);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
INT32 x;
|
||||
INT32 y;
|
||||
INT32 flags;
|
||||
} drawinfo_t;
|
||||
|
||||
patch_t *K_getItemBoxPatch(boolean small, boolean dark);
|
||||
patch_t *K_getItemMulPatch(boolean small);
|
||||
void K_getItemBoxDrawinfo(drawinfo_t *out);
|
||||
void K_getLapsDrawinfo(drawinfo_t *out);
|
||||
void K_getMinimapDrawinfo(drawinfo_t *out);
|
||||
|
||||
// =========================================================================
|
||||
#endif // __K_KART__
|
||||
+1
-4
@@ -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
|
||||
}
|
||||
@@ -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"
|
||||
@@ -54,10 +53,12 @@ static UINT8 lib_searchBlockmap_Objects(lua_State *L, INT32 x, INT32 y, mobj_t *
|
||||
CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1));
|
||||
lua_pop(gL, 1);
|
||||
blockfuncerror = true;
|
||||
P_SetTarget(&bnext, NULL);
|
||||
return 0; // *shrugs*
|
||||
}
|
||||
if (!lua_isnil(gL, -1))
|
||||
{ // if nil, continue
|
||||
P_SetTarget(&bnext, NULL);
|
||||
if (lua_toboolean(gL, -1))
|
||||
return 2; // stop whole search
|
||||
else
|
||||
@@ -257,6 +258,4 @@ int LUA_BlockmapLib(lua_State *L)
|
||||
{
|
||||
lua_register(L, "searchBlockmap", lib_searchBlockmap);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
@@ -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
@@ -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
@@ -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
|
||||
}
|
||||
+158
-5
@@ -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[]
|
||||
@@ -24,6 +23,7 @@
|
||||
#include "v_video.h"
|
||||
#include "w_wad.h"
|
||||
#include "z_zone.h"
|
||||
#include "k_kart.h"
|
||||
|
||||
#include "lua_script.h"
|
||||
#include "lua_libs.h"
|
||||
@@ -169,6 +169,58 @@ static const char *const camera_opt[] = {
|
||||
"pnum",
|
||||
NULL};
|
||||
|
||||
enum hudpatch {
|
||||
hudpatch_item = 0,
|
||||
hudpatch_itemmul
|
||||
};
|
||||
|
||||
static const char *const hud_patch_options[] = {
|
||||
"item",
|
||||
"itemmul",
|
||||
NULL};
|
||||
|
||||
enum hudoffsets {
|
||||
hudoffsets_item = 0,
|
||||
hudoffsets_time,
|
||||
hudoffsets_gametypeinfo,
|
||||
hudoffsets_countdown,
|
||||
hudoffsets_speedometer,
|
||||
hudoffsets_position,
|
||||
hudoffsets_minirankings,
|
||||
hudoffsets_startcountdown,
|
||||
hudoffsets_check,
|
||||
hudoffsets_minimap,
|
||||
hudoffsets_wanted,
|
||||
hudoffsets_statdisplay
|
||||
};
|
||||
|
||||
static const char *const hud_offsets_options[] = {
|
||||
"item",
|
||||
"time",
|
||||
"gametypeinfo",
|
||||
"countdown",
|
||||
"speedometer",
|
||||
"position",
|
||||
"minirankings",
|
||||
"startcountdown",
|
||||
"check",
|
||||
"minimap",
|
||||
"wanted",
|
||||
"statdisplay",
|
||||
NULL};
|
||||
|
||||
enum huddrawinfo {
|
||||
huddrawinfo_item = 0,
|
||||
huddrawinfo_gametypeinfo,
|
||||
huddrawinfo_minimap
|
||||
};
|
||||
|
||||
static const char *const hud_drawinfo_options[] = {
|
||||
"item",
|
||||
"gametypeinfo",
|
||||
"minimap",
|
||||
NULL};
|
||||
|
||||
static int lib_getHudInfo(lua_State *L)
|
||||
{
|
||||
UINT32 i;
|
||||
@@ -744,7 +796,6 @@ static int libd_drawStretched(lua_State *L)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int libd_drawNum(lua_State *L)
|
||||
{
|
||||
INT32 x, y, flags, num;
|
||||
@@ -1007,6 +1058,54 @@ static int libd_getColormap(lua_State *L)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int libd_getColorHudPatch(lua_State *L)
|
||||
{
|
||||
HUDONLY
|
||||
enum hudpatch option = luaL_checkoption(L, 1, NULL, hud_patch_options);
|
||||
patch_t *patch;
|
||||
UINT8 *colormap = R_GetTranslationColormap(TC_DEFAULT, K_GetHudColor(), GTC_CACHE);
|
||||
boolean small, dark;
|
||||
|
||||
switch (option) {
|
||||
case hudpatch_item:
|
||||
small = lua_optboolean(L, 2);
|
||||
dark = lua_optboolean(L, 3);
|
||||
patch = K_getItemBoxPatch(small, dark);
|
||||
if (!cv_colorizeditembox.value)
|
||||
colormap = NULL;
|
||||
break;
|
||||
case hudpatch_itemmul:
|
||||
small = lua_optboolean(L, 2);
|
||||
patch = K_getItemMulPatch(small);
|
||||
break;
|
||||
default:
|
||||
return 0; // you shouldn't be here
|
||||
}
|
||||
|
||||
LUA_PushUserdata(L, patch, META_PATCH);
|
||||
if (colormap && K_UseColorHud())
|
||||
LUA_PushUserdata(L, colormap, META_COLORMAP);
|
||||
else
|
||||
lua_pushnil(L);
|
||||
|
||||
return 2;
|
||||
}
|
||||
|
||||
static int libd_getHudColor(lua_State *L)
|
||||
{
|
||||
HUDONLY
|
||||
lua_pushinteger(L, K_GetHudColor());
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int libd_useColorHud(lua_State *L)
|
||||
{
|
||||
HUDONLY
|
||||
lua_pushboolean(L, K_UseColorHud());
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static int libd_width(lua_State *L)
|
||||
{
|
||||
HUDONLY
|
||||
@@ -1057,6 +1156,26 @@ static int libd_getlocaltransflag(lua_State *L)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int libd_getDrawInfo(lua_State *L)
|
||||
{
|
||||
HUDONLY
|
||||
enum huddrawinfo option = luaL_checkoption(L, 1, NULL, hud_drawinfo_options);
|
||||
drawinfo_t info;
|
||||
|
||||
switch(option) {
|
||||
case huddrawinfo_item: K_getItemBoxDrawinfo(&info); break;
|
||||
case huddrawinfo_gametypeinfo: K_getLapsDrawinfo(&info); break;
|
||||
case huddrawinfo_minimap: K_getMinimapDrawinfo(&info); break;
|
||||
default:
|
||||
return 0; // unreachable
|
||||
}
|
||||
|
||||
lua_pushinteger(L, info.x);
|
||||
lua_pushinteger(L, info.y);
|
||||
lua_pushinteger(L, info.flags);
|
||||
return 3;
|
||||
}
|
||||
|
||||
static luaL_Reg lib_draw[] = {
|
||||
{"patchExists", libd_patchExists},
|
||||
{"cachePatch", libd_cachePatch},
|
||||
@@ -1080,6 +1199,10 @@ static luaL_Reg lib_draw[] = {
|
||||
{"renderer", libd_renderer},
|
||||
{"localTransFlag", libd_getlocaltransflag},
|
||||
{"drawOnMinimap", libd_drawOnMinimap},
|
||||
{"getColorHudPatch", libd_getColorHudPatch},
|
||||
{"getDrawInfo", libd_getDrawInfo},
|
||||
{"getHudColor", libd_getHudColor},
|
||||
{"useColorHud", libd_useColorHud},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
@@ -1170,12 +1293,44 @@ static int lib_hudsetvotebackground(lua_State *L)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int lib_hudgetoffsets(lua_State *L)
|
||||
{
|
||||
enum hudoffsets option = luaL_checkoption(L, 1, NULL, hud_offsets_options);
|
||||
INT32 ofx, ofy;
|
||||
|
||||
#define OFS(it) ofx = cv_##it##_xoffset.value; ofy = cv_##it##_yoffset.value; break;
|
||||
#define OFY(it) ofx = 0; ofy = cv_##it##_yoffset.value; break;
|
||||
switch(option) {
|
||||
case hudoffsets_item: OFS(item)
|
||||
case hudoffsets_time: OFS(time)
|
||||
case hudoffsets_gametypeinfo: OFS(laps)
|
||||
case hudoffsets_countdown: OFS(dnft)
|
||||
case hudoffsets_speedometer: OFS(speed)
|
||||
case hudoffsets_position: OFS(posi)
|
||||
case hudoffsets_minirankings: OFS(face)
|
||||
case hudoffsets_startcountdown: OFS(stcd)
|
||||
case hudoffsets_check: OFY(chek)
|
||||
case hudoffsets_minimap: OFS(mini)
|
||||
case hudoffsets_wanted: OFS(want)
|
||||
case hudoffsets_statdisplay: OFS(stat)
|
||||
default:
|
||||
return 0; // unreachable
|
||||
}
|
||||
#undef OFS
|
||||
#undef OFY
|
||||
|
||||
lua_pushinteger(L, ofx);
|
||||
lua_pushinteger(L, ofy);
|
||||
return 2;
|
||||
}
|
||||
|
||||
static luaL_Reg lib_hud[] = {
|
||||
{"enable", lib_hudenable},
|
||||
{"disable", lib_huddisable},
|
||||
{"enabled", lib_hudenabled},
|
||||
{"add", lib_hudadd},
|
||||
{"setVoteBackground", lib_hudsetvotebackground},
|
||||
{"getOffsets", lib_hudgetoffsets},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
@@ -1411,6 +1566,4 @@ void LUAh_VoteHUD(huddrawlist_h list)
|
||||
|
||||
lua_pushlightuserdata(gL, NULL);
|
||||
lua_setfield(gL, LUA_REGISTRYINDEX, "HUD_DRAW_LIST");
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
+1
-4
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
|
||||
}
|
||||
+24
-19
@@ -11,7 +11,6 @@
|
||||
/// \brief Lua scripting basics
|
||||
|
||||
#include "doomdef.h"
|
||||
#ifdef HAVE_BLUA
|
||||
#include "fastcmp.h"
|
||||
#include "dehacked.h"
|
||||
#include "z_zone.h"
|
||||
@@ -27,6 +26,8 @@
|
||||
#include "d_netfil.h" // for LUA_DumpFile
|
||||
#endif
|
||||
|
||||
#include "hashtable.h"
|
||||
|
||||
#include "lua_script.h"
|
||||
#include "lua_libs.h"
|
||||
#include "lua_glib.h"
|
||||
@@ -494,9 +495,9 @@ void LUA_InvalidateLevel(void)
|
||||
size_t i;
|
||||
if (!gL)
|
||||
return;
|
||||
|
||||
for (th = thinkercap.next; th && th != &thinkercap; th = th->next)
|
||||
LUA_InvalidateUserdata(th);
|
||||
for (i = 0; i < NUM_THINKERLISTS; i++)
|
||||
for (th = thlist[i].next; th && th != &thlist[i]; th = th->next)
|
||||
LUA_InvalidateUserdata(th);
|
||||
|
||||
LUA_InvalidateMapthings();
|
||||
|
||||
@@ -1585,16 +1586,17 @@ void LUA_Archive(void)
|
||||
ArchiveExtVars(&players[i], "player");
|
||||
}
|
||||
|
||||
if (gamestate == GS_LEVEL)
|
||||
//if (gamestate == GS_LEVEL)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
if (th->function.acp1 == (actionf_p1)P_MobjThinker)
|
||||
{
|
||||
// archive function will determine when to skip mobjs,
|
||||
// and write mobjnum in otherwise.
|
||||
ArchiveExtVars(th, "mobj");
|
||||
}
|
||||
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
|
||||
// archive function will determine when to skip mobjs,
|
||||
// and write mobjnum in otherwise.
|
||||
ArchiveExtVars(th, "mobj");
|
||||
}
|
||||
|
||||
WRITEUINT32(save_p, UINT32_MAX); // end of mobjs marker, replaces mobjnum.
|
||||
|
||||
LUAh_NetArchiveHook(NetArchive); // call the NetArchive hook in archive mode
|
||||
@@ -1622,10 +1624,15 @@ void LUA_UnArchive(void)
|
||||
|
||||
do {
|
||||
mobjnum = READUINT32(save_p); // read a mobjnum
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
if (th->function.acp1 == (actionf_p1)P_MobjThinker
|
||||
&& ((mobj_t *)th)->mobjnum == mobjnum) // find matching mobj
|
||||
UnArchiveExtVars(th); // apply variables
|
||||
th = mobjnum_ht_linkedList_Find(mobjnum);
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
if (((mobj_t *)th)->mobjnum != mobjnum) // find matching mobj
|
||||
continue;
|
||||
UnArchiveExtVars(th); // apply variables
|
||||
}
|
||||
} while(mobjnum != UINT32_MAX); // repeat until end of mobjs marker.
|
||||
|
||||
LUAh_NetArchiveHook(NetUnArchive); // call the NetArchive hook in unarchive mode
|
||||
@@ -1688,6 +1695,4 @@ int Lua_optoption(lua_State *L, int narg,
|
||||
if (fastcmp(lst[i], name))
|
||||
return i;
|
||||
return -1;
|
||||
}
|
||||
|
||||
#endif // HAVE_BLUA
|
||||
}
|
||||
@@ -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
@@ -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
|
||||
}
|
||||
+8
-11
@@ -11,14 +11,13 @@
|
||||
/// \brief thinker library for Lua scripting
|
||||
|
||||
#include "doomdef.h"
|
||||
#ifdef HAVE_BLUA
|
||||
#include "p_local.h"
|
||||
#include "lua_script.h"
|
||||
#include "lua_libs.h"
|
||||
|
||||
#define META_ITERATIONSTATE "iteration state"
|
||||
|
||||
static const char *const iter_opt[] = {
|
||||
/*static const char *const iter_opt[] = {
|
||||
"all",
|
||||
"mobj",
|
||||
NULL};
|
||||
@@ -26,7 +25,7 @@ static const char *const iter_opt[] = {
|
||||
static const actionf_p1 iter_funcs[] = {
|
||||
NULL,
|
||||
(actionf_p1)P_MobjThinker
|
||||
};
|
||||
};*/
|
||||
|
||||
struct iterationState {
|
||||
actionf_p1 filter;
|
||||
@@ -58,7 +57,7 @@ static int lib_iterateThinkers(lua_State *L)
|
||||
lua_settop(L, 2);
|
||||
|
||||
if (lua_isnil(L, 2))
|
||||
th = &thinkercap;
|
||||
th = &thlist[THINK_MOBJ];
|
||||
else if (lua_isuserdata(L, 2))
|
||||
{
|
||||
if (lua_islightuserdata(L, 2))
|
||||
@@ -88,11 +87,11 @@ static int lib_iterateThinkers(lua_State *L)
|
||||
if (!next)
|
||||
return luaL_error(L, "next thinker invalidated during iteration");
|
||||
|
||||
for (; next != &thinkercap; next = next->next)
|
||||
for (; next != &thlist[THINK_MOBJ]; next = next->next)
|
||||
if (!it->filter || next->function.acp1 == it->filter)
|
||||
{
|
||||
push_thinker(next);
|
||||
if (next->next != &thinkercap)
|
||||
if (next->next != &thlist[THINK_MOBJ])
|
||||
{
|
||||
push_thinker(next->next);
|
||||
it->next = luaL_ref(L, LUA_REGISTRYINDEX);
|
||||
@@ -111,7 +110,7 @@ static int lib_startIterate(lua_State *L)
|
||||
luaL_getmetatable(L, META_ITERATIONSTATE);
|
||||
lua_setmetatable(L, -2);
|
||||
|
||||
it->filter = iter_funcs[luaL_checkoption(L, 1, "mobj", iter_opt)];
|
||||
it->filter = (actionf_p1)P_MobjThinker; //iter_funcs[luaL_checkoption(L, 1, "mobj", iter_opt)];
|
||||
it->next = LUA_REFNIL;
|
||||
return 2;
|
||||
}
|
||||
@@ -129,8 +128,6 @@ int LUA_ThinkerLib(lua_State *L)
|
||||
lua_pushcfunction(L, lib_iterateThinkers);
|
||||
lua_pushcclosure(L, lib_startIterate, 1);
|
||||
lua_setfield(L, -2, "iterate");
|
||||
lua_setglobal(L, "thinkers");
|
||||
lua_setglobal(L, "mobjs");
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
+1
-5
@@ -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
|
||||
+6
-7
@@ -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);
|
||||
|
||||
@@ -904,15 +902,16 @@ static mapthing_t *OP_CreateNewMapThing(player_t *player, UINT16 type, boolean c
|
||||
thinker_t *th;
|
||||
mobj_t *mo;
|
||||
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
|
||||
mo = (mobj_t *)th;
|
||||
// get offset from mt, which points to old mapthings, then add new location
|
||||
if (mo->spawnpoint)
|
||||
mo->spawnpoint = (mo->spawnpoint - mt) + mapthings;
|
||||
if (!mo->spawnpoint)
|
||||
continue;
|
||||
mo->spawnpoint = (mo->spawnpoint - mt) + mapthings;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -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
|
||||
|
||||
|
||||
+34
-40
@@ -1516,13 +1516,13 @@ static const char* OP_OpenGLTooltips[] =
|
||||
|
||||
static menuitem_t OP_SoundOptionsMenu[] =
|
||||
{
|
||||
{IT_STRING|IT_CVAR|IT_CV_NOPRINT, NULL, "SFX", &cv_gamesounds, 10},
|
||||
{IT_STRING|IT_CVAR|IT_CV_NOPRINT, NULL, "SFX", &cv_gamesounds, 10},
|
||||
{IT_STRING|IT_CVAR|IT_CV_SLIDER,
|
||||
NULL, "SFX Volume", &cv_soundvolume, 18},
|
||||
NULL, "SFX Volume", &cv_soundvolume, 18},
|
||||
|
||||
{IT_STRING|IT_CVAR|IT_CV_NOPRINT, NULL, "Music", &cv_gamedigimusic, 30},
|
||||
{IT_STRING|IT_CVAR|IT_CV_NOPRINT, NULL, "Music", &cv_gamedigimusic, 30},
|
||||
{IT_STRING|IT_CVAR|IT_CV_SLIDER,
|
||||
NULL, "Music Volume", &cv_digmusicvolume, 38},
|
||||
NULL, "Music Volume", &cv_digmusicvolume, 38},
|
||||
|
||||
/* -- :nonnathisshit:
|
||||
{IT_STRING|IT_CVAR, NULL, "MIDI", &cv_gamemidimusic, 50},
|
||||
@@ -1532,19 +1532,19 @@ static menuitem_t OP_SoundOptionsMenu[] =
|
||||
|
||||
//{IT_STRING|IT_CALL, NULL, "Restart Audio System", M_RestartAudio, 50},
|
||||
|
||||
{IT_STRING|IT_CVAR, NULL, "Reverse L/R Channels", &stereoreverse, 50},
|
||||
{IT_STRING|IT_CVAR, NULL, "Surround Sound", &surround, 60},
|
||||
{IT_STRING|IT_CVAR, NULL, "Reverse L/R Channels", &stereoreverse, 50},
|
||||
{IT_STRING|IT_CVAR, NULL, "Surround Sound", &surround, 60},
|
||||
|
||||
{IT_STRING|IT_CVAR, NULL, "Chat Notifications", &cv_chatnotifications, 75},
|
||||
{IT_STRING|IT_CVAR, NULL, "Character voices", &cv_kartvoices, 85},
|
||||
{IT_STRING|IT_CVAR, NULL, "Powerup Warning", &cv_kartinvinsfx, 95},
|
||||
{IT_STRING|IT_CVAR, NULL, "Chat Notifications", &cv_chatnotifications, 75},
|
||||
{IT_STRING|IT_CVAR, NULL, "Character voices", &cv_kartvoices, 85},
|
||||
{IT_STRING|IT_CVAR, NULL, "Powerup Warning", &cv_kartinvinsfx, 95},
|
||||
|
||||
{IT_KEYHANDLER|IT_STRING, NULL, "Sound Test", M_HandleSoundTest, 105},
|
||||
{IT_STRING|IT_CALL, NULL, "Music Test", M_MusicTest, 115},
|
||||
{IT_KEYHANDLER|IT_STRING, NULL, "Sound Test", M_HandleSoundTest, 105},
|
||||
{IT_STRING|IT_CALL, NULL, "Music Test", M_MusicTest, 115},
|
||||
|
||||
{IT_STRING|IT_CVAR, NULL, "Play Music While Unfocused", &cv_playmusicifunfocused, 125},
|
||||
{IT_STRING|IT_CVAR, NULL, "Play SFX While Unfocused", &cv_playsoundifunfocused, 135},
|
||||
{IT_STRING|IT_SUBMENU, NULL, "Advanced Settings...", &OP_SoundAdvancedDef, 155}
|
||||
{IT_STRING|IT_CVAR, NULL, "Play Music While Unfocused", &cv_playmusicifunfocused, 125},
|
||||
{IT_STRING|IT_CVAR, NULL, "Play SFX While Unfocused", &cv_playsoundifunfocused, 135},
|
||||
{IT_STRING|IT_SUBMENU, NULL, "Advanced Settings...", &OP_SoundAdvancedDef, 155}
|
||||
};
|
||||
|
||||
static const char* OP_SoundTooltips[] =
|
||||
@@ -1571,17 +1571,17 @@ static menuitem_t OP_SoundAdvancedMenu[] =
|
||||
#ifdef HAVE_OPENMPT
|
||||
{IT_HEADER, NULL, "Tracker Module Options", NULL, 10},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Instrument Filter", &cv_modfilter, 22},
|
||||
{IT_STRING | IT_CVAR, NULL, "Amiga Resampler", &cv_amigafilter, 42},
|
||||
{IT_STRING | IT_CVAR, NULL, "Instrument Filter", &cv_modfilter, 22},
|
||||
{IT_STRING | IT_CVAR, NULL, "Amiga Resampler", &cv_amigafilter, 42},
|
||||
#if OPENMPT_API_VERSION_MAJOR < 1 && OPENMPT_API_VERSION_MINOR > 4
|
||||
{IT_STRING | IT_CVAR, NULL, "Amiga Type", &cv_amigatype, 62},
|
||||
{IT_STRING | IT_CVAR, NULL, "Amiga Type", &cv_amigatype, 62},
|
||||
#endif
|
||||
{IT_STRING | IT_CVAR, NULL, "Stereo Seperation", &cv_stereosep, 82},
|
||||
{IT_STRING | IT_CVAR, NULL, "Stereo Seperation", &cv_stereosep, 82},
|
||||
#endif
|
||||
{IT_HEADER, NULL, "Misc", NULL, 105},
|
||||
{IT_HEADER, NULL, "Misc", NULL, 105},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Grow Music", &cv_growmusic, 117},
|
||||
{IT_STRING | IT_CVAR, NULL, "Invulnerability Music", &cv_supermusic, 137},
|
||||
{IT_STRING | IT_CVAR, NULL, "Grow Music", &cv_growmusic, 117},
|
||||
{IT_STRING | IT_CVAR, NULL, "Invulnerability Music", &cv_supermusic, 137},
|
||||
};
|
||||
|
||||
static const char* OP_SoundAdvancedTooltips[] =
|
||||
@@ -1604,11 +1604,10 @@ static const char* OP_SoundAdvancedTooltips[] =
|
||||
|
||||
static menuitem_t OP_DataOptionsMenu[] =
|
||||
{
|
||||
|
||||
{IT_STRING | IT_CALL, NULL, "Screenshot Options...", M_ScreenshotOptions, 10},
|
||||
{IT_STRING | IT_CALL, NULL, "Addon Options...", M_AddonsOptions, 20},
|
||||
{IT_STRING | IT_SUBMENU, NULL, "Replay Options...", &MISC_ReplayOptionsDef, 30},
|
||||
{IT_STRING | IT_SUBMENU, NULL, "Protocol options...", &OP_ProtocolDef, 40},
|
||||
{IT_STRING | IT_SUBMENU, NULL, "Protocol options...", &OP_ProtocolDef, 40},
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
{IT_STRING | IT_SUBMENU, NULL, "Discord Options...", &OP_DiscordOptionsDef, 50},
|
||||
|
||||
@@ -1624,21 +1623,21 @@ static menuitem_t OP_ScreenshotOptionsMenu[] =
|
||||
{IT_STRING|IT_CVAR|IT_CV_STRING, NULL, "Custom Folder", &cv_screenshot_folder, 20},
|
||||
|
||||
{IT_HEADER, NULL, "Screenshots (F8)", NULL, 50},
|
||||
{IT_STRING|IT_CVAR, NULL, "Memory Level", &cv_zlib_memory, 60},
|
||||
{IT_STRING|IT_CVAR, NULL, "Compression Level", &cv_zlib_level, 70},
|
||||
{IT_STRING|IT_CVAR, NULL, "Strategy", &cv_zlib_strategy, 80},
|
||||
{IT_STRING|IT_CVAR, NULL, "Window Size", &cv_zlib_window_bits, 90},
|
||||
{IT_STRING|IT_CVAR, NULL, "Memory Level", &cv_zlib_memory, 60},
|
||||
{IT_STRING|IT_CVAR, NULL, "Compression Level", &cv_zlib_level, 70},
|
||||
{IT_STRING|IT_CVAR, NULL, "Strategy", &cv_zlib_strategy, 80},
|
||||
{IT_STRING|IT_CVAR, NULL, "Window Size", &cv_zlib_window_bits, 90},
|
||||
|
||||
{IT_HEADER, NULL, "Movie Mode (F9)", NULL, 105},
|
||||
{IT_STRING|IT_CVAR, NULL, "Capture Mode", &cv_moviemode, 115},
|
||||
{IT_STRING|IT_CVAR, NULL, "Capture Mode", &cv_moviemode, 115},
|
||||
|
||||
{IT_STRING|IT_CVAR, NULL, "Region Optimizing", &cv_gif_optimize, 125},
|
||||
{IT_STRING|IT_CVAR, NULL, "Downscaling", &cv_gif_downscale, 135},
|
||||
{IT_STRING|IT_CVAR, NULL, "Region Optimizing", &cv_gif_optimize, 125},
|
||||
{IT_STRING|IT_CVAR, NULL, "Downscaling", &cv_gif_downscale, 135},
|
||||
|
||||
{IT_STRING|IT_CVAR, NULL, "Memory Level", &cv_zlib_memorya, 125},
|
||||
{IT_STRING|IT_CVAR, NULL, "Compression Level", &cv_zlib_levela, 135},
|
||||
{IT_STRING|IT_CVAR, NULL, "Strategy", &cv_zlib_strategya, 145},
|
||||
{IT_STRING|IT_CVAR, NULL, "Window Size", &cv_zlib_window_bitsa, 155},
|
||||
{IT_STRING|IT_CVAR, NULL, "Memory Level", &cv_zlib_memorya, 125},
|
||||
{IT_STRING|IT_CVAR, NULL, "Compression Level", &cv_zlib_levela, 135},
|
||||
{IT_STRING|IT_CVAR, NULL, "Strategy", &cv_zlib_strategya, 145},
|
||||
{IT_STRING|IT_CVAR, NULL, "Window Size", &cv_zlib_window_bitsa, 155},
|
||||
};
|
||||
|
||||
enum
|
||||
@@ -6457,13 +6456,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
|
||||
|
||||
+1
-421
@@ -19,7 +19,6 @@
|
||||
// (if libpng is compiled with setjmp error handling)
|
||||
#pragma GCC diagnostic ignored "-Wclobbered"
|
||||
#endif
|
||||
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
@@ -1937,430 +1936,11 @@ char *sizeu5(size_t num)
|
||||
return sizeu5_buf;
|
||||
}
|
||||
|
||||
#if defined (__GNUC__) && defined (__i386__) // from libkwave, under GPL
|
||||
// Alam: note libkwave memcpy code comes from mplayer's libvo/aclib_template.c, r699
|
||||
|
||||
/* for small memory blocks (<256 bytes) this version is faster */
|
||||
#define small_memcpy(dest,src,n)\
|
||||
{\
|
||||
register unsigned long int dummy;\
|
||||
__asm__ __volatile__(\
|
||||
"cld\n\t"\
|
||||
"rep; movsb"\
|
||||
:"=&D"(dest), "=&S"(src), "=&c"(dummy)\
|
||||
:"0" (dest), "1" (src),"2" (n)\
|
||||
: "memory", "cc");\
|
||||
}
|
||||
/* linux kernel __memcpy (from: /include/asm/string.h) */
|
||||
ATTRINLINE static FUNCINLINE void *__memcpy (void *dest, const void * src, size_t n)
|
||||
void *M_Memcpy(void *dest, const void *src, size_t n)
|
||||
{
|
||||
int d0, d1, d2;
|
||||
|
||||
if ( n < 4 )
|
||||
{
|
||||
small_memcpy(dest, src, n);
|
||||
}
|
||||
else
|
||||
{
|
||||
__asm__ __volatile__ (
|
||||
"rep ; movsl;"
|
||||
"testb $2,%b4;"
|
||||
"je 1f;"
|
||||
"movsw;"
|
||||
"1:\ttestb $1,%b4;"
|
||||
"je 2f;"
|
||||
"movsb;"
|
||||
"2:"
|
||||
: "=&c" (d0), "=&D" (d1), "=&S" (d2)
|
||||
:"0" (n/4), "q" (n),"1" ((long) dest),"2" ((long) src)
|
||||
: "memory");
|
||||
}
|
||||
|
||||
return dest;
|
||||
}
|
||||
|
||||
#define SSE_MMREG_SIZE 16
|
||||
#define MMX_MMREG_SIZE 8
|
||||
|
||||
#define MMX1_MIN_LEN 0x800 /* 2K blocks */
|
||||
#define MIN_LEN 0x40 /* 64-byte blocks */
|
||||
|
||||
/* SSE note: i tried to move 128 bytes a time instead of 64 but it
|
||||
didn't make any measureable difference. i'm using 64 for the sake of
|
||||
simplicity. [MF] */
|
||||
static /*FUNCTARGET("sse2")*/ void *sse_cpy(void * dest, const void * src, size_t n)
|
||||
{
|
||||
void *retval = dest;
|
||||
size_t i;
|
||||
|
||||
/* PREFETCH has effect even for MOVSB instruction ;) */
|
||||
__asm__ __volatile__ (
|
||||
"prefetchnta (%0);"
|
||||
"prefetchnta 32(%0);"
|
||||
"prefetchnta 64(%0);"
|
||||
"prefetchnta 96(%0);"
|
||||
"prefetchnta 128(%0);"
|
||||
"prefetchnta 160(%0);"
|
||||
"prefetchnta 192(%0);"
|
||||
"prefetchnta 224(%0);"
|
||||
"prefetchnta 256(%0);"
|
||||
"prefetchnta 288(%0);"
|
||||
: : "r" (src) );
|
||||
|
||||
if (n >= MIN_LEN)
|
||||
{
|
||||
register unsigned long int delta;
|
||||
/* Align destinition to MMREG_SIZE -boundary */
|
||||
delta = ((unsigned long int)dest)&(SSE_MMREG_SIZE-1);
|
||||
if (delta)
|
||||
{
|
||||
delta=SSE_MMREG_SIZE-delta;
|
||||
n -= delta;
|
||||
small_memcpy(dest, src, delta);
|
||||
}
|
||||
i = n >> 6; /* n/64 */
|
||||
n&=63;
|
||||
if (((unsigned long)src) & 15)
|
||||
/* if SRC is misaligned */
|
||||
for (; i>0; i--)
|
||||
{
|
||||
__asm__ __volatile__ (
|
||||
"prefetchnta 320(%0);"
|
||||
"prefetchnta 352(%0);"
|
||||
"movups (%0), %%xmm0;"
|
||||
"movups 16(%0), %%xmm1;"
|
||||
"movups 32(%0), %%xmm2;"
|
||||
"movups 48(%0), %%xmm3;"
|
||||
"movntps %%xmm0, (%1);"
|
||||
"movntps %%xmm1, 16(%1);"
|
||||
"movntps %%xmm2, 32(%1);"
|
||||
"movntps %%xmm3, 48(%1);"
|
||||
:: "r" (src), "r" (dest) : "memory");
|
||||
src = (const unsigned char *)src + 64;
|
||||
dest = (unsigned char *)dest + 64;
|
||||
}
|
||||
else
|
||||
/*
|
||||
Only if SRC is aligned on 16-byte boundary.
|
||||
It allows to use movaps instead of movups, which required data
|
||||
to be aligned or a general-protection exception (#GP) is generated.
|
||||
*/
|
||||
for (; i>0; i--)
|
||||
{
|
||||
__asm__ __volatile__ (
|
||||
"prefetchnta 320(%0);"
|
||||
"prefetchnta 352(%0);"
|
||||
"movaps (%0), %%xmm0;"
|
||||
"movaps 16(%0), %%xmm1;"
|
||||
"movaps 32(%0), %%xmm2;"
|
||||
"movaps 48(%0), %%xmm3;"
|
||||
"movntps %%xmm0, (%1);"
|
||||
"movntps %%xmm1, 16(%1);"
|
||||
"movntps %%xmm2, 32(%1);"
|
||||
"movntps %%xmm3, 48(%1);"
|
||||
:: "r" (src), "r" (dest) : "memory");
|
||||
src = ((const unsigned char *)src) + 64;
|
||||
dest = ((unsigned char *)dest) + 64;
|
||||
}
|
||||
/* since movntq is weakly-ordered, a "sfence"
|
||||
* is needed to become ordered again. */
|
||||
__asm__ __volatile__ ("sfence":::"memory");
|
||||
/* enables to use FPU */
|
||||
__asm__ __volatile__ ("emms":::"memory");
|
||||
}
|
||||
/*
|
||||
* Now do the tail of the block
|
||||
*/
|
||||
if (n) __memcpy(dest, src, n);
|
||||
return retval;
|
||||
}
|
||||
|
||||
static FUNCTARGET("mmx") void *mmx2_cpy(void *dest, const void *src, size_t n)
|
||||
{
|
||||
void *retval = dest;
|
||||
size_t i;
|
||||
|
||||
/* PREFETCH has effect even for MOVSB instruction ;) */
|
||||
__asm__ __volatile__ (
|
||||
"prefetchnta (%0);"
|
||||
"prefetchnta 32(%0);"
|
||||
"prefetchnta 64(%0);"
|
||||
"prefetchnta 96(%0);"
|
||||
"prefetchnta 128(%0);"
|
||||
"prefetchnta 160(%0);"
|
||||
"prefetchnta 192(%0);"
|
||||
"prefetchnta 224(%0);"
|
||||
"prefetchnta 256(%0);"
|
||||
"prefetchnta 288(%0);"
|
||||
: : "r" (src));
|
||||
|
||||
if (n >= MIN_LEN)
|
||||
{
|
||||
register unsigned long int delta;
|
||||
/* Align destinition to MMREG_SIZE -boundary */
|
||||
delta = ((unsigned long int)dest)&(MMX_MMREG_SIZE-1);
|
||||
if (delta)
|
||||
{
|
||||
delta=MMX_MMREG_SIZE-delta;
|
||||
n -= delta;
|
||||
small_memcpy(dest, src, delta);
|
||||
}
|
||||
i = n >> 6; /* n/64 */
|
||||
n&=63;
|
||||
for (; i>0; i--)
|
||||
{
|
||||
__asm__ __volatile__ (
|
||||
"prefetchnta 320(%0);"
|
||||
"prefetchnta 352(%0);"
|
||||
"movq (%0), %%mm0;"
|
||||
"movq 8(%0), %%mm1;"
|
||||
"movq 16(%0), %%mm2;"
|
||||
"movq 24(%0), %%mm3;"
|
||||
"movq 32(%0), %%mm4;"
|
||||
"movq 40(%0), %%mm5;"
|
||||
"movq 48(%0), %%mm6;"
|
||||
"movq 56(%0), %%mm7;"
|
||||
"movntq %%mm0, (%1);"
|
||||
"movntq %%mm1, 8(%1);"
|
||||
"movntq %%mm2, 16(%1);"
|
||||
"movntq %%mm3, 24(%1);"
|
||||
"movntq %%mm4, 32(%1);"
|
||||
"movntq %%mm5, 40(%1);"
|
||||
"movntq %%mm6, 48(%1);"
|
||||
"movntq %%mm7, 56(%1);"
|
||||
:: "r" (src), "r" (dest) : "memory");
|
||||
src = ((const unsigned char *)src) + 64;
|
||||
dest = ((unsigned char *)dest) + 64;
|
||||
}
|
||||
/* since movntq is weakly-ordered, a "sfence"
|
||||
* is needed to become ordered again. */
|
||||
__asm__ __volatile__ ("sfence":::"memory");
|
||||
__asm__ __volatile__ ("emms":::"memory");
|
||||
}
|
||||
/*
|
||||
* Now do the tail of the block
|
||||
*/
|
||||
if (n) __memcpy(dest, src, n);
|
||||
return retval;
|
||||
}
|
||||
|
||||
static FUNCTARGET("mmx") void *mmx1_cpy(void *dest, const void *src, size_t n) //3DNOW
|
||||
{
|
||||
void *retval = dest;
|
||||
size_t i;
|
||||
|
||||
/* PREFETCH has effect even for MOVSB instruction ;) */
|
||||
__asm__ __volatile__ (
|
||||
"prefetch (%0);"
|
||||
"prefetch 32(%0);"
|
||||
"prefetch 64(%0);"
|
||||
"prefetch 96(%0);"
|
||||
"prefetch 128(%0);"
|
||||
"prefetch 160(%0);"
|
||||
"prefetch 192(%0);"
|
||||
"prefetch 224(%0);"
|
||||
"prefetch 256(%0);"
|
||||
"prefetch 288(%0);"
|
||||
: : "r" (src));
|
||||
|
||||
if (n >= MMX1_MIN_LEN)
|
||||
{
|
||||
register unsigned long int delta;
|
||||
/* Align destinition to MMREG_SIZE -boundary */
|
||||
delta = ((unsigned long int)dest)&(MMX_MMREG_SIZE-1);
|
||||
if (delta)
|
||||
{
|
||||
delta=MMX_MMREG_SIZE-delta;
|
||||
n -= delta;
|
||||
small_memcpy(dest, src, delta);
|
||||
}
|
||||
i = n >> 6; /* n/64 */
|
||||
n&=63;
|
||||
for (; i>0; i--)
|
||||
{
|
||||
__asm__ __volatile__ (
|
||||
"prefetch 320(%0);"
|
||||
"prefetch 352(%0);"
|
||||
"movq (%0), %%mm0;"
|
||||
"movq 8(%0), %%mm1;"
|
||||
"movq 16(%0), %%mm2;"
|
||||
"movq 24(%0), %%mm3;"
|
||||
"movq 32(%0), %%mm4;"
|
||||
"movq 40(%0), %%mm5;"
|
||||
"movq 48(%0), %%mm6;"
|
||||
"movq 56(%0), %%mm7;"
|
||||
"movq %%mm0, (%1);"
|
||||
"movq %%mm1, 8(%1);"
|
||||
"movq %%mm2, 16(%1);"
|
||||
"movq %%mm3, 24(%1);"
|
||||
"movq %%mm4, 32(%1);"
|
||||
"movq %%mm5, 40(%1);"
|
||||
"movq %%mm6, 48(%1);"
|
||||
"movq %%mm7, 56(%1);"
|
||||
:: "r" (src), "r" (dest) : "memory");
|
||||
src = ((const unsigned char *)src) + 64;
|
||||
dest = ((unsigned char *)dest) + 64;
|
||||
}
|
||||
__asm__ __volatile__ ("femms":::"memory"); // same as mmx_cpy() but with a femms
|
||||
}
|
||||
/*
|
||||
* Now do the tail of the block
|
||||
*/
|
||||
if (n) __memcpy(dest, src, n);
|
||||
return retval;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Alam: why? memcpy may be __cdecl/_System and our code may be not the same type
|
||||
static void *cpu_cpy(void *dest, const void *src, size_t n)
|
||||
{
|
||||
if (src == NULL)
|
||||
{
|
||||
CONS_Debug(DBG_MEMORY, "Memcpy from 0x0?!: %p %p %s\n", dest, src, sizeu1(n));
|
||||
return dest;
|
||||
}
|
||||
|
||||
if(dest == NULL)
|
||||
{
|
||||
CONS_Debug(DBG_MEMORY, "Memcpy to 0x0?!: %p %p %s\n", dest, src, sizeu1(n));
|
||||
return dest;
|
||||
}
|
||||
|
||||
return memcpy(dest, src, n);
|
||||
}
|
||||
|
||||
static /*FUNCTARGET("mmx")*/ void *mmx_cpy(void *dest, const void *src, size_t n)
|
||||
{
|
||||
#if defined (_MSC_VER) && defined (_X86_)
|
||||
_asm
|
||||
{
|
||||
mov ecx, [n]
|
||||
mov esi, [src]
|
||||
mov edi, [dest]
|
||||
shr ecx, 6 // mit mmx: 64bytes per iteration
|
||||
jz lower_64 // if lower than 64 bytes
|
||||
loop_64: // MMX transfers multiples of 64bytes
|
||||
movq mm0, 0[ESI] // read sources
|
||||
movq mm1, 8[ESI]
|
||||
movq mm2, 16[ESI]
|
||||
movq mm3, 24[ESI]
|
||||
movq mm4, 32[ESI]
|
||||
movq mm5, 40[ESI]
|
||||
movq mm6, 48[ESI]
|
||||
movq mm7, 56[ESI]
|
||||
|
||||
movq 0[EDI], mm0 // write destination
|
||||
movq 8[EDI], mm1
|
||||
movq 16[EDI], mm2
|
||||
movq 24[EDI], mm3
|
||||
movq 32[EDI], mm4
|
||||
movq 40[EDI], mm5
|
||||
movq 48[EDI], mm6
|
||||
movq 56[EDI], mm7
|
||||
|
||||
add esi, 64
|
||||
add edi, 64
|
||||
dec ecx
|
||||
jnz loop_64
|
||||
emms // close mmx operation
|
||||
lower_64:// transfer rest of buffer
|
||||
mov ebx,esi
|
||||
sub ebx,src
|
||||
mov ecx,[n]
|
||||
sub ecx,ebx
|
||||
shr ecx, 3 // multiples of 8 bytes
|
||||
jz lower_8
|
||||
loop_8:
|
||||
movq mm0, [esi] // read source
|
||||
movq [edi], mm0 // write destination
|
||||
add esi, 8
|
||||
add edi, 8
|
||||
dec ecx
|
||||
jnz loop_8
|
||||
emms // close mmx operation
|
||||
lower_8:
|
||||
mov ebx,esi
|
||||
sub ebx,src
|
||||
mov ecx,[n]
|
||||
sub ecx,ebx
|
||||
rep movsb
|
||||
mov eax, [dest] // return dest
|
||||
}
|
||||
#elif defined (__GNUC__) && defined (__i386__)
|
||||
void *retval = dest;
|
||||
size_t i;
|
||||
|
||||
if (n >= MMX1_MIN_LEN)
|
||||
{
|
||||
register unsigned long int delta;
|
||||
/* Align destinition to MMREG_SIZE -boundary */
|
||||
delta = ((unsigned long int)dest)&(MMX_MMREG_SIZE-1);
|
||||
if (delta)
|
||||
{
|
||||
delta=MMX_MMREG_SIZE-delta;
|
||||
n -= delta;
|
||||
small_memcpy(dest, src, delta);
|
||||
}
|
||||
i = n >> 6; /* n/64 */
|
||||
n&=63;
|
||||
for (; i>0; i--)
|
||||
{
|
||||
__asm__ __volatile__ (
|
||||
"movq (%0), %%mm0;"
|
||||
"movq 8(%0), %%mm1;"
|
||||
"movq 16(%0), %%mm2;"
|
||||
"movq 24(%0), %%mm3;"
|
||||
"movq 32(%0), %%mm4;"
|
||||
"movq 40(%0), %%mm5;"
|
||||
"movq 48(%0), %%mm6;"
|
||||
"movq 56(%0), %%mm7;"
|
||||
"movq %%mm0, (%1);"
|
||||
"movq %%mm1, 8(%1);"
|
||||
"movq %%mm2, 16(%1);"
|
||||
"movq %%mm3, 24(%1);"
|
||||
"movq %%mm4, 32(%1);"
|
||||
"movq %%mm5, 40(%1);"
|
||||
"movq %%mm6, 48(%1);"
|
||||
"movq %%mm7, 56(%1);"
|
||||
:: "r" (src), "r" (dest) : "memory");
|
||||
src = ((const unsigned char *)src) + 64;
|
||||
dest = ((unsigned char *)dest) + 64;
|
||||
}
|
||||
__asm__ __volatile__ ("emms":::"memory");
|
||||
}
|
||||
/*
|
||||
* Now do the tail of the block
|
||||
*/
|
||||
if (n) __memcpy(dest, src, n);
|
||||
return retval;
|
||||
#else
|
||||
return cpu_cpy(dest, src, n);
|
||||
#endif
|
||||
}
|
||||
|
||||
void *(*M_Memcpy)(void* dest, const void* src, size_t n) = cpu_cpy;
|
||||
|
||||
/** Memcpy that uses MMX, 3DNow, MMXExt or even SSE
|
||||
* Do not use on overlapped memory, use memmove for that
|
||||
*/
|
||||
void M_SetupMemcpy(void)
|
||||
{
|
||||
#if defined (__GNUC__) && defined (__i386__)
|
||||
if (R_SSE2)
|
||||
M_Memcpy = sse_cpy;
|
||||
else if (R_MMXExt)
|
||||
M_Memcpy = mmx2_cpy;
|
||||
else if (R_3DNow)
|
||||
M_Memcpy = mmx1_cpy;
|
||||
else
|
||||
#endif
|
||||
if (R_MMX)
|
||||
M_Memcpy = mmx_cpy;
|
||||
#if 0
|
||||
M_Memcpy = cpu_cpy;
|
||||
#endif
|
||||
}
|
||||
|
||||
/** Return the appropriate message for a file error or end of file.
|
||||
*/
|
||||
const char *M_FileError(FILE *fp)
|
||||
|
||||
@@ -94,8 +94,6 @@ TMatrix *RotateZMatrix(angle_t rad);
|
||||
// s1 = s2+s3+s1 (1024 lenghtmax)
|
||||
void strcatbf(char *s1, const char *s2, const char *s3);
|
||||
|
||||
void M_SetupMemcpy(void);
|
||||
|
||||
const char *M_FileError(FILE *handle);
|
||||
|
||||
// counting bits, for weapon ammo code, usually
|
||||
|
||||
+4
-29
@@ -564,6 +564,7 @@ static void PS_UpdateFrameStats(void)
|
||||
// Update thinker counters by iterating the thinker lists.
|
||||
static void PS_CountThinkers(void)
|
||||
{
|
||||
int i;
|
||||
thinker_t *thinker;
|
||||
|
||||
ps_thinkercount.value.i = 0;
|
||||
@@ -574,38 +575,14 @@ static void PS_CountThinkers(void)
|
||||
ps_otherthcount.value.i = 0;
|
||||
ps_precipcount.value.i = 0;
|
||||
ps_removecount.value.i = 0;
|
||||
for (thinker = thinkercap.next; thinker != &thinkercap; thinker = thinker->next)
|
||||
{
|
||||
ps_thinkercount.value.i++;
|
||||
if (thinker->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
ps_removecount.value.i++;
|
||||
else if (thinker->function.acp1 == (actionf_p1)P_MobjThinker)
|
||||
{
|
||||
mobj_t *mobj = (mobj_t*)thinker;
|
||||
ps_mobjcount.value.i++;
|
||||
if (mobj->flags & MF_NOTHINK)
|
||||
ps_nothinkcount.value.i++;
|
||||
else if (mobj->flags & MF_SCENERY)
|
||||
ps_scenerycount.value.i++;
|
||||
else
|
||||
ps_regularcount.value.i++;
|
||||
}
|
||||
else if (thinker->function.acp1 == (actionf_p1)P_NullPrecipThinker)
|
||||
ps_precipcount.value.i++;
|
||||
else
|
||||
ps_otherthcount.value.i++;
|
||||
}
|
||||
/*for (i = 0; i < NUM_THINKERLISTS; i++)
|
||||
|
||||
for (i = 0; i < NUM_THINKERLISTS; i++)
|
||||
{
|
||||
for (thinker = thlist[i].next; thinker != &thlist[i]; thinker = thinker->next)
|
||||
{
|
||||
ps_thinkercount.value.i++;
|
||||
if (thinker->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
ps_removecount.value.i++;
|
||||
else if (i == THINK_POLYOBJ)
|
||||
ps_polythcount.value.i++;
|
||||
else if (i == THINK_MAIN)
|
||||
ps_mainthcount.value.i++;
|
||||
else if (i == THINK_MOBJ)
|
||||
{
|
||||
if (thinker->function.acp1 == (actionf_p1)P_MobjThinker)
|
||||
@@ -620,12 +597,10 @@ static void PS_CountThinkers(void)
|
||||
ps_regularcount.value.i++;
|
||||
}
|
||||
}
|
||||
else if (i == THINK_DYNSLOPE)
|
||||
ps_dynslopethcount.value.i++;
|
||||
else if (i == THINK_PRECIP)
|
||||
ps_precipcount.value.i++;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
// Update all metrics that are calculated on every tick.
|
||||
|
||||
+2
-2
@@ -410,7 +410,7 @@ INT32 EV_DoCeiling(line_t *line, ceiling_e type)
|
||||
// new door thinker
|
||||
rtn = 1;
|
||||
ceiling = Z_Calloc(sizeof (*ceiling), PU_LEVSPEC, NULL);
|
||||
P_AddThinker(&ceiling->thinker);
|
||||
P_AddThinker(THINK_MAIN, &ceiling->thinker);
|
||||
sec->ceilingdata = ceiling;
|
||||
ceiling->thinker.function.acp1 = (actionf_p1)T_MoveCeiling;
|
||||
ceiling->sector = sec;
|
||||
@@ -633,7 +633,7 @@ INT32 EV_DoCrush(line_t *line, ceiling_e type)
|
||||
// new door thinker
|
||||
rtn = 1;
|
||||
ceiling = Z_Calloc(sizeof (*ceiling), PU_LEVSPEC, NULL);
|
||||
P_AddThinker(&ceiling->thinker);
|
||||
P_AddThinker(THINK_MAIN, &ceiling->thinker);
|
||||
sec->ceilingdata = ceiling;
|
||||
ceiling->thinker.function.acp1 = (actionf_p1)T_CrushCeiling;
|
||||
ceiling->sector = sec;
|
||||
|
||||
+226
-582
File diff suppressed because it is too large.
Load diff
+22
-17
@@ -1977,20 +1977,25 @@ void T_ThwompSector(levelspecthink_t *thwomp)
|
||||
// scan the thinkers to find players!
|
||||
if (!rover || (rover->flags & FF_EXISTS))
|
||||
{
|
||||
// scan the thinkers to find players!
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
UINT8 i;
|
||||
// scan the players to find victims!
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
if (!playeringame[i])
|
||||
continue;
|
||||
if (players[i].spectator)
|
||||
continue;
|
||||
if (!players[i].mo)
|
||||
continue;
|
||||
if (!players[i].mo->health)
|
||||
continue;
|
||||
if (players[i].mo->z > thwomp->sector->ceilingheight)
|
||||
continue;
|
||||
if (P_AproxDistance(thwompx - players[i].mo->x, thwompy - players[i].mo->y) > 96 * FRACUNIT)
|
||||
continue;
|
||||
|
||||
mo = (mobj_t *)th;
|
||||
if (mo->type == MT_PLAYER && mo->health && mo->player && !mo->player->spectator
|
||||
&& mo->z <= thwomp->sector->ceilingheight
|
||||
&& P_AproxDistance(thwompx - mo->x, thwompy - mo->y) <= 96*FRACUNIT)
|
||||
{
|
||||
thwomp->direction = -1;
|
||||
break;
|
||||
}
|
||||
thwomp->direction = -1;
|
||||
break;
|
||||
}
|
||||
}*/
|
||||
|
||||
@@ -2678,7 +2683,7 @@ INT32 EV_DoFloor(line_t *line, floor_e floortype)
|
||||
// new floor thinker
|
||||
rtn = 1;
|
||||
dofloor = Z_Calloc(sizeof (*dofloor), PU_LEVSPEC, NULL);
|
||||
P_AddThinker(&dofloor->thinker);
|
||||
P_AddThinker(THINK_MAIN, &dofloor->thinker);
|
||||
|
||||
// make sure another floor thinker won't get started over this one
|
||||
sec->floordata = dofloor;
|
||||
@@ -2902,7 +2907,7 @@ INT32 EV_DoElevator(line_t *line, elevator_e elevtype, boolean customspeed)
|
||||
// create and initialize new elevator thinker
|
||||
rtn = 1;
|
||||
elevator = Z_Calloc(sizeof (*elevator), PU_LEVSPEC, NULL);
|
||||
P_AddThinker(&elevator->thinker);
|
||||
P_AddThinker(THINK_MAIN, &elevator->thinker);
|
||||
sec->floordata = elevator;
|
||||
sec->ceilingdata = elevator;
|
||||
elevator->thinker.function.acp1 = (actionf_p1)T_MoveElevator;
|
||||
@@ -3088,7 +3093,7 @@ INT32 EV_BounceSector(sector_t *sec, fixed_t momz, line_t *sourceline)
|
||||
return 0;
|
||||
|
||||
bouncer = Z_Calloc(sizeof (*bouncer), PU_LEVSPEC, NULL);
|
||||
P_AddThinker(&bouncer->thinker);
|
||||
P_AddThinker(THINK_MAIN, &bouncer->thinker);
|
||||
sec->ceilingdata = bouncer;
|
||||
bouncer->thinker.function.acp1 = (actionf_p1)T_BounceCheese;
|
||||
|
||||
@@ -3126,7 +3131,7 @@ INT32 EV_DoContinuousFall(sector_t *sec, sector_t *backsector, fixed_t spd, bool
|
||||
|
||||
// create and initialize new thinker
|
||||
faller = Z_Calloc(sizeof (*faller), PU_LEVSPEC, NULL);
|
||||
P_AddThinker(&faller->thinker);
|
||||
P_AddThinker(THINK_MAIN, &faller->thinker);
|
||||
faller->thinker.function.acp1 = (actionf_p1)T_ContinuousFalling;
|
||||
|
||||
// set up the fields
|
||||
@@ -3179,7 +3184,7 @@ INT32 EV_StartCrumble(sector_t *sec, ffloor_t *rover, boolean floating,
|
||||
|
||||
// create and initialize new elevator thinker
|
||||
elevator = Z_Calloc(sizeof (*elevator), PU_LEVSPEC, NULL);
|
||||
P_AddThinker(&elevator->thinker);
|
||||
P_AddThinker(THINK_MAIN, &elevator->thinker);
|
||||
elevator->thinker.function.acp1 = (actionf_p1)T_StartCrumble;
|
||||
|
||||
// Does this crumbler return?
|
||||
@@ -3257,7 +3262,7 @@ INT32 EV_MarioBlock(sector_t *sec, sector_t *roversector, fixed_t topheight, mob
|
||||
// create and initialize new elevator thinker
|
||||
|
||||
block = Z_Calloc(sizeof (*block), PU_LEVSPEC, NULL);
|
||||
P_AddThinker(&block->thinker);
|
||||
P_AddThinker(THINK_MAIN, &block->thinker);
|
||||
sec->floordata = block;
|
||||
sec->ceilingdata = block;
|
||||
block->thinker.function.acp1 = (actionf_p1)T_MarioBlock;
|
||||
|
||||
+12
-124
@@ -27,6 +27,7 @@
|
||||
#include "m_misc.h"
|
||||
#include "v_video.h" // video flags for CEchos
|
||||
#include "k_kart.h" // SRB2kart
|
||||
#include "p_local.h"
|
||||
|
||||
// CTF player names
|
||||
#define CTFTEAMCODE(pl) pl->ctfteam ? (pl->ctfteam == 1 ? "\x85" : "\x84") : ""
|
||||
@@ -288,43 +289,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)
|
||||
@@ -940,7 +910,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||
if (player->powers[pw_super])
|
||||
return;
|
||||
|
||||
player->gotflag |= flagflag;
|
||||
player->gotflag |= flagflag; // >:(
|
||||
CONS_Printf(M_GetText("%s picked up the %c%s%c!\n"), plname, flagcolor, flagtext, 0x80);
|
||||
(*flagmobj) = NULL;
|
||||
// code for dealing with abilities is handled elsewhere now
|
||||
@@ -1012,9 +982,9 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||
count = 1;
|
||||
|
||||
// scan the remaining thinkers
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
@@ -1062,9 +1032,9 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||
|
||||
// Now we RE-scan all the thinkers to find close objects to pull
|
||||
// in from the paraloop. Isn't this just so efficient?
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
@@ -1431,9 +1401,9 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||
EV_DoElevator(&junk, bridgeFall, false);
|
||||
|
||||
// scan the remaining thinkers to find koopa
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
@@ -2163,10 +2133,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
|
||||
@@ -2591,7 +2559,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source)
|
||||
|
||||
// scan the thinkers to make sure all the old pinch dummies are gone on death
|
||||
// this can happen if the boss was hurt earlier than expected
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
@@ -3129,11 +3097,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 +3117,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 +3128,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 +3161,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 +3187,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 +3223,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 +3295,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]))
|
||||
{
|
||||
|
||||
+5
-5
@@ -76,7 +76,7 @@ fireflicker_t *P_SpawnAdjustableFireFlicker(sector_t *minsector, sector_t *maxse
|
||||
P_RemoveLighting(maxsector); // out with the old, in with the new
|
||||
flick = Z_Calloc(sizeof (*flick), PU_LEVSPEC, NULL);
|
||||
|
||||
P_AddThinker(&flick->thinker);
|
||||
P_AddThinker(THINK_MAIN, &flick->thinker);
|
||||
|
||||
flick->thinker.function.acp1 = (actionf_p1)T_FireFlicker;
|
||||
flick->sector = maxsector;
|
||||
@@ -155,7 +155,7 @@ void P_SpawnLightningFlash(sector_t *sector)
|
||||
|
||||
flash = Z_Calloc(sizeof (*flash), PU_LEVSPEC, NULL);
|
||||
|
||||
P_AddThinker(&flash->thinker);
|
||||
P_AddThinker(THINK_MAIN, &flash->thinker);
|
||||
|
||||
flash->thinker.function.acp1 = (actionf_p1)T_LightningFlash;
|
||||
flash->sector = sector;
|
||||
@@ -214,7 +214,7 @@ strobe_t *P_SpawnAdjustableStrobeFlash(sector_t *minsector, sector_t *maxsector,
|
||||
P_RemoveLighting(maxsector); // out with the old, in with the new
|
||||
flash = Z_Calloc(sizeof (*flash), PU_LEVSPEC, NULL);
|
||||
|
||||
P_AddThinker(&flash->thinker);
|
||||
P_AddThinker(THINK_MAIN, &flash->thinker);
|
||||
|
||||
flash->sector = maxsector;
|
||||
flash->darktime = darktime;
|
||||
@@ -289,7 +289,7 @@ glow_t *P_SpawnAdjustableGlowingLight(sector_t *minsector, sector_t *maxsector,
|
||||
P_RemoveLighting(maxsector); // out with the old, in with the new
|
||||
g = Z_Calloc(sizeof (*g), PU_LEVSPEC, NULL);
|
||||
|
||||
P_AddThinker(&g->thinker);
|
||||
P_AddThinker(THINK_MAIN, &g->thinker);
|
||||
|
||||
g->sector = maxsector;
|
||||
g->minlight = minsector->lightlevel;
|
||||
@@ -350,7 +350,7 @@ void P_FadeLight(INT16 tag, INT32 destvalue, INT32 speed)
|
||||
ll->thinker.function.acp1 = (actionf_p1)T_LightFade;
|
||||
sector->lightingdata = ll; // set it to the lightlevel_t
|
||||
|
||||
P_AddThinker(&ll->thinker); // add thinker
|
||||
P_AddThinker(THINK_MAIN, &ll->thinker); // add thinker
|
||||
|
||||
ll->sector = sector;
|
||||
ll->destlevel = destvalue;
|
||||
|
||||
+15
-11
@@ -60,15 +60,21 @@
|
||||
#define mariomode (maptol & TOL_MARIO)
|
||||
#define twodlevel (maptol & TOL_2D)
|
||||
|
||||
//
|
||||
// P_TICK
|
||||
//
|
||||
|
||||
// both the head and tail of the thinker list
|
||||
extern thinker_t thinkercap;
|
||||
typedef enum
|
||||
{
|
||||
THINK_POLYOBJ,
|
||||
THINK_MAIN,
|
||||
THINK_MOBJ,
|
||||
#ifdef ESLOPE
|
||||
THINK_DYNSLOPE,
|
||||
#endif
|
||||
THINK_PRECIP,
|
||||
NUM_THINKERLISTS
|
||||
} thinklistnum_t; /**< Thinker lists. */
|
||||
extern thinker_t thlist[];
|
||||
|
||||
void P_InitThinkers(void);
|
||||
void P_AddThinker(thinker_t *thinker);
|
||||
void P_AddThinker(const thinklistnum_t n, thinker_t *thinker);
|
||||
void P_RemoveThinker(thinker_t *thinker);
|
||||
|
||||
//
|
||||
@@ -245,7 +251,7 @@ void P_PrecipitationEffects(void);
|
||||
|
||||
void P_RemoveMobj(mobj_t *th);
|
||||
boolean P_MobjWasRemoved(mobj_t *th);
|
||||
void P_RemoveSavegameMobj(mobj_t *th);
|
||||
void P_RemoveSavegameMobj(mobj_t *th, boolean preserveLevel);
|
||||
boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state);
|
||||
boolean P_SetMobjState(mobj_t *mobj, statenum_t state);
|
||||
//void P_RunShields(void);
|
||||
@@ -290,6 +296,7 @@ void P_ColorTeamMissile(mobj_t *missile, player_t *source);
|
||||
SINT8 P_MobjFlip(mobj_t *mobj);
|
||||
fixed_t P_GetMobjGravity(mobj_t *mo);
|
||||
FUNCMATH boolean P_WeaponOrPanel(mobjtype_t type);
|
||||
FUNCMATH boolean P_IsProjectile(mobjtype_t type);
|
||||
|
||||
boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled);
|
||||
|
||||
@@ -306,9 +313,6 @@ void P_FlashPal(player_t *pl, UINT16 type, UINT16 duration);
|
||||
// P_ENEMY
|
||||
//
|
||||
|
||||
// main player in game
|
||||
extern player_t *stplyr; // for splitscreen correct palette changes and overlay
|
||||
|
||||
// Is there a better place for these?
|
||||
extern INT32 var1;
|
||||
extern INT32 var2;
|
||||
|
||||
+1
-10
@@ -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))
|
||||
@@ -3954,7 +3945,7 @@ static boolean PIT_ChangeSector(mobj_t *thing, boolean realcrush)
|
||||
thinker_t *think;
|
||||
elevator_t *crumbler;
|
||||
|
||||
for (think = thinkercap.next; think != &thinkercap; think = think->next)
|
||||
for (think = thlist[THINK_MAIN].next; think != &thlist[THINK_MAIN]; think = think->next)
|
||||
{
|
||||
if (think->function.acp1 != (actionf_p1)T_StartCrumble)
|
||||
continue;
|
||||
|
||||
@@ -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;
|
||||
|
||||
+97
-93
@@ -49,6 +49,8 @@ static mobj_t *overlaycap = NULL;
|
||||
static mobj_t *shadowcap = NULL;
|
||||
mobj_t *waypointcap = NULL;
|
||||
|
||||
UINT32 globalmobjnum = 0; // this should never overflow, but 4 billion would be an impressive number to reach. \todo ensure this never happens
|
||||
|
||||
void P_InitCachedActions(void)
|
||||
{
|
||||
actioncachehead.prev = actioncachehead.next = &actioncachehead;
|
||||
@@ -63,9 +65,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 +221,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 +288,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;
|
||||
@@ -394,6 +393,12 @@ boolean P_WeaponOrPanel(mobjtype_t type)
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean P_IsProjectile(mobjtype_t type)
|
||||
{
|
||||
return type == MT_THROWNBOUNCE || type == MT_THROWNINFINITY || type == MT_THROWNAUTOMATIC || type == MT_THROWNSCATTER
|
||||
|| type == MT_THROWNEXPLOSION || type == MT_THROWNGRENADE || type == MT_REDRING;
|
||||
}
|
||||
|
||||
//
|
||||
// P_EmeraldManager
|
||||
//
|
||||
@@ -420,10 +425,10 @@ boolean P_WeaponOrPanel(mobjtype_t type)
|
||||
spawnpoints[i] = NULL;
|
||||
}
|
||||
|
||||
for (think = thinkercap.next; think != &thinkercap; think = think->next)
|
||||
for (think = thlist[THINK_MOBJ].next; think != &thlist[THINK_MOBJ]; think = think->next)
|
||||
{
|
||||
if (think->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue; // not a mobj thinker
|
||||
if (think->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
|
||||
mo = (mobj_t *)think;
|
||||
|
||||
@@ -3403,10 +3408,10 @@ void P_DestroyRobots(void)
|
||||
mobj_t *mo;
|
||||
thinker_t *think;
|
||||
|
||||
for (think = thinkercap.next; think != &thinkercap; think = think->next)
|
||||
for (think = thlist[THINK_MOBJ].next; think != &thlist[THINK_MOBJ]; think = think->next)
|
||||
{
|
||||
if (think->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue; // not a mobj thinker
|
||||
if (think->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
|
||||
mo = (mobj_t *)think;
|
||||
if (mo->health <= 0 || !(mo->flags & MF_ENEMY || mo->flags & MF_BOSS))
|
||||
@@ -4210,9 +4215,9 @@ static void P_Boss3Thinker(mobj_t *mobj)
|
||||
|
||||
// scan the thinkers to make sure all the old pinch dummies are gone before making new ones
|
||||
// this can happen if the boss was hurt earlier than expected
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
@@ -4301,15 +4306,25 @@ static void P_Boss3Thinker(mobj_t *mobj)
|
||||
// scan the thinkers
|
||||
// to find a point that matches
|
||||
// the number
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
if (mo2->type == MT_BOSS3WAYPOINT && mo2->spawnpoint && mo2->spawnpoint->angle == mobj->threshold)
|
||||
{
|
||||
P_SetTarget(&mobj->target, mo2);
|
||||
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
if (mo2->type != MT_BOSS3WAYPOINT)
|
||||
continue;
|
||||
if (!mo2->spawnpoint)
|
||||
continue;
|
||||
if (mo2->spawnpoint->angle != mobj->threshold)
|
||||
continue;
|
||||
if (mo2->spawnpoint->extrainfo != mobj->cusval)
|
||||
continue;
|
||||
|
||||
P_SetTarget(&mobj->tracer, mo2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -4922,9 +4937,9 @@ static void P_Boss7Thinker(mobj_t *mobj)
|
||||
closestdist = 16384*FRACUNIT; // Just in case...
|
||||
|
||||
// Find waypoint he is closest to
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
@@ -4977,9 +4992,9 @@ static void P_Boss7Thinker(mobj_t *mobj)
|
||||
|
||||
// scan the thinkers to find
|
||||
// the waypoint to use
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
@@ -5100,9 +5115,9 @@ static void P_Boss9Thinker(mobj_t *mobj)
|
||||
|
||||
// Run through the thinkers ONCE and find all of the MT_BOSS9GATHERPOINT in the map.
|
||||
// Build a hoop linked list of 'em!
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
@@ -5534,9 +5549,9 @@ mobj_t *P_GetClosestAxis(mobj_t *source)
|
||||
fixed_t dist1, dist2 = 0;
|
||||
|
||||
// scan the thinkers to find the closest axis point
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
@@ -6343,6 +6358,9 @@ void P_MobjThinker(mobj_t *mobj)
|
||||
if (mobj->flags & MF_NOTHINK)
|
||||
return;
|
||||
|
||||
if ((mobj->flags & MF_BOSS) && mobj->spawnpoint)
|
||||
return;
|
||||
|
||||
// Remove dead target/tracer.
|
||||
if (mobj->target && P_MobjWasRemoved(mobj->target))
|
||||
P_SetTarget(&mobj->target, NULL);
|
||||
@@ -6414,12 +6432,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 +7138,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 +7150,6 @@ void P_MobjThinker(mobj_t *mobj)
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
// Check for a Lua thinker first
|
||||
if (!mobj->player)
|
||||
{
|
||||
@@ -7148,7 +7163,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 +7181,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 +7189,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 +9145,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
|
||||
@@ -9633,6 +9635,7 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
|
||||
mobj->thinker.function.acp1 = (actionf_p1)P_MobjThinker;
|
||||
mobj->type = type;
|
||||
mobj->info = info;
|
||||
mobj->localmobjnum = globalmobjnum++;
|
||||
|
||||
mobj->x = x;
|
||||
mobj->y = y;
|
||||
@@ -9730,7 +9733,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 +9743,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:
|
||||
@@ -10023,7 +10024,7 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
|
||||
}
|
||||
|
||||
if (!(mobj->flags & MF_NOTHINK))
|
||||
P_AddThinker(&mobj->thinker); // Needs to come before the shadow spawn, or else the shadow's reference gets forgotten
|
||||
P_AddThinker(THINK_MOBJ, &mobj->thinker); // Needs to come before the shadow spawn, or else the shadow's reference gets forgotten
|
||||
|
||||
switch (mobj->type)
|
||||
{
|
||||
@@ -10063,9 +10064,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!
|
||||
@@ -10161,7 +10161,7 @@ mobj_t *P_SpawnShadowMobj(mobj_t * caster)
|
||||
mobj->eflags |= MFE_ONGROUND;
|
||||
|
||||
if (!(mobj->flags & MF_NOTHINK))
|
||||
P_AddThinker(&mobj->thinker);
|
||||
P_AddThinker(THINK_MOBJ, &mobj->thinker);
|
||||
|
||||
// Call action functions when the state is set
|
||||
if (st->action.acp1 && (mobj->flags & MF_RUNSPAWNFUNC))
|
||||
@@ -10178,9 +10178,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!
|
||||
@@ -10233,7 +10232,7 @@ static precipmobj_t *P_SpawnPrecipMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype
|
||||
mobj->momz = mobjinfo[type].speed;
|
||||
|
||||
mobj->thinker.function.acp1 = (actionf_p1)P_NullPrecipThinker;
|
||||
P_AddThinker(&mobj->thinker);
|
||||
P_AddThinker(THINK_PRECIP, &mobj->thinker);
|
||||
|
||||
CalculatePrecipFloor(mobj);
|
||||
|
||||
@@ -10277,16 +10276,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 &&
|
||||
@@ -10366,28 +10362,25 @@ void P_RemoveMobj(mobj_t *mobj)
|
||||
}
|
||||
}
|
||||
|
||||
// free block
|
||||
// DBG: set everything in mobj_t to 0xFF instead of leaving it. debug memory error.
|
||||
if (mobj->flags & MF_NOTHINK && !mobj->thinker.next)
|
||||
#ifdef SCRAMBLE_REMOVED
|
||||
// Invalidate mobj_t data to cause crashes if accessed!
|
||||
memset((UINT8 *)mobj + sizeof(thinker_t), 0xff, sizeof(mobj_t) - sizeof(thinker_t));
|
||||
#endif
|
||||
|
||||
// free block
|
||||
if (!mobj->thinker.next)
|
||||
{ // Uh-oh, the mobj doesn't think, P_RemoveThinker would never go through!
|
||||
INT32 prevreferences;
|
||||
if (!mobj->thinker.references)
|
||||
{
|
||||
#ifdef SCRAMBLE_REMOVED
|
||||
// Invalidate mobj_t data to cause crashes if accessed!
|
||||
memset(mobj, 0xff, sizeof(mobj_t));
|
||||
#endif
|
||||
Z_Free(mobj); // No refrences? Can be removed immediately! :D
|
||||
}
|
||||
else
|
||||
{ // Add thinker just to delay removing it until refrences are gone.
|
||||
mobj->flags &= ~MF_NOTHINK;
|
||||
P_AddThinker((thinker_t *)mobj);
|
||||
#ifdef SCRAMBLE_REMOVED
|
||||
// Invalidate mobj_t data to cause crashes if accessed!
|
||||
memset((UINT8 *)mobj + sizeof(thinker_t), 0xff, sizeof(mobj_t) - sizeof(thinker_t));
|
||||
#endif
|
||||
P_RemoveThinker((thinker_t *)mobj);
|
||||
Z_Free(mobj); // No refrrences? Can be removed immediately! :D
|
||||
return;
|
||||
}
|
||||
|
||||
prevreferences = mobj->thinker.references;
|
||||
P_AddThinker(THINK_MOBJ, (thinker_t *)mobj);
|
||||
mobj->thinker.references = prevreferences;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -10426,7 +10419,7 @@ void P_RemovePrecipMobj(precipmobj_t *mobj)
|
||||
}
|
||||
|
||||
// Clearing out stuff for savegames
|
||||
void P_RemoveSavegameMobj(mobj_t *mobj)
|
||||
void P_RemoveSavegameMobj(mobj_t *mobj, boolean preserveLevel)
|
||||
{
|
||||
// unlink from sector and block lists
|
||||
if (((thinker_t *)mobj)->function.acp1 == (actionf_p1)P_NullPrecipThinker)
|
||||
@@ -10453,7 +10446,16 @@ void P_RemoveSavegameMobj(mobj_t *mobj)
|
||||
}
|
||||
|
||||
// stop any playing sound
|
||||
S_StopSound(mobj);
|
||||
//if (!preserveLevel)
|
||||
//{
|
||||
S_StopSound(mobj);
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// detach any playing sounds from this mobj, but don't destroy them as they might still be there
|
||||
//S_DetachChannelsFromOrigin(mobj);
|
||||
//}
|
||||
|
||||
R_RemoveMobjInterpolator(mobj);
|
||||
|
||||
// free block
|
||||
@@ -10685,7 +10687,7 @@ void P_RespawnSpecials(void)
|
||||
{
|
||||
thinker_t *th;
|
||||
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
mobj_t *box;
|
||||
mobj_t *newmobj;
|
||||
@@ -11831,9 +11833,9 @@ ML_NOCLIMB : Direction not controllable
|
||||
mobj->health = (mthing->angle / 360) + 1;
|
||||
|
||||
// See if other starposts exist in this level that have the same value.
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
@@ -12109,7 +12111,7 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing)
|
||||
//mobj->hprev->hnext = mobj;
|
||||
}
|
||||
else
|
||||
mobj->hprev = mobj->hnext = NULL;
|
||||
P_SetTarget(&mobj->hprev, P_SetTarget(&mobj->hnext, NULL));
|
||||
|
||||
nextmobj = mobj;
|
||||
}
|
||||
@@ -12135,11 +12137,9 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing)
|
||||
mobj->z -= mobj->height/2;
|
||||
|
||||
// Link all the collision sprites together.
|
||||
mobj->hnext = NULL;
|
||||
P_SetTarget(&mobj->hnext, NULL);
|
||||
P_SetTarget(&mobj->hprev, nextmobj);
|
||||
P_SetTarget(&mobj->hprev->hnext, mobj);
|
||||
//mobj->hprev = nextmobj;
|
||||
//mobj->hprev->hnext = mobj;
|
||||
|
||||
nextmobj = mobj;
|
||||
}
|
||||
@@ -12164,11 +12164,9 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing)
|
||||
mobj->z -= mobj->height/2;
|
||||
|
||||
// Link all the collision sprites together.
|
||||
mobj->hnext = NULL;
|
||||
P_SetTarget(&mobj->hnext, NULL);
|
||||
P_SetTarget(&mobj->hprev, nextmobj);
|
||||
P_SetTarget(&mobj->hprev->hnext, mobj);
|
||||
//mobj->hprev = nextmobj;
|
||||
//mobj->hprev->hnext = mobj;
|
||||
|
||||
nextmobj = mobj;
|
||||
}
|
||||
@@ -12255,7 +12253,7 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing)
|
||||
//mobj->hprev->hnext = mobj;
|
||||
}
|
||||
else
|
||||
mobj->hprev = mobj->hnext = NULL;
|
||||
P_SetTarget(&mobj->hprev, P_SetTarget(&mobj->hnext, NULL));
|
||||
|
||||
nextmobj = mobj;
|
||||
}
|
||||
@@ -12292,11 +12290,9 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing)
|
||||
mobj->z -= mobj->height/2;
|
||||
|
||||
// Link all the collision sprites together.
|
||||
mobj->hnext = NULL;
|
||||
P_SetTarget(&mobj->hnext, NULL);
|
||||
P_SetTarget(&mobj->hprev, nextmobj);
|
||||
P_SetTarget(&mobj->hprev->hnext, mobj);
|
||||
//mobj->hprev = nextmobj;
|
||||
//mobj->hprev->hnext = mobj;
|
||||
|
||||
nextmobj = mobj;
|
||||
}
|
||||
@@ -12911,6 +12907,7 @@ mobj_t *P_SPMAngle(mobj_t *source, mobjtype_t type, angle_t angle, UINT8 allowai
|
||||
angle_t an;
|
||||
fixed_t x, y, z, slope = 0;
|
||||
|
||||
|
||||
// angle at which you fire, is player angle
|
||||
an = angle;
|
||||
|
||||
@@ -12927,6 +12924,13 @@ mobj_t *P_SPMAngle(mobj_t *source, mobjtype_t type, angle_t angle, UINT8 allowai
|
||||
|
||||
th = P_SpawnMobj(x, y, z, type);
|
||||
|
||||
if (cv_netslingdelay.value && issimulation && (tic_t)cv_netsteadyplayers.value >= targetsimtic - simtic && source == players[consoleplayer].mo)
|
||||
{
|
||||
z = 0x80000000; // don't make rings appear when using netslingdelay, teleport them somewhere else
|
||||
th->flags |= MF_NOTHINK;
|
||||
th->sprite = SPR_NULL;
|
||||
}
|
||||
|
||||
if (source->eflags & MFE_VERTICALFLIP)
|
||||
th->flags2 |= MF2_OBJECTFLIP;
|
||||
|
||||
|
||||
@@ -378,6 +378,7 @@ typedef struct mobj_s
|
||||
fixed_t waterbottom; // bottom of the water FOF the mobj is in
|
||||
|
||||
UINT32 mobjnum; // A unique number for this mobj. Used for restoring pointers on save games.
|
||||
UINT32 localmobjnum; // A unique number for this mobj stored locally for association when restoring savestates
|
||||
|
||||
fixed_t scale;
|
||||
fixed_t old_scale; // interpolation
|
||||
@@ -411,6 +412,8 @@ typedef struct mobj_s
|
||||
boolean salty_jump;
|
||||
boolean init_salty;
|
||||
|
||||
boolean isculled; // Whether the mobj is being culled during simulations
|
||||
|
||||
// WARNING: New fields must be added separately to savegame and Lua.
|
||||
} mobj_t;
|
||||
|
||||
@@ -526,6 +529,9 @@ void P_SetScale(mobj_t *mobj, fixed_t newscale);
|
||||
void P_XYMovement(mobj_t *mo);
|
||||
void P_EmeraldManager(void);
|
||||
|
||||
extern INT32 modulothing;
|
||||
extern UINT32 globalmobjnum;
|
||||
|
||||
#define MAXHUNTEMERALDS 64
|
||||
extern mapthing_t *huntemeralds[MAXHUNTEMERALDS];
|
||||
extern INT32 numhuntemeralds;
|
||||
|
||||
+162
-167
@@ -142,16 +142,6 @@ FUNCINLINE static ATTRINLINE void Polyobj_vecSub2(vertex_t *dst, vertex_t *v1, v
|
||||
dst->y = v1->y - v2->y;
|
||||
}
|
||||
|
||||
// Add the polyobject's thinker to the thinker list
|
||||
// Unlike P_AddThinker, this adds it to the front of the list instead of the back, so that carrying physics can work right. -Red
|
||||
FUNCINLINE static ATTRINLINE void PolyObj_AddThinker(thinker_t *th)
|
||||
{
|
||||
thinkercap.next->prev = th;
|
||||
th->next = thinkercap.next;
|
||||
th->prev = &thinkercap;
|
||||
thinkercap.next = th;
|
||||
}
|
||||
|
||||
//
|
||||
// P_PointInsidePolyobj
|
||||
//
|
||||
@@ -1512,31 +1502,31 @@ void Polyobj_InitLevel(void)
|
||||
|
||||
// run down the thinker list, count the number of spawn points, and save
|
||||
// the mobj_t pointers on a queue for use below.
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 == (actionf_p1)P_MobjThinker)
|
||||
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
|
||||
mobj_t *mo = (mobj_t *)th;
|
||||
|
||||
if (mo->info->doomednum == POLYOBJ_SPAWN_DOOMEDNUM ||
|
||||
mo->info->doomednum == POLYOBJ_SPAWNCRUSH_DOOMEDNUM)
|
||||
{
|
||||
mobj_t *mo = (mobj_t *)th;
|
||||
++numPolyObjects;
|
||||
|
||||
if (mo->info->doomednum == POLYOBJ_SPAWN_DOOMEDNUM ||
|
||||
mo->info->doomednum == POLYOBJ_SPAWNCRUSH_DOOMEDNUM)
|
||||
{
|
||||
++numPolyObjects;
|
||||
qitem = malloc(sizeof(mobjqitem_t));
|
||||
memset(qitem, 0, sizeof(mobjqitem_t));
|
||||
qitem->mo = mo;
|
||||
M_QueueInsert(&(qitem->mqitem), &spawnqueue);
|
||||
}
|
||||
else if (mo->info->doomednum == POLYOBJ_ANCHOR_DOOMEDNUM)
|
||||
{
|
||||
++numAnchors;
|
||||
|
||||
qitem = malloc(sizeof(mobjqitem_t));
|
||||
memset(qitem, 0, sizeof(mobjqitem_t));
|
||||
qitem->mo = mo;
|
||||
M_QueueInsert(&(qitem->mqitem), &spawnqueue);
|
||||
}
|
||||
else if (mo->info->doomednum == POLYOBJ_ANCHOR_DOOMEDNUM)
|
||||
{
|
||||
++numAnchors;
|
||||
|
||||
qitem = malloc(sizeof(mobjqitem_t));
|
||||
memset(qitem, 0, sizeof(mobjqitem_t));
|
||||
qitem->mo = mo;
|
||||
M_QueueInsert(&(qitem->mqitem), &anchorqueue);
|
||||
}
|
||||
qitem = malloc(sizeof(mobjqitem_t));
|
||||
memset(qitem, 0, sizeof(mobjqitem_t));
|
||||
qitem->mo = mo;
|
||||
M_QueueInsert(&(qitem->mqitem), &anchorqueue);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1556,6 +1546,11 @@ void Polyobj_InitLevel(void)
|
||||
qitem = (mobjqitem_t *)M_QueueIterator(&spawnqueue);
|
||||
|
||||
Polyobj_spawnPolyObj(i, qitem->mo, qitem->mo->spawnpoint->angle);
|
||||
|
||||
PolyObjects[i].origx = qitem->mo->x;
|
||||
PolyObjects[i].origy = qitem->mo->y;
|
||||
PolyObjects[i].origz = qitem->mo->z;
|
||||
PolyObjects[i].origangle = qitem->mo->spawnpoint->angle;
|
||||
}
|
||||
|
||||
// move polyobjects to spawn points
|
||||
@@ -1647,7 +1642,7 @@ void T_PolyObjRotate(polyrotate_t *th)
|
||||
#else
|
||||
{
|
||||
CONS_Debug(DBG_POLYOBJ, "T_PolyObjRotate: thinker with invalid id %d removed.\n", th->polyObjNum);
|
||||
P_RemoveThinkerDelayed(&th->thinker);
|
||||
P_RemoveThinker(&th->thinker);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@@ -1732,7 +1727,7 @@ void T_PolyObjMove(polymove_t *th)
|
||||
#else
|
||||
{
|
||||
CONS_Debug(DBG_POLYOBJ, "T_PolyObjMove: thinker with invalid id %d removed.\n", th->polyObjNum);
|
||||
P_RemoveThinkerDelayed(&th->thinker);
|
||||
P_RemoveThinker(&th->thinker);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@@ -1805,7 +1800,7 @@ void T_PolyObjWaypoint(polywaypoint_t *th)
|
||||
#else
|
||||
{
|
||||
CONS_Debug(DBG_POLYOBJ, "T_PolyObjWaypoint: thinker with invalid id %d removed.", th->polyObjNum);
|
||||
P_RemoveThinkerDelayed(&th->thinker);
|
||||
P_RemoveThinker(&th->thinker);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@@ -1816,9 +1811,9 @@ void T_PolyObjWaypoint(polywaypoint_t *th)
|
||||
|
||||
// Find out target first.
|
||||
// We redo this each tic to make savegame compatibility easier.
|
||||
for (wp = thinkercap.next; wp != &thinkercap; wp = wp->next)
|
||||
for (wp = thlist[THINK_MOBJ].next; wp != &thlist[THINK_MOBJ]; wp = wp->next)
|
||||
{
|
||||
if (wp->function.acp1 != (actionf_p1)P_MobjThinker) // Not a mobj thinker
|
||||
if (wp->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)wp;
|
||||
@@ -1897,9 +1892,9 @@ void T_PolyObjWaypoint(polywaypoint_t *th)
|
||||
CONS_Debug(DBG_POLYOBJ, "Looking for next waypoint...\n");
|
||||
|
||||
// Find next waypoint
|
||||
for (wp = thinkercap.next; wp != &thinkercap; wp = wp->next)
|
||||
for (wp = thlist[THINK_MOBJ].next; wp != &thlist[THINK_MOBJ]; wp = wp->next)
|
||||
{
|
||||
if (wp->function.acp1 != (actionf_p1)P_MobjThinker) // Not a mobj thinker
|
||||
if (wp->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)wp;
|
||||
@@ -1907,8 +1902,85 @@ void T_PolyObjWaypoint(polywaypoint_t *th)
|
||||
if (mo2->type != MT_TUBEWAYPOINT)
|
||||
continue;
|
||||
|
||||
if (mo2->threshold == th->sequence)
|
||||
if (mo2->threshold != th->sequence)
|
||||
continue;
|
||||
|
||||
if (th->direction == -1)
|
||||
{
|
||||
if (mo2->health == target->health - 1)
|
||||
{
|
||||
waypoint = mo2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mo2->health == target->health + 1)
|
||||
{
|
||||
waypoint = mo2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!waypoint && th->wrap) // If specified, wrap waypoints
|
||||
{
|
||||
if (!th->continuous)
|
||||
{
|
||||
th->wrap = 0;
|
||||
th->stophere = true;
|
||||
}
|
||||
|
||||
for (wp = thlist[THINK_MOBJ].next; wp != &thlist[THINK_MOBJ]; wp = wp->next)
|
||||
{
|
||||
if (wp->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)wp;
|
||||
|
||||
if (mo2->type != MT_TUBEWAYPOINT)
|
||||
continue;
|
||||
|
||||
if (mo2->threshold != th->sequence)
|
||||
continue;
|
||||
|
||||
if (th->direction == -1)
|
||||
{
|
||||
if (waypoint == NULL)
|
||||
waypoint = mo2;
|
||||
else if (mo2->health > waypoint->health)
|
||||
waypoint = mo2;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mo2->health == 0)
|
||||
{
|
||||
waypoint = mo2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!waypoint && th->comeback) // Come back to the start
|
||||
{
|
||||
th->direction = -th->direction;
|
||||
|
||||
if (!th->continuous)
|
||||
th->comeback = false;
|
||||
|
||||
for (wp = thlist[THINK_MOBJ].next; wp != &thlist[THINK_MOBJ]; wp = wp->next)
|
||||
{
|
||||
if (wp->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)wp;
|
||||
|
||||
if (mo2->type != MT_TUBEWAYPOINT)
|
||||
continue;
|
||||
|
||||
if (mo2->threshold != th->sequence)
|
||||
continue;
|
||||
|
||||
if (th->direction == -1)
|
||||
{
|
||||
if (mo2->health == target->health - 1)
|
||||
@@ -1927,83 +1999,6 @@ void T_PolyObjWaypoint(polywaypoint_t *th)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!waypoint && th->wrap) // If specified, wrap waypoints
|
||||
{
|
||||
if (!th->continuous)
|
||||
{
|
||||
th->wrap = 0;
|
||||
th->stophere = true;
|
||||
}
|
||||
|
||||
for (wp = thinkercap.next; wp != &thinkercap; wp = wp->next)
|
||||
{
|
||||
if (wp->function.acp1 != (actionf_p1)P_MobjThinker) // Not a mobj thinker
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)wp;
|
||||
|
||||
if (mo2->type != MT_TUBEWAYPOINT)
|
||||
continue;
|
||||
|
||||
if (mo2->threshold == th->sequence)
|
||||
{
|
||||
if (th->direction == -1)
|
||||
{
|
||||
if (waypoint == NULL)
|
||||
waypoint = mo2;
|
||||
else if (mo2->health > waypoint->health)
|
||||
waypoint = mo2;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mo2->health == 0)
|
||||
{
|
||||
waypoint = mo2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!waypoint && th->comeback) // Come back to the start
|
||||
{
|
||||
th->direction = -th->direction;
|
||||
|
||||
if (!th->continuous)
|
||||
th->comeback = false;
|
||||
|
||||
for (wp = thinkercap.next; wp != &thinkercap; wp = wp->next)
|
||||
{
|
||||
if (wp->function.acp1 != (actionf_p1)P_MobjThinker) // Not a mobj thinker
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)wp;
|
||||
|
||||
if (mo2->type != MT_TUBEWAYPOINT)
|
||||
continue;
|
||||
|
||||
if (mo2->threshold == th->sequence)
|
||||
{
|
||||
if (th->direction == -1)
|
||||
{
|
||||
if (mo2->health == target->health - 1)
|
||||
{
|
||||
waypoint = mo2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mo2->health == target->health + 1)
|
||||
{
|
||||
waypoint = mo2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (waypoint)
|
||||
@@ -2079,7 +2074,7 @@ void T_PolyDoorSlide(polyslidedoor_t *th)
|
||||
#else
|
||||
{
|
||||
CONS_Debug(DBG_POLYOBJ, "T_PolyDoorSlide: thinker with invalid id %d removed.\n", th->polyObjNum);
|
||||
P_RemoveThinkerDelayed(&th->thinker);
|
||||
P_RemoveThinker(&th->thinker);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@@ -2184,7 +2179,7 @@ void T_PolyDoorSwing(polyswingdoor_t *th)
|
||||
#else
|
||||
{
|
||||
CONS_Debug(DBG_POLYOBJ, "T_PolyDoorSwing: thinker with invalid id %d removed.\n", th->polyObjNum);
|
||||
P_RemoveThinkerDelayed(&th->thinker);
|
||||
P_RemoveThinker(&th->thinker);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@@ -2282,8 +2277,8 @@ void T_PolyObjDisplace(polydisplace_t *th)
|
||||
I_Error("T_PolyDoorSwing: thinker has invalid id %d\n", th->polyObjNum);
|
||||
#else
|
||||
{
|
||||
CONS_Debug(DBG_POLYOBJ, "T_PolyDoorSwing: thinker with invalid id %d removed.\n", th->polyObjNum);
|
||||
P_RemoveThinkerDelayed(&th->thinker);
|
||||
CONS_Debug(DBG_POLYOBJ, "T_PolyObjDisplace: thinker with invalid id %d removed.\n", th->polyObjNum);
|
||||
P_RemoveThinker(&th->thinker);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@@ -2341,7 +2336,7 @@ INT32 EV_DoPolyObjRotate(polyrotdata_t *prdata)
|
||||
// create a new thinker
|
||||
th = Z_Malloc(sizeof(polyrotate_t), PU_LEVSPEC, NULL);
|
||||
th->thinker.function.acp1 = (actionf_p1)T_PolyObjRotate;
|
||||
PolyObj_AddThinker(&th->thinker);
|
||||
P_AddThinker(THINK_POLYOBJ, &th->thinker);
|
||||
po->thinker = &th->thinker;
|
||||
|
||||
// set fields
|
||||
@@ -2409,7 +2404,7 @@ INT32 EV_DoPolyObjMove(polymovedata_t *pmdata)
|
||||
// create a new thinker
|
||||
th = Z_Malloc(sizeof(polymove_t), PU_LEVSPEC, NULL);
|
||||
th->thinker.function.acp1 = (actionf_p1)T_PolyObjMove;
|
||||
PolyObj_AddThinker(&th->thinker);
|
||||
P_AddThinker(THINK_POLYOBJ, &th->thinker);
|
||||
po->thinker = &th->thinker;
|
||||
|
||||
// set fields
|
||||
@@ -2475,7 +2470,7 @@ INT32 EV_DoPolyObjWaypoint(polywaypointdata_t *pwdata)
|
||||
// create a new thinker
|
||||
th = Z_Malloc(sizeof(polywaypoint_t), PU_LEVSPEC, NULL);
|
||||
th->thinker.function.acp1 = (actionf_p1)T_PolyObjWaypoint;
|
||||
PolyObj_AddThinker(&th->thinker);
|
||||
P_AddThinker(THINK_POLYOBJ, &th->thinker);
|
||||
po->thinker = &th->thinker;
|
||||
|
||||
// set fields
|
||||
@@ -2493,9 +2488,9 @@ INT32 EV_DoPolyObjWaypoint(polywaypointdata_t *pwdata)
|
||||
th->stophere = false;
|
||||
|
||||
// Find the first waypoint we need to use
|
||||
for (wp = thinkercap.next; wp != &thinkercap; wp = wp->next)
|
||||
for (wp = thlist[THINK_MOBJ].next; wp != &thlist[THINK_MOBJ]; wp = wp->next)
|
||||
{
|
||||
if (wp->function.acp1 != (actionf_p1)P_MobjThinker) // Not a mobj thinker
|
||||
if (wp->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)wp;
|
||||
@@ -2503,31 +2498,31 @@ INT32 EV_DoPolyObjWaypoint(polywaypointdata_t *pwdata)
|
||||
if (mo2->type != MT_TUBEWAYPOINT)
|
||||
continue;
|
||||
|
||||
if (mo2->threshold == th->sequence)
|
||||
if (mo2->threshold != th->sequence)
|
||||
continue;
|
||||
|
||||
if (th->direction == -1) // highest waypoint #
|
||||
{
|
||||
if (th->direction == -1) // highest waypoint #
|
||||
if (mo2->health == 0)
|
||||
last = mo2;
|
||||
else
|
||||
{
|
||||
if (mo2->health == 0)
|
||||
last = mo2;
|
||||
else
|
||||
{
|
||||
if (first == NULL)
|
||||
first = mo2;
|
||||
else if (mo2->health > first->health)
|
||||
first = mo2;
|
||||
}
|
||||
}
|
||||
else // waypoint 0
|
||||
{
|
||||
if (mo2->health == 0)
|
||||
if (first == NULL)
|
||||
first = mo2;
|
||||
else
|
||||
{
|
||||
if (last == NULL)
|
||||
last = mo2;
|
||||
else if (mo2->health > last->health)
|
||||
last = mo2;
|
||||
}
|
||||
else if (mo2->health > first->health)
|
||||
first = mo2;
|
||||
}
|
||||
}
|
||||
else // waypoint 0
|
||||
{
|
||||
if (mo2->health == 0)
|
||||
first = mo2;
|
||||
else
|
||||
{
|
||||
if (last == NULL)
|
||||
last = mo2;
|
||||
else if (mo2->health > last->health)
|
||||
last = mo2;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2564,9 +2559,9 @@ INT32 EV_DoPolyObjWaypoint(polywaypointdata_t *pwdata)
|
||||
|
||||
// Find the actual target movement waypoint
|
||||
target = first;
|
||||
/*for (wp = thinkercap.next; wp != &thinkercap; wp = wp->next)
|
||||
/*for (wp = thlist[THINK_MOBJ].next; wp != &thlist[THINK_MOBJ]; wp = wp->next)
|
||||
{
|
||||
if (wp->function.acp1 != (actionf_p1)P_MobjThinker) // Not a mobj thinker
|
||||
if (wp->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)wp;
|
||||
@@ -2574,23 +2569,23 @@ INT32 EV_DoPolyObjWaypoint(polywaypointdata_t *pwdata)
|
||||
if (mo2->type != MT_TUBEWAYPOINT)
|
||||
continue;
|
||||
|
||||
if (mo2->threshold == th->sequence)
|
||||
if (mo2->threshold != th->sequence)
|
||||
continue;
|
||||
|
||||
if (th->direction == -1) // highest waypoint #
|
||||
{
|
||||
if (th->direction == -1) // highest waypoint #
|
||||
if (mo2->health == first->health - 1)
|
||||
{
|
||||
if (mo2->health == first->health - 1)
|
||||
{
|
||||
target = mo2;
|
||||
break;
|
||||
}
|
||||
target = mo2;
|
||||
break;
|
||||
}
|
||||
else // waypoint 0
|
||||
}
|
||||
else // waypoint 0
|
||||
{
|
||||
if (mo2->health == first->health + 1)
|
||||
{
|
||||
if (mo2->health == first->health + 1)
|
||||
{
|
||||
target = mo2;
|
||||
break;
|
||||
}
|
||||
target = mo2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
@@ -2641,7 +2636,7 @@ static void Polyobj_doSlideDoor(polyobj_t *po, polydoordata_t *doordata)
|
||||
// allocate and add a new slide door thinker
|
||||
th = Z_Malloc(sizeof(polyslidedoor_t), PU_LEVSPEC, NULL);
|
||||
th->thinker.function.acp1 = (actionf_p1)T_PolyDoorSlide;
|
||||
PolyObj_AddThinker(&th->thinker);
|
||||
P_AddThinker(THINK_POLYOBJ, &th->thinker);
|
||||
|
||||
// point the polyobject to this thinker
|
||||
po->thinker = &th->thinker;
|
||||
@@ -2692,7 +2687,7 @@ static void Polyobj_doSwingDoor(polyobj_t *po, polydoordata_t *doordata)
|
||||
// allocate and add a new swing door thinker
|
||||
th = Z_Malloc(sizeof(polyswingdoor_t), PU_LEVSPEC, NULL);
|
||||
th->thinker.function.acp1 = (actionf_p1)T_PolyDoorSwing;
|
||||
PolyObj_AddThinker(&th->thinker);
|
||||
P_AddThinker(THINK_POLYOBJ, &th->thinker);
|
||||
|
||||
// point the polyobject to this thinker
|
||||
po->thinker = &th->thinker;
|
||||
@@ -2777,7 +2772,7 @@ INT32 EV_DoPolyObjDisplace(polydisplacedata_t *prdata)
|
||||
// create a new thinker
|
||||
th = Z_Malloc(sizeof(polydisplace_t), PU_LEVSPEC, NULL);
|
||||
th->thinker.function.acp1 = (actionf_p1)T_PolyObjDisplace;
|
||||
PolyObj_AddThinker(&th->thinker);
|
||||
P_AddThinker(THINK_POLYOBJ, &th->thinker);
|
||||
po->thinker = &th->thinker;
|
||||
|
||||
// set fields
|
||||
@@ -2817,7 +2812,7 @@ void T_PolyObjFlag(polymove_t *th)
|
||||
#else
|
||||
{
|
||||
CONS_Debug(DBG_POLYOBJ, "T_PolyObjFlag: thinker with invalid id %d removed.\n", th->polyObjNum);
|
||||
P_RemoveThinkerDelayed(&th->thinker);
|
||||
P_RemoveThinker(&th->thinker);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@@ -2881,7 +2876,7 @@ INT32 EV_DoPolyObjFlag(line_t *pfdata)
|
||||
// create a new thinker
|
||||
th = Z_Malloc(sizeof(polymove_t), PU_LEVSPEC, NULL);
|
||||
th->thinker.function.acp1 = (actionf_p1)T_PolyObjFlag;
|
||||
PolyObj_AddThinker(&th->thinker);
|
||||
P_AddThinker(THINK_POLYOBJ, &th->thinker);
|
||||
po->thinker = &th->thinker;
|
||||
|
||||
// set fields
|
||||
|
||||
@@ -103,6 +103,10 @@ typedef struct polyobj_s
|
||||
|
||||
// these are saved for netgames, so do not let Lua touch these!
|
||||
INT32 spawnflags; // Flags the polyobject originally spawned with
|
||||
INT32 spawntrans; // Translucency the polyobject originally spawned with
|
||||
|
||||
fixed_t origx, origy, origz;
|
||||
INT16 origangle;
|
||||
} polyobj_t;
|
||||
|
||||
//
|
||||
|
||||
+1544
-419
File diff suppressed because it is too large.
Load diff
+18
-10
@@ -18,16 +18,6 @@
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
// Persistent storage/archiving.
|
||||
// These are the load / save game routines.
|
||||
|
||||
void P_SaveGame(void);
|
||||
void P_SaveNetGame(void);
|
||||
boolean P_LoadGame(INT16 mapoverride);
|
||||
boolean P_LoadNetGame(void);
|
||||
|
||||
mobj_t *P_FindNewPosition(UINT32 oldposition);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
UINT8 skincolor;
|
||||
@@ -40,6 +30,24 @@ typedef struct
|
||||
UINT16 emeralds;
|
||||
} savedata_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
UINT8* buffer;
|
||||
} savestate_t;
|
||||
|
||||
// Persistent storage/archiving.
|
||||
// These are the load / save game routines.
|
||||
|
||||
void P_SaveGame(void);
|
||||
void P_SaveNetGame(void);
|
||||
void P_SaveGameState(savestate_t* savestate);
|
||||
boolean P_LoadGame(INT16 mapoverride);
|
||||
boolean P_LoadNetGame(boolean preserveLevel);
|
||||
boolean P_LoadGameState(const savestate_t* savestate);
|
||||
void P_GameStateFreeMemory(savestate_t* savestate);
|
||||
|
||||
mobj_t *P_FindNewPosition(UINT32 oldposition);
|
||||
|
||||
extern savedata_t savedata;
|
||||
extern UINT8 *save_p;
|
||||
|
||||
|
||||
+16
-140
@@ -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
|
||||
@@ -834,10 +825,10 @@ void P_ReloadRings(void)
|
||||
mapthing_t *hoopsToRespawn[4096];
|
||||
mapthing_t *mt = mapthings;
|
||||
|
||||
// scan the thinkers to find rings/wings/hoops to unset
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
// scan the thinkers to find rings/spheres/hoops to unset
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
|
||||
mo = (mobj_t *)th;
|
||||
@@ -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
|
||||
@@ -2444,18 +2391,13 @@ static void P_LevelInitStuff(void)
|
||||
void P_LoadThingsOnly(void)
|
||||
{
|
||||
// Search through all the thinkers.
|
||||
mobj_t *mo;
|
||||
thinker_t *think;
|
||||
|
||||
for (think = thinkercap.next; think != &thinkercap; think = think->next)
|
||||
for (think = thlist[THINK_MOBJ].next; think != &thlist[THINK_MOBJ]; think = think->next)
|
||||
{
|
||||
if (think->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue; // not a mobj thinker
|
||||
|
||||
mo = (mobj_t *)think;
|
||||
|
||||
if (mo)
|
||||
P_RemoveMobj(mo);
|
||||
if (think->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
P_RemoveMobj((mobj_t *)think);
|
||||
}
|
||||
|
||||
P_LevelInitStuff();
|
||||
@@ -2697,47 +2639,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))
|
||||
@@ -2808,6 +2709,11 @@ static boolean P_CanSave(void)
|
||||
*/
|
||||
boolean P_SetupLevel(boolean skipprecip)
|
||||
{
|
||||
if (issimulation)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// use gamemap to get map number.
|
||||
// 99% of the things already did, so.
|
||||
// Map header should always be in place at this point
|
||||
@@ -2826,6 +2732,10 @@ boolean P_SetupLevel(boolean skipprecip)
|
||||
CON_Drawer(); // let the user know what we are going to do
|
||||
I_FinishUpdate(); // page flip or blit buffer
|
||||
|
||||
// Reset the palette
|
||||
if (rendermode != render_none)
|
||||
V_SetPaletteLump("PLAYPAL");
|
||||
|
||||
// Initialize sector node list.
|
||||
P_Initsecnode();
|
||||
|
||||
@@ -2983,9 +2893,7 @@ boolean P_SetupLevel(boolean skipprecip)
|
||||
I_UpdateNoVsync();
|
||||
}*/
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
LUA_InvalidateLevel();
|
||||
#endif
|
||||
|
||||
for (ss = sectors; sectors+numsectors != ss; ss++)
|
||||
{
|
||||
@@ -3400,9 +3308,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 +3320,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 +3584,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
|
||||
@@ -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
@@ -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
|
||||
+68
-70
@@ -1589,7 +1589,7 @@ static void P_AddExecutorDelay(line_t *line, mobj_t *mobj, sector_t *sector)
|
||||
e->sector = sector;
|
||||
e->timer = (line->backsector->ceilingheight>>FRACBITS)+(line->backsector->floorheight>>FRACBITS);
|
||||
P_SetTarget(&e->caller, mobj); // Use P_SetTarget to make sure the mobj doesn't get freed while we're delaying.
|
||||
P_AddThinker(&e->thinker);
|
||||
P_AddThinker(THINK_MAIN, &e->thinker);
|
||||
}
|
||||
|
||||
/** Used by P_LinedefExecute to check a trigger linedef's conditions
|
||||
@@ -2055,7 +2055,7 @@ void P_SwitchWeather(INT32 weathernum)
|
||||
thinker_t *think;
|
||||
precipmobj_t *precipmobj;
|
||||
|
||||
for (think = thinkercap.next; think != &thinkercap; think = think->next)
|
||||
for (think = thlist[THINK_PRECIP].next; think != &thlist[THINK_PRECIP]; think = think->next)
|
||||
{
|
||||
if (think->function.acp1 != (actionf_p1)P_NullPrecipThinker)
|
||||
continue; // not a precipmobj thinker
|
||||
@@ -2071,7 +2071,7 @@ void P_SwitchWeather(INT32 weathernum)
|
||||
precipmobj_t *precipmobj;
|
||||
state_t *st;
|
||||
|
||||
for (think = thinkercap.next; think != &thinkercap; think = think->next)
|
||||
for (think = thlist[THINK_PRECIP].next; think != &thlist[THINK_PRECIP]; think = think->next)
|
||||
{
|
||||
if (think->function.acp1 != (actionf_p1)P_NullPrecipThinker)
|
||||
continue; // not a precipmobj thinker
|
||||
@@ -2936,7 +2936,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
|
||||
scroll_t *scroller;
|
||||
thinker_t *th;
|
||||
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MAIN].next; th != &thlist[THINK_MAIN]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)T_Scroll)
|
||||
continue;
|
||||
@@ -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
|
||||
@@ -3273,10 +3269,10 @@ void P_SetupSignExit(player_t *player)
|
||||
|
||||
// didn't find any signposts in the exit sector.
|
||||
// spin all signposts in the level then.
|
||||
for (think = thinkercap.next; think != &thinkercap; think = think->next)
|
||||
for (think = thlist[THINK_MOBJ].next; think != &thlist[THINK_MOBJ]; think = think->next)
|
||||
{
|
||||
if (think->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue; // not a mobj thinker
|
||||
if (think->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
|
||||
thing = (mobj_t *)think;
|
||||
if (thing->type != MT_SIGN)
|
||||
@@ -3320,23 +3316,18 @@ boolean P_IsFlagAtBase(mobjtype_t flag)
|
||||
{
|
||||
thinker_t *think;
|
||||
mobj_t *mo;
|
||||
INT32 specialnum = 0;
|
||||
INT32 specialnum = (flag == MT_REDFLAG) ? 3 : 4;
|
||||
|
||||
for (think = thinkercap.next; think != &thinkercap; think = think->next)
|
||||
for (think = thlist[THINK_MOBJ].next; think != &thlist[THINK_MOBJ]; think = think->next)
|
||||
{
|
||||
if (think->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue; // not a mobj thinker
|
||||
if (think->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
|
||||
mo = (mobj_t *)think;
|
||||
|
||||
if (mo->type != flag)
|
||||
continue;
|
||||
|
||||
if (mo->type == MT_REDFLAG)
|
||||
specialnum = 3;
|
||||
else if (mo->type == MT_BLUEFLAG)
|
||||
specialnum = 4;
|
||||
|
||||
if (GETSECSPECIAL(mo->subsector->sector->special, 4) == specialnum)
|
||||
return true;
|
||||
else if (mo->subsector->sector->ffloors) // Check the 3D floors
|
||||
@@ -3351,9 +3342,11 @@ boolean P_IsFlagAtBase(mobjtype_t flag)
|
||||
if (GETSECSPECIAL(rover->master->frontsector->special, 4) != specialnum)
|
||||
continue;
|
||||
|
||||
if (mo->z <= P_GetSpecialTopZ(mo, sectors + rover->secnum, mo->subsector->sector)
|
||||
&& mo->z >= P_GetSpecialBottomZ(mo, sectors + rover->secnum, mo->subsector->sector))
|
||||
return true;
|
||||
if (!(mo->z <= P_GetSpecialTopZ(mo, sectors + rover->secnum, mo->subsector->sector)
|
||||
&& mo->z >= P_GetSpecialBottomZ(mo, sectors + rover->secnum, mo->subsector->sector)))
|
||||
continue;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3763,14 +3756,14 @@ void P_ProcessSpecialSector(player_t *player, sector_t *sector, sector_t *rovers
|
||||
|
||||
// Find the center of the Eggtrap and release all the pretty animals!
|
||||
// The chimps are my friends.. heeheeheheehehee..... - LouisJM
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
if (mo2->type == MT_EGGTRAP)
|
||||
P_KillMobj(mo2, NULL, player->mo);
|
||||
if (mo2->type != MT_EGGTRAP)
|
||||
continue;
|
||||
P_KillMobj(mo2, NULL, player->mo);
|
||||
}
|
||||
|
||||
// clear the special so you can't push the button twice.
|
||||
@@ -4104,19 +4097,22 @@ DoneSection2:
|
||||
|
||||
// scan the thinkers
|
||||
// to find the first waypoint
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
|
||||
if (mo2->type == MT_TUBEWAYPOINT && mo2->threshold == sequence
|
||||
&& mo2->health == 0)
|
||||
{
|
||||
waypoint = mo2;
|
||||
break;
|
||||
}
|
||||
if (mo2->type != MT_TUBEWAYPOINT)
|
||||
continue;
|
||||
if (mo2->threshold != sequence)
|
||||
continue;
|
||||
if (mo2->health != 0)
|
||||
continue;
|
||||
|
||||
waypoint = mo2;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!waypoint)
|
||||
@@ -4180,20 +4176,22 @@ DoneSection2:
|
||||
|
||||
// scan the thinkers
|
||||
// to find the last waypoint
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
|
||||
if (mo2->type == MT_TUBEWAYPOINT && mo2->threshold == sequence)
|
||||
{
|
||||
if (!waypoint)
|
||||
waypoint = mo2;
|
||||
else if (mo2->health > waypoint->health)
|
||||
waypoint = mo2;
|
||||
}
|
||||
if (mo2->type != MT_TUBEWAYPOINT)
|
||||
continue;
|
||||
if (mo2->threshold != sequence)
|
||||
continue;
|
||||
|
||||
if (!waypoint)
|
||||
waypoint = mo2;
|
||||
else if (mo2->health > waypoint->health)
|
||||
waypoint = mo2;
|
||||
}
|
||||
|
||||
if (!waypoint)
|
||||
@@ -4400,9 +4398,9 @@ DoneSection2:
|
||||
|
||||
// scan the thinkers
|
||||
// to find the first waypoint
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
@@ -4438,9 +4436,9 @@ DoneSection2:
|
||||
}
|
||||
|
||||
// Find waypoint before this one (waypointlow)
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
@@ -4465,9 +4463,9 @@ DoneSection2:
|
||||
}
|
||||
|
||||
// Find waypoint after this one (waypointhigh)
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
@@ -5156,7 +5154,7 @@ static ffloor_t *P_AddFakeFloor(sector_t *sec, sector_t *sec2, line_t *master, f
|
||||
|
||||
// Just initialise both of these to placate the compiler.
|
||||
i = 0;
|
||||
th = thinkercap.next;
|
||||
th = thlist[THINK_MAIN].next;
|
||||
|
||||
for(;;)
|
||||
{
|
||||
@@ -5166,7 +5164,7 @@ static ffloor_t *P_AddFakeFloor(sector_t *sec, sector_t *sec2, line_t *master, f
|
||||
th = secthinkers[sec2num].thinkers[i];
|
||||
else break;
|
||||
}
|
||||
else if (th == &thinkercap)
|
||||
else if (th == &thlist[THINK_MAIN])
|
||||
break;
|
||||
|
||||
// Should this FOF have spikeness?
|
||||
@@ -5255,7 +5253,7 @@ static void P_AddSpikeThinker(sector_t *sec, INT32 referrer)
|
||||
|
||||
// create and initialize new thinker
|
||||
spikes = Z_Calloc(sizeof (*spikes), PU_LEVSPEC, NULL);
|
||||
P_AddThinker(&spikes->thinker);
|
||||
P_AddThinker(THINK_MAIN, &spikes->thinker);
|
||||
|
||||
spikes->thinker.function.acp1 = (actionf_p1)T_SpikeSector;
|
||||
|
||||
@@ -5277,7 +5275,7 @@ static void P_AddFloatThinker(sector_t *sec, INT32 tag, line_t *sourceline)
|
||||
|
||||
// create and initialize new thinker
|
||||
floater = Z_Calloc(sizeof (*floater), PU_LEVSPEC, NULL);
|
||||
P_AddThinker(&floater->thinker);
|
||||
P_AddThinker(THINK_MAIN, &floater->thinker);
|
||||
|
||||
floater->thinker.function.acp1 = (actionf_p1)T_FloatSector;
|
||||
|
||||
@@ -5305,7 +5303,7 @@ static inline void P_AddBridgeThinker(line_t *sourceline, sector_t *sec)
|
||||
|
||||
// create an initialize new thinker
|
||||
bridge = Z_Calloc(sizeof (*bridge), PU_LEVSPEC, NULL);
|
||||
P_AddThinker(&bridge->thinker);
|
||||
P_AddThinker(THINK_MAIN, &bridge->thinker);
|
||||
|
||||
bridge->thinker.function.acp1 = (actionf_p1)T_BridgeThinker;
|
||||
|
||||
@@ -5342,7 +5340,7 @@ static void P_AddBlockThinker(sector_t *sec, line_t *sourceline)
|
||||
|
||||
// create and initialize new elevator thinker
|
||||
block = Z_Calloc(sizeof (*block), PU_LEVSPEC, NULL);
|
||||
P_AddThinker(&block->thinker);
|
||||
P_AddThinker(THINK_MAIN, &block->thinker);
|
||||
|
||||
block->thinker.function.acp1 = (actionf_p1)T_MarioBlockChecker;
|
||||
block->sourceline = sourceline;
|
||||
@@ -5371,7 +5369,7 @@ static void P_AddRaiseThinker(sector_t *sec, line_t *sourceline)
|
||||
levelspecthink_t *raise;
|
||||
|
||||
raise = Z_Calloc(sizeof (*raise), PU_LEVSPEC, NULL);
|
||||
P_AddThinker(&raise->thinker);
|
||||
P_AddThinker(THINK_MAIN, &raise->thinker);
|
||||
|
||||
raise->thinker.function.acp1 = (actionf_p1)T_RaiseSector;
|
||||
|
||||
@@ -5414,7 +5412,7 @@ static void P_AddOldAirbob(sector_t *sec, line_t *sourceline, boolean noadjust)
|
||||
levelspecthink_t *airbob;
|
||||
|
||||
airbob = Z_Calloc(sizeof (*airbob), PU_LEVSPEC, NULL);
|
||||
P_AddThinker(&airbob->thinker);
|
||||
P_AddThinker(THINK_MAIN, &airbob->thinker);
|
||||
|
||||
airbob->thinker.function.acp1 = (actionf_p1)T_RaiseSector;
|
||||
|
||||
@@ -5479,7 +5477,7 @@ static inline void P_AddThwompThinker(sector_t *sec, sector_t *actionsector, lin
|
||||
|
||||
// create and initialize new elevator thinker
|
||||
thwomp = Z_Calloc(sizeof (*thwomp), PU_LEVSPEC, NULL);
|
||||
P_AddThinker(&thwomp->thinker);
|
||||
P_AddThinker(THINK_MAIN, &thwomp->thinker);
|
||||
|
||||
thwomp->thinker.function.acp1 = (actionf_p1)T_ThwompSector;
|
||||
|
||||
@@ -5520,7 +5518,7 @@ static inline void P_AddNoEnemiesThinker(sector_t *sec, line_t *sourceline)
|
||||
|
||||
// create and initialize new thinker
|
||||
nobaddies = Z_Calloc(sizeof (*nobaddies), PU_LEVSPEC, NULL);
|
||||
P_AddThinker(&nobaddies->thinker);
|
||||
P_AddThinker(THINK_MAIN, &nobaddies->thinker);
|
||||
|
||||
nobaddies->thinker.function.acp1 = (actionf_p1)T_NoEnemiesSector;
|
||||
|
||||
@@ -5542,7 +5540,7 @@ static inline void P_AddEachTimeThinker(sector_t *sec, line_t *sourceline)
|
||||
|
||||
// create and initialize new thinker
|
||||
eachtime = Z_Calloc(sizeof (*eachtime), PU_LEVSPEC, NULL);
|
||||
P_AddThinker(&eachtime->thinker);
|
||||
P_AddThinker(THINK_MAIN, &eachtime->thinker);
|
||||
|
||||
eachtime->thinker.function.acp1 = (actionf_p1)T_EachTimeThinker;
|
||||
|
||||
@@ -5564,7 +5562,7 @@ static inline void P_AddCameraScanner(sector_t *sourcesec, sector_t *actionsecto
|
||||
|
||||
// create and initialize new elevator thinker
|
||||
elevator = Z_Calloc(sizeof (*elevator), PU_LEVSPEC, NULL);
|
||||
P_AddThinker(&elevator->thinker);
|
||||
P_AddThinker(THINK_MAIN, &elevator->thinker);
|
||||
|
||||
elevator->thinker.function.acp1 = (actionf_p1)T_CameraScanner;
|
||||
elevator->type = elevateBounce;
|
||||
@@ -5654,7 +5652,7 @@ static inline void EV_AddLaserThinker(sector_t *sec, sector_t *sec2, line_t *lin
|
||||
|
||||
flash = Z_Calloc(sizeof (*flash), PU_LEVSPEC, NULL);
|
||||
|
||||
P_AddThinker(&flash->thinker);
|
||||
P_AddThinker(THINK_MAIN, &flash->thinker);
|
||||
|
||||
flash->thinker.function.acp1 = (actionf_p1)T_LaserFlash;
|
||||
flash->ffloor = ffloor;
|
||||
@@ -5783,7 +5781,7 @@ void P_SpawnSpecials(INT32 fromnetsave)
|
||||
secthinkers = Z_Calloc(numsectors * sizeof(thinkerlist_t), PU_STATIC, NULL);
|
||||
|
||||
// Firstly, find out how many there are in each sector
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MAIN].next; th != &thlist[THINK_MAIN]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 == (actionf_p1)T_SpikeSector)
|
||||
secthinkers[((levelspecthink_t *)th)->sector - sectors].count++;
|
||||
@@ -5803,7 +5801,7 @@ void P_SpawnSpecials(INT32 fromnetsave)
|
||||
}
|
||||
|
||||
// Finally, populate the lists.
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MAIN].next; th != &thlist[THINK_MAIN]; th = th->next)
|
||||
{
|
||||
size_t secnum = (size_t)-1;
|
||||
|
||||
@@ -7062,7 +7060,7 @@ static void Add_Scroller(INT32 type, fixed_t dx, fixed_t dy, INT32 control, INT3
|
||||
if ((s->control = control) != -1)
|
||||
s->last_height = sectors[control].floorheight + sectors[control].ceilingheight;
|
||||
s->affectee = affectee;
|
||||
P_AddThinker(&s->thinker);
|
||||
P_AddThinker(THINK_MAIN, &s->thinker);
|
||||
|
||||
// interpolation
|
||||
switch (type)
|
||||
@@ -7237,7 +7235,7 @@ static void Add_MasterDisappearer(tic_t appeartime, tic_t disappeartime, tic_t o
|
||||
d->exists = true;
|
||||
d->timer = 1;
|
||||
|
||||
P_AddThinker(&d->thinker);
|
||||
P_AddThinker(THINK_MAIN, &d->thinker);
|
||||
}
|
||||
|
||||
/** Makes a FOF appear/disappear
|
||||
@@ -7329,7 +7327,7 @@ static void Add_Friction(INT32 friction, INT32 movefactor, INT32 affectee, INT32
|
||||
else
|
||||
f->roverfriction = false;
|
||||
|
||||
P_AddThinker(&f->thinker);
|
||||
P_AddThinker(THINK_MAIN, &f->thinker);
|
||||
}
|
||||
|
||||
/** Applies friction to all things in a sector.
|
||||
@@ -7517,7 +7515,7 @@ static void Add_Pusher(pushertype_e type, fixed_t x_mag, fixed_t y_mag, mobj_t *
|
||||
p->z = p->source->z;
|
||||
}
|
||||
p->affectee = affectee;
|
||||
P_AddThinker(&p->thinker);
|
||||
P_AddThinker(THINK_MAIN, &p->thinker);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+74
-63
@@ -42,8 +42,8 @@ tic_t leveltime;
|
||||
// but the first element must be thinker_t.
|
||||
//
|
||||
|
||||
// Both the head and tail of the thinker list.
|
||||
thinker_t thinkercap;
|
||||
// The entries will behave like both the head and tail of the lists.
|
||||
thinker_t thlist[NUM_THINKERLISTS];
|
||||
|
||||
void Command_Numthinkers_f(void)
|
||||
{
|
||||
@@ -51,6 +51,9 @@ void Command_Numthinkers_f(void)
|
||||
INT32 count = 0;
|
||||
actionf_p1 action;
|
||||
thinker_t *think;
|
||||
thinklistnum_t start = 0;
|
||||
thinklistnum_t end = NUM_THINKERLISTS - 1;
|
||||
thinklistnum_t i;
|
||||
|
||||
if (gamestate != GS_LEVEL)
|
||||
{
|
||||
@@ -77,6 +80,7 @@ void Command_Numthinkers_f(void)
|
||||
switch (num)
|
||||
{
|
||||
case 1:
|
||||
start = end = THINK_MOBJ;
|
||||
action = (actionf_p1)P_MobjThinker;
|
||||
CONS_Printf(M_GetText("Number of %s: "), "P_MobjThinker");
|
||||
break;
|
||||
@@ -89,14 +93,17 @@ void Command_Numthinkers_f(void)
|
||||
CONS_Printf(M_GetText("Number of %s: "), "P_SnowThinker");
|
||||
break;*/
|
||||
case 2:
|
||||
start = end = THINK_PRECIP;
|
||||
action = (actionf_p1)P_NullPrecipThinker;
|
||||
CONS_Printf(M_GetText("Number of %s: "), "P_NullPrecipThinker");
|
||||
break;
|
||||
case 3:
|
||||
start = end = THINK_MAIN;
|
||||
action = (actionf_p1)T_Friction;
|
||||
CONS_Printf(M_GetText("Number of %s: "), "T_Friction");
|
||||
break;
|
||||
case 4:
|
||||
start = end = THINK_MAIN;
|
||||
action = (actionf_p1)T_Pusher;
|
||||
CONS_Printf(M_GetText("Number of %s: "), "T_Pusher");
|
||||
break;
|
||||
@@ -109,12 +116,15 @@ void Command_Numthinkers_f(void)
|
||||
return;
|
||||
}
|
||||
|
||||
for (think = thinkercap.next; think != &thinkercap; think = think->next)
|
||||
for (i = start; i <= end; i++)
|
||||
{
|
||||
if (think->function.acp1 != action)
|
||||
continue;
|
||||
for (think = thlist[i].next; think != &thlist[i]; think = think->next)
|
||||
{
|
||||
if (think->function.acp1 != action)
|
||||
continue;
|
||||
|
||||
count++;
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
CONS_Printf("%d\n", count);
|
||||
@@ -146,9 +156,9 @@ void Command_CountMobjs_f(void)
|
||||
|
||||
count = 0;
|
||||
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
|
||||
if (((mobj_t *)th)->type == i)
|
||||
@@ -166,9 +176,9 @@ void Command_CountMobjs_f(void)
|
||||
{
|
||||
count = 0;
|
||||
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
|
||||
if (((mobj_t *)th)->type == i)
|
||||
@@ -185,20 +195,24 @@ void Command_CountMobjs_f(void)
|
||||
//
|
||||
void P_InitThinkers(void)
|
||||
{
|
||||
thinkercap.prev = thinkercap.next = &thinkercap;
|
||||
waypointcap = NULL;
|
||||
UINT8 i;
|
||||
for (i = 0; i < NUM_THINKERLISTS; i++)
|
||||
thlist[i].prev = thlist[i].next = &thlist[i];
|
||||
|
||||
waypointcap = NULL; //Hack transplant
|
||||
}
|
||||
|
||||
//
|
||||
// P_AddThinker
|
||||
// Adds a new thinker at the end of the list.
|
||||
//
|
||||
void P_AddThinker(thinker_t *thinker)
|
||||
void P_AddThinker(const thinklistnum_t n, thinker_t *thinker)
|
||||
{
|
||||
thinkercap.prev->next = thinker;
|
||||
thinker->next = &thinkercap;
|
||||
thinker->prev = thinkercap.prev;
|
||||
thinkercap.prev = thinker;
|
||||
#ifdef PARANOIA
|
||||
I_Assert(n >= 0 && n < NUM_THINKERLISTS);
|
||||
#endif
|
||||
|
||||
thlist[n].prev->next = thinker;
|
||||
thinker->next = &thlist[n];
|
||||
thinker->prev = thlist[n].prev;
|
||||
thlist[n].prev = thinker;
|
||||
|
||||
thinker->references = 0; // killough 11/98: init reference counter to 0
|
||||
}
|
||||
@@ -221,25 +235,38 @@ static thinker_t *currentthinker;
|
||||
// remove it, and set currentthinker to one node preceeding it, so
|
||||
// that the next step in P_RunThinkers() will get its successor.
|
||||
//
|
||||
void P_RemoveThinkerDelayed(void *pthinker)
|
||||
void P_RemoveThinkerDelayed(thinker_t *thinker)
|
||||
{
|
||||
thinker_t *thinker = pthinker;
|
||||
if (!thinker->references)
|
||||
thinker_t *next;
|
||||
#ifdef PARANOIA
|
||||
#define BEENAROUNDBIT (0x40000000) // has to be sufficiently high that it's unlikely to happen in regular gameplay. If you change this, pay attention to the bit pattern of INT32_MIN.
|
||||
if (thinker->references & ~BEENAROUNDBIT)
|
||||
{
|
||||
{
|
||||
/* Remove from main thinker list */
|
||||
thinker_t *next = thinker->next;
|
||||
/* Note that currentthinker is guaranteed to point to us,
|
||||
* and since we're freeing our memory, we had better change that. So
|
||||
* point it to thinker->prev, so the iterator will correctly move on to
|
||||
* thinker->prev->next = thinker->next */
|
||||
(next->prev = currentthinker = thinker->prev)->next = next;
|
||||
}
|
||||
R_DestroyLevelInterpolators(thinker);
|
||||
Z_Free(thinker);
|
||||
if (thinker->references & BEENAROUNDBIT) // Usually gets cleared up in one frame; what's going on here, then?
|
||||
CONS_Printf("Number of potentially faulty references: %d\n", (thinker->references & ~BEENAROUNDBIT));
|
||||
thinker->references |= BEENAROUNDBIT;
|
||||
return;
|
||||
}
|
||||
#undef BEENAROUNDBIT
|
||||
#else
|
||||
if (thinker->references)
|
||||
return;
|
||||
#endif
|
||||
|
||||
/* Remove from main thinker list */
|
||||
next = thinker->next;
|
||||
/* Note that currentthinker is guaranteed to point to us,
|
||||
* and since we're freeing our memory, we had better change that. So
|
||||
* point it to thinker->prev, so the iterator will correctly move on to
|
||||
* thinker->prev->next = thinker->next */
|
||||
(next->prev = currentthinker = thinker->prev)->next = next;
|
||||
|
||||
R_DestroyLevelInterpolators(thinker);
|
||||
|
||||
Z_Free(thinker);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// P_RemoveThinker
|
||||
//
|
||||
@@ -254,10 +281,8 @@ void P_RemoveThinkerDelayed(void *pthinker)
|
||||
//
|
||||
void P_RemoveThinker(thinker_t *thinker)
|
||||
{
|
||||
#ifdef HAVE_BLUA
|
||||
LUA_InvalidateUserdata(thinker);
|
||||
#endif
|
||||
thinker->function.acp1 = P_RemoveThinkerDelayed;
|
||||
thinker->function.acp1 = (actionf_p1)P_RemoveThinkerDelayed;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -305,11 +330,21 @@ if ((*mop = targ) != NULL) // Set new target and if non-NULL, increase its count
|
||||
//
|
||||
static inline void P_RunThinkers(void)
|
||||
{
|
||||
for (currentthinker = thinkercap.next; currentthinker != &thinkercap; currentthinker = currentthinker->next)
|
||||
size_t i;
|
||||
for (i = 0; i < NUM_THINKERLISTS; i++)
|
||||
{
|
||||
if (currentthinker->function.acp1)
|
||||
for (currentthinker = thlist[i].next; currentthinker != &thlist[i]; currentthinker = currentthinker->next)
|
||||
{
|
||||
#ifdef PARANOIA
|
||||
I_Assert(currentthinker->function.acp1 != NULL);
|
||||
#endif
|
||||
if (currentthinker->function.acp1 == (actionf_p1)P_MobjThinker && issimulation && ((mobj_t*)currentthinker)->isculled)
|
||||
continue; // apply distance culling
|
||||
|
||||
currentthinker->function.acp1(currentthinker);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
@@ -661,13 +696,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 +711,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 +722,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 +849,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 +911,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 +936,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();
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ void Command_CountMobjs_f(void);
|
||||
void P_Ticker(boolean run);
|
||||
void P_PreTicker(INT32 frames);
|
||||
void P_DoTeamscrambling(void);
|
||||
void P_RemoveThinkerDelayed(void *pthinker); //killed
|
||||
void P_RemoveThinkerDelayed(thinker_t *thinker); //killed
|
||||
mobj_t *P_SetTarget(mobj_t **mo, mobj_t *target); // killough 11/98
|
||||
|
||||
#endif
|
||||
+106
-4063
File diff suppressed because it is too large.
Load diff
+2
-2
@@ -1673,8 +1673,8 @@ void R_PrecacheLevel(void)
|
||||
spritepresent = calloc(numsprites, sizeof (*spritepresent));
|
||||
if (spritepresent == NULL) I_Error("%s: Out of memory looking up sprites", "R_PrecacheLevel");
|
||||
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
if (th->function.acp1 == (actionf_p1)P_MobjThinker)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
if (th->function.acp1 != (actionf_p1)P_RemoveThinkerDelayed)
|
||||
spritepresent[((mobj_t *)th)->sprite] = 1;
|
||||
|
||||
spritememory = 0;
|
||||
|
||||
@@ -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
|
||||
|
||||
+10
-7
@@ -23,6 +23,9 @@
|
||||
#include "r_state.h"
|
||||
#include "z_zone.h"
|
||||
#include "console.h" // con_startup_loadprogress
|
||||
#ifdef HWRENDER
|
||||
#include "hardware/hw_main.h" // for cv_grshearing
|
||||
#endif
|
||||
|
||||
static CV_PossibleValue_t fpscap_cons_t[] = {
|
||||
#ifdef DEVELOP
|
||||
@@ -117,14 +120,15 @@ static vector3_t *R_LerpVector3(const vector3_t *from, const vector3_t *to, fixe
|
||||
// recalc necessary stuff for mouseaiming
|
||||
// slopes are already calculated for the full possible view (which is 4*viewheight).
|
||||
// 18/08/18: (No it's actually 16*viewheight, thanks Jimita for finding this out)
|
||||
static void R_SetupFreelook(player_t *player, boolean skybox)
|
||||
static void R_SetupFreelook(void)
|
||||
{
|
||||
(void)player;
|
||||
(void)skybox;
|
||||
|
||||
// clip it in the case we are looking a hardware 90 degrees full aiming
|
||||
// (lmps, network and use F12...)
|
||||
if (rendermode == render_soft)
|
||||
if (rendermode == render_soft
|
||||
#ifdef HWRENDER
|
||||
|| cv_grshearing.value
|
||||
#endif
|
||||
)
|
||||
{
|
||||
G_SoftwareClipAimingPitch((INT32 *)&aimingangle);
|
||||
}
|
||||
@@ -145,7 +149,6 @@ static void R_SetupFreelook(player_t *player, boolean skybox)
|
||||
void R_InterpolateView(fixed_t frac)
|
||||
{
|
||||
viewvars_t* prevview = oldview;
|
||||
boolean skybox = 0;
|
||||
UINT8 i;
|
||||
|
||||
if (FIXED_TO_FLOAT(frac) < 0)
|
||||
@@ -183,7 +186,7 @@ void R_InterpolateView(fixed_t frac)
|
||||
viewplayer = newview->player;
|
||||
viewsector = R_PointInSubsector(viewx, viewy)->sector;
|
||||
|
||||
R_SetupFreelook(newview->player, skybox);
|
||||
R_SetupFreelook();
|
||||
}
|
||||
|
||||
void R_UpdateViewInterpolation(void)
|
||||
|
||||
+2
-61
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+12
-231
@@ -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;
|
||||
|
||||
@@ -1352,12 +1183,17 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||
#endif
|
||||
|
||||
fixed_t ang_scale = FRACUNIT;
|
||||
|
||||
INT32 dist = -1;
|
||||
|
||||
if (cv_grmaxinterpdist.value)
|
||||
dist = R_QuickCamDist(thing->x, thing->y);
|
||||
|
||||
// uncapped/interpolation
|
||||
interpmobjstate_t interp = {0};
|
||||
|
||||
// do interpolation
|
||||
if (R_UsingFrameInterpolation() && !paused && (!cv_grmaxinterpdist.value || R_QuickCamDist(thing->x, thing->y) < cv_grmaxinterpdist.value))
|
||||
if (R_UsingFrameInterpolation() && !paused && (!cv_grmaxinterpdist.value || dist < cv_grmaxinterpdist.value))
|
||||
{
|
||||
R_InterpolateMobjState(oldthing, rendertimefrac, &interp);
|
||||
}
|
||||
@@ -1877,11 +1713,16 @@ static void R_ProjectPrecipitationSprite(precipmobj_t *thing)
|
||||
//SoM: 3/17/2000
|
||||
fixed_t gz ,gzt;
|
||||
|
||||
INT32 dist = 1;
|
||||
|
||||
if (cv_grmaxinterpdist.value)
|
||||
dist = R_QuickCamDist(thing->x, thing->y);
|
||||
|
||||
// uncapped/interpolation
|
||||
interpmobjstate_t interp = {0};
|
||||
|
||||
// do interpolation
|
||||
if (R_UsingFrameInterpolation() && !paused && (!cv_grmaxinterpdist.value || R_QuickCamDist(thing->x, thing->y) < cv_grmaxinterpdist.value))
|
||||
if (R_UsingFrameInterpolation() && !paused && (!cv_grmaxinterpdist.value || dist < cv_grmaxinterpdist.value))
|
||||
{
|
||||
R_InterpolatePrecipMobjState(thing, rendertimefrac, &interp);
|
||||
}
|
||||
@@ -2495,20 +2336,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 +3603,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
|
||||
@@ -61,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);
|
||||
@@ -229,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
@@ -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)
|
||||
|
||||
@@ -84,15 +84,6 @@ UINT8 *scr_borderpatch; // flat used to fill the reduced view borders set at ST_
|
||||
// Short and Tall sky drawer, for the current color mode
|
||||
void (*walldrawerfunc)(void);
|
||||
|
||||
boolean R_486 = false;
|
||||
boolean R_586 = false;
|
||||
boolean R_MMX = false;
|
||||
boolean R_SSE = false;
|
||||
boolean R_3DNow = false;
|
||||
boolean R_MMXExt = false;
|
||||
boolean R_SSE2 = false;
|
||||
|
||||
|
||||
void SCR_SetMode(void)
|
||||
{
|
||||
if (dedicated)
|
||||
@@ -148,48 +139,6 @@ void SCR_SetMode(void)
|
||||
//
|
||||
void SCR_Startup(void)
|
||||
{
|
||||
const CPUInfoFlags *RCpuInfo = I_CPUInfo();
|
||||
if (!M_CheckParm("-NOCPUID") && RCpuInfo)
|
||||
{
|
||||
#if defined (__i386__) || defined (_M_IX86) || defined (__WATCOMC__)
|
||||
R_486 = true;
|
||||
#endif
|
||||
if (RCpuInfo->RDTSC)
|
||||
R_586 = true;
|
||||
if (RCpuInfo->MMX)
|
||||
R_MMX = true;
|
||||
if (RCpuInfo->AMD3DNow)
|
||||
R_3DNow = true;
|
||||
if (RCpuInfo->MMXExt)
|
||||
R_MMXExt = true;
|
||||
if (RCpuInfo->SSE)
|
||||
R_SSE = true;
|
||||
if (RCpuInfo->SSE2)
|
||||
R_SSE2 = true;
|
||||
CONS_Printf("CPU Info: 486: %i, 586: %i, MMX: %i, 3DNow: %i, MMXExt: %i, SSE2: %i\n", R_486, R_586, R_MMX, R_3DNow, R_MMXExt, R_SSE2);
|
||||
}
|
||||
|
||||
if (M_CheckParm("-486"))
|
||||
R_486 = true;
|
||||
if (M_CheckParm("-586"))
|
||||
R_586 = true;
|
||||
if (M_CheckParm("-MMX"))
|
||||
R_MMX = true;
|
||||
if (M_CheckParm("-3DNow"))
|
||||
R_3DNow = true;
|
||||
if (M_CheckParm("-MMXExt"))
|
||||
R_MMXExt = true;
|
||||
|
||||
if (M_CheckParm("-SSE"))
|
||||
R_SSE = true;
|
||||
if (M_CheckParm("-noSSE"))
|
||||
R_SSE = false;
|
||||
|
||||
if (M_CheckParm("-SSE2"))
|
||||
R_SSE2 = true;
|
||||
|
||||
M_SetupMemcpy();
|
||||
|
||||
if (dedicated)
|
||||
{
|
||||
V_Init();
|
||||
|
||||
@@ -134,17 +134,6 @@ extern void (*transtransfunc)(void);
|
||||
extern void (*twosmultipatchfunc)(void);
|
||||
extern void (*twosmultipatchtransfunc)(void);
|
||||
|
||||
// -----
|
||||
// CPUID
|
||||
// -----
|
||||
extern boolean R_ASM;
|
||||
extern boolean R_486;
|
||||
extern boolean R_586;
|
||||
extern boolean R_MMX;
|
||||
extern boolean R_3DNow;
|
||||
extern boolean R_MMXExt;
|
||||
extern boolean R_SSE2;
|
||||
|
||||
// ----------------
|
||||
// screen variables
|
||||
// ----------------
|
||||
|
||||
@@ -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
|
||||
|
||||
+23
-74
@@ -5,7 +5,7 @@
|
||||
//
|
||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
// Portions Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 2014-2018 by Sonic Team Junior.
|
||||
// Copyright (C) 2014-2019 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
@@ -400,13 +400,12 @@ static void JoyReset(SDLJoyInfo_t *JoySet)
|
||||
|
||||
/** \brief First joystick up and running
|
||||
*/
|
||||
static INT32 joystick_started = 0;
|
||||
static INT32 joystick_started = 0;
|
||||
|
||||
/** \brief SDL info about joystick 1
|
||||
*/
|
||||
SDLJoyInfo_t JoyInfo;
|
||||
|
||||
|
||||
/** \brief Second joystick up and running
|
||||
*/
|
||||
static INT32 joystick2_started = 0;
|
||||
@@ -772,7 +771,7 @@ static void Impl_HandleKeyboardConsoleEvent(KEY_EVENT_RECORD evt, HANDLE co)
|
||||
break;
|
||||
case VK_RETURN:
|
||||
entering_con_command = false;
|
||||
// Fall through.
|
||||
/* FALLTHRU */
|
||||
default:
|
||||
//event.data1 = MapVirtualKey(evt.wVirtualKeyCode,2); // convert in to char
|
||||
event.data1 = evt.uChar.AsciiChar;
|
||||
@@ -1109,7 +1108,6 @@ INT32 I_GetJoystickDeviceIndex(SDL_GameController *dev)
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Misleading function: updates device indices for all players BUT the one specified.
|
||||
// Necessary for SDL_JOYDEVICEADDED events
|
||||
void I_UpdateJoystickDeviceIndices(INT32 player)
|
||||
@@ -2399,7 +2397,6 @@ void I_InitJoystick(void)
|
||||
SDL_GameController *newcontroller = NULL;
|
||||
|
||||
//I_ShutdownJoystick();
|
||||
//SDL_SetHintWithPriority("SDL_XINPUT_ENABLED", "0", SDL_HINT_OVERRIDE);
|
||||
if (M_CheckParm("-nojoy"))
|
||||
return;
|
||||
|
||||
@@ -2457,13 +2454,13 @@ void I_InitJoystick2(void)
|
||||
SDL_GameController *newcontroller = NULL;
|
||||
|
||||
//I_ShutdownJoystick2();
|
||||
//SDL_SetHintWithPriority("SDL_XINPUT_ENABLED", "0", SDL_HINT_OVERRIDE);
|
||||
if (M_CheckParm("-nojoy"))
|
||||
return;
|
||||
|
||||
if (SDL_WasInit(SDL_INIT_JOYSTICK) == 0)
|
||||
{
|
||||
CONS_Printf("I_InitJoystick2()...\n");
|
||||
|
||||
if (SDL_InitSubSystem(SDL_INIT_JOYSTICK) == -1)
|
||||
{
|
||||
CONS_Printf(M_GetText("Couldn't initialize joystick: %s\n"), SDL_GetError());
|
||||
@@ -2638,7 +2635,7 @@ INT32 I_NumJoys(void)
|
||||
return numjoy;
|
||||
}
|
||||
|
||||
static char joyname[255]; // MAX_PATH; joystick name is straight from the driver
|
||||
static char joyname[255]; // joystick name is straight from the driver
|
||||
|
||||
const char *I_GetJoyName(INT32 joyindex)
|
||||
{
|
||||
@@ -3179,8 +3176,11 @@ ticcmd_t *I_BaseTiccmd4(void)
|
||||
{
|
||||
return &emptycmd4;
|
||||
}
|
||||
static int lastTimeFudge = -1;
|
||||
extern consvar_t cv_timefudge;
|
||||
|
||||
static Uint64 timer_frequency;
|
||||
double tic_frequency;
|
||||
|
||||
precise_t I_GetPreciseTime(void)
|
||||
{
|
||||
@@ -3192,6 +3192,16 @@ UINT64 I_GetPrecisePrecision(void)
|
||||
return SDL_GetPerformanceFrequency();
|
||||
}
|
||||
|
||||
double elapsed;
|
||||
|
||||
void I_SetTime(tic_t tic, int fudge, boolean useAbsoluteFudge)
|
||||
{
|
||||
tic = max(tic, SDL_GetTicks());
|
||||
if (useAbsoluteFudge)
|
||||
elapsed = elapsed + (fudge / 100) * tic_frequency;
|
||||
}
|
||||
|
||||
|
||||
static UINT32 frame_rate;
|
||||
|
||||
static double frame_frequency;
|
||||
@@ -3249,6 +3259,8 @@ void I_StartupTimer(void)
|
||||
|
||||
I_InitFrameTime(0, R_GetFramerateCap());
|
||||
elapsed_frames = 0.0;
|
||||
|
||||
tic_frequency = timer_frequency / (double)NEWTICRATE;
|
||||
}
|
||||
|
||||
void I_Sleep(UINT32 ms)
|
||||
@@ -3518,7 +3530,7 @@ void I_Error(const char *error, ...)
|
||||
// which should fail gracefully if it can't put a message box up
|
||||
// on the target system
|
||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR,
|
||||
"SRB2Kart "VERSIONSTRING" Recursive Error",
|
||||
"SRB2 "VERSIONSTRING" Recursive Error",
|
||||
buffer, NULL);
|
||||
|
||||
W_Shutdown();
|
||||
@@ -3741,7 +3753,7 @@ char *I_GetUserName(void)
|
||||
INT32 I_mkdir(const char *dirname, INT32 unixright)
|
||||
{
|
||||
//[segabor]
|
||||
#if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON) || defined (__CYGWIN__) || defined (__OS2__)
|
||||
#if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON) || defined (__CYGWIN__)
|
||||
return mkdir(dirname, unixright);
|
||||
#elif defined (_WIN32)
|
||||
UNREFERENCED_PARAMETER(unixright); /// \todo should implement ntright under nt...
|
||||
@@ -3880,7 +3892,7 @@ static const char *searchWad(const char *searchDir)
|
||||
pathonly(tempsw);
|
||||
return tempsw;
|
||||
}
|
||||
|
||||
|
||||
strcpy(tempsw, WADKEYWORD2);
|
||||
fstemp = filesearch(tempsw, searchDir, NULL, true, 20);
|
||||
if (fstemp == FS_FOUND)
|
||||
@@ -4183,69 +4195,6 @@ size_t I_GetFreeMem(size_t *total)
|
||||
#endif
|
||||
}
|
||||
|
||||
const CPUInfoFlags *I_CPUInfo(void)
|
||||
{
|
||||
#if defined (_WIN32)
|
||||
static CPUInfoFlags WIN_CPUInfo;
|
||||
SYSTEM_INFO SI;
|
||||
p_IsProcessorFeaturePresent pfnCPUID = (p_IsProcessorFeaturePresent)(LPVOID)GetProcAddress(GetModuleHandleA("kernel32.dll"), "IsProcessorFeaturePresent");
|
||||
|
||||
ZeroMemory(&WIN_CPUInfo,sizeof (WIN_CPUInfo));
|
||||
if (pfnCPUID)
|
||||
{
|
||||
WIN_CPUInfo.FPPE = pfnCPUID( 0); //PF_FLOATING_POINT_PRECISION_ERRATA
|
||||
WIN_CPUInfo.FPE = pfnCPUID( 1); //PF_FLOATING_POINT_EMULATED
|
||||
WIN_CPUInfo.cmpxchg = pfnCPUID( 2); //PF_COMPARE_EXCHANGE_DOUBLE
|
||||
WIN_CPUInfo.MMX = pfnCPUID( 3); //PF_MMX_INSTRUCTIONS_AVAILABLE
|
||||
WIN_CPUInfo.PPCMM64 = pfnCPUID( 4); //PF_PPC_MOVEMEM_64BIT_OK
|
||||
WIN_CPUInfo.ALPHAbyte = pfnCPUID( 5); //PF_ALPHA_BYTE_INSTRUCTIONS
|
||||
WIN_CPUInfo.SSE = pfnCPUID( 6); //PF_XMMI_INSTRUCTIONS_AVAILABLE
|
||||
WIN_CPUInfo.AMD3DNow = pfnCPUID( 7); //PF_3DNOW_INSTRUCTIONS_AVAILABLE
|
||||
WIN_CPUInfo.RDTSC = pfnCPUID( 8); //PF_RDTSC_INSTRUCTION_AVAILABLE
|
||||
WIN_CPUInfo.PAE = pfnCPUID( 9); //PF_PAE_ENABLED
|
||||
WIN_CPUInfo.SSE2 = pfnCPUID(10); //PF_XMMI64_INSTRUCTIONS_AVAILABLE
|
||||
//WIN_CPUInfo.blank = pfnCPUID(11); //PF_SSE_DAZ_MODE_AVAILABLE
|
||||
WIN_CPUInfo.DEP = pfnCPUID(12); //PF_NX_ENABLED
|
||||
WIN_CPUInfo.SSE3 = pfnCPUID(13); //PF_SSE3_INSTRUCTIONS_AVAILABLE
|
||||
WIN_CPUInfo.cmpxchg16b = pfnCPUID(14); //PF_COMPARE_EXCHANGE128
|
||||
WIN_CPUInfo.cmp8xchg16 = pfnCPUID(15); //PF_COMPARE64_EXCHANGE128
|
||||
WIN_CPUInfo.PFC = pfnCPUID(16); //PF_CHANNELS_ENABLED
|
||||
}
|
||||
#ifdef HAVE_SDLCPUINFO
|
||||
else
|
||||
{
|
||||
WIN_CPUInfo.RDTSC = SDL_HasRDTSC();
|
||||
WIN_CPUInfo.MMX = SDL_HasMMX();
|
||||
WIN_CPUInfo.AMD3DNow = SDL_Has3DNow();
|
||||
WIN_CPUInfo.SSE = SDL_HasSSE();
|
||||
WIN_CPUInfo.SSE2 = SDL_HasSSE2();
|
||||
WIN_CPUInfo.AltiVec = SDL_HasAltiVec();
|
||||
}
|
||||
WIN_CPUInfo.MMXExt = SDL_FALSE; //SDL_HasMMXExt(); No longer in SDL2
|
||||
WIN_CPUInfo.AMD3DNowExt = SDL_FALSE; //SDL_Has3DNowExt(); No longer in SDL2
|
||||
#endif
|
||||
GetSystemInfo(&SI);
|
||||
WIN_CPUInfo.CPUs = SI.dwNumberOfProcessors;
|
||||
WIN_CPUInfo.IA64 = (SI.dwProcessorType == 2200); // PROCESSOR_INTEL_IA64
|
||||
WIN_CPUInfo.AMD64 = (SI.dwProcessorType == 8664); // PROCESSOR_AMD_X8664
|
||||
return &WIN_CPUInfo;
|
||||
#elif defined (HAVE_SDLCPUINFO)
|
||||
static CPUInfoFlags SDL_CPUInfo;
|
||||
memset(&SDL_CPUInfo,0,sizeof (CPUInfoFlags));
|
||||
SDL_CPUInfo.RDTSC = SDL_HasRDTSC();
|
||||
SDL_CPUInfo.MMX = SDL_HasMMX();
|
||||
SDL_CPUInfo.MMXExt = SDL_FALSE; //SDL_HasMMXExt(); No longer in SDL2
|
||||
SDL_CPUInfo.AMD3DNow = SDL_Has3DNow();
|
||||
SDL_CPUInfo.AMD3DNowExt = SDL_FALSE; //SDL_Has3DNowExt(); No longer in SDL2
|
||||
SDL_CPUInfo.SSE = SDL_HasSSE();
|
||||
SDL_CPUInfo.SSE2 = SDL_HasSSE2();
|
||||
SDL_CPUInfo.AltiVec = SDL_HasAltiVec();
|
||||
return &SDL_CPUInfo;
|
||||
#else
|
||||
return NULL; /// \todo CPUID asm
|
||||
#endif
|
||||
}
|
||||
|
||||
// note CPUAFFINITY code used to reside here
|
||||
void I_RegisterSysCommands(void) {}
|
||||
#endif
|
||||
@@ -222,17 +222,37 @@ static void SDLSetMode(INT32 width, INT32 height, SDL_bool fullscreen)
|
||||
}
|
||||
else // windowed mode
|
||||
{
|
||||
int xoffset = 0, yoffset = 0, arg;
|
||||
|
||||
if (wasfullscreen)
|
||||
{
|
||||
wasfullscreen = SDL_FALSE;
|
||||
SDL_SetWindowFullscreen(window, 0);
|
||||
}
|
||||
|
||||
// Reposition window only in windowed mode
|
||||
SDL_SetWindowSize(window, width, height);
|
||||
SDL_SetWindowPosition(window,
|
||||
SDL_WINDOWPOS_CENTERED_DISPLAY(SDL_GetWindowDisplayIndex(window)),
|
||||
SDL_WINDOWPOS_CENTERED_DISPLAY(SDL_GetWindowDisplayIndex(window))
|
||||
);
|
||||
|
||||
// Offset the window w/ command line parameters, useful for multiplayer testing via batch files
|
||||
if (arg = M_CheckParm("-winxoff"))
|
||||
{
|
||||
xoffset = atoi(arg + 1 < myargc ? myargv[arg + 1] : "0");
|
||||
}
|
||||
if (arg = M_CheckParm("-winyoff"))
|
||||
{
|
||||
yoffset = atoi(arg + 1 < myargc ? myargv[arg + 1] : "0");
|
||||
}
|
||||
|
||||
if (xoffset || yoffset)
|
||||
{
|
||||
int x, y;
|
||||
SDL_GetWindowPosition(window, &x, &y);
|
||||
SDL_SetWindowPosition(window, x + xoffset, y + yoffset);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1345,6 +1365,8 @@ void I_StartupMouse(void)
|
||||
//
|
||||
// I_OsPolling
|
||||
//
|
||||
void SOCK_FlushDelayBuffers(boolean flush);
|
||||
|
||||
void I_OsPolling(void)
|
||||
{
|
||||
SDL_Keymod mod;
|
||||
|
||||
+8
-1208
File diff suppressed because it is too large.
Load diff
Loaded 100 of 104 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user