Compare commits

...
16 Commits
Author SHA1 Message Date
alufolie91 029c21eae8 correct map issues clientside
but be loud about it instead of I_Error´ing
most of those would be fatal anyways, so screw vanilla desyncing if they crash eitherways
2026-06-22 20:53:49 +02:00
entryway 568f29ed1c Check for blockmap overflow in P_BlockLinesIterator. Under RANGECHECK define. 2026-06-22 20:52:49 +02:00
alufolie91 2dacc333b5 just set backsector to NULL
if not in vanilla doom compat mode/overflow emulation GetSectorAtNullAddress will just return NULL, so we can do so aswell
2026-06-22 20:52:42 +02:00
alufolie91 363612c488 port more checks from dsda-doom for invalid map data
decided to have it i_error for now, not sure what exactly is the best approach here
should we just "correct" some of those instead?
vanilla probably just crashes anyways
2026-06-22 20:52:19 +02:00
alufolie91 d8ffffd86e replace non valid sidenum magic number
with what dsda-doom uses
2026-06-22 20:52:11 +02:00
alufolie91 4b2a13defb cleanup K_DropItems a bit
move "paperitem" spawn to its separate function like RR
2026-06-21 23:30:20 +02:00
alufolie91 9cc74d8b17 use P_MobjWasRemoved for P_MoveChaseCamera
dont need to care about synch safety here....
2026-06-21 23:07:20 +02:00
alufolie91 066adb972e add some more mobj null checks to P_MobjThinker
from srb2 ig
2026-06-21 23:07:17 +02:00
alufolie91 0f1ad8a086 few more smaller cleanups 2026-06-21 23:07:12 +02:00
alufolie91 40537eca81 cleanup P_KillMobj a little 2026-06-21 23:03:45 +02:00
AJ Martinez 0cff3c23f3 Don't attempt itemamount correction after orbitals self-destruct 2026-06-21 22:35:20 +02:00
alufolie91 9bdda66a0c rename this to D_CheckMapReplacements 2026-06-21 19:14:22 +02:00
alufolie91 3b6a09da9b oops 2026-06-21 19:04:48 +02:00
Zwip-Zwap Zapony c275555678 Draw the input prompt while the console is moving 2026-06-21 19:00:10 +02:00
Zwip-Zwap Zapony fc588f8046 Make con_height adjustable on the fly 2026-06-21 19:00:07 +02:00
alufolie91 17093e8022 add command to list unused map slots
less pain for server owners
hope this is sufficient
2026-06-21 18:03:50 +02:00
23 changed files with 494 additions and 223 deletions

No files matched your search

