mirror of
				https://github.com/KartKrewDev/RingRacers.git
				synced 2025-10-30 08:01:28 +00:00 
			
		
		
		
	Merge branch 'staff-ghost-fixes' into 'master'
Fix staff ghost bugs See merge request KartKrew/Kart!2115
This commit is contained in:
		
						commit
						d8ae4d9550
					
				
					 8 changed files with 37 additions and 43 deletions
				
			
		| 
						 | 
				
			
			@ -980,8 +980,7 @@ consvar_t cv_dummyspbattack = MenuDummy("dummyspbattack", "Off").on_off().onchan
 | 
			
		|||
consvar_t cv_dummyspectate = MenuDummy("dummyspectate", "Spectator").values({{0, "Spectator"}, {1, "Playing"}});
 | 
			
		||||
 | 
			
		||||
extern CV_PossibleValue_t dummystaff_cons_t[];
 | 
			
		||||
void Dummystaff_OnChange(void);
 | 
			
		||||
consvar_t cv_dummystaff = MenuDummy("dummystaff", "0").values(dummystaff_cons_t).onchange(Dummystaff_OnChange);
 | 
			
		||||
consvar_t cv_dummystaff = MenuDummy("dummystaff", "0").values(dummystaff_cons_t);
 | 
			
		||||
 | 
			
		||||
