mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-11 18:50:46 +00:00
- hook up the savegame code in Exhumed. Superficially it looks like it works but it will require a lot more testing.
- fixed per-frame sound system update in Exhumed. Sound is still quite broken and will require more work.
This commit is contained in:
parent
8e5b9111bd
commit
7e758a5e48
4 changed files with 55 additions and 32 deletions
|
@ -1680,15 +1680,6 @@ void ExitGame()
|
|||
fclose(vcrfp);
|
||||
}
|
||||
|
||||
FadeSong();
|
||||
if (CDplaying()) {
|
||||
fadecdaudio();
|
||||
}
|
||||
|
||||
StopAllSounds();
|
||||
StopLocalSound();
|
||||
mysaveconfig();
|
||||
|
||||
if (bSerialPlay)
|
||||
{
|
||||
if (nNetPlayerCount != 0) {
|
||||
|
@ -1704,7 +1695,7 @@ void ExitGame()
|
|||
}
|
||||
|
||||
ShutDown();
|
||||
exit(0);
|
||||
throw ExitEvent(0);
|
||||
}
|
||||
|
||||
static int32_t nonsharedtimer;
|
||||
|
@ -2026,6 +2017,8 @@ MENU:
|
|||
case 3:
|
||||
forcelevel = 0;
|
||||
goto STARTGAME2;
|
||||
case 6:
|
||||
goto GAMELOOP;
|
||||
case 9:
|
||||
vcrfp = fopen("demo.vcr", "rb");
|
||||
if (vcrfp == NULL) {
|
||||
|
@ -2192,6 +2185,7 @@ LOOP3:
|
|||
//int edi = totalclock;
|
||||
tclocks2 = totalclock;
|
||||
// Game Loop
|
||||
GAMELOOP:
|
||||
while (1)
|
||||
{
|
||||
if (levelnew >= 0)
|
||||
|
@ -2408,6 +2402,8 @@ LOOP3:
|
|||
|
||||
goto STARTGAME2;
|
||||
}
|
||||
case 6:
|
||||
goto GAMELOOP;
|
||||
}
|
||||
|
||||
totalclock = ototalclock = tclocks;
|
||||
|
@ -2615,9 +2611,11 @@ void DoTitle()
|
|||
|
||||
var_18 += theArray[0];
|
||||
|
||||
inputState.ClearAllKeyStatus();
|
||||
while (LocalSoundPlaying())
|
||||
{
|
||||
HandleAsync();
|
||||
if (inputState.CheckAllInput()) break;
|
||||
|
||||
menu_DoPlasma();
|
||||
overwritesprite(160, 100, nTile, 0, 3, kPalNormal);
|
||||
|
@ -2636,7 +2634,7 @@ void DoTitle()
|
|||
{
|
||||
nCount++;
|
||||
|
||||
assert(nCount <= 12);
|
||||
if (nCount > 12) break;
|
||||
var_18 = nStartTime + theArray[nCount];
|
||||
|
||||
var_4 = var_4 == 0;
|
||||
|
|
|
@ -20,6 +20,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include "init.h"
|
||||
#include "music/z_music.h"
|
||||
//#include <fcntl.h>
|
||||
//#include <sys/stat.h>
|
||||
//#include <io.h>
|
||||
|
@ -30,6 +31,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
|
||||
BEGIN_PS_NS
|
||||
|
||||
extern int MenuExitCondition;
|
||||
void SaveTextureState();
|
||||
void LoadTextureState();
|
||||
|
||||
|
@ -113,7 +115,7 @@ bool GameInterface::LoadGame(FSaveGameNode* sv)
|
|||
fr.Read(show2dwall, sizeof(show2dwall));
|
||||
fr.Read(show2dsprite, sizeof(show2dsprite));
|
||||
fr.Read(show2dsector, sizeof(show2dsector));
|
||||
|
||||
fr.Close();
|
||||
}
|
||||
|
||||
for (auto sgh : sghelpers) sgh->Load();
|
||||
|
@ -133,7 +135,8 @@ bool GameInterface::LoadGame(FSaveGameNode* sv)
|
|||
parallaxtype = 2;
|
||||
g_visibility = 2048;
|
||||
ototalclock = totalclock;
|
||||
|
||||
MenuExitCondition = 6;
|
||||
Mus_ResumeSaved();
|
||||
return 1; // CHECKME
|
||||
}
|
||||
|
||||
|
|
|
@ -555,45 +555,67 @@ void UpdateSounds()
|
|||
|
||||
int nLocalSectFlags = SectFlag[nPlayerViewSect[nLocalPlayer]];
|
||||
|
||||
int x, y;
|
||||
vec3_t pos;
|
||||
short ang;
|
||||
if (nSnakeCam > -1)
|
||||
{
|
||||
Snake *pSnake = &SnakeList[nSnakeCam];
|
||||
spritetype *pSnakeSprite = &sprite[pSnake->nSprites[0]];
|
||||
x = pSnakeSprite->x;
|
||||
y = pSnakeSprite->y;
|
||||
pos = pSnakeSprite->pos;
|
||||
ang = pSnakeSprite->ang;
|
||||
}
|
||||
else
|
||||
{
|
||||
x = initx;
|
||||
y = inity;
|
||||
pos = { initx, inity, initz };
|
||||
ang = inita;
|
||||
}
|
||||
auto fv = GetSoundPos(&pos);
|
||||
SoundListener listener;
|
||||
listener.angle = -(float)ang * pi::pi() / 1024; // Build uses a period of 2048.
|
||||
listener.velocity.Zero();
|
||||
listener.position = GetSoundPos(&pos);
|
||||
listener.underwater = false;
|
||||
// This should probably use a real environment instead of the pitch hacking in S_PlaySound3D.
|
||||
// listenactor->waterlevel == 3;
|
||||
//assert(primaryLevel->Zones.Size() > listenactor->Sector->ZoneNumber);
|
||||
listener.Environment = 0;// primaryLevel->Zones[listenactor->Sector->ZoneNumber].Environment;
|
||||
listener.valid = true;
|
||||
|
||||
|
||||
soundEngine->SetListener(listener);
|
||||
soundEngine->UpdateSounds((int)totalclock);
|
||||
ActiveSound* pASound = sActiveSound;
|
||||
pASound++;
|
||||
for (int i = 1; i < kMaxActiveSounds; i++, pASound++)
|
||||
{
|
||||
if (pASound->snd_channel != nullptr)
|
||||
{
|
||||
short nSoundSprite = pASound->snd_sprite;
|
||||
int nPitch = pASound->snd_pitch;
|
||||
short nSoundSect;
|
||||
if (nSoundSprite >= 0)
|
||||
if (pASound->snd_channel->ChanFlags & CHANF_FORGETTABLE)
|
||||
{
|
||||
if (nSoundSprite == nLocalSpr)
|
||||
nSoundSect = nPlayerViewSect[nLocalPlayer];
|
||||
else
|
||||
nSoundSect = sprite[nSoundSprite].sectnum;
|
||||
// If the channel has become invalid, remove the reference.
|
||||
// ChannelEnded may be called late so waiting for it is problematic.
|
||||
pASound->snd_channel = nullptr;
|
||||
}
|
||||
else
|
||||
nSoundSect = pASound->snd_sector;
|
||||
{
|
||||
short nSoundSprite = pASound->snd_sprite;
|
||||
int nPitch = pASound->snd_pitch;
|
||||
short nSoundSect;
|
||||
if (nSoundSprite >= 0)
|
||||
{
|
||||
if (nSoundSprite == nLocalSpr)
|
||||
nSoundSect = nPlayerViewSect[nLocalPlayer];
|
||||
else
|
||||
nSoundSect = sprite[nSoundSprite].sectnum;
|
||||
}
|
||||
else
|
||||
nSoundSect = pASound->snd_sector;
|
||||
|
||||
int nVolume = pASound->snd_volume;
|
||||
GetSpriteSoundPitch(nSoundSect, &nVolume, &nPitch, nLocalSectFlags);
|
||||
soundEngine->SetPitch(pASound->snd_channel, (11025 + nPitch) / 11025.f);
|
||||
soundEngine->SetVolume(pASound->snd_channel, nVolume / 255.f);
|
||||
int nVolume = pASound->snd_volume;
|
||||
GetSpriteSoundPitch(nSoundSect, &nVolume, &nPitch, nLocalSectFlags);
|
||||
soundEngine->SetPitch(pASound->snd_channel, (11025 + nPitch) / 11025.f);
|
||||
soundEngine->SetVolume(pASound->snd_channel, nVolume / 255.f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -354,7 +354,7 @@ static void DoTimedSound(AmbientSound* amb)
|
|||
amb->curIndex += synctics;
|
||||
if (amb->curIndex >= amb->maxIndex)
|
||||
{
|
||||
if (amb->sndChan == nullptr)
|
||||
if (amb->sndChan == nullptr || (amb->sndChan->ChanFlags & CHANF_FORGETTABLE))
|
||||
{
|
||||
// Check for special case ambient sounds. Since the sound is stopped and doesn't occupy a real channel at this time we can just swap out the sound ID before restarting it.
|
||||
int ambid = RandomizeAmbientSpecials(amb->vocIndex);
|
||||
|
|
Loading…
Reference in a new issue