Merge branch 'next' of https://git.magicalgirl.moe/STJr/SRB2.git into special_save

# Conflicts:
#	src/g_game.c
This commit is contained in:
toaster 2020-06-25 10:48:36 +01:00
commit f258131e55
25 changed files with 369 additions and 453 deletions

View file

@ -1156,7 +1156,7 @@ UINT8 CanChangeSkin(INT32 playernum)
// Server has skin change restrictions.
if (cv_restrictskinchange.value)
{
if (gametype == GT_COOP)
if (gametyperules & GTR_FRIENDLY)
return true;
// Can change skin during initial countdown.
@ -1747,7 +1747,7 @@ void D_MapChange(INT32 mapnum, INT32 newgametype, boolean pultmode, boolean rese
}
CONS_Debug(DBG_GAMELOGIC, "Map change: mapnum=%d gametype=%d ultmode=%d resetplayers=%d delay=%d skipprecutscene=%d\n",
mapnum, newgametype, pultmode, resetplayers, delay, skipprecutscene);
if ((netgame || multiplayer) && !((gametype == newgametype) && (newgametype == GT_COOP)))
if ((netgame || multiplayer) && !((gametype == newgametype) && (gametypedefaultrules[newgametype] & GTR_CAMPAIGN)))
FLS = false;
if (delay != 2)
@ -1989,7 +1989,7 @@ static void Command_Map_f(void)
fromlevelselect =
( netgame || multiplayer ) &&
newgametype == gametype &&
newgametype == GT_COOP;
gametypedefaultrules[newgametype] & GTR_CAMPAIGN;
}
}
@ -2779,7 +2779,7 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum)
players[playernum].spectator = false;
//If joining after hidetime in normal tag, default to being IT.
if (gametype == GT_TAG && (leveltime > (hidetime * TICRATE)))
if (((gametyperules & (GTR_TAG|GTR_HIDEFROZEN)) == GTR_TAG) && (leveltime > (hidetime * TICRATE)))
{
NetPacket.packet.newteam = 1; //minor hack, causes the "is it" message to be printed later.
players[playernum].pflags |= PF_TAGIT; //make the player IT.
@ -3627,7 +3627,7 @@ static void PointLimit_OnChange(void)
static void NumLaps_OnChange(void)
{
// Just don't be verbose
if (gametype == GT_RACE)
if ((gametyperules & (GTR_RACE|GTR_LIVES)) == GTR_RACE)
CONS_Printf(M_GetText("Number of laps set to %d\n"), cv_numlaps.value);
}
@ -3741,7 +3741,7 @@ static void ExitMove_OnChange(void)
{
UINT8 i;
if (!(netgame || multiplayer) || gametype != GT_COOP)
if (!(netgame || multiplayer) || !(gametyperules & GTR_FRIENDLY))
return;
if (cv_exitmove.value)
@ -4615,7 +4615,7 @@ static void Command_ShowTime_f(void)
static void BaseNumLaps_OnChange(void)
{
if (gametype == GT_RACE)
if ((gametyperules & (GTR_RACE|GTR_LIVES)) == GTR_RACE)
{
if (cv_basenumlaps.value)
CONS_Printf(M_GetText("Number of laps will be changed to map defaults next round.\n"));

View file

@ -5756,10 +5756,12 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
"S_FANG_PINCHPATHINGSTART1",
"S_FANG_PINCHPATHINGSTART2",
"S_FANG_PINCHPATHING",
"S_FANG_PINCHBOUNCE0",
"S_FANG_PINCHBOUNCE1",
"S_FANG_PINCHBOUNCE2",
"S_FANG_PINCHBOUNCE3",
"S_FANG_PINCHBOUNCE4",
"S_FANG_PINCHFALL0",
"S_FANG_PINCHFALL1",
"S_FANG_PINCHFALL2",
"S_FANG_PINCHSKID1",

View file

@ -2067,7 +2067,7 @@ boolean G_Responder(event_t *ev)
&& players[displayplayer].ctfteam != players[consoleplayer].ctfteam)
continue;
}
else if (gametype == GT_HIDEANDSEEK)
else if (gametyperules & GTR_HIDEFROZEN)
{
if (players[consoleplayer].pflags & PF_TAGIT)
continue;
@ -2618,7 +2618,7 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps)
S_ChangeMusicEx(mapmusname, mapmusflags, true, mapmusposition, 0, 0);
}
if (gametype == GT_COOP)
if (gametyperules & GTR_EMERALDHUNT)
P_FindEmerald(); // scan for emeralds to hunt for
// If NiGHTS, find lowest mare to start with.
@ -2786,6 +2786,26 @@ mapthing_t *G_FindCoopStart(INT32 playernum)
return NULL;
}
// Find a Co-op start, or fallback into other types of starts.
static inline mapthing_t *G_FindCoopStartOrFallback(INT32 playernum)
{
mapthing_t *spawnpoint = NULL;
if (!(spawnpoint = G_FindCoopStart(playernum)) // find a Co-op start
&& !(spawnpoint = G_FindMatchStart(playernum))) // find a DM start
spawnpoint = G_FindCTFStart(playernum); // fallback
return spawnpoint;
}
// Find a Match start, or fallback into other types of starts.
static inline mapthing_t *G_FindMatchStartOrFallback(INT32 playernum)
{
mapthing_t *spawnpoint = NULL;
if (!(spawnpoint = G_FindMatchStart(playernum)) // find a DM start
&& !(spawnpoint = G_FindCTFStart(playernum))) // find a CTF start
spawnpoint = G_FindCoopStart(playernum); // fallback
return spawnpoint;
}
mapthing_t *G_FindMapStart(INT32 playernum)
{
mapthing_t *spawnpoint;
@ -2793,9 +2813,22 @@ mapthing_t *G_FindMapStart(INT32 playernum)
if (!playeringame[playernum])
return NULL;
// -- Spectators --
// Order in platform gametypes: Coop->DM->CTF
// And, with deathmatch starts: DM->CTF->Coop
if (players[playernum].spectator)
{
// In platform gametypes, spawn in Co-op starts first
// Overriden by GTR_DEATHMATCHSTARTS.
if (G_PlatformGametype() && !(gametyperules & GTR_DEATHMATCHSTARTS))
spawnpoint = G_FindCoopStartOrFallback(playernum);
else
spawnpoint = G_FindMatchStartOrFallback(playernum);
}
// -- CTF --
// Order: CTF->DM->Coop
if ((gametyperules & (GTR_TEAMFLAGS|GTR_TEAMS)) && players[playernum].ctfteam)
else if ((gametyperules & (GTR_TEAMFLAGS|GTR_TEAMS)) && players[playernum].ctfteam)
{
if (!(spawnpoint = G_FindCTFStart(playernum)) // find a CTF start
&& !(spawnpoint = G_FindMatchStart(playernum))) // find a DM start
@ -2804,21 +2837,13 @@ mapthing_t *G_FindMapStart(INT32 playernum)
// -- DM/Tag/CTF-spectator/etc --
// Order: DM->CTF->Coop
else if ((gametyperules & GTR_DEATHMATCHSTARTS) && !(players[playernum].pflags & PF_TAGIT))
{
if (!(spawnpoint = G_FindMatchStart(playernum)) // find a DM start
&& !(spawnpoint = G_FindCTFStart(playernum))) // find a CTF start
spawnpoint = G_FindCoopStart(playernum); // fallback
}
else if (G_TagGametype() ? (!(players[playernum].pflags & PF_TAGIT)) : (gametyperules & GTR_DEATHMATCHSTARTS))
spawnpoint = G_FindMatchStartOrFallback(playernum);
// -- Other game modes --
// Order: Coop->DM->CTF
else
{
if (!(spawnpoint = G_FindCoopStart(playernum)) // find a Co-op start
&& !(spawnpoint = G_FindMatchStart(playernum))) // find a DM start
spawnpoint = G_FindCTFStart(playernum); // fallback
}
spawnpoint = G_FindCoopStartOrFallback(playernum);
//No spawns found. ANYWHERE.
if (!spawnpoint)
@ -2904,7 +2929,7 @@ void G_DoReborn(INT32 playernum)
return;
}
if (countdowntimeup || (!(netgame || multiplayer) && gametype == GT_COOP))
if (countdowntimeup || (!(netgame || multiplayer) && (gametyperules & GTR_CAMPAIGN)))
resetlevel = true;
else if ((G_GametypeUsesCoopLives() || G_GametypeUsesCoopStarposts()) && (netgame || multiplayer) && !G_IsSpecialStage(gamemap))
{
@ -3109,7 +3134,7 @@ void G_AddPlayer(INT32 playernum)
p->height = mobjinfo[MT_PLAYER].height;
if (G_GametypeUsesLives() || ((netgame || multiplayer) && gametype == GT_COOP))
if (G_GametypeUsesLives() || ((netgame || multiplayer) && (gametyperules & GTR_FRIENDLY)))
p->lives = cv_startinglives.value;
if ((countplayers && !notexiting) || G_IsSpecialStage(gamemap))
@ -3158,7 +3183,7 @@ void G_ExitLevel(void)
CV_SetValue(&cv_teamscramble, cv_scrambleonchange.value);
}
if (!(gametyperules & GTR_CAMPAIGN))
if (!(gametyperules & (GTR_FRIENDLY|GTR_CAMPAIGN)))
CONS_Printf(M_GetText("The round has ended.\n"));
// Remove CEcho text on round end.
@ -3224,7 +3249,7 @@ UINT32 gametypedefaultrules[NUMGAMETYPES] =
// Tag
GTR_RINGSLINGER|GTR_FIRSTPERSON|GTR_TAG|GTR_SPECTATORS|GTR_POINTLIMIT|GTR_TIMELIMIT|GTR_OVERTIME|GTR_STARTCOUNTDOWN|GTR_BLINDFOLDED|GTR_DEATHMATCHSTARTS|GTR_SPAWNINVUL|GTR_RESPAWNDELAY,
// Hide and Seek
GTR_RINGSLINGER|GTR_FIRSTPERSON|GTR_TAG|GTR_SPECTATORS|GTR_POINTLIMIT|GTR_TIMELIMIT|GTR_OVERTIME|GTR_STARTCOUNTDOWN|GTR_BLINDFOLDED|GTR_DEATHMATCHSTARTS|GTR_SPAWNINVUL|GTR_RESPAWNDELAY,
GTR_RINGSLINGER|GTR_FIRSTPERSON|GTR_TAG|GTR_SPECTATORS|GTR_POINTLIMIT|GTR_TIMELIMIT|GTR_OVERTIME|GTR_STARTCOUNTDOWN|GTR_HIDEFROZEN|GTR_BLINDFOLDED|GTR_DEATHMATCHSTARTS|GTR_SPAWNINVUL|GTR_RESPAWNDELAY,
// CTF
GTR_RINGSLINGER|GTR_FIRSTPERSON|GTR_SPECTATORS|GTR_TEAMS|GTR_TEAMFLAGS|GTR_POINTLIMIT|GTR_TIMELIMIT|GTR_OVERTIME|GTR_POWERSTONES|GTR_DEATHMATCHSTARTS|GTR_SPAWNINVUL|GTR_RESPAWNDELAY|GTR_PITYSHIELD,
@ -3569,6 +3594,16 @@ boolean G_PlatformGametype(void)
return (!(gametyperules & GTR_RINGSLINGER));
}
//
// G_CoopGametype
//
// Returns true if a gametype is a Co-op gametype.
//
boolean G_CoopGametype(void)
{
return ((gametyperules & (GTR_FRIENDLY|GTR_CAMPAIGN)) == (GTR_FRIENDLY|GTR_CAMPAIGN));
}
//
// G_TagGametype
//
@ -3834,7 +3869,10 @@ static void G_DoCompleted(void)
if (nextmap < NUMMAPS && !mapheaderinfo[nextmap])
P_AllocMapHeader(nextmap);
if ((skipstats && !modeattacking) || (spec && modeattacking && stagefailed))
// If the current gametype has no intermission screen set, then don't start it.
Y_DetermineIntermissionType();
if ((skipstats && !modeattacking) || (spec && modeattacking && stagefailed) || (intertype == int_none))
{
G_UpdateVisited();
G_AfterIntermission();
@ -3860,7 +3898,7 @@ static void G_DoCompleted(void)
remove(liveeventbackup);
cursaveslot = 0;
}
else if ((!modifiedgame || savemoddata) && !(netgame || multiplayer))
else if ((!modifiedgame || savemoddata) && !(netgame || multiplayer || ultimatemode || demorecording || metalrecording || modeattacking))
G_SaveGame((UINT32)cursaveslot, spstage_start);
}
}
@ -3886,7 +3924,7 @@ void G_AfterIntermission(void)
HU_ClearCEcho();
if ((gametyperules & GTR_CUTSCENES) && mapheaderinfo[gamemap-1]->cutscenenum && !modeattacking && skipstats <= 1 && !(marathonmode & MA_NOCUTSCENES)) // Start a custom cutscene.
if ((gametyperules & GTR_CUTSCENES) && mapheaderinfo[gamemap-1]->cutscenenum && !modeattacking && skipstats <= 1 && (gamecomplete || !(marathonmode & MA_NOCUTSCENES))) // Start a custom cutscene.
F_StartCustomCutscene(mapheaderinfo[gamemap-1]->cutscenenum-1, false, false);
else
{
@ -3912,7 +3950,7 @@ static void G_DoWorldDone(void)
{
if (server)
{
if (gametype == GT_COOP)
if (gametyperules & GTR_CAMPAIGN)
// don't reset player between maps
D_MapChange(nextmap+1, gametype, ultimatemode, false, 0, false, false);
else

View file

@ -191,6 +191,7 @@ boolean G_GametypeHasTeams(void);
boolean G_GametypeHasSpectators(void);
boolean G_RingSlingerGametype(void);
boolean G_PlatformGametype(void);
boolean G_CoopGametype(void);
boolean G_TagGametype(void);
boolean G_CompetitionGametype(void);
boolean G_EnoughPlayersFinished(void);

View file

@ -61,9 +61,6 @@ typedef struct
// equivalent of the software renderer's vissprites
typedef struct gr_vissprite_s
{
// Doubly linked list
struct gr_vissprite_s *prev;
struct gr_vissprite_s *next;
float x1, x2;
float tz, ty;
//lumpnum_t patchlumpnum;

View file

@ -4179,96 +4179,45 @@ static inline void HWR_DrawPrecipitationSprite(gr_vissprite_t *spr)
// --------------------------------------------------------------------------
// Sort vissprites by distance
// --------------------------------------------------------------------------
static gr_vissprite_t gr_vsprsortedhead;
gr_vissprite_t* gr_vsprorder[MAXVISSPRITES];
static void HWR_SortVisSprites(void)
// Note: For more correct transparency the transparent sprites would need to be
// sorted and drawn together with transparent surfaces.
static int CompareVisSprites(const void *p1, const void *p2)
{
UINT32 i;
gr_vissprite_t *ds, *dsprev, *dsnext, *dsfirst;
gr_vissprite_t *best = NULL;
gr_vissprite_t unsorted;
float bestdist = 0.0f;
INT32 bestdispoffset = 0;
if (!gr_visspritecount)
return;
dsfirst = HWR_GetVisSprite(0);
for (i = 0, dsnext = dsfirst, ds = NULL; i < gr_visspritecount; i++)
{
dsprev = ds;
ds = dsnext;
if (i < gr_visspritecount - 1) dsnext = HWR_GetVisSprite(i + 1);
ds->next = dsnext;
ds->prev = dsprev;
}
// Fix first and last. ds still points to the last one after the loop
dsfirst->prev = &unsorted;
unsorted.next = dsfirst;
if (ds)
ds->next = &unsorted;
unsorted.prev = ds;
// pull the vissprites out by scale
gr_vsprsortedhead.next = gr_vsprsortedhead.prev = &gr_vsprsortedhead;
for (i = 0; i < gr_visspritecount; i++)
{
best = NULL;
for (ds = unsorted.next; ds != &unsorted; ds = ds->next)
{
if (!best || ds->tz > bestdist)
{
bestdist = ds->tz;
bestdispoffset = ds->dispoffset;
best = ds;
}
// order visprites of same scale by dispoffset, smallest first
else if (fabsf(ds->tz - bestdist) < 1.0E-36f && ds->dispoffset < bestdispoffset)
{
bestdispoffset = ds->dispoffset;
best = ds;
}
}
if (best)
{
best->next->prev = best->prev;
best->prev->next = best->next;
best->next = &gr_vsprsortedhead;
best->prev = gr_vsprsortedhead.prev;
}
gr_vsprsortedhead.prev->next = best;
gr_vsprsortedhead.prev = best;
}
gr_vissprite_t* spr1 = *(gr_vissprite_t*const*)p1;
gr_vissprite_t* spr2 = *(gr_vissprite_t*const*)p2;
int idiff;
float fdiff;
// Make transparent sprites last. Comment from the previous sort implementation:
// Sryder: Oh boy, while it's nice having ALL the sprites sorted properly, it fails when we bring MD2's into the
// mix and they want to be translucent. So let's place all the translucent sprites and MD2's AFTER
// everything else, but still ordered of course, the depth buffer can handle the opaque ones plenty fine.
// We just need to move all translucent ones to the end in order
// TODO: Fully sort all sprites and MD2s with walls and floors, this part will be unnecessary after that
best = gr_vsprsortedhead.next;
int transparency1 = (spr1->mobj->flags2 & MF2_SHADOW) || (spr1->mobj->frame & FF_TRANSMASK);
int transparency2 = (spr2->mobj->flags2 & MF2_SHADOW) || (spr2->mobj->frame & FF_TRANSMASK);
idiff = transparency1 - transparency2;
if (idiff != 0) return idiff;
fdiff = spr2->tz - spr1->tz; // this order seems correct when checking with apitrace. Back to front.
if (fabsf(fdiff) < 1.0E-36f)
return spr1->dispoffset - spr2->dispoffset; // smallest dispoffset first if sprites are at (almost) same location.
else if (fdiff > 0)
return 1;
else
return -1;
}
static void HWR_SortVisSprites(void)
{
UINT32 i;
for (i = 0; i < gr_visspritecount; i++)
{
if ((best->mobj->flags2 & MF2_SHADOW) || (best->mobj->frame & FF_TRANSMASK))
{
if (best == gr_vsprsortedhead.next)
{
gr_vsprsortedhead.next = best->next;
}
best->prev->next = best->next;
best->next->prev = best->prev;
best->prev = gr_vsprsortedhead.prev;
gr_vsprsortedhead.prev->next = best;
gr_vsprsortedhead.prev = best;
ds = best;
best = best->next;
ds->next = &gr_vsprsortedhead;
}
else
best = best->next;
gr_vsprorder[i] = HWR_GetVisSprite(i);
}
qsort(gr_vsprorder, gr_visspritecount, sizeof(gr_vissprite_t*), CompareVisSprites);
}
// A drawnode is something that points to a 3D floor, 3D side, or masked
@ -4402,28 +4351,66 @@ void HWR_AddTransparentPolyobjectFloor(levelflat_t *levelflat, polyobj_t *polyse
numpolyplanes++;
}
// putting sortindex and sortnode here so the comparator function can see them
gr_drawnode_t *sortnode;
size_t *sortindex;
static int CompareDrawNodes(const void *p1, const void *p2)
{
size_t n1 = *(const size_t*)p1;
size_t n2 = *(const size_t*)p2;
INT32 v1 = 0;
INT32 v2 = 0;
INT32 diff;
if (sortnode[n1].plane)
v1 = sortnode[n1].plane->drawcount;
else if (sortnode[n1].polyplane)
v1 = sortnode[n1].polyplane->drawcount;
else if (sortnode[n1].wall)
v1 = sortnode[n1].wall->drawcount;
else I_Error("CompareDrawNodes: n1 unknown");
if (sortnode[n2].plane)
v2 = sortnode[n2].plane->drawcount;
else if (sortnode[n2].polyplane)
v2 = sortnode[n2].polyplane->drawcount;
else if (sortnode[n2].wall)
v2 = sortnode[n2].wall->drawcount;
else I_Error("CompareDrawNodes: n2 unknown");
diff = v2 - v1;
if (diff == 0) I_Error("CompareDrawNodes: diff is zero");
return diff;
}
static int CompareDrawNodePlanes(const void *p1, const void *p2)
{
size_t n1 = *(const size_t*)p1;
size_t n2 = *(const size_t*)p2;
if (!sortnode[n1].plane) I_Error("CompareDrawNodePlanes: Uh.. This isn't a plane! (n1)");
if (!sortnode[n2].plane) I_Error("CompareDrawNodePlanes: Uh.. This isn't a plane! (n2)");
return ABS(sortnode[n2].plane->fixedheight - viewz) - ABS(sortnode[n1].plane->fixedheight - viewz);
}
//
// HWR_CreateDrawNodes
// Creates and sorts a list of drawnodes for the scene being rendered.
static void HWR_CreateDrawNodes(void)
{
UINT32 i = 0, p = 0, prev = 0, loop;
const fixed_t pviewz = dup_viewz;
UINT32 i = 0, p = 0;
size_t run_start = 0;
// Dump EVERYTHING into a huge drawnode list. Then we'll sort it!
// Could this be optimized into _AddTransparentWall/_AddTransparentPlane?
// Hell yes! But sort algorithm must be modified to use a linked list.
gr_drawnode_t *sortnode = Z_Calloc((sizeof(planeinfo_t)*numplanes)
+ (sizeof(polyplaneinfo_t)*numpolyplanes)
+ (sizeof(wallinfo_t)*numwalls)
,PU_STATIC, NULL);
sortnode = Z_Calloc((sizeof(planeinfo_t)*numplanes)
+ (sizeof(polyplaneinfo_t)*numpolyplanes)
+ (sizeof(wallinfo_t)*numwalls)
,PU_STATIC, NULL);
// todo:
// However, in reality we shouldn't be re-copying and shifting all this information
// that is already lying around. This should all be in some sort of linked list or lists.
size_t *sortindex = Z_Calloc(sizeof(size_t) * (numplanes + numpolyplanes + numwalls), PU_STATIC, NULL);
// If true, swap the draw order.
boolean shift = false;
sortindex = Z_Calloc(sizeof(size_t) * (numplanes + numpolyplanes + numwalls), PU_STATIC, NULL);
rs_hw_nodesorttime = I_GetTimeMicros();
@ -4449,104 +4436,36 @@ static void HWR_CreateDrawNodes(void)
// p is the number of stuff to sort
// Add the 3D floors, thicksides, and masked textures...
// Instead of going through drawsegs, we need to iterate
// through the lists of masked textures and
// translucent ffloors being drawn.
// sort the list based on the value of the 'drawcount' member of the drawnodes.
qsort(sortindex, p, sizeof(size_t), CompareDrawNodes);
// This is a bubble sort! Wahoo!
// Stuff is sorted:
// sortnode[sortindex[0]] = farthest away
// sortnode[sortindex[p-1]] = closest
// "i" should be closer. "prev" should be further.
// The lower drawcount is, the further it is from the screen.
for (loop = 0; loop < p; loop++)
// an additional pass is needed to correct the order of consecutive planes in the list.
// for each consecutive run of planes in the list, sort that run based on plane height and view height.
while (run_start < p-1)// p-1 because a 1 plane run at the end of the list does not count
{
for (i = 1; i < p; i++)
// locate run start
if (sortnode[sortindex[run_start]].plane)
{
prev = i-1;
if (sortnode[sortindex[i]].plane)
// found it, now look for run end
size_t run_end;// (inclusive)
for (i = run_start+1; i < p; i++)// size_t and UINT32 being used mixed here... shouldnt break anything though..
{
// What are we comparing it with?
if (sortnode[sortindex[prev]].plane)
{
// Plane (i) is further away than plane (prev)
if (ABS(sortnode[sortindex[i]].plane->fixedheight - pviewz) > ABS(sortnode[sortindex[prev]].plane->fixedheight - pviewz))
shift = true;
}
if (sortnode[sortindex[prev]].polyplane)
{
// Plane (i) is further away than polyplane (prev)
if (ABS(sortnode[sortindex[i]].plane->fixedheight - pviewz) > ABS(sortnode[sortindex[prev]].polyplane->fixedheight - pviewz))
shift = true;
}
else if (sortnode[sortindex[prev]].wall)
{
// Plane (i) is further than wall (prev)
if (sortnode[sortindex[i]].plane->drawcount > sortnode[sortindex[prev]].wall->drawcount)
shift = true;
}
if (!sortnode[sortindex[i]].plane) break;
}
else if (sortnode[sortindex[i]].polyplane)
run_end = i-1;
if (run_end > run_start)// if there are multiple consecutive planes, not just one
{
// What are we comparing it with?
if (sortnode[sortindex[prev]].plane)
{
// Plane (i) is further away than plane (prev)
if (ABS(sortnode[sortindex[i]].polyplane->fixedheight - pviewz) > ABS(sortnode[sortindex[prev]].plane->fixedheight - pviewz))
shift = true;
}
if (sortnode[sortindex[prev]].polyplane)
{
// Plane (i) is further away than polyplane (prev)
if (ABS(sortnode[sortindex[i]].polyplane->fixedheight - pviewz) > ABS(sortnode[sortindex[prev]].polyplane->fixedheight - pviewz))
shift = true;
}
else if (sortnode[sortindex[prev]].wall)
{
// Plane (i) is further than wall (prev)
if (sortnode[sortindex[i]].polyplane->drawcount > sortnode[sortindex[prev]].wall->drawcount)
shift = true;
}
// consecutive run of planes found, now sort it
qsort(sortindex + run_start, run_end - run_start + 1, sizeof(size_t), CompareDrawNodePlanes);
}
else if (sortnode[sortindex[i]].wall)
{
// What are we comparing it with?
if (sortnode[sortindex[prev]].plane)
{
// Wall (i) is further than plane(prev)
if (sortnode[sortindex[i]].wall->drawcount > sortnode[sortindex[prev]].plane->drawcount)
shift = true;
}
if (sortnode[sortindex[prev]].polyplane)
{
// Wall (i) is further than polyplane(prev)
if (sortnode[sortindex[i]].wall->drawcount > sortnode[sortindex[prev]].polyplane->drawcount)
shift = true;
}
else if (sortnode[sortindex[prev]].wall)
{
// Wall (i) is further than wall (prev)
if (sortnode[sortindex[i]].wall->drawcount > sortnode[sortindex[prev]].wall->drawcount)
shift = true;
}
}
if (shift)
{
size_t temp;
temp = sortindex[prev];
sortindex[prev] = sortindex[i];
sortindex[i] = temp;
shift = false;
}
} //i++
} // loop++
run_start = run_end + 1;// continue looking for runs coming right after this one
}
else
{
// this wasnt the run start, try next one
run_start++;
}
}
rs_hw_nodesorttime = I_GetTimeMicros() - rs_hw_nodesorttime;
@ -4605,52 +4524,45 @@ static void HWR_CreateDrawNodes(void)
// added the stransform so they can be switched as drawing happenes so MD2s and sprites are sorted correctly with each other
static void HWR_DrawSprites(void)
{
if (gr_visspritecount > 0)
UINT32 i;
HWD.pfnSetSpecialState(HWD_SET_MODEL_LIGHTING, cv_grmodellighting.value);
for (i = 0; i < gr_visspritecount; i++)
{
gr_vissprite_t *spr;
HWD.pfnSetSpecialState(HWD_SET_MODEL_LIGHTING, cv_grmodellighting.value);
// draw all vissprites back to front
for (spr = gr_vsprsortedhead.next;
spr != &gr_vsprsortedhead;
spr = spr->next)
{
gr_vissprite_t *spr = gr_vsprorder[i];
#ifdef HWPRECIP
if (spr->precip)
HWR_DrawPrecipitationSprite(spr);
else
if (spr->precip)
HWR_DrawPrecipitationSprite(spr);
else
#endif
{
if (spr->mobj && spr->mobj->shadowscale && cv_shadow.value)
{
if (spr->mobj && spr->mobj->shadowscale && cv_shadow.value)
{
HWR_DrawDropShadow(spr->mobj, spr->mobj->shadowscale);
}
HWR_DrawDropShadow(spr->mobj, spr->mobj->shadowscale);
}
if (spr->mobj && spr->mobj->skin && spr->mobj->sprite == SPR_PLAY)
{
if (!cv_grmodels.value || md2_playermodels[(skin_t*)spr->mobj->skin-skins].notfound || md2_playermodels[(skin_t*)spr->mobj->skin-skins].scale < 0.0f)
HWR_DrawSprite(spr);
else
{
if (!HWR_DrawModel(spr))
HWR_DrawSprite(spr);
}
}
if (spr->mobj && spr->mobj->skin && spr->mobj->sprite == SPR_PLAY)
{
if (!cv_grmodels.value || md2_playermodels[(skin_t*)spr->mobj->skin-skins].notfound || md2_playermodels[(skin_t*)spr->mobj->skin-skins].scale < 0.0f)
HWR_DrawSprite(spr);
else
{
if (!cv_grmodels.value || md2_models[spr->mobj->sprite].notfound || md2_models[spr->mobj->sprite].scale < 0.0f)
if (!HWR_DrawModel(spr))
HWR_DrawSprite(spr);
}
}
else
{
if (!cv_grmodels.value || md2_models[spr->mobj->sprite].notfound || md2_models[spr->mobj->sprite].scale < 0.0f)
HWR_DrawSprite(spr);
else
{
if (!HWR_DrawModel(spr))
HWR_DrawSprite(spr);
else
{
if (!HWR_DrawModel(spr))
HWR_DrawSprite(spr);
}
}
}
}
HWD.pfnSetSpecialState(HWD_SET_MODEL_LIGHTING, 0);
}
HWD.pfnSetSpecialState(HWD_SET_MODEL_LIGHTING, 0);
}
// --------------------------------------------------------------------------

View file

@ -375,7 +375,10 @@ static void md2_loadTexture(md2_t *model)
#endif
grpatch->mipmap->grInfo.format = PCX_Load(filename, &w, &h, grpatch);
if (grpatch->mipmap->grInfo.format == 0)
{
model->notexturefile = true; // mark it so its not searched for again repeatedly
return;
}
grpatch->mipmap->downloaded = 0;
grpatch->mipmap->flags = 0;
@ -430,6 +433,7 @@ static void md2_loadBlendTexture(md2_t *model)
grpatch->mipmap->grInfo.format = PCX_Load(filename, &w, &h, grpatch);
if (grpatch->mipmap->grInfo.format == 0)
{
model->noblendfile = true; // mark it so its not searched for again repeatedly
Z_Free(filename);
return;
}
@ -465,6 +469,8 @@ void HWR_InitModels(void)
md2_playermodels[s].scale = -1.0f;
md2_playermodels[s].model = NULL;
md2_playermodels[s].grpatch = NULL;
md2_playermodels[s].notexturefile = false;
md2_playermodels[s].noblendfile = false;
md2_playermodels[s].skin = -1;
md2_playermodels[s].notfound = true;
md2_playermodels[s].error = false;
@ -474,6 +480,8 @@ void HWR_InitModels(void)
md2_models[i].scale = -1.0f;
md2_models[i].model = NULL;
md2_models[i].grpatch = NULL;
md2_models[i].notexturefile = false;
md2_models[i].noblendfile = false;
md2_models[i].skin = -1;
md2_models[i].notfound = true;
md2_models[i].error = false;
@ -1298,12 +1306,14 @@ boolean HWR_DrawModel(gr_vissprite_t *spr)
finalscale = md2->scale;
//Hurdler: arf, I don't like that implementation at all... too much crappy
gpatch = md2->grpatch;
if (!gpatch || !gpatch->mipmap->grInfo.format || !gpatch->mipmap->downloaded)
if (!gpatch || ((!gpatch->mipmap->grInfo.format || !gpatch->mipmap->downloaded) && !md2->notexturefile))
md2_loadTexture(md2);
gpatch = md2->grpatch; // Load it again, because it isn't being loaded into gpatch after md2_loadtexture...
if ((gpatch && gpatch->mipmap->grInfo.format) // don't load the blend texture if the base texture isn't available
&& (!md2->blendgrpatch || !((GLPatch_t *)md2->blendgrpatch)->mipmap->grInfo.format || !((GLPatch_t *)md2->blendgrpatch)->mipmap->downloaded))
&& (!md2->blendgrpatch
|| ((!((GLPatch_t *)md2->blendgrpatch)->mipmap->grInfo.format || !((GLPatch_t *)md2->blendgrpatch)->mipmap->downloaded)
&& !md2->noblendfile)))
md2_loadBlendTexture(md2);
if (gpatch && gpatch->mipmap->grInfo.format) // else if meant that if a texture couldn't be loaded, it would just end up using something else's texture

View file

@ -28,7 +28,9 @@ typedef struct
float offset;
model_t *model;
void *grpatch;
boolean notexturefile; // true if texture file was not found
void *blendgrpatch;
boolean noblendfile; // true if blend texture file was not found
boolean notfound;
INT32 skin;
boolean error;

View file

@ -2102,7 +2102,7 @@ void HU_Drawer(void)
{
if (LUA_HudEnabled(hud_rankings))
HU_DrawRankings();
if (gametype == GT_COOP)
if (gametyperules & GTR_CAMPAIGN)
HU_DrawNetplayCoopOverlay();
}
else

View file

@ -1430,11 +1430,13 @@ state_t states[NUMSTATES] =
{SPR_FANG, 8, 0, {A_PrepareRepeat}, 1, 0, S_FANG_PINCHPATHINGSTART2}, // S_FANG_PINCHPATHINGSTART1
{SPR_FANG, 8, 0, {A_PlayActiveSound}, 0, 0, S_FANG_PINCHPATHING}, // S_FANG_PINCHPATHINGSTART2
{SPR_FANG, 8, 0, {A_Boss5FindWaypoint}, 1, 0, S_FANG_PINCHBOUNCE1}, // S_FANG_PINCHPATHING
{SPR_FANG, 8, 0, {A_Boss5FindWaypoint}, 1, 0, S_FANG_PINCHBOUNCE0}, // S_FANG_PINCHPATHING
{SPR_FANG, 8, 0, {A_SetObjectFlags}, MF_NOCLIP|MF_NOCLIPHEIGHT, 2, S_FANG_PINCHBOUNCE1}, // S_FANG_PINCHBOUNCE0
{SPR_FANG, 8, 2, {A_Thrust}, 0, 1, S_FANG_PINCHBOUNCE2}, // S_FANG_PINCHBOUNCE1
{SPR_FANG, 9, 2, {NULL}, 0, 0, S_FANG_PINCHBOUNCE3}, // S_FANG_PINCHBOUNCE2
{SPR_FANG, 10, 2, {A_Boss5Jump}, 0, 0, S_FANG_PINCHBOUNCE4}, // S_FANG_PINCHBOUNCE3
{SPR_FANG, 10, 1, {A_Boss5CheckFalling}, S_FANG_PINCHSKID1, S_FANG_PINCHFALL1, S_FANG_PINCHBOUNCE4}, // S_FANG_PINCHBOUNCE4
{SPR_FANG, 10, 1, {A_Boss5CheckFalling}, S_FANG_PINCHSKID1, S_FANG_PINCHFALL0, S_FANG_PINCHBOUNCE4}, // S_FANG_PINCHBOUNCE4
{SPR_FANG, 12, 0, {A_SetObjectFlags}, MF_NOCLIP|MF_NOCLIPHEIGHT, 1, S_FANG_PINCHFALL1}, // S_FANG_PINCHFALL0
{SPR_FANG, 12, 1, {A_Boss5CheckOnGround}, S_FANG_PINCHSKID1, 0, S_FANG_PINCHFALL2}, // S_FANG_PINCHFALL1
{SPR_FANG, 13, 1, {A_Boss5CheckOnGround}, S_FANG_PINCHSKID1, 0, S_FANG_PINCHFALL1}, // S_FANG_PINCHFALL2
{SPR_FANG, 4, 0, {A_PlayAttackSound}, 0, 0, S_FANG_PINCHSKID2}, // S_FANG_PINCHSKID1
@ -3362,7 +3364,7 @@ state_t states[NUMSTATES] =
// CTF Sign
{SPR_GFLG, FF_FULLBRIGHT, 2, {NULL}, 0, 0, S_NULL}, // S_GOTFLAG
// Finish flag
{SPR_FNSF, FF_TRANS30, -1, {NULL}, 0, 0, S_NULL}, // S_FINISHFLAG
@ -18010,7 +18012,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
MF_NOBLOCKMAP|MF_NOCLIP|MF_NOGRAVITY|MF_SCENERY, // flags
S_NULL // raisestate
},
{ // MT_FINISHFLAG
-1, // doomednum
S_FINISHFLAG, // spawnstate
@ -19855,7 +19857,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
MF_SLIDEME|MF_SPECIAL|MF_NOGRAVITY|MF_NOCLIPHEIGHT, // flags
S_NULL // raisestate
},
{ // MT_FLINGNIGHTSSTAR
-1, // doomednum
S_NIGHTSSTAR, // spawnstate
@ -21691,7 +21693,7 @@ skincolor_t skincolors[MAXSKINCOLORS] = {
{"Violet", {0xd0, 0xd1, 0xd2, 0xca, 0xcc, 0xb8, 0xb9, 0xb9, 0xba, 0xa8, 0xa8, 0xa9, 0xa9, 0xfd, 0xfe, 0xfe}, SKINCOLOR_MINT, 6, V_MAGENTAMAP, true}, // SKINCOLOR_VIOLET
{"Lilac", {0x00, 0xd0, 0xd1, 0xd2, 0xd3, 0xc1, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc5, 0xc6, 0xc6, 0xfe, 0x1f}, SKINCOLOR_VAPOR, 4, V_ROSYMAP, true}, // SKINCOLOR_LILAC
{"Plum", {0xc8, 0xd3, 0xd5, 0xd6, 0xd7, 0xce, 0xcf, 0xb9, 0xb9, 0xba, 0xba, 0xa9, 0xa9, 0xa9, 0xfd, 0xfe}, SKINCOLOR_MINT, 7, V_ROSYMAP, true}, // SKINCOLOR_PLUM
{"Raspberry", {0xc8, 0xc9, 0xca, 0xcb, 0xcb, 0xcc, 0xcd, 0xcd, 0xce, 0xb9, 0xb9, 0xba, 0xba, 0xbb, 0xfe, 0xfe}, SKINCOLOR_APPLE, 15, V_MAGENTAMAP, true}, // SKINCOLOR_RASPBERRY
{"Raspberry", {0xc8, 0xc9, 0xca, 0xcb, 0xcb, 0xcc, 0xcd, 0xcd, 0xce, 0xb9, 0xb9, 0xba, 0xba, 0xbb, 0xfe, 0xfe}, SKINCOLOR_APPLE, 13, V_MAGENTAMAP, true}, // SKINCOLOR_RASPBERRY
{"Rosy", {0xfc, 0xc8, 0xc8, 0xc9, 0xc9, 0xca, 0xca, 0xcb, 0xcb, 0xcc, 0xcc, 0xcd, 0xcd, 0xce, 0xce, 0xcf}, SKINCOLOR_AQUA, 1, V_ROSYMAP, true}, // SKINCOLOR_ROSY
// super

View file

@ -1608,10 +1608,12 @@ typedef enum state
S_FANG_PINCHPATHINGSTART1,
S_FANG_PINCHPATHINGSTART2,
S_FANG_PINCHPATHING,
S_FANG_PINCHBOUNCE0,
S_FANG_PINCHBOUNCE1,
S_FANG_PINCHBOUNCE2,
S_FANG_PINCHBOUNCE3,
S_FANG_PINCHBOUNCE4,
S_FANG_PINCHFALL0,
S_FANG_PINCHFALL1,
S_FANG_PINCHFALL2,
S_FANG_PINCHSKID1,
@ -3498,7 +3500,7 @@ typedef enum state
// Got Flag Sign
S_GOTFLAG,
// Finish flag
S_FINISHFLAG,

View file

@ -3103,6 +3103,14 @@ static int lib_gPlatformGametype(lua_State *L)
return 1;
}
static int lib_gCoopGametype(lua_State *L)
{
//HUDSAFE
INLEVEL
lua_pushboolean(L, G_CoopGametype());
return 1;
}
static int lib_gTagGametype(lua_State *L)
{
//HUDSAFE
@ -3386,6 +3394,7 @@ static luaL_Reg lib[] = {
{"G_GametypeHasSpectators",lib_gGametypeHasSpectators},
{"G_RingSlingerGametype",lib_gRingSlingerGametype},
{"G_PlatformGametype",lib_gPlatformGametype},
{"G_CoopGametype",lib_gCoopGametype},
{"G_TagGametype",lib_gTagGametype},
{"G_CompetitionGametype",lib_gCompetitionGametype},
{"G_TicsToHours",lib_gTicsToHours},

View file

@ -139,6 +139,7 @@ static const char *const side_opt[] = {
"toptexture",
"bottomtexture",
"midtexture",
"line",
"sector",
"special",
"repeatcnt",

View file

@ -4950,7 +4950,7 @@ void A_ThrownRing(mobj_t *actor)
continue;
// Don't home in on teammates.
if ((gametyperules & GTR_TEAMFLAGS)
if ((gametyperules & GTR_TEAMS)
&& actor->target->player->ctfteam == player->ctfteam)
continue;
}
@ -5142,12 +5142,10 @@ void A_SignPlayer(mobj_t *actor)
;
else if (!skin->sprites[SPR2_SIGN].numframes)
signcolor = facecolor;
else if ((actor->target->player->skincolor == skin->prefcolor) && (skin->prefoppositecolor)) // Set it as the skin's preferred oppositecolor?
else if ((facecolor == skin->prefcolor) && (skin->prefoppositecolor)) // Set it as the skin's preferred oppositecolor?
signcolor = skin->prefoppositecolor;
else if (actor->target->player->skincolor) // Set the sign to be an appropriate background color for this player's skincolor.
signcolor = skincolors[actor->target->player->skincolor].invcolor;
else
signcolor = SKINCOLOR_NONE;
else if (facecolor) // Set the sign to be an appropriate background color for this player's skincolor.
signcolor = skincolors[facecolor].invcolor;
}
else if (locvar1 != -3) // set to a defined skin
{
@ -5211,6 +5209,7 @@ void A_SignPlayer(mobj_t *actor)
P_SetMobjState(ov, actor->info->meleestate); // S_EGGMANSIGN
if (!signcolor)
signcolor = SKINCOLOR_CARBON;
facecolor = signcolor;
}
actor->tracer->color = signcolor;
@ -6524,7 +6523,7 @@ void A_OldRingExplode(mobj_t *actor) {
if (changecolor)
{
if (!(gametyperules & GTR_TEAMFLAGS))
if (!(gametyperules & GTR_TEAMS))
mo->color = actor->target->color; //copy color
else if (actor->target->player->ctfteam == 2)
mo->color = skincolor_bluering;
@ -6540,7 +6539,7 @@ void A_OldRingExplode(mobj_t *actor) {
if (changecolor)
{
if (!(gametyperules & GTR_TEAMFLAGS))
if (!(gametyperules & GTR_TEAMS))
mo->color = actor->target->color; //copy color
else if (actor->target->player->ctfteam == 2)
mo->color = skincolor_bluering;
@ -6555,7 +6554,7 @@ void A_OldRingExplode(mobj_t *actor) {
if (changecolor)
{
if (!(gametyperules & GTR_TEAMFLAGS))
if (!(gametyperules & GTR_TEAMS))
mo->color = actor->target->color; //copy color
else if (actor->target->player->ctfteam == 2)
mo->color = skincolor_bluering;

View file

@ -2278,7 +2278,7 @@ void P_CheckSurvivors(void)
if (!taggers) //If there are no taggers, pick a survivor at random to be it.
{
// Exception for hide and seek. If a round has started and the IT player leaves, end the round.
if (gametype == GT_HIDEANDSEEK && (leveltime >= (hidetime * TICRATE)))
if ((gametyperules & GTR_HIDEFROZEN) && (leveltime >= (hidetime * TICRATE)))
{
CONS_Printf(M_GetText("The IT player has left the game.\n"));
if (server)
@ -2516,7 +2516,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget
}
P_RestoreMusic(target->player);
if (gametype != GT_COOP)
if (!G_CoopGametype())
{
HU_SetCEchoFlags(0);
HU_SetCEchoDuration(5);
@ -2594,7 +2594,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget
// allow them to try again, rather than sitting the whole thing out.
if (leveltime >= hidetime * TICRATE)
{
if (gametype == GT_TAG)//suiciding in survivor makes you IT.
if (!(gametyperules & GTR_HIDEFROZEN))//suiciding in survivor makes you IT.
{
target->player->pflags |= PF_TAGIT;
CONS_Printf(M_GetText("%s is now IT!\n"), player_names[target->player-players]); // Tell everyone who is it!
@ -3088,7 +3088,7 @@ static boolean P_TagDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, IN
P_AddPlayerScore(source->player, 100); //award points to tagger.
P_HitDeathMessages(player, inflictor, source, 0);
if (gametype == GT_TAG) //survivor
if (!(gametyperules & GTR_HIDEFROZEN)) //survivor
{
player->pflags |= PF_TAGIT; //in survivor, the player becomes IT and helps hunt down the survivors.
CONS_Printf(M_GetText("%s is now IT!\n"), player_names[player-players]); // Tell everyone who is it!
@ -3149,7 +3149,7 @@ static boolean P_PlayerHitsPlayer(mobj_t *target, mobj_t *inflictor, mobj_t *sou
// In COOP/RACE, you can't hurt other players unless cv_friendlyfire is on
if (!(cv_friendlyfire.value || (gametyperules & GTR_FRIENDLYFIRE)) && (gametyperules & GTR_FRIENDLY))
{
if (gametype == GT_COOP && inflictor->type == MT_LHRT && !(player->powers[pw_shield] & SH_NOSTACK)) // co-op only
if ((gametyperules & GTR_FRIENDLY) && inflictor->type == MT_LHRT && !(player->powers[pw_shield] & SH_NOSTACK)) // co-op only
{
if (player->revitem != MT_LHRT && player->spinitem != MT_LHRT && player->thokitem != MT_LHRT) // Healers do not get to heal other healers.
{
@ -3248,7 +3248,7 @@ static void P_KillPlayer(player_t *player, mobj_t *source, INT32 damage)
}
// If the player was super, tell them he/she ain't so super nomore.
if (gametype != GT_COOP && player->powers[pw_super])
if (!G_CoopGametype() && player->powers[pw_super])
{
S_StartSound(NULL, sfx_s3k66); //let all players hear it.
HU_SetCEchoFlags(0);
@ -3610,7 +3610,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
if (source == target)
return false; // Don't hit yourself with your own paraloop, baka
if (source && source->player && !(cv_friendlyfire.value || (gametyperules & GTR_FRIENDLYFIRE))
&& (gametype == GT_COOP
&& ((gametyperules & GTR_FRIENDLY)
|| (G_GametypeHasTeams() && player->ctfteam == source->player->ctfteam)))
return false; // Don't run eachother over in special stages and team games and such
}

View file

@ -1588,7 +1588,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
}
// Force solid players in hide and seek to avoid corner stacking.
if (cv_tailspickup.value && gametype != GT_HIDEANDSEEK)
if (cv_tailspickup.value && !(gametyperules & GTR_HIDEFROZEN))
{
if (tmthing->player && thing->player)
{

View file

@ -11309,7 +11309,7 @@ void P_SpawnPlayer(INT32 playernum)
if (!G_GametypeHasSpectators())
{
p->spectator = p->outofcoop =
(((multiplayer || netgame) && gametype == GT_COOP) // only question status in coop
(((multiplayer || netgame) && G_CoopGametype()) // only question status in coop
&& ((leveltime > 0
&& ((G_IsSpecialStage(gamemap)) // late join special stage
|| (cv_coopstarposts.value == 2 && (p->jointime < 1 || p->outofcoop)))) // late join or die in new coop
@ -11768,7 +11768,7 @@ static boolean P_AllowMobjSpawn(mapthing_t* mthing, mobjtype_t i)
case MT_EMERALD5:
case MT_EMERALD6:
case MT_EMERALD7:
if (gametype != GT_COOP) // Don't place emeralds in non-coop modes
if (!G_CoopGametype()) // Don't place emeralds in non-coop modes
return false;
if (metalrecording)
@ -11788,7 +11788,7 @@ static boolean P_AllowMobjSpawn(mapthing_t* mthing, mobjtype_t i)
runemeraldmanager = true;
break;
case MT_ROSY:
if (!(gametype == GT_COOP || (mthing->options & MTF_EXTRA)))
if (!(G_CoopGametype() || (mthing->options & MTF_EXTRA)))
return false; // she doesn't hang out here
if (!mariomode && !(netgame || multiplayer) && players[consoleplayer].skin == 3)
@ -11903,7 +11903,7 @@ static mobjtype_t P_GetMobjtypeSubstitute(mapthing_t *mthing, mobjtype_t i)
}
}
// Set powerup boxes to user settings for other netplay modes
else if (gametype != GT_COOP)
else if (!G_CoopGametype())
{
switch (cv_matchboxes.value)
{

View file

@ -3459,7 +3459,7 @@ static void P_InitGametype(void)
if (G_TagGametype())
P_InitTagGametype();
else if (gametype == GT_RACE && server)
else if (((gametyperules & (GTR_RACE|GTR_LIVES)) == GTR_RACE) && server)
CV_StealthSetValue(&cv_numlaps,
(cv_basenumlaps.value)
? cv_basenumlaps.value

View file

@ -4078,7 +4078,7 @@ void P_SetupSignExit(player_t *player)
if (!numfound
&& !(player->mo->target && player->mo->target->type == MT_SIGN)
&& !(gametype == GT_COOP && (netgame || multiplayer) && cv_exitmove.value))
&& !((gametyperules & GTR_FRIENDLY) && (netgame || multiplayer) && cv_exitmove.value))
P_SetTarget(&player->mo->target, thing);
if (thing->state != &states[thing->info->spawnstate])
@ -4109,7 +4109,7 @@ void P_SetupSignExit(player_t *player)
if (!numfound
&& !(player->mo->target && player->mo->target->type == MT_SIGN)
&& !(gametype == GT_COOP && (netgame || multiplayer) && cv_exitmove.value))
&& !((gametyperules & GTR_FRIENDLY) && (netgame || multiplayer) && cv_exitmove.value))
P_SetTarget(&player->mo->target, thing);
if (thing->state != &states[thing->info->spawnstate])
@ -4465,7 +4465,7 @@ void P_ProcessSpecialSector(player_t *player, sector_t *sector, sector_t *rovers
continue;
if (players[i].bot)
continue;
if (gametype == GT_COOP && players[i].lives <= 0)
if (G_CoopGametype() && players[i].lives <= 0)
continue;
if (roversector)
{
@ -4691,7 +4691,7 @@ DoneSection2:
// FOF custom exits not to work.
lineindex = P_FindSpecialLineFromTag(2, sector->tag, -1);
if (gametype == GT_COOP && lineindex != -1) // Custom exit!
if (G_CoopGametype() && lineindex != -1) // Custom exit!
{
// Special goodies with the block monsters flag depending on emeralds collected
if ((lines[lineindex].flags & ML_BLOCKMONSTERS) && ALL7EMERALDS(emeralds))
@ -4925,7 +4925,7 @@ DoneSection2:
break;
case 10: // Finish Line
if (gametype == GT_RACE && !player->exiting)
if (((gametyperules & (GTR_RACE|GTR_LIVES)) == GTR_RACE) && !player->exiting)
{
if (player->starpostnum == numstarposts) // Must have touched all the starposts
{
@ -6240,7 +6240,7 @@ void P_SpawnSpecials(boolean fromnetsave)
switch(GETSECSPECIAL(sector->special, 4))
{
case 10: // Circuit finish line
if (gametype == GT_RACE)
if ((gametyperules & (GTR_RACE|GTR_LIVES)) == GTR_RACE)
circuitmap = true;
break;
}

View file

@ -692,7 +692,7 @@ void P_Ticker(boolean run)
if (run)
{
if (countdowntimer && G_PlatformGametype() && (gametype == GT_COOP || leveltime >= 4*TICRATE) && !stoppedclock && --countdowntimer <= 0)
if (countdowntimer && G_PlatformGametype() && ((gametyperules & GTR_CAMPAIGN) || leveltime >= 4*TICRATE) && !stoppedclock && --countdowntimer <= 0)
{
countdowntimer = 0;
countdowntimeup = true;

View file

@ -1051,7 +1051,8 @@ void P_DoPlayerPain(player_t *player, mobj_t *source, mobj_t *inflictor)
// Point penalty for hitting a hazard during tag.
// Discourages players from intentionally hurting themselves to avoid being tagged.
if (gametype == GT_TAG && (!(player->pflags & PF_GAMETYPEOVER) && !(player->pflags & PF_TAGIT)))
if (((gametyperules & (GTR_TAG|GTR_HIDEFROZEN)) == GTR_TAG)
&& (!(player->pflags & PF_GAMETYPEOVER) && !(player->pflags & PF_TAGIT)))
{
if (player->score >= 50)
player->score -= 50;
@ -1351,7 +1352,7 @@ void P_DoSuperTransformation(player_t *player, boolean giverings)
player->powers[pw_sneakers] = 0;
}
if (gametype != GT_COOP)
if (!G_CoopGametype())
{
HU_SetCEchoFlags(0);
HU_SetCEchoDuration(5);
@ -1418,7 +1419,7 @@ void P_AddPlayerScore(player_t *player, UINT32 amount)
}
}
if (gametype == GT_COOP)
if (G_CoopGametype())
return;
}
@ -1437,7 +1438,7 @@ void P_AddPlayerScore(player_t *player, UINT32 amount)
}
// In team match, all awarded points are incremented to the team's running score.
if (gametype == GT_TEAMMATCH)
if ((gametyperules & (GTR_TEAMS|GTR_TEAMFLAGS)) == GTR_TEAMS)
{
if (player->ctfteam == 1)
redscore += amount;
@ -1471,7 +1472,7 @@ void P_StealPlayerScore(player_t *player, UINT32 amount)
if (stolen > 0)
{
// In team match, all stolen points are removed from the enemy team's running score.
if (gametype == GT_TEAMMATCH)
if ((gametyperules & (GTR_TEAMS|GTR_TEAMFLAGS)) == GTR_TEAMS)
{
if (player->ctfteam == 1)
bluescore -= amount;
@ -3621,7 +3622,7 @@ static boolean PIT_CheckSolidsTeeter(mobj_t *thing)
if (thing == teeterer)
return true;
if (thing->player && cv_tailspickup.value && gametype != GT_HIDEANDSEEK)
if (thing->player && cv_tailspickup.value && !(gametyperules & GTR_HIDEFROZEN))
return true;
blockdist = teeterer->radius + thing->radius;
@ -4233,7 +4234,7 @@ static void P_DoSuperStuff(player_t *player)
G_GhostAddColor(GHC_NORMAL);
}
if (gametype != GT_COOP)
if (!G_CoopGametype())
{
HU_SetCEchoFlags(0);
HU_SetCEchoDuration(5);
@ -4283,14 +4284,14 @@ static void P_DoSuperStuff(player_t *player)
G_GhostAddColor(GHC_NORMAL);
}
if (gametype != GT_COOP)
if (!G_CoopGametype())
player->powers[pw_flashing] = flashingtics-1;
if (player->mo->sprite2 & FF_SPR2SUPER)
P_SetPlayerMobjState(player->mo, player->mo->state-states);
// Inform the netgame that the champion has fallen in the heat of battle.
if (gametype != GT_COOP)
if (!G_CoopGametype())
{
S_StartSound(NULL, sfx_s3k66); //let all players hear it.
HU_SetCEchoFlags(0);
@ -7905,7 +7906,7 @@ static void P_MovePlayer(player_t *player)
if (player->pflags & PF_TAGIT)
forcestasis = true;
}
else if (gametype == GT_HIDEANDSEEK)
else if (gametyperules & GTR_HIDEFROZEN)
{
if (!(player->pflags & PF_TAGIT))
{
@ -9433,7 +9434,7 @@ static void P_DeathThink(player_t *player)
}
if ((cv_cooplives.value != 1)
&& (gametype == GT_COOP)
&& (G_GametypeUsesCoopLives())
&& (netgame || multiplayer)
&& (player->lives <= 0))
{
@ -9515,17 +9516,17 @@ static void P_DeathThink(player_t *player)
countdown2 = 1*TICRATE;
}
}
//else if (gametype == GT_COOP) -- moved to G_DoReborn
//else if (G_CoopGametype()) -- moved to G_DoReborn
}
if (gametype == GT_COOP && (multiplayer || netgame) && (player->lives <= 0) && (player->deadtimer >= 8*TICRATE || ((cmd->buttons & BT_JUMP) && (player->deadtimer > TICRATE))))
if (G_CoopGametype() && (multiplayer || netgame) && (player->lives <= 0) && (player->deadtimer >= 8*TICRATE || ((cmd->buttons & BT_JUMP) && (player->deadtimer > TICRATE))))
{
//player->spectator = true;
player->outofcoop = true;
player->playerstate = PST_REBORN;
}
if ((gametyperules & GTR_RACE) || (gametype == GT_COOP && (multiplayer || netgame)))
if ((gametyperules & GTR_RACE) || (G_CoopGametype() && (multiplayer || netgame)))
{
// Keep time rolling in race mode
if (!(countdown2 && !countdown) && !player->exiting && !(player->pflags & PF_GAMETYPEOVER) && !stoppedclock)
@ -9542,7 +9543,7 @@ static void P_DeathThink(player_t *player)
}
// Return to level music
if (gametype != GT_COOP && player->lives <= 0 && player->deadtimer == gameovertics)
if (!G_CoopGametype() && player->lives <= 0 && player->deadtimer == gameovertics)
P_RestoreMultiMusic(player);
}
@ -9719,7 +9720,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
if (player->exiting)
{
if (mo->target && mo->target->type == MT_SIGN && mo->target->spawnpoint
&& !(gametype == GT_COOP && (netgame || multiplayer) && cv_exitmove.value)
&& !((gametyperules & GTR_FRIENDLY) && (netgame || multiplayer) && cv_exitmove.value)
&& !(twodlevel || (mo->flags2 & MF2_TWOD)))
sign = mo->target;
else if ((player->powers[pw_carry] == CR_NIGHTSMODE)
@ -10388,7 +10389,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
boolean P_SpectatorJoinGame(player_t *player)
{
if (gametype != GT_COOP && !cv_allowteamchange.value)
if (!G_CoopGametype() && !cv_allowteamchange.value)
{
if (P_IsLocalPlayer(player))
CONS_Printf(M_GetText("Server does not allow team change.\n"));
@ -10470,7 +10471,7 @@ boolean P_SpectatorJoinGame(player_t *player)
player->spectator = player->outofcoop = false;
player->playerstate = PST_REBORN;
if (gametype == GT_TAG)
if ((gametyperules & (GTR_TAG|GTR_HIDEFROZEN)) == GTR_TAG)
{
//Make joining players "it" after hidetime.
if (leveltime > (hidetime * TICRATE))
@ -10491,7 +10492,7 @@ boolean P_SpectatorJoinGame(player_t *player)
displayplayer = consoleplayer;
}
if (gametype != GT_COOP)
if (!G_CoopGametype())
CONS_Printf(M_GetText("%s entered the game.\n"), player_names[player-players]);
return true; // no more player->mo, cannot continue.
}
@ -11518,7 +11519,7 @@ void P_PlayerThink(player_t *player)
// so we can fade music
if (!exitfadestarted &&
player->exiting > 0 && player->exiting <= 1*TICRATE &&
(!multiplayer || gametype == GT_COOP ? !mapheaderinfo[gamemap-1]->musinterfadeout : true) &&
(!multiplayer || G_CoopGametype() ? !mapheaderinfo[gamemap-1]->musinterfadeout : true) &&
// don't fade if we're fading during intermission. follows Y_StartIntermission intertype = int_coop
((gametyperules & GTR_RACE) ? countdown2 == 0 : true) && // don't fade on timeout
player->lives > 0 && // don't fade on game over (competition)
@ -11591,7 +11592,7 @@ void P_PlayerThink(player_t *player)
if (player->pflags & PF_FINISHED)
{
if ((gametype == GT_COOP && cv_exitmove.value) && !G_EnoughPlayersFinished())
if (((gametyperules & GTR_FRIENDLY) && cv_exitmove.value) && !G_EnoughPlayersFinished())
player->exiting = 0;
else
P_DoPlayerExit(player);
@ -11625,10 +11626,10 @@ void P_PlayerThink(player_t *player)
// Make sure spectators always have a score and ring count of 0.
if (player->spectator)
{
if (gametype != GT_COOP)
if (!(gametyperules & GTR_CAMPAIGN))
player->score = 0;
}
else if ((netgame || multiplayer) && player->lives <= 0 && gametype != GT_COOP)
else if ((netgame || multiplayer) && player->lives <= 0 && !G_CoopGametype())
{
// Outside of Co-Op, replenish a user's lives if they are depleted.
// of course, this is just a cheap hack, meh...
@ -12492,7 +12493,7 @@ void P_PlayerAfterThink(player_t *player)
player->mo->momz = tails->momz;
}
if (gametype == GT_COOP && (!tails->player || tails->player->bot != 1))
if (G_CoopGametype() && (!tails->player || tails->player->bot != 1))
{
player->mo->angle = tails->angle;

View file

@ -219,6 +219,28 @@ static void var_cleanup(void)
internal_volume = 100;
}
static const char* get_zlib_error(int zErr)
{
switch (zErr)
{
case Z_ERRNO:
return "Z_ERRNO";
case Z_STREAM_ERROR:
return "Z_STREAM_ERROR";
case Z_DATA_ERROR:
return "Z_DATA_ERROR";
case Z_MEM_ERROR:
return "Z_MEM_ERROR";
case Z_BUF_ERROR:
return "Z_BUF_ERROR";
case Z_VERSION_ERROR:
return "Z_VERSION_ERROR";
default:
return "unknown error";
}
}
/// ------------------------
/// Audio System
/// ------------------------
@ -475,7 +497,7 @@ void *I_GetSfx(sfxinfo_t *sfx)
zErr = inflate(&stream, Z_FINISH);
if (zErr == Z_STREAM_END) {
// Run GME on new data
if (!gme_open_data(inflatedData, inflatedLen, &emu, 44100))
if (!gme_open_data(inflatedData, inflatedLen, &emu, SAMPLERATE))
{
short *mem;
UINT32 len;
@ -498,58 +520,18 @@ void *I_GetSfx(sfxinfo_t *sfx)
}
}
else
{
const char *errorType;
switch (zErr)
{
case Z_ERRNO:
errorType = "Z_ERRNO"; break;
case Z_STREAM_ERROR:
errorType = "Z_STREAM_ERROR"; break;
case Z_DATA_ERROR:
errorType = "Z_DATA_ERROR"; break;
case Z_MEM_ERROR:
errorType = "Z_MEM_ERROR"; break;
case Z_BUF_ERROR:
errorType = "Z_BUF_ERROR"; break;
case Z_VERSION_ERROR:
errorType = "Z_VERSION_ERROR"; break;
default:
errorType = "unknown error";
}
CONS_Alert(CONS_ERROR,"Encountered %s when running inflate: %s\n", errorType, stream.msg);
}
CONS_Alert(CONS_ERROR,"Encountered %s when running inflate: %s\n", get_zlib_error(zErr), stream.msg);
(void)inflateEnd(&stream);
}
else // Hold up, zlib's got a problem
{
const char *errorType;
switch (zErr)
{
case Z_ERRNO:
errorType = "Z_ERRNO"; break;
case Z_STREAM_ERROR:
errorType = "Z_STREAM_ERROR"; break;
case Z_DATA_ERROR:
errorType = "Z_DATA_ERROR"; break;
case Z_MEM_ERROR:
errorType = "Z_MEM_ERROR"; break;
case Z_BUF_ERROR:
errorType = "Z_BUF_ERROR"; break;
case Z_VERSION_ERROR:
errorType = "Z_VERSION_ERROR"; break;
default:
errorType = "unknown error";
}
CONS_Alert(CONS_ERROR,"Encountered %s when running inflateInit: %s\n", errorType, stream.msg);
}
CONS_Alert(CONS_ERROR,"Encountered %s when running inflateInit: %s\n", get_zlib_error(zErr), stream.msg);
Z_Free(inflatedData); // GME didn't open jack, but don't let that stop us from freeing this up
#else
return NULL; // No zlib support
#endif
}
// Try to read it as a GME sound
else if (!gme_open_data(lump, sfx->length, &emu, 44100))
else if (!gme_open_data(lump, sfx->length, &emu, SAMPLERATE))
{
short *mem;
UINT32 len;
@ -1175,77 +1157,30 @@ boolean I_LoadSong(char *data, size_t len)
if (zErr == Z_OK) // We're good to go
{
zErr = inflate(&stream, Z_FINISH);
if (zErr == Z_STREAM_END) {
if (zErr == Z_STREAM_END)
{
// Run GME on new data
if (!gme_open_data(inflatedData, inflatedLen, &gme, 44100))
if (!gme_open_data(inflatedData, inflatedLen, &gme, SAMPLERATE))
{
gme_equalizer_t eq = {GME_TREBLE, GME_BASS, 0,0,0,0,0,0,0,0};
gme_start_track(gme, 0);
current_track = 0;
gme_set_equalizer(gme, &eq);
Mix_HookMusic(mix_gme, gme);
Z_Free(inflatedData); // GME supposedly makes a copy for itself, so we don't need this lying around
return true;
}
}
else
{
const char *errorType;
switch (zErr)
{
case Z_ERRNO:
errorType = "Z_ERRNO"; break;
case Z_STREAM_ERROR:
errorType = "Z_STREAM_ERROR"; break;
case Z_DATA_ERROR:
errorType = "Z_DATA_ERROR"; break;
case Z_MEM_ERROR:
errorType = "Z_MEM_ERROR"; break;
case Z_BUF_ERROR:
errorType = "Z_BUF_ERROR"; break;
case Z_VERSION_ERROR:
errorType = "Z_VERSION_ERROR"; break;
default:
errorType = "unknown error";
}
CONS_Alert(CONS_ERROR,"Encountered %s when running inflate: %s\n", errorType, stream.msg);
}
CONS_Alert(CONS_ERROR, "Encountered %s when running inflate: %s\n", get_zlib_error(zErr), stream.msg);
(void)inflateEnd(&stream);
}
else // Hold up, zlib's got a problem
{
const char *errorType;
switch (zErr)
{
case Z_ERRNO:
errorType = "Z_ERRNO"; break;
case Z_STREAM_ERROR:
errorType = "Z_STREAM_ERROR"; break;
case Z_DATA_ERROR:
errorType = "Z_DATA_ERROR"; break;
case Z_MEM_ERROR:
errorType = "Z_MEM_ERROR"; break;
case Z_BUF_ERROR:
errorType = "Z_BUF_ERROR"; break;
case Z_VERSION_ERROR:
errorType = "Z_VERSION_ERROR"; break;
default:
errorType = "unknown error";
}
CONS_Alert(CONS_ERROR,"Encountered %s when running inflateInit: %s\n", errorType, stream.msg);
}
CONS_Alert(CONS_ERROR, "Encountered %s when running inflateInit: %s\n", get_zlib_error(zErr), stream.msg);
Z_Free(inflatedData); // GME didn't open jack, but don't let that stop us from freeing this up
return false;
#else
CONS_Alert(CONS_ERROR,"Cannot decompress VGZ; no zlib support\n");
return true;
CONS_Alert(CONS_ERROR, "Cannot decompress VGZ; no zlib support\n");
return false;
#endif
}
else if (!gme_open_data(data, len, &gme, 44100))
{
gme_equalizer_t eq = {GME_TREBLE, GME_BASS, 0,0,0,0,0,0,0,0};
gme_set_equalizer(gme, &eq);
else if (!gme_open_data(data, len, &gme, SAMPLERATE))
return true;
}
#endif
#ifdef HAVE_MIXERX
@ -1360,6 +1295,8 @@ boolean I_PlaySong(boolean looping)
#ifdef HAVE_LIBGME
if (gme)
{
gme_equalizer_t eq = {GME_TREBLE, GME_BASS, 0,0,0,0,0,0,0,0};
gme_set_equalizer(gme, &eq);
gme_start_track(gme, 0);
current_track = 0;
Mix_HookMusic(mix_gme, gme);

View file

@ -2215,7 +2215,7 @@ static void ST_drawTextHUD(void)
if (F_GetPromptHideHud(y))
return;
if (stplyr->spectator && (gametype != GT_COOP || stplyr->playerstate == PST_LIVE))
if (stplyr->spectator && (!G_CoopGametype() || stplyr->playerstate == PST_LIVE))
textHUDdraw(M_GetText("\x86""Spectator mode:"))
if (circuitmap)
@ -2226,7 +2226,7 @@ static void ST_drawTextHUD(void)
textHUDdraw(va("Lap:""\x82 %u/%d", stplyr->laps+1, cv_numlaps.value))
}
if (gametype != GT_COOP && (stplyr->exiting || (G_GametypeUsesLives() && stplyr->lives <= 0 && countdown != 1)))
if (!G_CoopGametype() && (stplyr->exiting || (G_GametypeUsesLives() && stplyr->lives <= 0 && countdown != 1)))
{
if (!splitscreen && !donef12)
{
@ -2243,7 +2243,7 @@ static void ST_drawTextHUD(void)
else
textHUDdraw(M_GetText("\x82""JUMP:""\x80 Respawn"))
}
else if (stplyr->spectator && (gametype != GT_COOP || stplyr->playerstate == PST_LIVE))
else if (stplyr->spectator && (!G_CoopGametype() || stplyr->playerstate == PST_LIVE))
{
if (!splitscreen && !donef12)
{
@ -2290,7 +2290,7 @@ static void ST_drawTextHUD(void)
textHUDdraw(M_GetText("\x82""FIRE:""\x80 Enter game"))
}
if (gametype == GT_COOP && (!stplyr->spectator || (!(maptol & TOL_NIGHTS) && G_IsSpecialStage(gamemap))) && (stplyr->exiting || (stplyr->pflags & PF_FINISHED)))
if (G_CoopGametype() && (!stplyr->spectator || (!(maptol & TOL_NIGHTS) && G_IsSpecialStage(gamemap))) && (stplyr->exiting || (stplyr->pflags & PF_FINISHED)))
{
UINT8 numneeded = (G_IsSpecialStage(gamemap) ? 4 : cv_playersforexit.value);
if (numneeded)
@ -2339,20 +2339,19 @@ static void ST_drawTextHUD(void)
textHUDdraw(M_GetText("\x82""You are blindfolded!"))
textHUDdraw(M_GetText("Waiting for players to hide..."))
}
else if (gametype == GT_HIDEANDSEEK)
else if (gametyperules & GTR_HIDEFROZEN)
textHUDdraw(M_GetText("Hide before time runs out!"))
else
textHUDdraw(M_GetText("Flee before you are hunted!"))
}
else if (gametype == GT_HIDEANDSEEK && !(stplyr->pflags & PF_TAGIT))
else if ((gametyperules & GTR_HIDEFROZEN) && !(stplyr->pflags & PF_TAGIT))
{
if (!splitscreen && !donef12)
{
textHUDdraw(M_GetText("\x82""VIEWPOINT:""\x80 Switch view"))
donef12 = true;
}
if (gametyperules & GTR_HIDEFROZEN)
textHUDdraw(M_GetText("You cannot move while hiding."))
textHUDdraw(M_GetText("You cannot move while hiding."))
}
}
@ -2628,11 +2627,11 @@ static void ST_overlayDrawer(void)
}
// GAME OVER hud
if ((gametype == GT_COOP)
if (G_GametypeUsesCoopLives()
&& (netgame || multiplayer)
&& (cv_cooplives.value == 0))
;
else if ((G_GametypeUsesLives() || gametype == GT_RACE) && stplyr->lives <= 0 && !(hu_showscores && (netgame || multiplayer)))
else if ((G_GametypeUsesLives() || ((gametyperules & (GTR_RACE|GTR_LIVES)) == GTR_RACE)) && stplyr->lives <= 0 && !(hu_showscores && (netgame || multiplayer)))
{
INT32 i = MAXPLAYERS;
INT32 deadtimer = stplyr->spectator ? TICRATE : (stplyr->deadtimer-(TICRATE<<1));

View file

@ -227,8 +227,7 @@ static void Y_IntermissionTokenDrawer(void)
//
// Y_ConsiderScreenBuffer
//
// Can we copy the current screen
// to a buffer?
// Can we copy the current screen to a buffer?
//
void Y_ConsiderScreenBuffer(void)
{
@ -254,9 +253,7 @@ void Y_ConsiderScreenBuffer(void)
//
// Y_RescaleScreenBuffer
//
// Write the rescaled source picture,
// to the destination picture that
// has the current screen's resolutions.
// Write the rescaled source picture, to the destination picture that has the current screen's resolutions.
//
static void Y_RescaleScreenBuffer(void)
{
@ -326,13 +323,6 @@ void Y_IntermissionDrawer(void)
if (rendermode == render_none)
return;
if (intertype == int_none)
{
LUAh_IntermissionHUD();
return;
}
if (!usebuffer)
// Lactozilla: Renderer switching
if (needpatchrecache)
{
@ -373,11 +363,11 @@ void Y_IntermissionDrawer(void)
{
if (widebgpatch && rendermode == render_soft && vid.width / vid.dupx == 400)
V_DrawScaledPatch(0, 0, V_SNAPTOLEFT, widebgpatch);
else
else if (bgpatch)
V_DrawScaledPatch(0, 0, 0, bgpatch);
}
}
else
else if (bgtile)
V_DrawPatchFill(bgtile);
LUAh_IntermissionHUD();
@ -1186,6 +1176,34 @@ void Y_Ticker(void)
}
}
//
// Y_DetermineIntermissionType
//
// Determines the intermission type from the current gametype.
//
void Y_DetermineIntermissionType(void)
{
// set to int_none initially
intertype = int_none;
if (intermissiontypes[gametype] != int_none)
intertype = intermissiontypes[gametype];
else if (gametype == GT_COOP)
intertype = (G_IsSpecialStage(gamemap)) ? int_spec : int_coop;
else if (gametype == GT_TEAMMATCH)
intertype = int_teammatch;
else if (gametype == GT_MATCH
|| gametype == GT_TAG
|| gametype == GT_HIDEANDSEEK)
intertype = int_match;
else if (gametype == GT_RACE)
intertype = int_race;
else if (gametype == GT_COMPETITION)
intertype = int_comp;
else if (gametype == GT_CTF)
intertype = int_ctf;
}
//
// Y_StartIntermission
//
@ -1207,12 +1225,11 @@ void Y_StartIntermission(void)
if (!multiplayer)
{
timer = 0;
intertype = (G_IsSpecialStage(gamemap)) ? int_spec : int_coop;
}
else
{
if (cv_inttime.value == 0 && gametype == GT_COOP)
if (cv_inttime.value == 0 && ((intertype == int_coop) || (intertype == int_spec)))
timer = 0;
else
{
@ -1221,23 +1238,6 @@ void Y_StartIntermission(void)
if (!timer)
timer = 1;
}
if (intermissiontypes[gametype] != int_none)
intertype = intermissiontypes[gametype];
else if (gametype == GT_COOP)
intertype = (G_IsSpecialStage(gamemap)) ? int_spec : int_coop;
else if (gametype == GT_TEAMMATCH)
intertype = int_teammatch;
else if (gametype == GT_MATCH
|| gametype == GT_TAG
|| gametype == GT_HIDEANDSEEK)
intertype = int_match;
else if (gametype == GT_RACE)
intertype = int_race;
else if (gametype == GT_COMPETITION)
intertype = int_comp;
else if (gametype == GT_CTF)
intertype = int_ctf;
}
// We couldn't display the intermission even if we wanted to.

View file

@ -13,11 +13,15 @@ extern boolean usebuffer;
void Y_IntermissionDrawer(void);
void Y_Ticker(void);
void Y_StartIntermission(void);
void Y_EndIntermission(void);
void Y_ConsiderScreenBuffer(void);
void Y_CleanupScreenBuffer(void);
void Y_DetermineIntermissionType(void);
typedef enum
{
int_none,