- implemented the game progression interface.

This commit is contained in:
Christoph Oelckers 2020-10-30 17:11:40 +01:00
parent 9952e6d2b0
commit 30e96293cf
7 changed files with 73 additions and 47 deletions

View file

@ -839,10 +839,6 @@ int32_t md_undefinemodel(int32_t modelid);
int32_t loaddefinitionsfile(const char *fn, bool loadadds = false);
// if loadboard() fails with -2 return, try loadoldboard(). if it fails with
// -2, board is dodgy
int32_t engineLoadBoardV5V6(const char *filename, char fromwhere, vec3_t *dapos, int16_t *daang, int16_t *dacursectnum);
#ifdef USE_OPENGL
# include "polymost.h"
#endif

View file

@ -582,9 +582,7 @@ void InitItems()
{
if (isWh2()) {
startWh2Ending([](bool) {
gameaction = ga_mainmenu;
});
CompleteLevel(nullptr);
return;
}
plr.treasure[THORNEDSKULL] = 1;

View file

@ -6,6 +6,8 @@
#include "v_draw.h"
#include "menu.h"
#include "mmulti.h"
#include "raze_music.h"
#include "statistics.h"
BEGIN_WH_NS
@ -338,6 +340,69 @@ void GameInterface::Ticker()
r_NoInterpolate = false;
}
void GameInterface::LevelCompleted(MapRecord* map, int skill)
{
if (map)
{
STAT_Update(false);
auto pplr = &player[pyrn];
auto completion = [=](bool)
{
spritesound(S_CHAINDOOR1, &sprite[pplr->spritenum]);
playertorch = 0;
spritesound(S_WARP, &sprite[pplr->spritenum]);
};
if (isWh2()) {
showStatisticsScreen(completion);
return;
}
completion(false);
}
else if (!isWh2())
{
STAT_Update(true);
showVictoryScreen([=](bool)
{
gameaction = ga_mainmenu;
});
}
else
{
STAT_Update(true);
startWh2Ending([](bool) {
gameaction = ga_mainmenu;
});
}
}
void GameInterface::NextLevel(MapRecord* map, int skill)
{
mapon = map->levelNumber;
currentLevel = map;
difficulty = skill;
nextlevel = true;
prepareboard(currentLevel->fileName);
STAT_NewLevel(currentLevel->labelName);
}
void GameInterface::NewGame(MapRecord* map, int skill)
{
//pNet.ready2send = false;
//game.nNetMode = NetMode.Single;
mapon = map->levelNumber;
currentLevel = map;
difficulty = skill;
justteleported = false;
nextlevel = false;
Mus_Stop();
prepareboard(currentLevel->fileName);
STAT_StartNewGame(isWh2() ? "Witchaven2" : "Witchaven", skill);
STAT_NewLevel(currentLevel->labelName);
}
void GameInterface::MenuSound(EMenuSounds snd)
{
if (!isWh2()) SND_Sound(85);

View file

@ -273,7 +273,6 @@ void setdelayfunc(int item, int delay);
extern boolean nextlevel;
void loadnewlevel(int mapon);
void preparesectors();
boolean prepareboard(const char* fname);
@ -543,9 +542,9 @@ struct GameInterface : public ::GameInterface
void Ticker() override;
const char* GenericCheat(int player, int cheat) override;
const char* CheckCheatMode() override;
//void NextLevel(MapRecord* map, int skill) override;
//void NewGame(MapRecord* map, int skill) override;
//void LevelCompleted(MapRecord* map, int skill) override;
void NextLevel(MapRecord* map, int skill) override;
void NewGame(MapRecord* map, int skill) override;
void LevelCompleted(MapRecord* map, int skill) override;
//bool DrawAutomapPlayer(int x, int y, int z, int a) override;
//int playerKeyMove() override { return 40; }

View file

@ -1,6 +1,7 @@
#include "ns.h"
#include "wh.h"
#include "gamestate.h"
#include "mapinfo.h"
BEGIN_WH_NS
@ -461,33 +462,12 @@ void teleporter() {
switch (sector[plr.sector].hitag) {
case 1: // NEXTLEVEL
justteleported = true;
if(isWh2()) {
auto pplr = &plr;
showStatisticsScreen([=](bool)
{
mapon++;
spritesound(S_CHAINDOOR1, &sprite[pplr->spritenum]);
playertorch = 0;
spritesound(S_WARP, &sprite[pplr->spritenum]);
loadnewlevel(mapon);
});
break;
}
mapon++;
spritesound(S_CHAINDOOR1, &sprite[plr.spritenum]);
playertorch = 0;
spritesound(S_WARP, &sprite[plr.spritenum]);
loadnewlevel(mapon);
CompleteLevel(currentLevel);
break;
case 2: // ENDOFDEMO
spritesound(S_THUNDER1, &sprite[plr.spritenum]);
justteleported = true;
showVictoryScreen([=](bool)
{
gameaction = ga_mainmenu;
});
CompleteLevel(nullptr);
break;
}
} else {

View file

@ -9,18 +9,6 @@ BEGIN_WH_NS
boolean nextlevel;
void loadnewlevel(int mapon) {
#if 0
MapInfo nextmap;
if(gCurrentEpisode != nullptr && (nextmap = gCurrentEpisode.getMap(mapon)) != nullptr) {
boardfilename = nextmap.path;
Console.Println("Entering level " + boardfilename);
nextlevel = true;
gGameScreen.loadboard(boardfilename, nullptr);
} else game.show();
#endif
}
void preparesectors() {
int endwall, j, k = 0, startwall;
int dax, day;

View file

@ -23,7 +23,7 @@ int damage_vel, damage_svel, damage_angvel;
void viewBackupPlayerLoc( int nPlayer )
{
SPRITE& pSprite = sprite[player[nPlayer].spritenum];
PLOCATION pPLocation = gPrevPlayerLoc[nPlayer];
PLOCATION& pPLocation = gPrevPlayerLoc[nPlayer];
pPLocation.x = pSprite.x;
pPLocation.y = pSprite.y;
pPLocation.z = player[nPlayer].z;