+53 -39
View File
@@ -62,7 +62,7 @@ static boolean con_started = false; // console has been initialised
static boolean con_forcepic = true; // at startup toggle console translucency when first off static boolean con_forcepic = true; // at startup toggle console translucency when first off
boolean con_recalc = false; // set true when screen size has changed boolean con_recalc = false; // set true when screen size has changed
static tic_t con_tick; // console ticker for anim or blinking prompt cursor static tic_t con_tick; // console ticker for blinking prompt cursor
// con_scrollup should use time (currenttime - lasttime).. // con_scrollup should use time (currenttime - lasttime)..
static boolean consoletoggle; // true when console key pushed, ticker will handle static boolean consoletoggle; // true when console key pushed, ticker will handle
@@ -103,6 +103,7 @@ static void CON_InputInit(void);
static void CON_RecalcSize(void); static void CON_RecalcSize(void);
static void CON_ChangeHeight(void); static void CON_ChangeHeight(void);
static void CONS_height_Change(void);
static void CONS_hudlines_Change(void); static void CONS_hudlines_Change(void);
static void CONS_backcolor_Change(void); static void CONS_backcolor_Change(void);
@@ -131,7 +132,7 @@ static CV_PossibleValue_t speed_cons_t[] = {{0, "MIN"}, {64, "MAX"}, {0, NULL}};
static consvar_t cons_speed = {"con_speed", "8", CV_SAVE, speed_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; static consvar_t cons_speed = {"con_speed", "8", CV_SAVE, speed_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
// percentage of screen height to use for console // percentage of screen height to use for console
static consvar_t cons_height = {"con_height", "50", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL}; static consvar_t cons_height = {"con_height", "50", CV_CALL|CV_SAVE, CV_Unsigned, CONS_height_Change, 0, NULL, NULL, 0, 0, NULL};
static CV_PossibleValue_t backpic_cons_t[] = {{0, "translucent"}, {1, "picture"}, {0, NULL}}; static CV_PossibleValue_t backpic_cons_t[] = {{0, "translucent"}, {1, "picture"}, {0, NULL}};
// whether to use console background picture, or translucent mode // whether to use console background picture, or translucent mode
@@ -173,6 +174,18 @@ consvar_t cons_consoleprintinmenu = {"consoleprintinmenu", "Off", CV_SAVE, CV_On
static void CON_Print(char *msg); static void CON_Print(char *msg);
// Change the console height on demand
//
static void CONS_height_Change(void)
{
Lock_state();
if (con_destlines > 0 && !con_startup) // If the console is open (as in, not using "bind")...
CON_ChangeHeight(); // ...update its height now, not only when it's closed and re-opened
Unlock_state();
}
// //
// //
static void CONS_hudlines_Change(void) static void CONS_hudlines_Change(void)
@@ -1637,53 +1650,54 @@ static void CON_DrawConsole(void)
} }
// draw console text lines from top to bottom // draw console text lines from top to bottom
if (con_curlines < minheight) if (con_curlines >= minheight)
return;
i = con_cy - con_scrollup;
// skip the last empty line due to the cursor being at the start of a new line
i--;
i -= (con_curlines - minheight) / charheight;
if (rendermode == render_none) return;
for (y = (con_curlines-minheight) % charheight; y <= con_curlines-minheight; y += charheight, i++)
{ {
INT32 x; i = con_cy - con_scrollup;
size_t c;
p = (UINT8 *)&con_buffer[((i > 0 ? i : 0)%con_totallines)*con_width]; // skip the last empty line due to the cursor being at the start of a new line
i--;
for (c = 0, x = charwidth; c < con_width; c++, x += charwidth, p++) i -= (con_curlines - minheight) / charheight;
if (rendermode == render_none)
return;
for (y = (con_curlines-minheight) % charheight; y <= con_curlines-minheight; y += charheight, i++)
{ {
while (*p & 0x80) INT32 x;
size_t c;
p = (UINT8 *)&con_buffer[((i > 0 ? i : 0)%con_totallines)*con_width];
for (c = 0, x = charwidth; c < con_width; c++, x += charwidth, p++)
{ {
charflags = (*p & 0x7f) << V_CHARCOLORSHIFT; while (*p & 0x80)
p++; {
c++; charflags = (*p & 0x7f) << V_CHARCOLORSHIFT;
p++;
c++;
}
if (c >= con_width)
break;
int emotelen;
emote_t *emote;
if ((emote = M_VerifyEmote((const char *)p, &emotelen)))
{
M_DrawScaledEmote(x<<FRACBITS, (y+2*con_scalefactor)<<FRACBITS, charwidth*FRACUNIT/EMOTEWIDTH, emote, V_NOSCALESTART|V_NOSCALEPATCH);
p += emotelen-1;
c += emotelen-1;
continue;
}
V_DrawCharacter(x, y, (INT32)(*p) | charflags | cv_constextsize.value | V_NOSCALESTART, !cv_allcaps.value);
} }
if (c >= con_width)
break;
int emotelen;
emote_t *emote;
if ((emote = M_VerifyEmote((const char *)p, &emotelen)))
{
M_DrawScaledEmote(x<<FRACBITS, (y+2*con_scalefactor)<<FRACBITS, charwidth*FRACUNIT/EMOTEWIDTH, emote, V_NOSCALESTART|V_NOSCALEPATCH);
p += emotelen-1;
c += emotelen-1;
continue;
}
V_DrawCharacter(x, y, (INT32)(*p) | charflags | cv_constextsize.value | V_NOSCALESTART, !cv_allcaps.value);
} }
} }
// draw prompt if enough place (not while game startup) // draw prompt if enough place (not while game startup)
if ((con_curlines == con_destlines) && (con_curlines >= minheight) && !con_startup) if ((con_curlines >= (minheight-charheight)) && !con_startup)
CON_DrawInput(); CON_DrawInput();
} }
+10 -8
View File
@@ -1353,7 +1353,7 @@ static void IdentifyVersion(void)
// //
// search for maps // search for maps
// //
static void D_CheckMaps(boolean checkreplaced) static void D_CheckMapReplacements(boolean checkreplaced)
{ {
INT32 i; INT32 i;
char *name; char *name;
@@ -1829,17 +1829,19 @@ void D_SRB2Main(void)
// conversion sometimes needs the palette // conversion sometimes needs the palette
V_ReloadPalette(); V_ReloadPalette();
D_CheckMaps(false); D_CheckMapReplacements(false);
W_InitMultipleFiles(startuppwads, startuppwadcount, true);
// Only search for pwad maps if we actually have a pwad added
if (startuppwadcount > 0) if (startuppwadcount > 0)
{ {
D_CheckMaps(true); CONS_Printf("W_InitMultipleFiles(): Adding extra PWADs.\n");
W_InitMultipleFiles(startuppwads, startuppwadcount, true);
// Only search for pwad maps if we actually have a pwad added
D_CheckMapReplacements(true);
D_CleanFile(startuppwads, startuppwadcount);
} }
D_CleanFile(startuppwads, startuppwadcount);
startuppwadcount = 0; startuppwadcount = 0;
cht_Init(); cht_Init();
@@ -1926,7 +1928,7 @@ void D_SRB2Main(void)
CONS_Printf("R_Init(): Init SRB2 refresh daemon.\n"); CONS_Printf("R_Init(): Init SRB2 refresh daemon.\n");
R_Init(); R_Init();
#if SOUND==SOUND_DUMMY #if SOUND == SOUND_DUMMY
sound_disabled = true; sound_disabled = true;
music_disabled = true; music_disabled = true;
#else #else
+19
View File
@@ -150,6 +150,7 @@ static void Command_ListWADS_f(void);
static void Command_LocateLump_f(void); static void Command_LocateLump_f(void);
static void Command_ListDoomednums_f(void); static void Command_ListDoomednums_f(void);
static void Command_ListUnusedSprites_f(void); static void Command_ListUnusedSprites_f(void);
static void Command_ListUnusedMapSlots_f(void);
static void Command_RunSOC(void); static void Command_RunSOC(void);
static void Command_Pause(void); static void Command_Pause(void);
static void Command_Respawn(void); static void Command_Respawn(void);
@@ -645,6 +646,7 @@ void D_RegisterServerCommands(void)
COM_AddCommand("locatelump", Command_LocateLump_f); COM_AddCommand("locatelump", Command_LocateLump_f);
COM_AddCommand("listmapthings", Command_ListDoomednums_f); COM_AddCommand("listmapthings", Command_ListDoomednums_f);
COM_AddCommand("listunusedsprites", Command_ListUnusedSprites_f); COM_AddCommand("listunusedsprites", Command_ListUnusedSprites_f);
COM_AddCommand("listunusedmapslots", Command_ListUnusedMapSlots_f);
COM_AddCommand("runsoc", Command_RunSOC); COM_AddCommand("runsoc", Command_RunSOC);
COM_AddCommand("pause", Command_Pause); COM_AddCommand("pause", Command_Pause);
@@ -4591,6 +4593,23 @@ void Command_ListUnusedSprites_f(void)
} }
} }
void Command_ListUnusedMapSlots_f(void)
{
INT32 i;
CONS_Printf("\x82Printing map slot non-usage...\n");
for (i = 0; i < NUMMAPS; i++)
{
// is checking this enough?
if (mapheaderinfo[i])
continue;
CONS_Printf("%s\n", G_BuildMapName(i+1));
}
}
// ========================================================================= // =========================================================================
// MISC. COMMANDS // MISC. COMMANDS
// ========================================================================= // =========================================================================
+3 -1
View File
@@ -81,10 +81,12 @@ typedef struct
INT16 flags; INT16 flags;
INT16 special; INT16 special;
INT16 tag; INT16 tag;
// sidenum[1] will be 0xffff if one sided // sidenum[1] will be NO_INDEX if one sided
UINT16 sidenum[2]; UINT16 sidenum[2];
} ATTRPACK maplinedef_t; } ATTRPACK maplinedef_t;
#define NO_INDEX 0xffff
// //
// LineDef attributes. // LineDef attributes.
// //
+6 -2
View File
@@ -857,7 +857,8 @@ static void G_HandleLocalDriftturn(ticcmd_t *cmd, UINT8 ssplayer)
static void G_BuildLocalTiccmd(ticcmd_t *cmd, UINT8 ssplayer, boolean freecam) static void G_BuildLocalTiccmd(ticcmd_t *cmd, UINT8 ssplayer, boolean freecam)
{ {
INT32 axis = 0; INT32 axis = 0;
const boolean usejoystick = cv_usejoystick[(ssplayer-1)].value; const UINT8 forplayer = (ssplayer-1);
const boolean usejoystick = cv_usejoystick[forplayer].value;
// check for inputs and return button commands // check for inputs and return button commands
// for stuff like joining with item button, saltyhop, honking, etc. // for stuff like joining with item button, saltyhop, honking, etc.
@@ -893,7 +894,7 @@ static void G_BuildLocalTiccmd(ticcmd_t *cmd, UINT8 ssplayer, boolean freecam)
#undef CHECKINPUT #undef CHECKINPUT
axis = JoyAxis(AXISLOOKBACK, ssplayer); axis = JoyAxis(AXISLOOKBACK, ssplayer);
camspin[ssplayer-1] = (InputDown(gc_lookback, ssplayer) || (usejoystick && axis > 0)); camspin[forplayer] = (InputDown(gc_lookback, ssplayer) || (usejoystick && axis > 0));
// Reset to our spec player if we watch someone else. // Reset to our spec player if we watch someone else.
if ((cmd->driftturn || cmd->buttons) if ((cmd->driftturn || cmd->buttons)
@@ -1309,6 +1310,7 @@ static void G_DoLoadLevel(boolean resetplayer)
{ {
// fail so reset game stuff // fail so reset game stuff
Command_ExitGame_f(); Command_ExitGame_f();
P_FreeCorruptMapWarnings();
return; return;
} }
@@ -1342,6 +1344,8 @@ static void G_DoLoadLevel(boolean resetplayer)
// clear hud messages remains (usually from game startup) // clear hud messages remains (usually from game startup)
CON_ClearHUD(); CON_ClearHUD();
// print any map errors now due to clearhud above :chaosleep:
P_PrintCorruptMapWarnings();
server_lagless = !cv_gentlemens.value; server_lagless = !cv_gentlemens.value;
+1 -1
View File
@@ -373,7 +373,7 @@ static poly_t *CutOutSubsecPoly(seg_t *lseg, INT32 count, poly_t *poly)
if (!gl_maphashorizonlines && line->special == HORIZONSPECIAL) if (!gl_maphashorizonlines && line->special == HORIZONSPECIAL)
gl_maphashorizonlines = true; gl_maphashorizonlines = true;
if (line->sidenum[1] != 0xffff) if (line->sidenum[1] != NO_INDEX)
{ {
if (sides[line->sidenum[0]].sector == sides[line->sidenum[1]].sector) if (sides[line->sidenum[0]].sector == sides[line->sidenum[1]].sector)
{ {
+1 -1
View File
@@ -729,7 +729,7 @@ static void HWR_PrecacheLevelTextures(void)
for (j = 0; j < 2; j++) for (j = 0; j < 2; j++)
{ {
// check if single-sided linedef // check if single-sided linedef
if (line->sidenum[j] == 0xffff) if (line->sidenum[j] == NO_INDEX)
continue; continue;
const side_t *side = &sides[line->sidenum[j]]; const side_t *side = &sides[line->sidenum[j]];
+1
View File
@@ -1135,6 +1135,7 @@ static void HU_SendChatMessage(void)
return; return;
} }
} }
// I'm very bad at C, I swear I am, additional checks eww! // I'm very bad at C, I swear I am, additional checks eww!
if (spc != 0) if (spc != 0)
{ {
+46 -35
View File
@@ -4559,50 +4559,59 @@ void K_DropHnextList(player_t *player)
P_RemoveMobj(work); P_RemoveMobj(work);
} }
{ // we need this here too because this is done in afterthink - pointers are cleaned up at the START of each tic...
// we need this here too because this is done in afterthink - pointers are cleaned up at the START of each tic... P_SetTarget(&player->mo->hnext, NULL);
P_SetTarget(&player->mo->hnext, NULL); player->kartstuff[k_bananadrag] = 0;
player->kartstuff[k_bananadrag] = 0;
if (player->kartstuff[k_eggmanheld]) if (player->kartstuff[k_eggmanheld])
player->kartstuff[k_eggmanheld] = 0; player->kartstuff[k_eggmanheld] = 0;
else if (player->kartstuff[k_itemheld] else if (player->kartstuff[k_itemheld]
&& (dropall || (--player->kartstuff[k_itemamount] <= 0))) && (dropall || (--player->kartstuff[k_itemamount] <= 0)))
{ {
player->kartstuff[k_itemamount] = player->kartstuff[k_itemheld] = 0; player->kartstuff[k_itemamount] = player->kartstuff[k_itemheld] = 0;
player->kartstuff[k_itemtype] = KITEM_NONE; player->kartstuff[k_itemtype] = KITEM_NONE;
}
} }
} }
static void K_DropPaperItem(player_t *player, boolean thunderhack, INT32 itemamount)
{
const mobj_t *pmo = player->mo;
if (P_MobjWasRemoved(pmo))
{
return;
}
mobj_t *drop = P_SpawnMobj(pmo->x, pmo->y, (pmo->z + pmo->height/2), MT_FLOATINGITEM);
P_SetScale(drop, drop->scale>>4);
drop->destscale = (3*drop->destscale)/2;
drop->angle = pmo->angle + ANGLE_90;
P_Thrust(drop, FixedAngle(P_RandomFixed()*180) + pmo->angle + ANGLE_90, 16*mapobjectscale);
drop->momz = P_MobjFlip(pmo)*3*mapobjectscale;
if (drop->eflags & MFE_UNDERWATER)
drop->momz = (117 * drop->momz) / 200;
drop->threshold = (thunderhack ? KITEM_THUNDERSHIELD : player->kartstuff[k_itemtype]);
drop->movecount = itemamount;
drop->flags |= MF_NOCLIPTHING;
}
// For getting EXTRA hit! // For getting EXTRA hit!
void K_DropItems(player_t *player) void K_DropItems(player_t *player)
{ {
boolean thunderhack = (player->kartstuff[k_curshield] && player->kartstuff[k_itemtype] == KITEM_THUNDERSHIELD); const boolean thunderhack = (player->kartstuff[k_curshield] && player->kartstuff[k_itemtype] == KITEM_THUNDERSHIELD);
if (thunderhack) if (thunderhack)
player->kartstuff[k_itemtype] = KITEM_NONE; player->kartstuff[k_itemtype] = KITEM_NONE;
K_DropHnextList(player); K_DropHnextList(player);
if (!P_MobjWasRemoved(player->mo) && player->kartstuff[k_itemamount]) if (player->kartstuff[k_itemamount])
{ {
mobj_t *drop = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z + player->mo->height/2, MT_FLOATINGITEM); K_DropPaperItem(player, thunderhack, player->kartstuff[k_itemamount]);
P_SetScale(drop, drop->scale>>4);
drop->destscale = (3*drop->destscale)/2;
drop->angle = player->mo->angle + ANGLE_90;
P_Thrust(drop,
FixedAngle(P_RandomFixed()*180) + player->mo->angle + ANGLE_90,
16*mapobjectscale);
drop->momz = P_MobjFlip(player->mo)*3*mapobjectscale;
if (drop->eflags & MFE_UNDERWATER)
drop->momz = (117 * drop->momz) / 200;
drop->threshold = (thunderhack ? KITEM_THUNDERSHIELD : player->kartstuff[k_itemtype]);
drop->movecount = player->kartstuff[k_itemamount];
drop->flags |= MF_NOCLIPTHING;
} }
K_StripItems(player); K_StripItems(player);
@@ -4658,7 +4667,7 @@ void K_DropKitchenSink(player_t *player)
return; return;
if (player->mo->hnext->type != MT_SINK_SHIELD) if (player->mo->hnext->type != MT_SINK_SHIELD)
return; //so we can just call this function regardless of what is being held return; // so we can just call this function regardless of what is being held
P_KillMobj(player->mo->hnext, NULL, NULL); P_KillMobj(player->mo->hnext, NULL, NULL);
@@ -4684,9 +4693,8 @@ void K_RepairOrbitChain(mobj_t *orbit)
} }
// Then recount to make sure item amount is correct // Then recount to make sure item amount is correct
if (orbit->target && orbit->target->player) if (orbit->target && orbit->target->player) // !P_MobjWasRemoved(orbit->target)
{ {
player_t *player = orbit->target->player;
INT32 num = 0; INT32 num = 0;
mobj_t *cur = orbit->target->hnext; mobj_t *cur = orbit->target->hnext;
@@ -4696,13 +4704,14 @@ void K_RepairOrbitChain(mobj_t *orbit)
{ {
prev = cur; prev = cur;
cur = cur->hnext; cur = cur->hnext;
if (++num > player->kartstuff[k_itemamount]) if (++num > orbit->target->player->kartstuff[k_itemamount])
P_RemoveMobj(prev); P_RemoveMobj(prev);
else else
prev->movedir = num; prev->movedir = num;
} }
player->kartstuff[k_itemamount] = num; if (orbit->target) // !P_MobjWasRemoved(orbit->target)
orbit->target->player->kartstuff[k_itemamount] = num;
} }
} }
@@ -4934,8 +4943,10 @@ static void K_MoveHeldObjects(player_t *player)
cur->momx = FixedMul(FINECOSINE(cur->angle>>ANGLETOFINESHIFT), cur->extravalue1); cur->momx = FixedMul(FINECOSINE(cur->angle>>ANGLETOFINESHIFT), cur->extravalue1);
cur->momy = FixedMul(FINESINE(cur->angle>>ANGLETOFINESHIFT), cur->extravalue1); cur->momy = FixedMul(FINESINE(cur->angle>>ANGLETOFINESHIFT), cur->extravalue1);
cur->flags &= ~MF_NOCLIPTHING; cur->flags &= ~MF_NOCLIPTHING;
if (!P_TryMove(cur, player->mo->x + cur->momx, player->mo->y + cur->momy, true)) if (!P_TryMove(cur, player->mo->x + cur->momx, player->mo->y + cur->momy, true))
P_SlideMove(cur, true); P_SlideMove(cur, true);
if (P_IsObjectOnGround(player->mo)) if (P_IsObjectOnGround(player->mo))
{ {
if (P_MobjFlip(cur) > 0) if (P_MobjFlip(cur) > 0)
+1 -1
View File
@@ -652,7 +652,7 @@ static int line_get(lua_State *L)
LUA_PushUserdata(L, &sides[line->sidenum[0]], META_SIDE); LUA_PushUserdata(L, &sides[line->sidenum[0]], META_SIDE);
return 1; return 1;
case line_backside: // backside case line_backside: // backside
if (line->sidenum[1] == 0xffff) if (line->sidenum[1] == NO_INDEX)
return 0; return 0;
LUA_PushUserdata(L, &sides[line->sidenum[1]], META_SIDE); LUA_PushUserdata(L, &sides[line->sidenum[1]], META_SIDE);
return 1; return 1;
+82 -66
View File
@@ -1462,48 +1462,11 @@ boolean P_CheckRacers(void)
return false; return false;
} }
/** Kills an object. static void P_UpdateRemovedOrbital(mobj_t *target, mobj_t *inflictor, mobj_t *source)
*
* \param target The victim.
* \param inflictor The attack weapon. May be NULL (environmental damage).
* \param source The attacker. May be NULL.
* \todo Cleanup, refactor, split up.
* \sa P_DamageMobj
*/
void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source)
{ {
mobjtype_t item;
mobj_t *mo;
int ms;
if (target->flags & (MF_ENEMY|MF_BOSS))
target->momx = target->momy = target->momz = 0;
// SRB2kart
if (target->type != MT_PLAYER && !(target->flags & MF_MONITOR)
&& !(target->type == MT_ORBINAUT || target->type == MT_ORBINAUT_SHIELD
|| target->type == MT_JAWZ || target->type == MT_JAWZ_DUD || target->type == MT_JAWZ_SHIELD
|| target->type == MT_BANANA || target->type == MT_BANANA_SHIELD
|| target->type == MT_EGGMANITEM || target->type == MT_EGGMANITEM_SHIELD
|| target->type == MT_BALLHOG || target->type == MT_SPB)) // kart dead items
target->flags |= MF_NOGRAVITY; // Don't drop Tails 03-08-2000
else
target->flags &= ~MF_NOGRAVITY; // lose it if you for whatever reason have it, I'm looking at you shields
//
if (target->flags2 & MF2_NIGHTSPULL)
P_SetTarget(&target->tracer, NULL);
// dead target is no more shootable
target->flags &= ~(MF_SHOOTABLE|MF_FLOAT|MF_SPECIAL);
target->flags2 &= ~(MF2_SKULLFLY|MF2_NIGHTSPULL);
target->health = 0; // This makes it easy to check if something's dead elsewhere.
if (LUA_HookMobjDeath(target, inflictor, source) || P_MobjWasRemoved(target))
return;
// SRB2kart // SRB2kart
// I wish I knew a better way to do this // I wish I knew a better way to do this
//if (!P_MobjWasRemoved(target->target) && target->target->player && !P_MobjWasRemoved(target->target->player->mo))
if (target->target && target->target->player && target->target->player->mo) if (target->target && target->target->player && target->target->player->mo)
{ {
if (target->target->player->kartstuff[k_eggmanheld] && target->type == MT_EGGMANITEM_SHIELD) if (target->target->player->kartstuff[k_eggmanheld] && target->type == MT_EGGMANITEM_SHIELD)
@@ -1517,7 +1480,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source)
{ {
if (target->movedir != 0 && target->movedir < (UINT16)target->target->player->kartstuff[k_itemamount]) if (target->movedir != 0 && target->movedir < (UINT16)target->target->player->kartstuff[k_itemamount])
{ {
if (target->target->hnext) if (target->target->hnext) // !P_MobjWasRemoved(target->target->hnext))
K_KillBananaChain(target->target->hnext, inflictor, source); K_KillBananaChain(target->target->hnext, inflictor, source);
target->target->player->kartstuff[k_itemamount] = 0; target->target->player->kartstuff[k_itemamount] = 0;
@@ -1546,14 +1509,60 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source)
P_SetTarget(&target->target->hnext, NULL); P_SetTarget(&target->target->hnext, NULL);
} }
} }
// Above block does not clean up rocket sneakers when a player dies, so we need to do it here target->target is null when using rocket sneakers }
/** Kills an object.
*
* \param target The victim.
* \param inflictor The attack weapon. May be NULL (environmental damage).
* \param source The attacker. May be NULL.
* \todo Cleanup, refactor, split up.
* \sa P_DamageMobj
*/
void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source)
{
mobjtype_t item;
mobj_t *mo;
int ms;
if (target->flags & (MF_ENEMY|MF_BOSS))
target->momx = target->momy = target->momz = 0;
// SRB2kart
if (target->type != MT_PLAYER
&& !(target->flags & MF_MONITOR)
&& !(target->type == MT_ORBINAUT || target->type == MT_ORBINAUT_SHIELD
|| target->type == MT_JAWZ || target->type == MT_JAWZ_DUD || target->type == MT_JAWZ_SHIELD
|| target->type == MT_BANANA || target->type == MT_BANANA_SHIELD
|| target->type == MT_EGGMANITEM || target->type == MT_EGGMANITEM_SHIELD
|| target->type == MT_BALLHOG || target->type == MT_SPB)) // kart dead items
target->flags |= MF_NOGRAVITY; // Don't drop Tails 03-08-2000
else
target->flags &= ~MF_NOGRAVITY; // lose it if you for whatever reason have it, I'm looking at you shields
//
if (target->flags2 & MF2_NIGHTSPULL)
P_SetTarget(&target->tracer, NULL);
// dead target is no more shootable
target->flags &= ~(MF_SHOOTABLE|MF_FLOAT|MF_SPECIAL);
target->flags2 &= ~(MF2_SKULLFLY|MF2_NIGHTSPULL);
target->health = 0; // This makes it easy to check if something's dead elsewhere.
if (LUA_HookMobjDeath(target, inflictor, source) || P_MobjWasRemoved(target))
return;
P_UpdateRemovedOrbital(target, inflictor, source);
if (target->player) if (target->player)
{
// Above block does not clean up rocket sneakers when a player dies, so we need to do it here target->target is null when using rocket sneakers
K_DropRocketSneaker(target->player); K_DropRocketSneaker(target->player);
// Let EVERYONE know what happened to a player! 01-29-2002 Tails // Let EVERYONE know what happened to a player! 01-29-2002 Tails
if (target->player && !target->player->spectator) if (!target->player->spectator)
{ target->flags2 &= ~MF2_DONTDRAW;
target->flags2 &= ~MF2_DONTDRAW;
} }
// if killed by a player // if killed by a player
@@ -1563,6 +1572,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source)
{ {
P_SetTarget(&target->target, source); P_SetTarget(&target->target, source);
source->player->numboxes++; source->player->numboxes++;
if (cv_itemrespawn.value && (netgame || multiplayer)) if (cv_itemrespawn.value && (netgame || multiplayer))
{ {
target->fuse = cv_itemrespawntime.value*TICRATE + 2; // Random box generation target->fuse = cv_itemrespawntime.value*TICRATE + 2; // Random box generation
@@ -1580,35 +1590,41 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source)
target->player->playerstate = PST_DEAD; target->player->playerstate = PST_DEAD;
if (cv_fading.value && P_IsLocalPlayer(target->player)) if (P_IsLocalPlayer(target->player))
{ {
if (netgame || multiplayer) if (cv_fading.value)
ms = cv_respawntime.value * 1000; {
else if (netgame || multiplayer)
ms = 1000; ms = cv_respawntime.value * 1000;
else
ms = 1000;
/* /*
If the time spent with the music paused is less than half * If the time spent with the music paused is less than half
a second, continue playing the song (just mute it). * a second, continue playing the song (just mute it).
*/ */
if ((ms - cv_respawnfademusicout.value) < 500) if ((ms - cv_respawnfademusicout.value) < 500)
S_FadeMusic(0, cv_respawnfademusicout.value); S_FadeMusic(0, cv_respawnfademusicout.value);
else else
S_FadeOutStopMusic(cv_respawnfademusicout.value); S_FadeOutStopMusic(cv_respawnfademusicout.value);
} }
for (UINT8 i = 0; i <= splitscreen; i++) if (target->player == &players[consoleplayer])
{
if (target->player == P_GetLocalPlayerForNum(i))
{ {
// don't die in auto map, // don't die in auto map,
// switch view prior to dying // switch view prior to dying
if (i == 0 && automapactive) if (automapactive)
AM_Stop(); AM_Stop();
}
// added : 22-02-98: recenter view for next life... for (UINT8 i = 0; i <= splitscreen; i++)
localaiming[i] = 0; {
break; if (target->player == P_GetLocalPlayerForNum(i))
{
// added : 22-02-98: recenter view for next life...
localaiming[i] = 0;
break;
}
} }
} }
+2 -2
View File
@@ -1575,13 +1575,13 @@ static boolean PIT_CheckLine(line_t *ld)
tmbbox[BOXLEFT] >= ld->bbox[BOXRIGHT] || tmbbox[BOXLEFT] >= ld->bbox[BOXRIGHT] ||
tmbbox[BOXTOP] <= ld->bbox[BOXBOTTOM] || tmbbox[BOXTOP] <= ld->bbox[BOXBOTTOM] ||
tmbbox[BOXBOTTOM] >= ld->bbox[BOXTOP]) tmbbox[BOXBOTTOM] >= ld->bbox[BOXTOP])
return true; return true; // didn't hit it
if (ld->polyobj && !(ld->polyobj->flags & POF_SOLID)) if (ld->polyobj && !(ld->polyobj->flags & POF_SOLID))
return true; return true;
if (P_BoxOnLineSide(tmbbox, ld) != -1) if (P_BoxOnLineSide(tmbbox, ld) != -1)
return true; return true; // didn't hit it
if (tmthing->flags & MF_PAPERCOLLISION) // Caution! Turning whilst up against a wall will get you stuck. You probably shouldn't give the player this flag. if (tmthing->flags & MF_PAPERCOLLISION) // Caution! Turning whilst up against a wall will get you stuck. You probably shouldn't give the player this flag.
{ {
+9 -2
View File
@@ -242,7 +242,7 @@ void P_CameraLineOpening(line_t *linedef)
sector_t *back; sector_t *back;
fixed_t frontfloor, frontceiling, backfloor, backceiling; fixed_t frontfloor, frontceiling, backfloor, backceiling;
if (linedef->sidenum[1] == 0xffff) if (linedef->sidenum[1] == NO_INDEX)
{ {
// single sided line // single sided line
openrange = 0; openrange = 0;
@@ -398,7 +398,7 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
{ {
sector_t *front, *back; sector_t *front, *back;
if (linedef->sidenum[1] == 0xffff) if (linedef->sidenum[1] == NO_INDEX)
{ {
// single sided line // single sided line
openrange = 0; openrange = 0;
@@ -972,6 +972,10 @@ boolean P_BlockLinesIterator(INT32 x, INT32 y, boolean (*func)(line_t *))
// First index is really empty, so +1 it. // First index is really empty, so +1 it.
for (list = blockmaplump + offset + 1; *list != -1; list++) for (list = blockmaplump + offset + 1; *list != -1; list++)
{ {
#ifdef RANGECHECK
if (*list < 0 || (UINT32)*list >= numlines)
I_Error("P_BlockLinesIterator: index >= numlines");
#endif
ld = &lines[*list]; ld = &lines[*list];
if (ld->validcount == validcount) if (ld->validcount == validcount)
@@ -1000,11 +1004,13 @@ boolean P_BlockThingsIterator(INT32 x, INT32 y, boolean (*func)(mobj_t *))
for (mobj = blocklinks[y*bmapwidth + x]; mobj; mobj = bnext) for (mobj = blocklinks[y*bmapwidth + x]; mobj; mobj = bnext)
{ {
P_SetTarget(&bnext, mobj->bnext); // We want to note our reference to bnext here incase it is MF_NOTHINK and gets removed! P_SetTarget(&bnext, mobj->bnext); // We want to note our reference to bnext here incase it is MF_NOTHINK and gets removed!
if (!func(mobj)) if (!func(mobj))
{ {
P_SetTarget(&bnext, NULL); P_SetTarget(&bnext, NULL);
return false; return false;
} }
if (P_MobjWasRemoved(tmthing) // func just popped our tmthing, cannot continue. if (P_MobjWasRemoved(tmthing) // func just popped our tmthing, cannot continue.
|| (bnext && P_MobjWasRemoved(bnext))) // func just broke blockmap chain, cannot continue. || (bnext && P_MobjWasRemoved(bnext))) // func just broke blockmap chain, cannot continue.
{ {
@@ -1012,6 +1018,7 @@ boolean P_BlockThingsIterator(INT32 x, INT32 y, boolean (*func)(mobj_t *))
return true; return true;
} }
} }
P_SetTarget(&bnext, NULL); P_SetTarget(&bnext, NULL);
return true; return true;
} }
+9
View File
@@ -9167,6 +9167,11 @@ void P_MobjThinker(mobj_t *mobj)
|| P_WeaponOrPanel(mobj->type)) || P_WeaponOrPanel(mobj->type))
{ {
P_TryMove(mobj, mobj->x, mobj->y, true); // Sets mo->standingslope correctly P_TryMove(mobj, mobj->x, mobj->y, true); // Sets mo->standingslope correctly
//if (P_MobjWasRemoved(mobj))
if (!mobj) // anything that calls checkposition can be lethal
return;
P_ButteredSlope(mobj); P_ButteredSlope(mobj);
} }
@@ -9192,6 +9197,10 @@ void P_MobjThinker(mobj_t *mobj)
} }
} }
//if (P_MobjWasRemoved(mobj))
if (!mobj)
return; // obligatory paranoia check
// Can end up here if a player dies. // Can end up here if a player dies.
P_CycleMobjState(mobj); P_CycleMobjState(mobj);
+9 -4
View File
@@ -691,7 +691,7 @@ static void ArchiveLines(savebuffer_t *save)
if (spawnli->special == 321 || spawnli->special == 322) // only reason li->callcount would be non-zero is if either of these are involved if (spawnli->special == 321 || spawnli->special == 322) // only reason li->callcount would be non-zero is if either of these are involved
diff |= LD_CLLCOUNT; diff |= LD_CLLCOUNT;
if (li->sidenum[0] != 0xffff) if (li->sidenum[0] != NO_INDEX)
{ {
si = &sides[li->sidenum[0]]; si = &sides[li->sidenum[0]];
spawnsi = &spawnsides[li->sidenum[0]]; spawnsi = &spawnsides[li->sidenum[0]];
@@ -706,7 +706,8 @@ static void ArchiveLines(savebuffer_t *save)
if (si->midtexture != spawnsi->midtexture) if (si->midtexture != spawnsi->midtexture)
diff |= LD_S1MIDTEX; diff |= LD_S1MIDTEX;
} }
if (li->sidenum[1] != 0xffff)
if (li->sidenum[1] != NO_INDEX)
{ {
si = &sides[li->sidenum[1]]; si = &sides[li->sidenum[1]];
spawnsi = &spawnsides[li->sidenum[1]]; spawnsi = &spawnsides[li->sidenum[1]];
@@ -786,6 +787,7 @@ static void UnArchiveFFloors(savebuffer_t *save, const sector_t *ss)
I_Error("Sector does not have any ffloors!"); I_Error("Sector does not have any ffloors!");
fflr_i = READUINT16(save->p); // get first modified ffloor's number ready fflr_i = READUINT16(save->p); // get first modified ffloor's number ready
for (;;) // for some reason the usual for (rover = x; ...) thing doesn't work here? for (;;) // for some reason the usual for (rover = x; ...) thing doesn't work here?
{ {
if (fflr_i == 0xffff) // end of modified ffloors list, let's stop already if (fflr_i == 0xffff) // end of modified ffloors list, let's stop already
@@ -3510,7 +3512,7 @@ static void P_ReloadSaveLevelData(void)
li->firsttag = spawnli->firsttag; li->firsttag = spawnli->firsttag;
li->nexttag = spawnli->nexttag; li->nexttag = spawnli->nexttag;
if (li->sidenum[0] != 0xffff) if (li->sidenum[0] != NO_INDEX)
{ {
si = &sides[li->sidenum[0]]; si = &sides[li->sidenum[0]];
spawnsi = &spawnsides[li->sidenum[0]]; spawnsi = &spawnsides[li->sidenum[0]];
@@ -3521,7 +3523,7 @@ static void P_ReloadSaveLevelData(void)
si->midtexture = spawnsi->midtexture; si->midtexture = spawnsi->midtexture;
} }
if (li->sidenum[1] != 0xffff) if (li->sidenum[1] != NO_INDEX)
{ {
si = &sides[li->sidenum[1]]; si = &sides[li->sidenum[1]];
spawnsi = &spawnsides[li->sidenum[1]]; spawnsi = &spawnsides[li->sidenum[1]];
@@ -3588,8 +3590,11 @@ FUNCINLINE static ATTRINLINE boolean P_NetUnArchiveMisc(savebuffer_t *save, bool
if (!P_SetupLevel(true, reloading)) if (!P_SetupLevel(true, reloading))
{ {
CONS_Alert(CONS_ERROR, M_GetText("Can't load the level!\n")); CONS_Alert(CONS_ERROR, M_GetText("Can't load the level!\n"));
P_FreeCorruptMapWarnings();
return false; return false;
} }
P_PrintCorruptMapWarnings();
} }
else else
{ {
+207 -35
View File
@@ -188,6 +188,57 @@ FUNCNORETURN static ATTRNORETURN void CorruptMapError(const char *msg)
I_Error("Invalid or corrupt map.\nLook in log file or text console for technical details."); I_Error("Invalid or corrupt map.\nLook in log file or text console for technical details.");
} }
static char **mapwarnings = NULL;
static size_t nummapwarnings = 0;
// collect map errors we can fix clientside
// we then can print em when the map finishes loading
// so they actually appear and raise awareness shits fucked
// see G_DoLoadLevel as to why :chaosleep:
static void CorruptMapWarning(const char *msg)
{
#ifdef PARANOIA
// just error out
I_Error("%sThis WILL crash Vanilla clients!\n", msg);
#endif
nummapwarnings++;
mapwarnings = Z_Realloc(mapwarnings, nummapwarnings * sizeof(*mapwarnings), PU_STATIC, NULL);
mapwarnings[nummapwarnings-1] = Z_StrDup(msg);
}
void P_PrintCorruptMapWarnings(void)
{
size_t i;
if (!nummapwarnings)
return;
for (i = 0; i < nummapwarnings; i++)
{
CONS_Alert(CONS_ERROR, "%sAttempting to fix... This WILL crash Vanilla clients!\n", mapwarnings[i]);
}
P_FreeCorruptMapWarnings();
}
void P_FreeCorruptMapWarnings(void)
{
size_t i;
if (!nummapwarnings)
return;
for (i = 0; i < nummapwarnings; i++)
{
Z_Free(mapwarnings[i]);
mapwarnings[i] = NULL;
}
Z_Free(mapwarnings);
mapwarnings = NULL;
nummapwarnings = 0;
}
#define NUMLAPS_DEFAULT 3 #define NUMLAPS_DEFAULT 3
static void P_ClearMapHeaderLighting(mapheader_lighting_t *lighting) static void P_ClearMapHeaderLighting(mapheader_lighting_t *lighting)
@@ -437,8 +488,39 @@ static void P_LoadSegs(UINT8 *data)
for (i = 0; i < numsegs; i++, li++, ml++) for (i = 0; i < numsegs; i++, li++, ml++)
{ {
li->v1 = &vertexes[SHORT(ml->v1)]; INT16 v1, v2;
li->v2 = &vertexes[SHORT(ml->v2)];
v1 = SHORT(ml->v1);
v2 = SHORT(ml->v2);
// e6y
// check and fix wrong references to non-existent vertexes
// see e1m9 @ NIVELES.WAD
// http://www.doomworld.com/idgames/index.php?id=12647
if ((unsigned)v1 >= numvertexes || (unsigned)v2 >= numvertexes)
{
if ((unsigned)v1 >= numvertexes)
CorruptMapWarning(va("P_LoadSegs: seg %s references a non-existent vertex %d\n", sizeu1(i), v1));
if ((unsigned)v2 >= numvertexes)
CorruptMapWarning(va("P_LoadSegs: seg %s references a non-existent vertex %d\n", sizeu1(i), v2));
if (li->sidedef == &sides[li->linedef->sidenum[0]])
{
li->v1 = lines[ml->linedef].v1;
li->v2 = lines[ml->linedef].v2;
}
else
{
li->v1 = lines[ml->linedef].v2;
li->v2 = lines[ml->linedef].v1;
}
}
else
{
li->v1 = &vertexes[v1];
li->v2 = &vertexes[v2];
}
#ifdef HWRENDER #ifdef HWRENDER
if (rendermode == render_opengl) if (rendermode == render_opengl)
{ {
@@ -455,14 +537,59 @@ static void P_LoadSegs(UINT8 *data)
li->angle = (SHORT(ml->angle))<<FRACBITS; li->angle = (SHORT(ml->angle))<<FRACBITS;
li->offset = (SHORT(ml->offset))<<FRACBITS; li->offset = (SHORT(ml->offset))<<FRACBITS;
rawlinedef = SHORT(ml->linedef); rawlinedef = SHORT(ml->linedef);
//e6y: check for wrong indexes
if ((unsigned)rawlinedef >= numlines)
{
I_Error("P_LoadSegs: seg %s references a non-existent linedef %d", sizeu1(i), (unsigned)rawlinedef);
}
ldef = &lines[rawlinedef]; ldef = &lines[rawlinedef];
li->linedef = ldef; li->linedef = ldef;
li->side = rawside = SHORT(ml->side); rawside = SHORT(ml->side);
//e6y: fix wrong side index
if (rawside != 0 && rawside != 1)
{
CorruptMapWarning(va("P_LoadSegs: seg %s contains wrong side index %d.\n", sizeu1(i), rawside));
rawside = 1;
}
//e6y: check for wrong indexes
if (ldef->sidenum[rawside] >= numsides)
{
I_Error("P_LoadSegs: linedef %d for seg %s references a non-existent sidedef %d", rawlinedef, sizeu1(i), ldef->sidenum[rawside]);
}
li->side = rawside;
li->sidedef = &sides[ldef->sidenum[rawside]]; li->sidedef = &sides[ldef->sidenum[rawside]];
li->frontsector = sides[ldef->sidenum[rawside]].sector;
/* cph 2006/09/30 - our frontsector can be the second side of the
* linedef, so must check for NO_INDEX in case we are incorrectly
* referencing the back of a 1S line */
if (ldef->sidenum[rawside] == NO_INDEX)
{
CorruptMapWarning(va("P_LoadSegs: front of seg %s has no sidedef\n", sizeu1(i)));
li->frontsector = NULL;
}
else
{
li->frontsector = sides[ldef->sidenum[rawside]].sector;
}
if (ldef->flags & ML_TWOSIDED) if (ldef->flags & ML_TWOSIDED)
li->backsector = sides[ldef->sidenum[rawside^1]].sector; {
if (ldef->sidenum[rawside^1] == NO_INDEX)
{
CorruptMapWarning(va("P_LoadSegs: back of seg %s has no sidedef while being marked as double sided\n", sizeu1(i)));
li->backsector = NULL;
}
else
{
li->backsector = sides[ldef->sidenum[rawside^1]].sector;
}
}
P_UpdateSegLightOffset(li); P_UpdateSegLightOffset(li);
} }
@@ -738,7 +865,33 @@ static void P_LoadNodes(UINT8 *data)
for (j = 0; j < 2; j++) for (j = 0; j < 2; j++)
{ {
no->children[j] = SHORT(mn->children[j]); UINT16 child;
child = SHORT(mn->children[j]);
if (child & NF_SUBSECTOR)
{
// Convert to extended type
child &= ~NF_SUBSECTOR;
// haleyjd 11/06/10: check for invalid subsector reference
if (child >= numsubsectors)
{
CorruptMapWarning(va("P_LoadNodes: BSP tree %s references invalid subsector %d\n", sizeu1(i), child));
child = 0;
}
child |= NF_SUBSECTOR;
}
else if (child >= numnodes)
{
CorruptMapWarning(va("P_LoadNodes: BSP node %s references invalid node.\n", sizeu1(i)));
//I_Error("P_LoadNodes: BSP node %d references invalid node %d.\n", sizeu1(i), Index(((node_t *)no->children[j])));
child = 0;
}
no->children[j] = child;
for (k = 0; k < 4; k++) for (k = 0; k < 4; k++)
no->bbox[j][k] = SHORT(mn->bbox[j][k])<<FRACBITS; no->bbox[j][k] = SHORT(mn->bbox[j][k])<<FRACBITS;
} }
@@ -1001,9 +1154,9 @@ static void P_InitializeLinedef(line_t *ld)
// cph 2002/07/20 - these errors are fatal if not fixed, so apply them // cph 2002/07/20 - these errors are fatal if not fixed, so apply them
for (j = 0; j < 2; j++) for (j = 0; j < 2; j++)
{ {
if (ld->sidenum[j] != 0xffff && ld->sidenum[j] >= (UINT16)numsides) if (ld->sidenum[j] != NO_INDEX && ld->sidenum[j] >= (UINT16)numsides)
{ {
ld->sidenum[j] = 0xffff; ld->sidenum[j] = NO_INDEX;
CONS_Debug(DBG_SETUP, "P_InitializeLinedef: Linedef %s has out-of-range sidedef number\n", sizeu1((size_t)(ld - lines))); CONS_Debug(DBG_SETUP, "P_InitializeLinedef: Linedef %s has out-of-range sidedef number\n", sizeu1((size_t)(ld - lines)));
} }
} }
@@ -1011,23 +1164,24 @@ static void P_InitializeLinedef(line_t *ld)
ld->firsttag = ld->nexttag = -1; ld->firsttag = ld->nexttag = -1;
// killough 11/98: fix common wad errors (missing sidedefs): // killough 11/98: fix common wad errors (missing sidedefs):
if (ld->sidenum[0] == 0xffff) if (ld->sidenum[0] == NO_INDEX)
{ {
ld->sidenum[0] = 0; // Substitute dummy sidedef for missing right side ld->sidenum[0] = 0; // Substitute dummy sidedef for missing right side
// cph - print a warning about the bug // cph - print a warning about the bug
CONS_Debug(DBG_SETUP, "P_InitializeLinedef: Linedef %s missing first sidedef\n", sizeu1((size_t)(ld - lines))); CONS_Debug(DBG_SETUP, "P_InitializeLinedef: Linedef %s missing first sidedef\n", sizeu1((size_t)(ld - lines)));
} }
if ((ld->sidenum[1] == 0xffff) && (ld->flags & ML_TWOSIDED)) if ((ld->sidenum[1] == NO_INDEX) && (ld->flags & ML_TWOSIDED))
{ {
ld->flags &= ~ML_TWOSIDED; // Clear 2s flag for missing left side ld->flags &= ~ML_TWOSIDED; // Clear 2s flag for missing left side
// cph - print a warning about the bug // cph - print a warning about the bug
CONS_Debug(DBG_SETUP, "P_InitializeLinedef: Linedef %s has two-sided flag set, but no second sidedef\n", sizeu1((size_t)(ld - lines))); CONS_Debug(DBG_SETUP, "P_InitializeLinedef: Linedef %s has two-sided flag set, but no second sidedef\n", sizeu1((size_t)(ld - lines)));
} }
if (ld->sidenum[0] != 0xffff && ld->special) // killough 4/4/98: support special sidedef interpretation below
if (ld->sidenum[0] != NO_INDEX && ld->special)
sides[ld->sidenum[0]].special = ld->special; sides[ld->sidenum[0]].special = ld->special;
if (ld->sidenum[1] != 0xffff && ld->special) if (ld->sidenum[1] != NO_INDEX && ld->special)
sides[ld->sidenum[1]].special = ld->special; sides[ld->sidenum[1]].special = ld->special;
} }
@@ -1060,10 +1214,10 @@ static void P_LoadLineDefs2(void)
for (; i--; ld++) for (; i--; ld++)
{ {
ld->frontsector = sides[ld->sidenum[0]].sector; //e6y: Can't be -1 here ld->frontsector = sides[ld->sidenum[0]].sector; //e6y: Can't be -1 here
ld->backsector = ld->sidenum[1] != 0xffff ? sides[ld->sidenum[1]].sector : NULL; ld->backsector = ld->sidenum[1] != NO_INDEX ? sides[ld->sidenum[1]].sector : NULL;
// Repeat count for midtexture // Repeat count for midtexture
if ((ld->flags & ML_EFFECT5) && (ld->sidenum[1] != 0xffff)) if ((ld->flags & ML_EFFECT5) && (ld->sidenum[1] != NO_INDEX))
{ {
sides[ld->sidenum[0]].repeatcnt = (INT16)(((unsigned)sides[ld->sidenum[0]].textureoffset >> FRACBITS) >> 12); sides[ld->sidenum[0]].repeatcnt = (INT16)(((unsigned)sides[ld->sidenum[0]].textureoffset >> FRACBITS) >> 12);
sides[ld->sidenum[0]].textureoffset = (((unsigned)sides[ld->sidenum[0]].textureoffset >> FRACBITS) & 2047) << FRACBITS; sides[ld->sidenum[0]].textureoffset = (((unsigned)sides[ld->sidenum[0]].textureoffset >> FRACBITS) & 2047) << FRACBITS;
@@ -1079,13 +1233,13 @@ static void P_LoadLineDefs2(void)
{ {
size_t len = strlen(sides[ld->sidenum[0]].text)+1; size_t len = strlen(sides[ld->sidenum[0]].text)+1;
if (ld->sidenum[1] != 0xffff && sides[ld->sidenum[1]].text) if (ld->sidenum[1] != NO_INDEX && sides[ld->sidenum[1]].text)
len += strlen(sides[ld->sidenum[1]].text); len += strlen(sides[ld->sidenum[1]].text);
ld->text = Z_Malloc(len, PU_LEVEL, NULL); ld->text = Z_Malloc(len, PU_LEVEL, NULL);
memcpy(ld->text, sides[ld->sidenum[0]].text, strlen(sides[ld->sidenum[0]].text)+1); memcpy(ld->text, sides[ld->sidenum[0]].text, strlen(sides[ld->sidenum[0]].text)+1);
if (ld->sidenum[1] != 0xffff && sides[ld->sidenum[1]].text) if (ld->sidenum[1] != NO_INDEX && sides[ld->sidenum[1]].text)
memcpy(ld->text+strlen(ld->text)+1, sides[ld->sidenum[1]].text, strlen(sides[ld->sidenum[1]].text)+1); memcpy(ld->text+strlen(ld->text)+1, sides[ld->sidenum[1]].text, strlen(sides[ld->sidenum[1]].text)+1);
} }
break; break;
@@ -1747,16 +1901,11 @@ static boolean P_LoadRawBlockMap(UINT8 *data, size_t count)
// http://www.doomworld.com/idgames/index.php?id=12935 // http://www.doomworld.com/idgames/index.php?id=12935
if (!P_VerifyBlockMap(count)) if (!P_VerifyBlockMap(count))
{ {
#ifdef PARANOIA CorruptMapWarning(va("P_LoadBlockMap: corrupted or invalid BLOCKMAP lump! Check the log for more information.\n"));
I_Error("P_LoadBlockMap: erroneous BLOCKMAP lump may cause crashes.\n"); // vanilla WILL crash here anyways so just rebuild it ourselves
#endif Z_Free(blockmaplump);
CONS_Alert(CONS_ERROR, "P_LoadBlockMap: erroneous BLOCKMAP lump may cause crashes.\n"); blockmaplump = NULL;
return false;
//Z_Free(blockmaplump);
//blockmaplump = NULL;
//return false; // ideally we would just let the game rebuild the blockmap
// but this has a chance of desynching vanilla clients
// not sure whats worse honestly and i do not want to decide that :chaosleep:
} }
// clear out mobj chains // clear out mobj chains
@@ -1793,22 +1942,35 @@ static void P_GroupLines(void)
for (i = 0; i < numsubsectors; i++, ss++) for (i = 0; i < numsubsectors; i++, ss++)
{ {
if (ss->firstline >= numsegs) if (ss->firstline >= numsegs)
{
CorruptMapError(va("P_GroupLines: ss->firstline invalid " CorruptMapError(va("P_GroupLines: ss->firstline invalid "
"(subsector %s, firstline refers to %d of %s)", sizeu1(i), ss->firstline, "(subsector %s, firstline refers to %d of %s)", sizeu1(i), ss->firstline,
sizeu2(numsegs))); sizeu2(numsegs)));
}
seg = &segs[ss->firstline]; seg = &segs[ss->firstline];
sidei = (size_t)(seg->sidedef - sides); sidei = (size_t)(seg->sidedef - sides);
if (!seg->sidedef) if (!seg->sidedef)
{
CorruptMapError(va("P_GroupLines: seg->sidedef is NULL " CorruptMapError(va("P_GroupLines: seg->sidedef is NULL "
"(subsector %s, firstline is %d)", sizeu1(i), ss->firstline)); "(subsector %s, firstline is %d)", sizeu1(i), ss->firstline));
}
if (seg->sidedef - sides < 0 || seg->sidedef - sides > (UINT16)numsides) if (seg->sidedef - sides < 0 || seg->sidedef - sides > (UINT16)numsides)
{
CorruptMapError(va("P_GroupLines: seg->sidedef refers to sidedef %s of %s " CorruptMapError(va("P_GroupLines: seg->sidedef refers to sidedef %s of %s "
"(subsector %s, firstline is %d)", sizeu1(sidei), sizeu2(numsides), "(subsector %s, firstline is %d)", sizeu1(sidei), sizeu2(numsides),
sizeu3(i), ss->firstline)); sizeu3(i), ss->firstline));
}
if (!seg->sidedef->sector) if (!seg->sidedef->sector)
{
CorruptMapError(va("P_GroupLines: seg->sidedef->sector is NULL " CorruptMapError(va("P_GroupLines: seg->sidedef->sector is NULL "
"(subsector %s, firstline is %d, sidedef is %s)", sizeu1(i), ss->firstline, "(subsector %s, firstline is %d, sidedef is %s)", sizeu1(i), ss->firstline,
sizeu1(sidei))); sizeu1(sidei)));
}
ss->sector = seg->sidedef->sector; ss->sector = seg->sidedef->sector;
} }
@@ -1886,11 +2048,16 @@ static void P_LoadReject(UINT8 *data, size_t rejectsize)
{ {
if (rejectsize < neededsize) if (rejectsize < neededsize)
{ {
#ifdef PARANOIA CorruptMapWarning(va("P_LoadReject: REJECT is %s byte%s too small. REJECT might be invalid!\n", sizeu1(neededsize - rejectsize), (neededsize - rejectsize) == 1 ? "" : "s"));
I_Error("REJECT is %s byte%s too small. REJECT might be invalid and crash vanilla clients!\n", sizeu1(neededsize - rejectsize), (neededsize - rejectsize) == 1 ? "" : "s"); #ifdef COMPAT_VANILLA
#endif // we can pad this and somewhat prevent desyncs
CONS_Alert(CONS_ERROR, "REJECT is %s byte%s too small. REJECT might be invalid and crash vanilla clients!\n", sizeu1(neededsize - rejectsize), (neededsize - rejectsize) == 1 ? "" : "s"); // probs not cool if the reject is from a completely different map
// but whatever
allocsize = neededsize; allocsize = neededsize;
#else
rejectmatrix = NULL;
return;
#endif
} }
rejectmatrix = Z_Calloc(allocsize, PU_LEVEL, NULL); // allocate memory for the reject matrix rejectmatrix = Z_Calloc(allocsize, PU_LEVEL, NULL); // allocate memory for the reject matrix
@@ -2329,7 +2496,9 @@ static void P_LoadRecordGhosts(void)
if (!gpath) if (!gpath)
return; return;
sprintf(gpath,"%s"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s", srb2home, timeattackfolder, G_BuildMapName(gamemap)); const char *mapname = G_BuildMapName(gamemap);
sprintf(gpath,"%s"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s", srb2home, timeattackfolder, mapname);
// Best Time ghost // Best Time ghost
if (cv_ghost_besttime.value) if (cv_ghost_besttime.value)
@@ -2379,9 +2548,10 @@ static void P_LoadRecordGhosts(void)
{ {
lumpnum_t l; lumpnum_t l;
UINT8 j = 1; UINT8 j = 1;
while (j <= 99 && (l = W_CheckNumForName(va("%sS%02u",G_BuildMapName(gamemap),j))) != LUMPERROR)
while (j <= 99 && (l = W_CheckNumForName(va("%sS%02u", mapname, j))) != LUMPERROR)
{ {
G_AddGhost(va("%sS%02u",G_BuildMapName(gamemap),j)); G_AddGhost(va("%sS%02u", mapname, j));
j++; j++;
} }
} }
@@ -2423,10 +2593,12 @@ static void P_InitMinimapInfo(void)
Patch_Free(minimapinfo.minimap_pic); Patch_Free(minimapinfo.minimap_pic);
minimapinfo.minimap_pic = NULL; minimapinfo.minimap_pic = NULL;
lumpnum = W_CheckNumForName(va("%sR", G_BuildMapName(gamemap))); const char *mapname = G_BuildMapName(gamemap);
lumpnum = W_CheckNumForName(va("%sR", mapname));
if (lumpnum != LUMPERROR) if (lumpnum != LUMPERROR)
minimapinfo.minimap_pic = W_CachePatchName(va("%sR", G_BuildMapName(gamemap)), PU_PATCH); minimapinfo.minimap_pic = W_CachePatchName(va("%sR", mapname), PU_PATCH);
minimapinfo.min_x = bsp->bbox[0][BOXLEFT]; minimapinfo.min_x = bsp->bbox[0][BOXLEFT];
minimapinfo.max_x = bsp->bbox[0][BOXRIGHT]; minimapinfo.max_x = bsp->bbox[0][BOXRIGHT];
+3
View File
@@ -114,6 +114,9 @@ size_t P_PrecacheLevelFlats(void);
void P_AllocMapHeader(INT16 i); void P_AllocMapHeader(INT16 i);
void P_PrintCorruptMapWarnings(void);
void P_FreeCorruptMapWarnings(void);
#ifdef __cplusplus #ifdef __cplusplus
} // extern "C" } // extern "C"
#endif #endif
+9 -9
View File
@@ -889,7 +889,7 @@ static boolean PolyDoor(line_t *line)
pdd.angle = line->angle; // angle of motion pdd.angle = line->angle; // angle of motion
pdd.distance = sides[line->sidenum[0]].rowoffset; pdd.distance = sides[line->sidenum[0]].rowoffset;
if (line->sidenum[1] != 0xffff) if (line->sidenum[1] != NO_INDEX)
pdd.delay = sides[line->sidenum[1]].textureoffset >> FRACBITS; // delay in tics pdd.delay = sides[line->sidenum[1]].textureoffset >> FRACBITS; // delay in tics
else else
pdd.delay = 0; pdd.delay = 0;
@@ -899,7 +899,7 @@ static boolean PolyDoor(line_t *line)
pdd.speed = sides[line->sidenum[0]].textureoffset >> FRACBITS; // angular speed pdd.speed = sides[line->sidenum[0]].textureoffset >> FRACBITS; // angular speed
pdd.distance = sides[line->sidenum[0]].rowoffset >> FRACBITS; // angular distance pdd.distance = sides[line->sidenum[0]].rowoffset >> FRACBITS; // angular distance
if (line->sidenum[1] != 0xffff) if (line->sidenum[1] != NO_INDEX)
pdd.delay = sides[line->sidenum[1]].textureoffset >> FRACBITS; // delay in tics pdd.delay = sides[line->sidenum[1]].textureoffset >> FRACBITS; // delay in tics
else else
pdd.delay = 0; pdd.delay = 0;
@@ -1989,8 +1989,8 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
INT32 position = (INT32)max(sides[line->sidenum[0]].midtexture, 0); INT32 position = (INT32)max(sides[line->sidenum[0]].midtexture, 0);
UINT32 prefadems = (UINT32)max(sides[line->sidenum[0]].textureoffset >> FRACBITS, 0); UINT32 prefadems = (UINT32)max(sides[line->sidenum[0]].textureoffset >> FRACBITS, 0);
UINT32 postfadems = (UINT32)max(sides[line->sidenum[0]].rowoffset >> FRACBITS, 0); UINT32 postfadems = (UINT32)max(sides[line->sidenum[0]].rowoffset >> FRACBITS, 0);
UINT8 fadetarget = (UINT8)max((line->sidenum[1] != 0xffff) ? sides[line->sidenum[1]].textureoffset >> FRACBITS : 0, 0); UINT8 fadetarget = (UINT8)max((line->sidenum[1] != NO_INDEX) ? sides[line->sidenum[1]].textureoffset >> FRACBITS : 0, 0);
INT16 fadesource = (INT16)max((line->sidenum[1] != 0xffff) ? sides[line->sidenum[1]].rowoffset >> FRACBITS : -1, -1); INT16 fadesource = (INT16)max((line->sidenum[1] != NO_INDEX) ? sides[line->sidenum[1]].rowoffset >> FRACBITS : -1, -1);
// Seek offset from current song position // Seek offset from current song position
if (line->flags & ML_EFFECT1) if (line->flags & ML_EFFECT1)
@@ -2504,7 +2504,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
var1 = sides[line->sidenum[0]].toptexture; //(line->dx>>FRACBITS)-1; var1 = sides[line->sidenum[0]].toptexture; //(line->dx>>FRACBITS)-1;
if (line->sidenum[1] != 0xffff && line->flags & ML_BLOCKMONSTERS) // read power from back sidedef if (line->sidenum[1] != NO_INDEX && line->flags & ML_BLOCKMONSTERS) // read power from back sidedef
var2 = sides[line->sidenum[1]].toptexture; var2 = sides[line->sidenum[1]].toptexture;
else if (line->flags & ML_NOCLIMB) // 'Infinite' else if (line->flags & ML_NOCLIMB) // 'Infinite'
var2 = UINT16_MAX; var2 = UINT16_MAX;
@@ -2633,7 +2633,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
if (always || this->bottomtexture) if (always || this->bottomtexture)
this->bottomtexture = set->bottomtexture; this->bottomtexture = set->bottomtexture;
if (lines[linenum].sidenum[1] == 0xffff) if (lines[linenum].sidenum[1] == NO_INDEX)
continue; // One-sided stops here. continue; // One-sided stops here.
// Back side // Back side
@@ -2682,7 +2682,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
sector_t *sec; sector_t *sec;
mobj_t *thing; mobj_t *thing;
if (line->sidenum[1] != 0xffff) if (line->sidenum[1] != NO_INDEX)
state = (statenum_t)sides[line->sidenum[1]].toptexture; state = (statenum_t)sides[line->sidenum[1]].toptexture;
while ((secnum = P_FindSectorFromLineTag(line, secnum)) >= 0) while ((secnum = P_FindSectorFromLineTag(line, secnum)) >= 0)
@@ -6056,7 +6056,7 @@ void P_SpawnSpecials(INT32 fromnetsave, boolean reloadinggamestate)
break; break;
case 259: // Make-Your-Own FOF! case 259: // Make-Your-Own FOF!
if (lines[i].sidenum[1] != 0xffff) if (lines[i].sidenum[1] != NO_INDEX)
{ {
UINT8 *data; UINT8 *data;
UINT16 b; UINT16 b;
@@ -6785,7 +6785,7 @@ static void P_SpawnScrollers(void)
case 506: case 506:
s = lines[i].sidenum[1]; s = lines[i].sidenum[1];
if (s != 0xffff) if (s != NO_INDEX)
Add_Scroller(sc_side, -sides[s].textureoffset, sides[s].rowoffset, -1, lines[i].sidenum[0], accel, 0); Add_Scroller(sc_side, -sides[s].textureoffset, sides[s].rowoffset, -1, lines[i].sidenum[0], accel, 0);
else else
CONS_Debug(DBG_GAMELOGIC, "Line special 506 (line #%s) missing 2nd side!\n", sizeu1(i)); CONS_Debug(DBG_GAMELOGIC, "Line special 506 (line #%s) missing 2nd side!\n", sizeu1(i));
+1 -1
View File
@@ -3739,7 +3739,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
fixed_t f1, f2; fixed_t f1, f2;
// We probably shouldn't move the camera if there is no player or player mobj somehow // We probably shouldn't move the camera if there is no player or player mobj somehow
if (!player || !player->mo) if (!player || P_MobjWasRemoved(player->mo))
return true; return true;
// This can happen when joining // This can happen when joining
+1 -1
View File
@@ -430,7 +430,7 @@ typedef struct line_s
INT16 tag; INT16 tag;
// Visual appearance: sidedefs. // Visual appearance: sidedefs.
UINT16 sidenum[2]; // sidenum[1] will be 0xffff if one-sided UINT16 sidenum[2]; // sidenum[1] will be NO_INDEX if one-sided
fixed_t alpha; // translucency fixed_t alpha; // translucency
UINT8 blendmode; // blendmode UINT8 blendmode; // blendmode
+19 -14
View File
@@ -311,6 +311,7 @@ static void R_RenderMaskedSegLoop(drawcolumndata_t* dc, drawseg_t *drawseg, INT3
{ {
rw_scalestep = drawseg->scalestep; rw_scalestep = drawseg->scalestep;
spryscale = drawseg->scale1 + (x1 - drawseg->x1)*rw_scalestep; spryscale = drawseg->scale1 + (x1 - drawseg->x1)*rw_scalestep;
if (dc->numlights) if (dc->numlights)
{ // reset all lights to their starting heights { // reset all lights to their starting heights
for (i = 0; i < dc->numlights; i++) for (i = 0; i < dc->numlights; i++)
@@ -435,6 +436,7 @@ static void R_RenderMaskedSegLoop(drawcolumndata_t* dc, drawseg_t *drawseg, INT3
windowtop = windowbottom + 1; windowtop = windowbottom + 1;
set_colormap_below_light(); set_colormap_below_light();
} }
windowbottom = realbot; windowbottom = realbot;
if (windowtop < windowbottom) if (windowtop < windowbottom)
colfunc_2s(dc, col); colfunc_2s(dc, col);
@@ -2204,7 +2206,7 @@ void R_StoreWallRange(INT32 start, INT32 stop)
topremap = (encoremap && !(curline->linedef->flags & ML_TFERLINE)); topremap = (encoremap && !(curline->linedef->flags & ML_TFERLINE));
if ((linedef->flags & (ML_DONTPEGTOP) && (linedef->flags & ML_DONTPEGBOTTOM)) if ((linedef->flags & (ML_DONTPEGTOP) && (linedef->flags & ML_DONTPEGBOTTOM))
&& linedef->sidenum[1] != 0xffff) && linedef->sidenum[1] != NO_INDEX)
{ {
// Special case... use offsets from 2nd side but only if it has a texture. // Special case... use offsets from 2nd side but only if it has a texture.
side_t *def = &sides[linedef->sidenum[1]]; side_t *def = &sides[linedef->sidenum[1]];
@@ -2615,8 +2617,8 @@ void R_StoreWallRange(INT32 start, INT32 stop)
auto set_topstep_normal = [&] auto set_topstep_normal = [&]
{ {
topstep = -FixedMul (rw_scalestep, worldtop); topstep = -FixedMul(rw_scalestep, worldtop);
topfrac = (centeryfrac>>4) - FixedMul (worldtop, rw_scale); topfrac = (centeryfrac>>4) - FixedMul(worldtop, rw_scale);
}; };
// untextured seg // untextured seg
@@ -2625,7 +2627,7 @@ void R_StoreWallRange(INT32 start, INT32 stop)
const bool tophigh = (worldhigh <= worldtop && worldhighslope <= worldtopslope); const bool tophigh = (worldhigh <= worldtop && worldhighslope <= worldtopslope);
// if we cant see the goddamn skyplane, well there wont be any skybox // if we cant see the goddamn skyplane, well there wont be any skybox
// we could kill skyVisible instead, but i want to keep the performance improvemnts it yields // we could kill skyVisible instead, but i want to keep the performance improvements it yields
// so we do this absolute trash // so we do this absolute trash
if ((tophigh if ((tophigh
&& (frontsector->floorpic != skyflatnum && frontsector->ceilingpic != skyflatnum)) // try to guess if its a "window" && (frontsector->floorpic != skyflatnum && frontsector->ceilingpic != skyflatnum)) // try to guess if its a "window"
@@ -2637,14 +2639,16 @@ void R_StoreWallRange(INT32 start, INT32 stop)
// this is an attempt to fix issues with textureless single sided lines drawing nothing where they should just draw sky instead // this is an attempt to fix issues with textureless single sided lines drawing nothing where they should just draw sky instead
if (tophigh && !backsector && frontsector->ceilingpic == skyflatnum) if (tophigh && !backsector && frontsector->ceilingpic == skyflatnum)
{ {
topstep = -FixedMul (rw_scalestep, worldbottom);
topfrac = (centeryfrac>>4) - FixedMul (worldbottom, rw_scale);
// account for slopes to try and get rid of sharp edges from the black void // account for slopes to try and get rid of sharp edges from the black void
if (frontsector->f_slope || (backsector && backsector->f_slope)) if (frontsector->f_slope || (backsector && backsector->f_slope))
{ {
topstep = -FixedMul (rw_scalestep, worldbottomslope); topstep = -FixedMul(rw_scalestep, worldbottomslope);
topfrac = (centeryfrac>>4) - FixedMul (worldbottomslope, rw_scale); topfrac = (centeryfrac>>4) - FixedMul(worldbottomslope, rw_scale);
}
else
{
topstep = -FixedMul(rw_scalestep, worldbottom);
topfrac = (centeryfrac>>4) - FixedMul(worldbottom, rw_scale);
} }
} }
else else
@@ -2653,18 +2657,18 @@ void R_StoreWallRange(INT32 start, INT32 stop)
else else
set_topstep_normal(); set_topstep_normal();
bottomstep = -FixedMul (rw_scalestep, worldbottom); bottomstep = -FixedMul(rw_scalestep, worldbottom);
bottomfrac = (centeryfrac>>4) - FixedMul (worldbottom, rw_scale); bottomfrac = (centeryfrac>>4) - FixedMul(worldbottom, rw_scale);
if (frontsector->c_slope) if (frontsector->c_slope)
{ {
fixed_t topfracend = (centeryfrac>>4) - FixedMul (worldtopslope, ds_p->scale2); fixed_t topfracend = (centeryfrac>>4) - FixedMul(worldtopslope, ds_p->scale2);
topstep = (topfracend-topfrac)/(range); topstep = (topfracend-topfrac)/(range);
} }
if (frontsector->f_slope) if (frontsector->f_slope)
{ {
fixed_t bottomfracend = (centeryfrac>>4) - FixedMul (worldbottomslope, ds_p->scale2); fixed_t bottomfracend = (centeryfrac>>4) - FixedMul(worldbottomslope, ds_p->scale2);
bottomstep = (bottomfracend-bottomfrac)/(range); bottomstep = (bottomfracend-bottomfrac)/(range);
} }
} }
@@ -2782,7 +2786,7 @@ void R_StoreWallRange(INT32 start, INT32 stop)
if (bottomtexture) if (bottomtexture)
{ {
fixed_t bottomfracend = (centeryfrac>>4) - FixedMul (worldlowslope, ds_p->scale2); fixed_t bottomfracend = (centeryfrac>>4) - FixedMul(worldlowslope, ds_p->scale2);
pixlow = (centeryfrac>>4) - FixedMul (worldlow, rw_scale); pixlow = (centeryfrac>>4) - FixedMul (worldlow, rw_scale);
pixlowstep = (bottomfracend-pixlow)/(range); pixlowstep = (bottomfracend-pixlow)/(range);
@@ -3045,6 +3049,7 @@ void R_StoreWallRange(INT32 start, INT32 stop)
ds_p->silhouette |= SIL_BOTTOM; ds_p->silhouette |= SIL_BOTTOM;
ds_p->bsilheight = backsector->f_slope ? INT32_MAX : backsector->floorheight; ds_p->bsilheight = backsector->f_slope ? INT32_MAX : backsector->floorheight;
} }
if (!(ds_p->silhouette & SIL_TOP)) if (!(ds_p->silhouette & SIL_TOP))
{ {
ds_p->silhouette |= SIL_TOP; ds_p->silhouette |= SIL_TOP;
+1 -1
View File
@@ -131,7 +131,7 @@ void R_AddWallSplat(line_t *wallline, INT16 sectorside, const char *patchname, f
// set the splat // set the splat
splat->patch = W_GetNumForName(patchname); splat->patch = W_GetNumForName(patchname);
sectorside ^= 1; sectorside ^= 1;
if (wallline->sidenum[sectorside] != 0xffff) if (wallline->sidenum[sectorside] != NO_INDEX)
{ {
backsector = sides[wallline->sidenum[sectorside]].sector; backsector = sides[wallline->sidenum[sectorside]].sector;
+1
View File
@@ -937,6 +937,7 @@ static boolean S_AdjustSoundParams(const mobj_t *listener, const mobj_t *source,
listener_t listensource; listener_t listensource;
INT32 i; INT32 i;
// e6y
if (!listener) if (!listener)
return false; return false;