Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiangreffrath committed Jul 28, 2021
2 parents d587245 + 3524a67 commit c072715
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 5 deletions.
5 changes: 3 additions & 2 deletions opl/opl_sdl.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,10 @@ static void FillBuffer(uint8_t *buffer, unsigned int nsamples)

// Callback function to fill a new sound buffer:

static void OPL_Mix_Callback(void *udata, Uint8 *buffer, int len)
static void OPL_Mix_Callback(int chan, void *stream, int len, void *udata)
{
unsigned int filled, buffer_samples;
Uint8 *buffer = (Uint8*)stream;

// Repeatedly call the OPL emulator update function until the buffer is
// full.
Expand Down Expand Up @@ -351,7 +352,7 @@ static int OPL_SDL_Init(unsigned int port_base)
// Set postmix that adds the OPL music. This is deliberately done
// as a postmix and not using Mix_HookMusic() as the latter disables
// normal SDL_mixer music mixing.
Mix_SetPostMix(OPL_Mix_Callback, NULL);
Mix_RegisterEffect(MIX_CHANNEL_POST, OPL_Mix_Callback, NULL, NULL);

return 1;
}
Expand Down
4 changes: 2 additions & 2 deletions pcsound/pcsound_sdl.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ static int phase_offset = 0;

// Mixer function that does the PC speaker emulation

static void PCSound_Mix_Callback(void *udata, Uint8 *stream, int len)
static void PCSound_Mix_Callback(int chan, void *stream, int len, void *udata)
{
Sint16 *leftptr;
Sint16 *rightptr;
Expand Down Expand Up @@ -236,7 +236,7 @@ static int PCSound_SDL_Init(pcsound_callback_func callback_func)
current_freq = 0;
current_remaining = 0;

Mix_SetPostMix(PCSound_Mix_Callback, NULL);
Mix_RegisterEffect(MIX_CHANNEL_POST, PCSound_Mix_Callback, NULL, NULL);

return 1;
}
Expand Down
28 changes: 27 additions & 1 deletion src/hexen/g_game.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ boolean lowres_turn;
boolean shortticfix; // calculate lowres turning like doom
boolean demoplayback;
boolean demoextend;
boolean netdemo;
byte *demobuffer, *demo_p, *demoend;
boolean singledemo; // quit after playing a demo from cmdline

Expand Down Expand Up @@ -1021,7 +1022,7 @@ void G_Ticker(void)
if (demorecording)
G_WriteDemoTiccmd(cmd);

if (netgame && !(gametic % ticdup))
if (netgame && !netdemo && !(gametic % ticdup))
{
if (gametic > BACKUPTICS
&& consistancy[i][buf] != cmd->consistancy)
Expand Down Expand Up @@ -1795,6 +1796,7 @@ void G_InitNew(skill_t skill, int episode, int map)
// loading a saved one from the menu, and only during playback.
demorecording = false;
demoplayback = false;
netdemo = false;
usergame = true; // will be set false if a demo
}
paused = false;
Expand Down Expand Up @@ -2098,6 +2100,12 @@ void G_DoPlayDemo(void)
PlayerClass[i] = *demo_p++;
}

if (playeringame[1] || M_ParmExists("-solo-net")
|| M_ParmExists("-netdemo"))
{
netgame = true;
}

// Initialize world info, etc.
G_StartNewInit();

Expand All @@ -2106,6 +2114,11 @@ void G_DoPlayDemo(void)
precache = true;
usergame = false;
demoplayback = true;

if (netgame)
{
netdemo = true;
}
}


Expand Down Expand Up @@ -2140,13 +2153,24 @@ void G_TimeDemo(char *name)
PlayerClass[i] = *demo_p++;
}

if (playeringame[1] || M_ParmExists("-solo-net")
|| M_ParmExists("-netdemo"))
{
netgame = true;
}

G_InitNew(skill, episode, map);
starttime = I_GetTime();

usergame = false;
demoplayback = true;
timingdemo = true;
singletics = true;

if (netgame)
{
netdemo = true;
}
}


Expand Down Expand Up @@ -2181,6 +2205,8 @@ boolean G_CheckDemoStatus(void)

W_ReleaseLumpName(defdemoname);
demoplayback = false;
netdemo = false;
netgame = false;
H2_AdvanceDemo();
return true;
}
Expand Down

0 comments on commit c072715

Please sign in to comment.