mirror of
https://github.com/ZDoom/Raze.git
synced 2024-12-02 00:53:16 +00:00
- added a bit more code for the main loop.
This commit is contained in:
parent
82f23a4733
commit
0a03331400
5 changed files with 86 additions and 13 deletions
|
@ -5,8 +5,12 @@
|
|||
#include "buildtiles.h"
|
||||
#include "v_draw.h"
|
||||
#include "menu.h"
|
||||
#include "mmulti.h"
|
||||
|
||||
BEGIN_WH_NS
|
||||
BEGIN_WH_NS
|
||||
|
||||
int followmode, followx, followy, followa;
|
||||
int followang, followvel, followsvel;
|
||||
|
||||
const char *GameInterface::CheckCheatMode()
|
||||
{
|
||||
|
@ -275,9 +279,75 @@ void GameInterface::DrawBackground()
|
|||
}
|
||||
}
|
||||
|
||||
inline bool playrunning()
|
||||
{
|
||||
return (paused == 0 || multiplayer/* || demoplay/record*/);
|
||||
}
|
||||
|
||||
void GameInterface::Ticker()
|
||||
{
|
||||
#if 0
|
||||
// Make copies so that the originals do not have to be modified.
|
||||
for (int i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
auto oldactions = ps[i].sync.actions;
|
||||
ps[i].sync = playercmds[i].ucmd;
|
||||
if (oldactions & SB_CENTERVIEW) ps[i].sync.actions |= SB_CENTERVIEW;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!playrunning())
|
||||
{
|
||||
r_NoInterpolate = true;
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = connecthead; i >= 0; i = connectpoint2[i])
|
||||
player[i].oldsector = player[i].sector;
|
||||
|
||||
PLAYER &plr = player[pyrn];
|
||||
viewBackupPlayerLoc(pyrn);
|
||||
|
||||
//processinput(pyrn);
|
||||
updateviewmap(plr);
|
||||
//updatepaletteshifts();
|
||||
|
||||
processobjs(plr);
|
||||
animateobjs(plr);
|
||||
animatetags(pyrn);
|
||||
doanimations();
|
||||
dodelayitems(TICSPERFRAME);
|
||||
dofx();
|
||||
speelbookprocess(plr);
|
||||
timerprocess(plr);
|
||||
weaponsprocess(pyrn);
|
||||
|
||||
updatesounds();
|
||||
|
||||
if (followmode) {
|
||||
followa += followang;
|
||||
|
||||
followx += (followvel * sintable[(512 + 2048 - followa) & 2047]) >> 10;
|
||||
followy += (followvel * sintable[(512 + 1024 - 512 - followa) & 2047]) >> 10;
|
||||
|
||||
followx += (followsvel * sintable[(512 + 1024 - 512 - followa) & 2047]) >> 10;
|
||||
followy -= (followsvel * sintable[(512 + 2048 - followa) & 2047]) >> 10;
|
||||
}
|
||||
|
||||
lockclock += TICSPERFRAME;
|
||||
}
|
||||
|
||||
void GameInterface::MenuSound(EMenuSounds snd)
|
||||
{
|
||||
if (!isWh2()) SND_Sound(85);
|
||||
else SND_Sound(59);
|
||||
}
|
||||
|
||||
|
||||
::GameInterface* CreateInterface()
|
||||
{
|
||||
return new GameInterface;
|
||||
}
|
||||
|
||||
|
||||
END_WH_NS
|
||||
|
|
|
@ -144,15 +144,16 @@ int playsound_internal(int sn, spritetype *spr, int x, int y, int loop, int chan
|
|||
sn++;
|
||||
if (!soundEngine->isValidSoundId(sn)) return -1;
|
||||
int sourcetype = spr ? SOURCE_Actor : x != 0 || y != 0 ? SOURCE_Unattached : SOURCE_None;
|
||||
vec3_t pos = { x, y, 0 };
|
||||
vec3_t pos = { x, y, 0 };
|
||||
auto spos = GetSoundPos(&pos);
|
||||
float attn = sourcetype == SOURCE_None ? 0 : 1;
|
||||
int flags = sourcetype == SOURCE_Unattached ? CHANF_LISTENERZ : CHANF_NONE;
|
||||
if (loop != 0) flags |= CHANF_LOOP;
|
||||
auto sfx = soundEngine->StartSound(sourcetype, spr, &spos, chan, EChanFlags::FromInt(flags), sn, 1.f, attn);
|
||||
if (loop > 0 && sfx) sfx->UserData = IntToFixed(loop);
|
||||
if (!sfx) return -1;
|
||||
if (loop > 0) sfx->UserData = IntToFixed(loop);
|
||||
else sfx->UserData = 0;
|
||||
return sfx ? 0 : -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@ int playertorch = 0;
|
|||
uint8_t ceilingshadearray[MAXSECTORS];
|
||||
uint8_t floorshadearray[MAXSECTORS];
|
||||
uint8_t wallshadearray[MAXWALLS];
|
||||
int hours, minutes, seconds, fortieth;
|
||||
short floormirrorsector[64];
|
||||
int floormirrorcnt;
|
||||
int displaytime = -1;
|
||||
|
|
|
@ -152,7 +152,6 @@ extern int playertorch;
|
|||
extern uint8_t ceilingshadearray[MAXSECTORS];
|
||||
extern uint8_t floorshadearray[MAXSECTORS];
|
||||
extern uint8_t wallshadearray[MAXWALLS];
|
||||
extern int hours, minutes, seconds, fortieth;
|
||||
extern short floormirrorsector[64];
|
||||
extern int floormirrorcnt;
|
||||
extern int displaytime;
|
||||
|
@ -453,6 +452,7 @@ inline void startblueflash(int)
|
|||
{}
|
||||
|
||||
|
||||
void updatesounds();
|
||||
int playsound_internal(int sn, spritetype* spr, int x, int y, int loop, int chan);
|
||||
|
||||
inline int playsound(int sn, int x, int y, int loop = 0, int channel = CHAN_AUTO) {
|
||||
|
@ -473,6 +473,14 @@ void setupmidi();
|
|||
|
||||
extern int attacktheme;
|
||||
|
||||
inline int insertsprite(int sectnum, int statnum)
|
||||
{
|
||||
int j = ::insertsprite(sectnum, statnum);
|
||||
if (j != -1)
|
||||
sprite[j].detail = 0;
|
||||
return j;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void startWh2Ending();
|
||||
|
@ -498,7 +506,7 @@ struct GameInterface : public ::GameInterface
|
|||
//void PlayHudSound() override;
|
||||
//GameStats getStats() override;
|
||||
//void MenuOpened() override;
|
||||
//void MenuSound(EMenuSounds snd) override;
|
||||
void MenuSound(EMenuSounds snd) override;
|
||||
bool CanSave() override;
|
||||
//bool StartGame(FNewGameStartup& gs) override;
|
||||
//FSavegameInfo GetSaveSig() override;
|
||||
|
@ -513,7 +521,7 @@ struct GameInterface : public ::GameInterface
|
|||
void Startup() override;
|
||||
void DrawBackground() override;
|
||||
//void Render() override;
|
||||
//void Ticker() override;
|
||||
void Ticker() override;
|
||||
const char* GenericCheat(int player, int cheat) override;
|
||||
const char* CheckCheatMode() override;
|
||||
//void NextLevel(MapRecord* map, int skill) override;
|
||||
|
|
|
@ -243,11 +243,6 @@ boolean prepareboard(const char* fname) {
|
|||
damage_svel = 0;
|
||||
damage_vel = 0;
|
||||
|
||||
hours = 0;
|
||||
minutes = 0;
|
||||
seconds = 0;
|
||||
fortieth = 0;
|
||||
|
||||
// goblinwarcnt = 0;
|
||||
treasurescnt = 0;
|
||||
treasuresfound = 0;
|
||||
|
|
Loading…
Reference in a new issue