delet metal sonic replay code
massively cluttered the demo code hope this aint used for some super obscure thing guess we´ll see
This commit is contained in:
1 parent
3c85295622
commit
7c490de93e
19 files changed
+42
-533
No files matched your search
+1
-1
@@ -836,7 +836,7 @@ boolean CON_Responder(event_t *ev)
|
||||
// check for console toggle key
|
||||
if (ev->type != ev_console)
|
||||
{
|
||||
if (modeattacking || metalrecording)
|
||||
if (modeattacking)
|
||||
return false;
|
||||
|
||||
if (ev->data1 >= KEY_MOUSE1) // See also: HUD_Responder
|
||||
|
||||
@@ -3451,10 +3451,6 @@ void CL_RemovePlayer(INT32 playernum, INT32 reason)
|
||||
|
||||
void CL_Reset(void)
|
||||
{
|
||||
if (metalrecording)
|
||||
G_StopMetalRecording();
|
||||
if (metalplayback)
|
||||
G_StopMetalDemo();
|
||||
if (demo.recording)
|
||||
G_CheckDemoStatus();
|
||||
|
||||
@@ -4700,8 +4696,6 @@ boolean SV_SpawnServer(void)
|
||||
{
|
||||
if (demo.playback)
|
||||
G_StopDemo(); // reset engine parameter
|
||||
if (metalplayback)
|
||||
G_StopMetalDemo();
|
||||
|
||||
if (!serverrunning)
|
||||
{
|
||||
|
||||
+1
-6
@@ -2018,12 +2018,7 @@ void D_SRB2Main(void)
|
||||
|
||||
// check for a driver that wants intermission stats
|
||||
// start the apropriate game based on parms
|
||||
if (M_CheckParm("-metal"))
|
||||
{
|
||||
G_RecordMetal();
|
||||
autostart = true;
|
||||
}
|
||||
else if (M_CheckParm("-record") && M_IsNextParm())
|
||||
if (M_CheckParm("-record") && M_IsNextParm())
|
||||
{
|
||||
G_RecordDemo(M_GetNextParm());
|
||||
autostart = true;
|
||||
|
||||
+1
-12
@@ -1530,12 +1530,7 @@ static void SendNameAndColor(void)
|
||||
if (players[consoleplayer].mo)
|
||||
players[consoleplayer].mo->color = players[consoleplayer].skincolor;
|
||||
|
||||
if (metalrecording)
|
||||
{ // Metal Sonic is Sonic, obviously.
|
||||
SetPlayerSkinByNum(consoleplayer, 0);
|
||||
CV_StealthSet(&cv_skin, skins[0].name);
|
||||
}
|
||||
else if ((foundskin = R_SkinAvailable(cv_skin.string)) != -1)
|
||||
if ((foundskin = R_SkinAvailable(cv_skin.string)) != -1)
|
||||
{
|
||||
cv_skin.value = foundskin;
|
||||
SetPlayerSkin(consoleplayer, cv_skin.string);
|
||||
@@ -2325,8 +2320,6 @@ static void Command_Playdemo_f(void)
|
||||
// disconnect from server here?
|
||||
if (demo.playback)
|
||||
G_StopDemo();
|
||||
if (metalplayback)
|
||||
G_StopMetalDemo();
|
||||
|
||||
// open the demo file
|
||||
strcpy(name, COM_Argv(1));
|
||||
@@ -2373,8 +2366,6 @@ static void Command_Timedemo_f(void)
|
||||
// disconnect from server here?
|
||||
if (demo.playback)
|
||||
G_StopDemo();
|
||||
if (metalplayback)
|
||||
G_StopMetalDemo();
|
||||
|
||||
// open the demo file
|
||||
strcpy (name, COM_Argv(1));
|
||||
@@ -2931,8 +2922,6 @@ static void Got_Mapcmd(UINT8 **cp, INT32 playernum)
|
||||
if (demo.timing)
|
||||
G_DoneLevelLoad();
|
||||
|
||||
if (metalrecording)
|
||||
G_BeginMetal();
|
||||
if (demo.recording) // Okay, level loaded, character spawned and skinned,
|
||||
G_BeginRecording(); // I AM NOW READY TO RECORD.
|
||||
demo.deferstart = true;
|
||||
|
||||
@@ -383,10 +383,6 @@ typedef struct player_s
|
||||
fixed_t viewz;
|
||||
// Base height above floor for viewz.
|
||||
fixed_t viewheight;
|
||||
// Bob/squat speed.
|
||||
//fixed_t deltaviewheight;
|
||||
// bounded/scaled total momentum.
|
||||
//fixed_t bob;
|
||||
|
||||
angle_t viewrollangle;
|
||||
angle_t tilt;
|
||||
|
||||
@@ -1439,8 +1439,6 @@ void I_Quit(void)
|
||||
|
||||
if (demo.recording)
|
||||
G_CheckDemoStatus();
|
||||
if (metalrecording)
|
||||
G_StopMetalRecording();
|
||||
|
||||
D_QuitNetGame();
|
||||
I_ShutdownMusic();
|
||||
@@ -1546,8 +1544,6 @@ void I_Error(const char *error, ...)
|
||||
// Shutdown. Here might be other errors.
|
||||
if (demo.recording)
|
||||
G_CheckDemoStatus();
|
||||
if (metalrecording)
|
||||
G_StopMetalRecording();
|
||||
|
||||
D_QuitNetGame();
|
||||
I_ShutdownMusic();
|
||||
|
||||
@@ -71,7 +71,6 @@ extern boolean majormods;
|
||||
extern UINT16 mainwads;
|
||||
extern boolean savemoddata; // This mod saves time/emblem data.
|
||||
extern boolean imcontinuing; // Temporary flag while continuing
|
||||
extern boolean metalrecording;
|
||||
|
||||
#define ATTACKING_NONE 0
|
||||
#define ATTACKING_RECORD 1
|
||||
|
||||
+13
-411
@@ -82,12 +82,6 @@ static boolean demosynced = true; // console warning message
|
||||
|
||||
struct demovars_s demo;
|
||||
|
||||
boolean metalrecording; // recording as metal sonic
|
||||
mobj_t *metalplayback;
|
||||
static UINT8 *metalbuffer = NULL;
|
||||
static UINT8 *metal_p;
|
||||
static UINT16 metalversion;
|
||||
|
||||
consvar_t cv_resyncdemo = {"resyncdemo", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
// extra data stuff (events registered this frame while recording)
|
||||
@@ -196,25 +190,10 @@ static ticcmd_t oldcmd[MAXPLAYERS];
|
||||
#define EZT_SPRITE 0x40 // Changed sprite set completely out of PLAY (NiGHTS, SOCs, whatever)
|
||||
#define EZT_KART 0x80 // SRB2Kart: Changed current held item/quantity and bumpers for battle
|
||||
|
||||
static mobj_t oldmetal, oldghost[MAXPLAYERS];
|
||||
static mobj_t oldghost[MAXPLAYERS];
|
||||
|
||||
static void G_ResetDemoPlayback(char *pdemoname);
|
||||
|
||||
void G_SaveMetal(UINT8 **buffer)
|
||||
{
|
||||
I_Assert(buffer != NULL && *buffer != NULL);
|
||||
|
||||
WRITEUINT32(*buffer, metal_p - metalbuffer);
|
||||
}
|
||||
|
||||
void G_LoadMetal(UINT8 **buffer)
|
||||
{
|
||||
I_Assert(buffer != NULL && *buffer != NULL);
|
||||
|
||||
G_DoPlayMetal();
|
||||
metal_p = metalbuffer + READUINT32(*buffer);
|
||||
}
|
||||
|
||||
// Finds a skin with the closest stats if the expected skin doesn't exist.
|
||||
static INT32 GetSkinNumClosestToStats(UINT8 kartspeed, UINT8 kartweight)
|
||||
{
|
||||
@@ -1269,15 +1248,15 @@ void G_GhostTicker(void)
|
||||
{
|
||||
switch (ziptic & EZT_THOKMASK)
|
||||
{
|
||||
case EZT_THOK:
|
||||
type = (UINT32)mobjinfo[MT_PLAYER].painchance;
|
||||
break;
|
||||
case EZT_SPIN:
|
||||
type = (UINT32)mobjinfo[MT_PLAYER].damage;
|
||||
break;
|
||||
case EZT_REV:
|
||||
type = (UINT32)mobjinfo[MT_PLAYER].raisestate;
|
||||
break;
|
||||
case EZT_THOK:
|
||||
type = (UINT32)mobjinfo[MT_PLAYER].painchance;
|
||||
break;
|
||||
case EZT_SPIN:
|
||||
type = (UINT32)mobjinfo[MT_PLAYER].damage;
|
||||
break;
|
||||
case EZT_REV:
|
||||
type = (UINT32)mobjinfo[MT_PLAYER].raisestate;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (type != -1)
|
||||
@@ -1575,216 +1554,6 @@ void G_ConfirmRewind(tic_t rewindtime)
|
||||
P_ResetCamera(&players[displayplayers[i]], &camera[i]);
|
||||
}
|
||||
|
||||
void G_ReadMetalTic(mobj_t *metal)
|
||||
{
|
||||
UINT8 ziptic;
|
||||
UINT16 speed;
|
||||
UINT8 statetype;
|
||||
|
||||
if (!metal_p)
|
||||
return;
|
||||
ziptic = READUINT8(metal_p);
|
||||
|
||||
// Read changes from the tic
|
||||
if (ziptic & GZT_XYZ)
|
||||
{
|
||||
oldmetal.x = READFIXED(metal_p);
|
||||
oldmetal.y = READFIXED(metal_p);
|
||||
oldmetal.z = READFIXED(metal_p);
|
||||
P_MoveOrigin(metal, oldmetal.x, oldmetal.y, oldmetal.z);
|
||||
oldmetal.x = metal->x;
|
||||
oldmetal.y = metal->y;
|
||||
oldmetal.z = metal->z;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ziptic & GZT_MOMXY)
|
||||
{
|
||||
oldmetal.momx = READINT16(metal_p)<<8;
|
||||
oldmetal.momy = READINT16(metal_p)<<8;
|
||||
}
|
||||
if (ziptic & GZT_MOMZ)
|
||||
oldmetal.momz = READINT16(metal_p)<<8;
|
||||
oldmetal.x += oldmetal.momx;
|
||||
oldmetal.y += oldmetal.momy;
|
||||
oldmetal.z += oldmetal.momz;
|
||||
}
|
||||
if (ziptic & GZT_ANGLE)
|
||||
oldmetal.angle = READUINT8(metal_p)<<24;
|
||||
if (ziptic & GZT_SPRITE)
|
||||
metal_p++; // Currently unused. (Metal Sonic figures out what he's doing his own damn self.)
|
||||
|
||||
// Set movement, position, and angle
|
||||
// oldmetal contains where you're supposed to be.
|
||||
metal->momx = oldmetal.momx;
|
||||
metal->momy = oldmetal.momy;
|
||||
metal->momz = oldmetal.momz;
|
||||
P_UnsetThingPosition(metal);
|
||||
metal->x = oldmetal.x;
|
||||
metal->y = oldmetal.y;
|
||||
metal->z = oldmetal.z;
|
||||
P_SetThingPosition(metal);
|
||||
metal->angle = oldmetal.angle;
|
||||
|
||||
if (ziptic & GZT_EXTRA)
|
||||
{ // But wait, there's more!
|
||||
ziptic = READUINT8(metal_p);
|
||||
if (ziptic & EZT_FLIP)
|
||||
metal->eflags ^= MFE_VERTICALFLIP;
|
||||
if (ziptic & EZT_SCALE)
|
||||
{
|
||||
metal->destscale = READFIXED(metal_p);
|
||||
if (metal->destscale != metal->scale)
|
||||
P_SetScale(metal, metal->destscale);
|
||||
}
|
||||
}
|
||||
|
||||
// Calculates player's speed based on distance-of-a-line formula
|
||||
speed = FixedDiv(P_AproxDistance(oldmetal.momx, oldmetal.momy), metal->scale)>>FRACBITS;
|
||||
|
||||
// Use speed to decide an appropriate state
|
||||
if (speed > 20) // default skin runspeed
|
||||
statetype = 2;
|
||||
else if (speed > 1) // stopspeed
|
||||
statetype = 1;
|
||||
else
|
||||
statetype = 0;
|
||||
|
||||
// Set state
|
||||
if (statetype != metal->threshold)
|
||||
{
|
||||
switch (statetype)
|
||||
{
|
||||
case 2: // run
|
||||
P_SetMobjState(metal,metal->info->meleestate);
|
||||
break;
|
||||
case 1: // walk
|
||||
P_SetMobjState(metal,metal->info->seestate);
|
||||
break;
|
||||
default: // stand
|
||||
P_SetMobjState(metal,metal->info->spawnstate);
|
||||
break;
|
||||
}
|
||||
metal->threshold = statetype;
|
||||
}
|
||||
|
||||
// TODO: Modify state durations based on movement speed, similar to players?
|
||||
|
||||
if (*metal_p == DEMOMARKER)
|
||||
{
|
||||
// end of demo data stream
|
||||
G_StopMetalDemo();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void G_WriteMetalTic(mobj_t *metal)
|
||||
{
|
||||
UINT8 ziptic = 0;
|
||||
UINT8 *ziptic_p;
|
||||
|
||||
if (!demobuf.p) // demobuf.p will be NULL until the race start linedef executor is triggered!
|
||||
return;
|
||||
|
||||
ziptic_p = demobuf.p++; // the ziptic, written at the end of this function
|
||||
|
||||
#define MAXMOM (0xFFFF<<8)
|
||||
|
||||
// GZT_XYZ is only useful if you've moved 256 FRACUNITS or more in a single tic.
|
||||
if (abs(metal->x-oldmetal.x) > MAXMOM
|
||||
|| abs(metal->y-oldmetal.y) > MAXMOM
|
||||
|| abs(metal->z-oldmetal.z) > MAXMOM)
|
||||
{
|
||||
oldmetal.x = metal->x;
|
||||
oldmetal.y = metal->y;
|
||||
oldmetal.z = metal->z;
|
||||
WRITEFIXED(demobuf.p,oldmetal.x);
|
||||
WRITEFIXED(demobuf.p,oldmetal.y);
|
||||
WRITEFIXED(demobuf.p,oldmetal.z);
|
||||
ziptic |= GZT_XYZ;
|
||||
}
|
||||
else
|
||||
{
|
||||
// For moving normally:
|
||||
// Store one full byte of movement, plus one byte of fractional movement.
|
||||
INT16 momx = (INT16)((metal->x-oldmetal.x)>>8);
|
||||
INT16 momy = (INT16)((metal->y-oldmetal.y)>>8);
|
||||
if (momx != oldmetal.momx
|
||||
|| momy != oldmetal.momy)
|
||||
{
|
||||
oldmetal.momx = momx;
|
||||
oldmetal.momy = momy;
|
||||
WRITEINT16(demobuf.p,momx);
|
||||
WRITEINT16(demobuf.p,momy);
|
||||
ziptic |= GZT_MOMXY;
|
||||
}
|
||||
momx = (INT16)((metal->z-oldmetal.z)>>8);
|
||||
if (momx != oldmetal.momz)
|
||||
{
|
||||
oldmetal.momz = momx;
|
||||
WRITEINT16(demobuf.p,momx);
|
||||
ziptic |= GZT_MOMZ;
|
||||
}
|
||||
|
||||
// This SHOULD set oldmetal.x/y/z to match metal->x/y/z
|
||||
// but it keeps the fractional loss of one byte,
|
||||
// so it will hopefully be made up for in future tics.
|
||||
oldmetal.x += oldmetal.momx<<8;
|
||||
oldmetal.y += oldmetal.momy<<8;
|
||||
oldmetal.z += oldmetal.momz<<8;
|
||||
}
|
||||
|
||||
#undef MAXMOM
|
||||
|
||||
// Only store the 8 most relevant bits of angle
|
||||
// because exact values aren't too easy to discern to begin with when only 8 angles have different sprites
|
||||
// and it does not affect movement at all anyway.
|
||||
if (metal->angle>>24 != oldmetal.angle)
|
||||
{
|
||||
oldmetal.angle = metal->angle>>24;
|
||||
WRITEUINT8(demobuf.p,oldmetal.angle);
|
||||
ziptic |= GZT_ANGLE;
|
||||
}
|
||||
|
||||
// Metal Sonic does not need our state changes.
|
||||
// ... currently.
|
||||
|
||||
{
|
||||
UINT8 *exttic_p = NULL;
|
||||
UINT8 exttic = 0;
|
||||
if ((metal->eflags & MFE_VERTICALFLIP) != (oldmetal.eflags & MFE_VERTICALFLIP))
|
||||
{
|
||||
if (!exttic_p)
|
||||
exttic_p = demobuf.p++;
|
||||
exttic |= EZT_FLIP;
|
||||
oldmetal.eflags ^= MFE_VERTICALFLIP;
|
||||
}
|
||||
if (metal->scale != oldmetal.scale)
|
||||
{
|
||||
if (!exttic_p)
|
||||
exttic_p = demobuf.p++;
|
||||
exttic |= EZT_SCALE;
|
||||
WRITEFIXED(demobuf.p,metal->scale);
|
||||
oldmetal.scale = metal->scale;
|
||||
}
|
||||
if (exttic_p)
|
||||
{
|
||||
*exttic_p = exttic;
|
||||
ziptic |= GZT_EXTRA;
|
||||
}
|
||||
}
|
||||
|
||||
*ziptic_p = ziptic;
|
||||
|
||||
// attention here for the ticcmd size!
|
||||
// latest demos with mouse aiming byte in ticcmd
|
||||
if (demobuf.p >= demoend - 32)
|
||||
{
|
||||
G_StopMetalRecording(); // no more space
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// G_RecordDemo
|
||||
//
|
||||
@@ -1815,23 +1584,6 @@ void G_RecordDemo(const char *name)
|
||||
}
|
||||
}
|
||||
|
||||
void G_RecordMetal(void)
|
||||
{
|
||||
INT32 maxsize;
|
||||
maxsize = cv_maxdemosize.value*1024*1024;
|
||||
if (demobuf.buffer)
|
||||
Z_Free(demobuf.buffer);
|
||||
demobuf.p = NULL;
|
||||
metalrecording = false;
|
||||
demobuf.buffer = Z_Malloc(maxsize + 100*1024, PU_STATIC, NULL);
|
||||
demoend = demobuf.buffer + maxsize;
|
||||
|
||||
if (demobuf.buffer)
|
||||
metalrecording = true;
|
||||
else
|
||||
CONS_Alert(CONS_ERROR, "Failed to allocate demo buffer\n");
|
||||
}
|
||||
|
||||
void G_BeginRecording(void)
|
||||
{
|
||||
UINT8 i, p;
|
||||
@@ -2016,46 +1768,6 @@ void G_BeginRecording(void)
|
||||
}
|
||||
}
|
||||
|
||||
void G_BeginMetal(void)
|
||||
{
|
||||
mobj_t *mo = players[consoleplayer].mo;
|
||||
|
||||
if (demobuf.buffer == NULL)
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, "No metal demo buffer allocated\n");
|
||||
metalrecording = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (demobuf.p)
|
||||
{
|
||||
Z_Free(demobuf.buffer);
|
||||
demobuf.buffer = NULL;
|
||||
metalrecording = false;
|
||||
return;
|
||||
}
|
||||
|
||||
demobuf.p = demobuf.buffer;
|
||||
|
||||
// Write header.
|
||||
M_Memcpy(demobuf.p, DEMOHEADER, 12); demobuf.p += 12;
|
||||
WRITEUINT8(demobuf.p,VERSION);
|
||||
WRITEUINT8(demobuf.p,SUBVERSION);
|
||||
WRITEUINT16(demobuf.p,DEMOVERSION);
|
||||
|
||||
// demo checksum
|
||||
demobuf.p += 16;
|
||||
|
||||
M_Memcpy(demobuf.p, "METL", 4); demobuf.p += 4;
|
||||
|
||||
// Set up our memory.
|
||||
memset(&oldmetal,0,sizeof(oldmetal));
|
||||
oldmetal.x = mo->x;
|
||||
oldmetal.y = mo->y;
|
||||
oldmetal.z = mo->z;
|
||||
oldmetal.angle = mo->angle;
|
||||
}
|
||||
|
||||
void G_WriteStanding(UINT8 ranking, char *name, INT32 skinnum, UINT8 color, UINT32 val)
|
||||
{
|
||||
char temp[17];
|
||||
@@ -3657,74 +3369,6 @@ void G_TimeDemo(const char *name)
|
||||
G_DeferedPlayDemo(name);
|
||||
}
|
||||
|
||||
void G_DoPlayMetal(void)
|
||||
{
|
||||
lumpnum_t l;
|
||||
mobj_t *mo = NULL;
|
||||
thinker_t *th;
|
||||
|
||||
// it's an internal demo
|
||||
if ((l = W_CheckNumForName(va("%sMS",G_BuildMapName(gamemap)))) == LUMPERROR)
|
||||
{
|
||||
CONS_Alert(CONS_WARNING, M_GetText("No bot recording for this map.\n"));
|
||||
return;
|
||||
}
|
||||
else
|
||||
metalbuffer = metal_p = W_CacheLumpNum(l, PU_STATIC);
|
||||
|
||||
// find metal sonic
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
{
|
||||
if (th->function != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
mo = (mobj_t *)th;
|
||||
if (mo->type == MT_METALSONIC_RACE)
|
||||
break;
|
||||
}
|
||||
if (!mo)
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, M_GetText("Failed to find bot entity.\n"));
|
||||
Z_Free(metalbuffer);
|
||||
return;
|
||||
}
|
||||
|
||||
// read demo header
|
||||
metal_p += 12; // DEMOHEADER
|
||||
metal_p++; // VERSION
|
||||
metal_p++; // SUBVERSION
|
||||
metalversion = READUINT16(metal_p);
|
||||
switch(metalversion)
|
||||
{
|
||||
case DEMOVERSION: // latest always supported
|
||||
break;
|
||||
#ifdef DEMO_COMPAT_100
|
||||
case 0x0001:
|
||||
I_Error("You need to implement demo compat here, doofus! %s:%d", __FILE__, __LINE__);
|
||||
#endif
|
||||
// too old, cannot support.
|
||||
default:
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Failed to load bot recording for this map, format version incompatible.\n"));
|
||||
Z_Free(metalbuffer);
|
||||
return;
|
||||
}
|
||||
metal_p += 16; // demo checksum
|
||||
if (memcmp(metal_p, "METL", 4))
|
||||
{
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Failed to load bot recording for this map, wasn't recorded in Metal format.\n"));
|
||||
Z_Free(metalbuffer);
|
||||
return;
|
||||
} metal_p += 4; // "METL"
|
||||
|
||||
// read initial tic
|
||||
memset(&oldmetal,0,sizeof(oldmetal));
|
||||
oldmetal.x = mo->x;
|
||||
oldmetal.y = mo->y;
|
||||
oldmetal.z = mo->z;
|
||||
oldmetal.angle = mo->angle;
|
||||
metalplayback = mo;
|
||||
}
|
||||
|
||||
void G_DoneLevelLoad(void)
|
||||
{
|
||||
CONS_Printf(M_GetText("Loaded level in %f sec\n"), (double)(I_GetTime() - demostarttime) / TICRATE);
|
||||
@@ -3742,42 +3386,6 @@ void G_DoneLevelLoad(void)
|
||||
===================
|
||||
*/
|
||||
|
||||
// Stops metal sonic's demo. Separate from other functions because metal + replays can coexist
|
||||
void G_StopMetalDemo(void)
|
||||
{
|
||||
// Metal Sonic finishing doesn't end the game, dammit.
|
||||
Z_Free(metalbuffer);
|
||||
metalbuffer = NULL;
|
||||
metalplayback = NULL;
|
||||
metal_p = NULL;
|
||||
}
|
||||
|
||||
// Stops metal sonic recording.
|
||||
ATTRNORETURN void FUNCNORETURN G_StopMetalRecording(void)
|
||||
{
|
||||
boolean saved = false;
|
||||
if (demobuf.p && demobuf.buffer != NULL)
|
||||
{
|
||||
UINT8 *p = demobuf.buffer+16; // checksum position
|
||||
#ifdef NOMD5
|
||||
UINT8 i;
|
||||
WRITEUINT8(demobuf.p, DEMOMARKER); // add the demo end marker
|
||||
for (i = 0; i < 16; i++, p++)
|
||||
*p = P_RandomByte(); // This MD5 was chosen by fair dice roll and most likely < 50% correct.
|
||||
#else
|
||||
WRITEUINT8(demobuf.p, DEMOMARKER); // add the demo end marker
|
||||
md5_buffer((char *)p+16, demobuf.p - (p+16), (void *)p); // make a checksum of everything after the checksum in the file.
|
||||
#endif
|
||||
saved = FIL_WriteFile(va("%sMS.LMP", G_BuildMapName(gamemap)), demobuf.buffer, demobuf.p - demobuf.buffer); // finally output the file.
|
||||
}
|
||||
Z_Free(demobuf.buffer);
|
||||
demobuf.buffer = NULL;
|
||||
metalrecording = false;
|
||||
if (saved)
|
||||
I_Error("Saved to %sMS.LMP", G_BuildMapName(gamemap));
|
||||
I_Error("Failed to save demo!");
|
||||
}
|
||||
|
||||
// reset engine variable set for the demos
|
||||
// called from stopdemo command, map command, and g_checkdemoStatus.
|
||||
void G_StopDemo(void)
|
||||
@@ -3860,8 +3468,6 @@ boolean G_CheckDemoStatus(void)
|
||||
{
|
||||
G_FreeGhosts();
|
||||
|
||||
// DO NOT end metal sonic demos here
|
||||
|
||||
if (demo.timing)
|
||||
{
|
||||
G_StopTimingDemo();
|
||||
@@ -3907,18 +3513,15 @@ boolean G_CheckDemoStatus(void)
|
||||
|
||||
void G_ResetDemoRecording(void)
|
||||
{
|
||||
if (demobuf.buffer)
|
||||
Z_Free(demobuf.buffer);
|
||||
Z_Free(demobuf.buffer);
|
||||
demobuf.buffer = NULL;
|
||||
demo.recording = false;
|
||||
}
|
||||
|
||||
static void G_ResetDemoPlayback(char *pdemoname)
|
||||
{
|
||||
if (pdemoname)
|
||||
Z_Free(pdemoname);
|
||||
if (demobuf.buffer)
|
||||
Z_Free(demobuf.buffer);
|
||||
Z_Free(pdemoname);
|
||||
Z_Free(demobuf.buffer);
|
||||
demobuf.buffer = NULL;
|
||||
demo.playback = false;
|
||||
if (demo.title)
|
||||
@@ -4007,7 +3610,6 @@ void G_SaveDemo(void)
|
||||
md5_buffer((char *)p+16, (demobuf.buffer + length) - (p+16), p);
|
||||
#endif
|
||||
|
||||
|
||||
if (FIL_WriteFile(va(pandf, srb2home, demoname), demobuf.buffer, demobuf.p - demobuf.buffer)) // finally output the file.
|
||||
demo.savemode = DSM_SAVED;
|
||||
|
||||
|
||||
@@ -87,13 +87,9 @@ typedef struct menudemo_s {
|
||||
} standings[MAXPLAYERS];
|
||||
} menudemo_t;
|
||||
|
||||
extern mobj_t *metalplayback;
|
||||
|
||||
// Only called by startup code.
|
||||
void G_RecordDemo(const char *name);
|
||||
void G_RecordMetal(void);
|
||||
void G_BeginRecording(void);
|
||||
void G_BeginMetal(void);
|
||||
|
||||
// Only called by shutdown code.
|
||||
void G_WriteStanding(UINT8 ranking, char *name, INT32 skinnum, UINT8 color, UINT32 val);
|
||||
@@ -147,11 +143,6 @@ void G_StoreRewindInfo(void);
|
||||
void G_PreviewRewind(tic_t previewtime);
|
||||
void G_ConfirmRewind(tic_t rewindtime);
|
||||
|
||||
void G_ReadMetalTic(mobj_t *metal);
|
||||
void G_WriteMetalTic(mobj_t *metal);
|
||||
void G_SaveMetal(UINT8 **buffer);
|
||||
void G_LoadMetal(UINT8 **buffer);
|
||||
|
||||
// Your naming conventions are stupid and useless.
|
||||
// There is no conflict here.
|
||||
typedef struct demoghost {
|
||||
@@ -176,10 +167,7 @@ void G_TimeDemo(const char *name);
|
||||
void G_AddGhost(char *defdemoname);
|
||||
void G_FreeGhosts(void);
|
||||
void G_UpdateStaffGhostName(lumpnum_t l);
|
||||
void G_DoPlayMetal(void);
|
||||
void G_DoneLevelLoad(void);
|
||||
void G_StopMetalDemo(void);
|
||||
ATTRNORETURN void FUNCNORETURN G_StopMetalRecording(void);
|
||||
void G_StopDemo(void);
|
||||
boolean G_CheckDemoStatus(void);
|
||||
void G_SaveDemo(void);
|
||||
|
||||
@@ -3053,11 +3053,6 @@ static void G_DoCompleted(void)
|
||||
|
||||
gameaction = ga_nothing;
|
||||
|
||||
if (metalplayback)
|
||||
G_StopMetalDemo();
|
||||
if (metalrecording)
|
||||
G_StopMetalRecording();
|
||||
|
||||
K_StatRound();
|
||||
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
|
||||
@@ -7111,8 +7111,6 @@ static void M_StartServer(INT32 choice)
|
||||
|
||||
if (demo.playback)
|
||||
G_StopDemo();
|
||||
if (metalrecording)
|
||||
G_StopMetalDemo();
|
||||
|
||||
if (!cv_nextmap.value)
|
||||
CV_SetValue(&cv_nextmap, G_RandMap(G_TOLFlag(cv_newgametype.value), -1, false, 0, false, NULL)+1);
|
||||
|
||||
+7
-13
@@ -1575,9 +1575,6 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source)
|
||||
// Let EVERYONE know what happened to a player! 01-29-2002 Tails
|
||||
if (target->player && !target->player->spectator)
|
||||
{
|
||||
if (metalrecording) // Ack! Metal Sonic shouldn't die! Cut the tape, end recording!
|
||||
G_StopMetalRecording();
|
||||
|
||||
target->flags2 &= ~MF2_DONTDRAW;
|
||||
}
|
||||
|
||||
@@ -2254,18 +2251,15 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|
||||
}
|
||||
|
||||
// Everything above here can't be forced.
|
||||
if (!metalrecording)
|
||||
{
|
||||
UINT8 shouldForce = LUA_HookShouldDamage(target, inflictor, source, damage);
|
||||
UINT8 shouldForce = LUA_HookShouldDamage(target, inflictor, source, damage);
|
||||
|
||||
if (P_MobjWasRemoved(target))
|
||||
return (shouldForce == 1); // mobj was removed
|
||||
if (P_MobjWasRemoved(target))
|
||||
return (shouldForce == 1); // mobj was removed
|
||||
|
||||
if (shouldForce == 1)
|
||||
force = true;
|
||||
else if (shouldForce == 2)
|
||||
return false;
|
||||
}
|
||||
if (shouldForce == 1)
|
||||
force = true;
|
||||
else if (shouldForce == 2)
|
||||
return false;
|
||||
|
||||
if (!force)
|
||||
{
|
||||
|
||||
+2
-19
@@ -11048,20 +11048,12 @@ void P_SpawnMapThing(mapthing_t *mthing)
|
||||
else
|
||||
{
|
||||
// save spots for respawning in network games
|
||||
if (!metalrecording)
|
||||
playerstarts[mthing->type-1] = mthing;
|
||||
playerstarts[mthing->type-1] = mthing;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// If recording, you ARE Metal Sonic. Do not spawn it, do not save normal spawnpoints.
|
||||
if (metalrecording && mthing->type == mobjinfo[MT_METALSONIC_RACE].doomednum)
|
||||
{
|
||||
playerstarts[0] = mthing;
|
||||
return;
|
||||
}
|
||||
|
||||
// find which type to spawn
|
||||
for (i = 0; i < NUMMOBJTYPES; i++)
|
||||
{
|
||||
@@ -11079,20 +11071,11 @@ void P_SpawnMapThing(mapthing_t *mthing)
|
||||
i = MT_UNKNOWN;
|
||||
}
|
||||
|
||||
if (metalrecording) // Metal Sonic can't use these things.
|
||||
{
|
||||
if (mobjinfo[i].flags & (MF_ENEMY|MF_BOSS) || i == MT_EMMY || i == MT_STARPOST)
|
||||
return;
|
||||
}
|
||||
|
||||
if (i >= MT_EMERALD1 && i <= MT_EMERALD7) // Pickupable Emeralds
|
||||
{
|
||||
if (gametype != GT_COOP) // Don't place emeralds in non-coop modes
|
||||
return;
|
||||
|
||||
if (metalrecording)
|
||||
return; // Metal Sonic isn't for collecting emeralds.
|
||||
|
||||
if (emeralds & mobjinfo[i].speed) // You already have this emerald!
|
||||
return;
|
||||
}
|
||||
@@ -11679,7 +11662,7 @@ ML_NOCLIMB : Direction not controllable
|
||||
mobj->fuse = mthing->angle + mobj->info->speed;
|
||||
}
|
||||
// Use per-thing collision for spikes if the deaf flag is checked.
|
||||
if (mthing->options & MTF_AMBUSH && !metalrecording)
|
||||
if (mthing->options & MTF_AMBUSH)
|
||||
{
|
||||
P_UnsetThingPosition(mobj);
|
||||
mobj->flags &= ~(MF_NOBLOCKMAP|MF_NOGRAVITY|MF_NOCLIPHEIGHT);
|
||||
|
||||
+2
-9
@@ -3301,13 +3301,7 @@ static inline void P_NetArchiveSpecials(savebuffer_t *save)
|
||||
// Current global weather type
|
||||
WRITEUINT8(save->p, globalweather);
|
||||
|
||||
if (metalplayback) // Is metal sonic running?
|
||||
{
|
||||
WRITEUINT8(save->p, 0x01);
|
||||
G_SaveMetal(&save->p);
|
||||
}
|
||||
else
|
||||
WRITEUINT8(save->p, 0x00);
|
||||
WRITEUINT8(save->p, 0x00); // metal sonic
|
||||
}
|
||||
|
||||
//
|
||||
@@ -3348,8 +3342,7 @@ static void P_NetUnArchiveSpecials(savebuffer_t *save)
|
||||
P_SwitchWeather(globalweather);
|
||||
}
|
||||
|
||||
if (READUINT8(save->p) == 0x01) // metal sonic
|
||||
G_LoadMetal(&save->p);
|
||||
READUINT8(save->p); // metal sonic
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
|
||||
@@ -938,9 +938,6 @@ static void P_SpawnMapThings(void)
|
||||
huntemeralds[emer3 - 1]->z<<FRACBITS, MT_EMERHUNT);
|
||||
}
|
||||
|
||||
if (metalrecording) // Metal Sonic gets no rings to distract him.
|
||||
return;
|
||||
|
||||
// Run through the list of mapthings again to spawn hoops and rings
|
||||
for (i = 0, mt = mapthings; i < nummapthings; i++, mt++)
|
||||
{
|
||||
@@ -2724,9 +2721,6 @@ boolean P_SetupLevel(boolean fromnetsave, boolean reloadinggamestate)
|
||||
if (netgame || multiplayer)
|
||||
cv_debug = botskin = 0;
|
||||
|
||||
if (metalplayback)
|
||||
G_StopMetalDemo();
|
||||
|
||||
// Clear CECHO messages
|
||||
HU_ClearCEcho();
|
||||
|
||||
|
||||
+14
-9
@@ -2678,6 +2678,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
|
||||
size_t linenum;
|
||||
side_t *set = &sides[line->sidenum[0]], *this;
|
||||
boolean always = !(line->flags & ML_NOCLIMB); // If noclimb: Only change mid texture if mid texture already exists on tagged lines, etc.
|
||||
|
||||
for (linenum = 0; linenum < numlines; linenum++)
|
||||
{
|
||||
if (lines[linenum].special == 439)
|
||||
@@ -2688,25 +2689,29 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
|
||||
|
||||
// Front side
|
||||
this = &sides[lines[linenum].sidenum[0]];
|
||||
if (always || this->toptexture) this->toptexture = set->toptexture;
|
||||
if (always || this->midtexture) this->midtexture = set->midtexture;
|
||||
if (always || this->bottomtexture) this->bottomtexture = set->bottomtexture;
|
||||
if (always || this->toptexture)
|
||||
this->toptexture = set->toptexture;
|
||||
if (always || this->midtexture)
|
||||
this->midtexture = set->midtexture;
|
||||
if (always || this->bottomtexture)
|
||||
this->bottomtexture = set->bottomtexture;
|
||||
|
||||
if (lines[linenum].sidenum[1] == 0xffff)
|
||||
continue; // One-sided stops here.
|
||||
|
||||
// Back side
|
||||
this = &sides[lines[linenum].sidenum[1]];
|
||||
if (always || this->toptexture) this->toptexture = set->toptexture;
|
||||
if (always || this->midtexture) this->midtexture = set->midtexture;
|
||||
if (always || this->bottomtexture) this->bottomtexture = set->bottomtexture;
|
||||
if (always || this->toptexture)
|
||||
this->toptexture = set->toptexture;
|
||||
if (always || this->midtexture)
|
||||
this->midtexture = set->midtexture;
|
||||
if (always || this->bottomtexture)
|
||||
this->bottomtexture = set->bottomtexture;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 440: // Play race countdown and start Metal Sonic
|
||||
if (!metalrecording && !metalplayback)
|
||||
G_DoPlayMetal();
|
||||
case 440: // Play race countdown and start Metal Sonic // srb2kart: unused
|
||||
break;
|
||||
|
||||
case 441: // Trigger unlockable
|
||||
|
||||
@@ -829,11 +829,6 @@ void P_Ticker(boolean run)
|
||||
|
||||
P_RunQuakes();
|
||||
|
||||
if (metalplayback)
|
||||
G_ReadMetalTic(metalplayback);
|
||||
if (metalrecording)
|
||||
G_WriteMetalTic(players[consoleplayer].mo);
|
||||
|
||||
if (demo.recording)
|
||||
{
|
||||
G_WriteAllGhostTics();
|
||||
|
||||
+1
-4
@@ -1399,7 +1399,7 @@ static void P_CheckBustableBlocks(player_t *player)
|
||||
if (!(rover->flags & FF_SHATTER) && !(rover->flags & FF_SPINBUST)
|
||||
&& !((player->pflags & PF_SPINNING) && !(player->pflags & PF_JUMPED))
|
||||
&& (!player->powers[pw_super])
|
||||
&& !(player->pflags & PF_DRILLING) && !metalrecording)
|
||||
&& !(player->pflags & PF_DRILLING))
|
||||
continue;
|
||||
|
||||
topheight = P_GetFOFTopZ(player->mo, node->m_sector, rover, player->mo->x, player->mo->y, NULL);
|
||||
@@ -1448,9 +1448,6 @@ static void P_CheckBustableBlocks(player_t *player)
|
||||
player->mo->momy >>= 1;
|
||||
}
|
||||
|
||||
//if (metalrecording)
|
||||
// G_RecordBustup(rover);
|
||||
|
||||
EV_CrumbleChain(node->m_sector, rover);
|
||||
|
||||
// Run a linedef executor??
|
||||
|
||||
@@ -1974,8 +1974,6 @@ void I_Quit(void)
|
||||
|
||||
if (demo.recording)
|
||||
G_CheckDemoStatus();
|
||||
if (metalrecording)
|
||||
G_StopMetalRecording();
|
||||
|
||||
D_QuitNetGame();
|
||||
I_ShutdownMusic();
|
||||
@@ -2100,8 +2098,6 @@ void I_Error(const char *error, ...)
|
||||
// Shutdown. Here might be other errors.
|
||||
if (demo.recording)
|
||||
G_CheckDemoStatus();
|
||||
if (metalrecording)
|
||||
G_StopMetalRecording();
|
||||
|
||||
D_QuitNetGame();
|
||||
I_ShutdownMusic();
|
||||
|
||||
Reference in new issue
Block a user