consvar_t cv_dummyteam = MenuDummy("dummyteam", "Spectator").values({{0, "Spectator"}, {1, "Red"}, {2, "Blue"}});
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1743,10 +1743,10 @@ void F_TitleScreenTicker(boolean run)
 | 
			
		|||
	if (!(--demoIdleLeft))
 | 
			
		||||
	{
 | 
			
		||||
		char dname[MAXMAPLUMPNAME+1+8+1];
 | 
			
		||||
		lumpnum_t dlump;
 | 
			
		||||
		UINT16 mapnum;
 | 
			
		||||
		UINT8 numstaff;
 | 
			
		||||
		static boolean use_netreplay = false;
 | 
			
		||||
		const char *lumpname;
 | 
			
		||||
		staffbrief_t *brief;
 | 
			
		||||
 | 
			
		||||
		if ((use_netreplay = !use_netreplay))
 | 
			
		||||
| 
						 | 
				
			
			@ -1760,6 +1760,7 @@ void F_TitleScreenTicker(boolean run)
 | 
			
		|||
			{
 | 
			
		||||
				numstaff = M_RandomKey(numstaff)+1;
 | 
			
		||||
				snprintf(dname, 9, "TDEMO%03u", numstaff);
 | 
			
		||||
				dlump = LUMPERROR;
 | 
			
		||||
				goto loadreplay;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
| 
						 | 
				
			
			@ -1777,14 +1778,14 @@ void F_TitleScreenTicker(boolean run)
 | 
			
		|||
 | 
			
		||||
		// Setup demo name
 | 
			
		||||
		brief = mapheaderinfo[mapnum]->ghostBrief[numstaff];
 | 
			
		||||
		lumpname = W_CheckNameForNumPwad(brief->wad, brief->lump);
 | 
			
		||||
		strlcpy(dname, lumpname, sizeof(dname));
 | 
			
		||||
		strcpy(dname, "");
 | 
			
		||||
		dlump = (brief->wad << 16) | brief->lump;
 | 
			
		||||
 | 
			
		||||
loadreplay:
 | 
			
		||||
		demo.attract = DEMO_ATTRACT_TITLE;
 | 
			
		||||
		demo.ignorefiles = true;
 | 
			
		||||
		demo.loadfiles = false;
 | 
			
		||||
		G_DoPlayDemo(dname);
 | 
			
		||||
		G_DoPlayDemoEx(dname, dlump);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2891,7 +2891,7 @@ void G_DeferedPlayDemo(const char *name)
 | 
			
		|||
 | 
			
		||||
#define SKIPERRORS
 | 
			
		||||
 | 
			
		||||
void G_DoPlayDemo(const char *defdemoname)
 | 
			
		||||
void G_DoPlayDemoEx(const char *defdemoname, lumpnum_t deflumpnum)
 | 
			
		||||
{
 | 
			
		||||
	INT32 i;
 | 
			
		||||
	UINT8 p, numslots = 0;
 | 
			
		||||
| 
						 | 
				
			
			@ -2918,7 +2918,7 @@ void G_DoPlayDemo(const char *defdemoname)
 | 
			
		|||
	gtname[MAXGAMETYPELENGTH-1] = '\0';
 | 
			
		||||
 | 
			
		||||
	// No demo name means we're restarting the current demo
 | 
			
		||||
	if (defdemoname == NULL)
 | 
			
		||||
	if (defdemoname == NULL && deflumpnum == LUMPERROR)
 | 
			
		||||
	{
 | 
			
		||||
		demobuf.p = demobuf.buffer;
 | 
			
		||||
		pdemoname = static_cast<char*>(ZZ_Alloc(1)); // Easier than adding checks for this everywhere it's freed
 | 
			
		||||
| 
						 | 
				
			
			@ -2929,18 +2929,21 @@ void G_DoPlayDemo(const char *defdemoname)
 | 
			
		|||
		//Z_Free(demobuf.buffer);
 | 
			
		||||
		demobuf.buffer = NULL;
 | 
			
		||||
 | 
			
		||||
		n = defdemoname+strlen(defdemoname);
 | 
			
		||||
		while (*n != '/' && *n != '\\' && n != defdemoname)
 | 
			
		||||
			n--;
 | 
			
		||||
		if (n != defdemoname)
 | 
			
		||||
			n++;
 | 
			
		||||
		pdemoname = static_cast<char*>(ZZ_Alloc(strlen(n)+1));
 | 
			
		||||
		strcpy(pdemoname,n);
 | 
			
		||||
		if (defdemoname != NULL)
 | 
			
		||||
		{
 | 
			
		||||
			n = defdemoname+strlen(defdemoname);
 | 
			
		||||
			while (*n != '/' && *n != '\\' && n != defdemoname)
 | 
			
		||||
				n--;
 | 
			
		||||
			if (n != defdemoname)
 | 
			
		||||
				n++;
 | 
			
		||||
			pdemoname = static_cast<char*>(ZZ_Alloc(strlen(n)+1));
 | 
			
		||||
			strcpy(pdemoname,n);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		M_SetPlaybackMenuPointer();
 | 
			
		||||
 | 
			
		||||
		// Internal if no extension, external if one exists
 | 
			
		||||
		if (FIL_CheckExtension(defdemoname))
 | 
			
		||||
		if (defdemoname != NULL && FIL_CheckExtension(defdemoname))
 | 
			
		||||
		{
 | 
			
		||||
			//FIL_DefaultExtension(defdemoname, ".lmp");
 | 
			
		||||
			if (P_SaveBufferFromFile(&demobuf, defdemoname) == false)
 | 
			
		||||
| 
						 | 
				
			
			@ -2956,7 +2959,12 @@ void G_DoPlayDemo(const char *defdemoname)
 | 
			
		|||
		// load demo resource from WAD
 | 
			
		||||
		else
 | 
			
		||||
		{
 | 
			
		||||
			if (n == defdemoname)
 | 
			
		||||
			if (deflumpnum != LUMPERROR)
 | 
			
		||||
			{
 | 
			
		||||
				P_SaveBufferFromLump(&demobuf, deflumpnum);
 | 
			
		||||
				pdemoname = Z_StrDup(wadfiles[WADFILENUM(deflumpnum)]->lumpinfo[LUMPNUM(deflumpnum)].fullname);
 | 
			
		||||
			}
 | 
			
		||||
			else if (n == defdemoname)
 | 
			
		||||
			{
 | 
			
		||||
				// Raw lump.
 | 
			
		||||
				if ((l = W_CheckNumForName(defdemoname)) == LUMPERROR)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -214,7 +214,8 @@ extern demoghost *ghosts;
 | 
			
		|||
#define DFILE_ERROR_CORRUPT              0x06 // Demo file is corrupted
 | 
			
		||||
 | 
			
		||||
void G_DeferedPlayDemo(const char *demo);
 | 
			
		||||
void G_DoPlayDemo(const char *defdemoname);
 | 
			
		||||
void G_DoPlayDemoEx(const char *defdemoname, lumpnum_t deflumpnum);
 | 
			
		||||
#define G_DoPlayDemo(defdemoname) G_DoPlayDemoEx(defdemoname, LUMPERROR)
 | 
			
		||||
void G_TimeDemo(const char *name);
 | 
			
		||||
void G_AddGhost(savebuffer_t *buffer, const char *defdemoname);
 | 
			
		||||
staffbrief_t *G_GetStaffGhostBrief(UINT8 *buffer);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -521,7 +521,7 @@ static boolean F_CreditsPlayDemo(void)
 | 
			
		|||
	demo.ignorefiles = true;
 | 
			
		||||
	demo.loadfiles = false;
 | 
			
		||||
 | 
			
		||||
	G_DoPlayDemo(demo_name.c_str());
 | 
			
		||||
	G_DoPlayDemoEx("", (brief->wad << 16) | brief->lump);
 | 
			
		||||
 | 
			
		||||
	g_fast_forward = 30 * TICRATE;
 | 
			
		||||
	g_credits.demo_exit = 0;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -59,25 +59,6 @@ static boolean noFurtherInput = false;
 | 
			
		|||
 | 
			
		||||
CV_PossibleValue_t dummystaff_cons_t[] = {{0, "MIN"}, {999, "MAX"}, {0, NULL}};
 | 
			
		||||
 | 
			
		||||
// ==========================================================================
 | 
			
		||||
// CVAR ONCHANGE EVENTS GO HERE
 | 
			
		||||
// ==========================================================================
 | 
			
		||||
// (there's only a couple anyway)
 | 
			
		||||
 | 
			
		||||
void Dummystaff_OnChange(void);
 | 
			
		||||
void Dummystaff_OnChange(void)
 | 
			
		||||
{
 | 
			
		||||
	if (mapheaderinfo[levellist.choosemap] == NULL || mapheaderinfo[levellist.choosemap]->ghostCount <= 0)
 | 
			
		||||
		return;
 | 
			
		||||
 | 
			
		||||
	dummystaff_cons_t[1].value = mapheaderinfo[levellist.choosemap]->ghostCount-1;
 | 
			
		||||
	if (cv_dummystaff.value > dummystaff_cons_t[1].value)
 | 
			
		||||
	{
 | 
			
		||||
		CV_StealthSetValue(&cv_dummystaff, 0);
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
// =========================================================================
 | 
			
		||||
// BASIC MENU HANDLING
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -335,9 +335,12 @@ void CV_SPBAttackChanged(void)
 | 
			
		|||
			PLAY_TAGhosts[taghost_staff].status = IT_DISABLED;
 | 
			
		||||
		if (mapheaderinfo[levellist.choosemap]->ghostCount > 0 && !modeprefix[0])
 | 
			
		||||
		{
 | 
			
		||||
			extern CV_PossibleValue_t dummystaff_cons_t[];
 | 
			
		||||
			dummystaff_cons_t[1].value = mapheaderinfo[levellist.choosemap]->ghostCount-1;
 | 
			
		||||
			CV_SetValue(&cv_dummystaff, 0);
 | 
			
		||||
 | 
			
		||||
			PLAY_TAReplay[tareplay_staff].status = IT_STRING|IT_ARROWS;
 | 
			
		||||
			PLAY_TAGhosts[taghost_staff].status = IT_STRING|IT_CVAR;
 | 
			
		||||
			CV_SetValue(&cv_dummystaff, 0);
 | 
			
		||||
			active |= 1|4;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -413,7 +416,6 @@ void M_HandleStaffReplay(INT32 choice)
 | 
			
		|||
	{
 | 
			
		||||
		mapheader_t *mapheader;
 | 
			
		||||
		staffbrief_t *staffbrief;
 | 
			
		||||
		const char* lumpname = NULL;
 | 
			
		||||
		restoreMenu = &PLAY_TimeAttackDef;
 | 
			
		||||
 | 
			
		||||
		M_ClearMenus(true);
 | 
			
		||||
| 
						 | 
				
			
			@ -423,9 +425,7 @@ void M_HandleStaffReplay(INT32 choice)
 | 
			
		|||
		mapheader = mapheaderinfo[levellist.choosemap];
 | 
			
		||||
		staffbrief = mapheader->ghostBrief[cv_dummystaff.value];
 | 
			
		||||
 | 
			
		||||
		lumpname = W_CheckNameForNumPwad(staffbrief->wad, staffbrief->lump);
 | 
			
		||||
 | 
			
		||||
		G_DoPlayDemo(lumpname);
 | 
			
		||||
		G_DoPlayDemoEx("", (staffbrief->wad << 16) | staffbrief->lump);
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -8460,6 +8460,10 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate)
 | 
			
		|||
		if (demo.attract)
 | 
			
		||||
		{
 | 
			
		||||
			; // Leave the music alone! We're already playing what we want!
 | 
			
		||||
 | 
			
		||||
			// Pull from RNG even though music will never change
 | 
			
		||||
			// To silence playback has desynced warning
 | 
			
		||||
			P_Random(PR_MUSICSELECT);
 | 
			
		||||
		}
 | 
			
		||||
		else if (K_PodiumSequence())
 | 
			
		||||
		{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue