2019-11-20 16:21:32 +00:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
/*
|
|
|
|
Copyright (C) 2010-2019 EDuke32 developers and contributors
|
|
|
|
Copyright (C) 2019 sirlemonhead, Nuke.YKT
|
|
|
|
This file is part of PCExhumed.
|
|
|
|
PCExhumed is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License version 2
|
|
|
|
as published by the Free Software Foundation.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
//-------------------------------------------------------------------------
|
2019-11-22 23:11:37 +00:00
|
|
|
#include "ns.h"
|
2019-08-26 03:59:14 +00:00
|
|
|
#include "engine.h"
|
|
|
|
#include "exhumed.h"
|
2022-05-19 20:28:41 +00:00
|
|
|
#include "aistuff.h"
|
2019-08-26 03:59:14 +00:00
|
|
|
#include "sequence.h"
|
|
|
|
#include "names.h"
|
|
|
|
#include "player.h"
|
|
|
|
#include "sound.h"
|
|
|
|
#include "view.h"
|
|
|
|
#include "status.h"
|
|
|
|
#include "version.h"
|
2020-08-18 07:52:08 +00:00
|
|
|
#include "aistuff.h"
|
2019-12-27 09:52:40 +00:00
|
|
|
#include "mapinfo.h"
|
2019-08-26 03:59:14 +00:00
|
|
|
#include <string.h>
|
|
|
|
#include <cstdio> // for printf
|
|
|
|
#include <cstdlib>
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <ctype.h>
|
|
|
|
#include <time.h>
|
|
|
|
#include <assert.h>
|
2019-12-12 23:19:34 +00:00
|
|
|
#include "gamecvars.h"
|
2019-12-26 22:17:11 +00:00
|
|
|
#include "savegamehelp.h"
|
2019-12-27 19:05:58 +00:00
|
|
|
#include "c_dispatch.h"
|
2020-04-12 06:09:38 +00:00
|
|
|
#include "raze_sound.h"
|
2020-08-20 19:05:14 +00:00
|
|
|
#include "gamestate.h"
|
|
|
|
#include "screenjob.h"
|
2020-08-22 19:13:11 +00:00
|
|
|
#include "c_console.h"
|
|
|
|
#include "cheathandler.h"
|
2020-08-26 22:53:35 +00:00
|
|
|
#include "inputstate.h"
|
2020-09-02 22:29:17 +00:00
|
|
|
#include "d_protocol.h"
|
2020-10-06 20:35:25 +00:00
|
|
|
#include "texturemanager.h"
|
2020-10-04 16:31:48 +00:00
|
|
|
#include "razemenu.h"
|
2020-10-13 19:38:24 +00:00
|
|
|
#include "v_draw.h"
|
2020-11-26 17:29:20 +00:00
|
|
|
#include "interpolate.h"
|
2022-12-07 16:10:27 +00:00
|
|
|
#include "tilesetbuilder.h"
|
2022-01-12 22:33:44 +00:00
|
|
|
#include "psky.h"
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2019-11-22 23:11:37 +00:00
|
|
|
BEGIN_PS_NS
|
|
|
|
|
2021-12-05 19:55:19 +00:00
|
|
|
IMPLEMENT_CLASS(DExhumedActor, false, true)
|
|
|
|
IMPLEMENT_POINTERS_START(DExhumedActor)
|
|
|
|
IMPLEMENT_POINTER(pTarget)
|
|
|
|
IMPLEMENT_POINTERS_END
|
2021-10-15 16:37:39 +00:00
|
|
|
|
2021-12-07 17:53:02 +00:00
|
|
|
size_t MarkMove();
|
|
|
|
size_t MarkBullets();
|
|
|
|
size_t MarkItems();
|
|
|
|
size_t MarkLighting();
|
|
|
|
size_t MarkObjects();
|
|
|
|
size_t MarkPlayers();
|
|
|
|
size_t MarkQueen();
|
|
|
|
size_t MarkRa();
|
|
|
|
size_t MarkSnake();
|
|
|
|
size_t MarkRunlist();
|
|
|
|
|
|
|
|
|
|
|
|
static void markgcroots()
|
|
|
|
{
|
2021-12-06 16:00:15 +00:00
|
|
|
MarkBullets();
|
|
|
|
MarkItems();
|
|
|
|
MarkLighting();
|
|
|
|
MarkObjects();
|
|
|
|
MarkPlayers();
|
|
|
|
MarkQueen();
|
|
|
|
MarkRa();
|
|
|
|
MarkSnake();
|
|
|
|
MarkRunlist();
|
2021-12-07 17:53:02 +00:00
|
|
|
|
|
|
|
GC::Mark(pSpiritSprite);
|
|
|
|
}
|
|
|
|
|
2020-09-11 18:56:46 +00:00
|
|
|
static MapRecord* NextMap;
|
2019-08-31 09:08:38 +00:00
|
|
|
|
2020-08-18 07:52:08 +00:00
|
|
|
void uploadCinemaPalettes();
|
2020-08-18 08:28:19 +00:00
|
|
|
int32_t registerosdcommands(void);
|
2020-09-02 22:41:32 +00:00
|
|
|
void InitCheats();
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2020-09-04 19:59:38 +00:00
|
|
|
int EndLevel = 0;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2019-10-31 17:22:12 +00:00
|
|
|
|
|
|
|
////////
|
|
|
|
|
2020-08-18 07:52:08 +00:00
|
|
|
void ResetEngine()
|
|
|
|
{
|
|
|
|
EraseScreen(-1);
|
|
|
|
}
|
|
|
|
|
2021-06-01 09:05:26 +00:00
|
|
|
void GameInterface::loadPalette()
|
2020-08-18 07:52:08 +00:00
|
|
|
{
|
2021-06-01 09:05:26 +00:00
|
|
|
paletteLoadFromDisk();
|
2020-08-18 07:52:08 +00:00
|
|
|
uploadCinemaPalettes();
|
|
|
|
LoadPaletteLookups();
|
|
|
|
}
|
|
|
|
|
2022-12-09 13:24:36 +00:00
|
|
|
void CopyTileToBitmap(FTextureID nSrcTile, FTextureID nDestTile, int xPos, int yPos);
|
2019-08-26 03:59:14 +00:00
|
|
|
|
|
|
|
// void TestSaveLoad();
|
|
|
|
void LoadStatus();
|
|
|
|
void MySetView(int x1, int y1, int x2, int y2);
|
|
|
|
|
|
|
|
char sHollyStr[40];
|
|
|
|
|
2021-11-21 18:24:46 +00:00
|
|
|
int nFontFirstChar;
|
|
|
|
int nBackgroundPic;
|
|
|
|
int nShadowPic;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2021-11-21 19:13:19 +00:00
|
|
|
int nCreaturesKilled = 0, nCreaturesTotal = 0;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2021-11-21 19:13:19 +00:00
|
|
|
int nFreeze;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2021-11-21 19:13:19 +00:00
|
|
|
int nSnakeCam = -1;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
|
|
|
int nNetPlayerCount = 0;
|
|
|
|
|
2021-11-21 19:13:19 +00:00
|
|
|
int nClockVal;
|
|
|
|
int nRedTicks;
|
|
|
|
int nAlarmTicks;
|
|
|
|
int nButtonColor;
|
|
|
|
int nEnergyChan;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
|
|
|
int lCountDown = 0;
|
2021-11-21 19:13:19 +00:00
|
|
|
int nEnergyTowers = 0;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2021-11-21 19:13:19 +00:00
|
|
|
int nCfgNetPlayers = 0;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2021-11-21 19:13:19 +00:00
|
|
|
bool bCoordinates = false;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
|
|
|
int nNetTime = -1;
|
|
|
|
|
|
|
|
int flash;
|
|
|
|
int totalmoves;
|
|
|
|
|
2021-11-21 19:13:19 +00:00
|
|
|
int nCurBodyNum = 0;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2021-11-21 19:13:19 +00:00
|
|
|
int nBodyTotal = 0;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2021-11-21 19:13:19 +00:00
|
|
|
int nTotalPlayers = 1;
|
2019-11-13 21:34:11 +00:00
|
|
|
// TODO: Rename this (or make it static) so it doesn't conflict with library function
|
2019-08-26 03:59:14 +00:00
|
|
|
|
|
|
|
|
2021-11-21 19:13:19 +00:00
|
|
|
bool bSnakeCam = false;
|
|
|
|
bool bRecord = false;
|
|
|
|
bool bPlayback = false;
|
|
|
|
bool bInDemo = false;
|
|
|
|
bool bSlipMode = false;
|
|
|
|
bool bDoFlashes = true;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
|
|
|
|
|
|
|
int nStartLevel;
|
|
|
|
int nTimeLimit;
|
|
|
|
|
2019-10-27 16:36:25 +00:00
|
|
|
int bVanilla = 0;
|
|
|
|
|
2022-09-11 06:09:26 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2019-08-26 03:59:14 +00:00
|
|
|
void DebugOut(const char *fmt, ...)
|
|
|
|
{
|
|
|
|
#ifdef _DEBUG
|
2019-08-27 06:08:18 +00:00
|
|
|
va_list args;
|
2019-08-26 03:59:14 +00:00
|
|
|
va_start(args, fmt);
|
2019-11-24 09:03:19 +00:00
|
|
|
VPrintf(PRINT_HIGH, fmt, args);
|
2019-08-26 03:59:14 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
void DoClockBeep()
|
|
|
|
{
|
2021-10-20 20:27:16 +00:00
|
|
|
ExhumedStatIterator it(407);
|
|
|
|
while (auto i = it.Next())
|
2020-10-15 17:10:51 +00:00
|
|
|
{
|
2021-10-21 22:08:40 +00:00
|
|
|
PlayFX2(StaticSound[kSound74], i);
|
2019-08-27 06:08:18 +00:00
|
|
|
}
|
2019-08-26 03:59:14 +00:00
|
|
|
}
|
|
|
|
|
2022-09-11 06:09:26 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2019-08-26 03:59:14 +00:00
|
|
|
void DoRedAlert(int nVal)
|
|
|
|
{
|
2019-08-27 06:08:18 +00:00
|
|
|
if (nVal)
|
|
|
|
{
|
|
|
|
nAlarmTicks = 69;
|
|
|
|
nRedTicks = 30;
|
|
|
|
}
|
|
|
|
|
2021-10-19 18:03:11 +00:00
|
|
|
ExhumedStatIterator it(405);
|
|
|
|
while (auto ac = it.Next())
|
2019-08-27 06:08:18 +00:00
|
|
|
{
|
|
|
|
if (nVal)
|
|
|
|
{
|
2022-08-20 15:52:06 +00:00
|
|
|
PlayFXAtXYZ(StaticSound[kSoundAlarm], ac->spr.pos);
|
2022-08-20 14:19:07 +00:00
|
|
|
AddFlash(ac->sector(), ac->spr.pos, 192);
|
2019-08-27 06:08:18 +00:00
|
|
|
}
|
|
|
|
}
|
2019-08-26 03:59:14 +00:00
|
|
|
}
|
|
|
|
|
2022-09-11 06:09:26 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2019-08-26 03:59:14 +00:00
|
|
|
void DrawClock()
|
|
|
|
{
|
2019-08-27 06:08:18 +00:00
|
|
|
int ebp = 49;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2022-12-06 17:30:57 +00:00
|
|
|
auto pixels = GetWritablePixels(tileGetTextureID(kTile3603));
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2020-04-11 22:04:02 +00:00
|
|
|
memset(pixels, TRANSPARENT_INDEX, 4096);
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2019-08-27 06:08:18 +00:00
|
|
|
if (lCountDown / 30 != nClockVal)
|
|
|
|
{
|
|
|
|
nClockVal = lCountDown / 30;
|
|
|
|
DoClockBeep();
|
|
|
|
}
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2019-08-27 06:08:18 +00:00
|
|
|
int nVal = nClockVal;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2019-08-27 06:08:18 +00:00
|
|
|
while (nVal)
|
|
|
|
{
|
|
|
|
int v2 = nVal & 0xF;
|
2022-12-09 13:24:36 +00:00
|
|
|
auto texid = tileGetTextureID(v2 + kClockSymbol1);
|
|
|
|
auto tex = TexMan.GetGameTexture(texid);
|
2020-11-23 07:39:49 +00:00
|
|
|
int yPos = 32 - tileHeight(v2 + kClockSymbol1) / 2;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2022-12-09 13:24:36 +00:00
|
|
|
CopyTileToBitmap(texid, tileGetTextureID(kTile3603), ebp - tex->GetTexelWidth() / 2, yPos);
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2019-08-27 06:08:18 +00:00
|
|
|
ebp -= 15;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2019-08-27 06:08:18 +00:00
|
|
|
nVal /= 16;
|
|
|
|
}
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2019-08-27 06:08:18 +00:00
|
|
|
DoEnergyTile();
|
2019-08-26 03:59:14 +00:00
|
|
|
}
|
|
|
|
|
2022-09-11 06:09:26 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2021-04-30 14:21:37 +00:00
|
|
|
void DoGameOverScene(bool finallevel)
|
|
|
|
{
|
|
|
|
// todo: make these customizable later.
|
|
|
|
StartCutscene(finallevel ? "ExhumedCutscenes.BuildCinemaLose" : "ExhumedCutscenes.BuildGameoverScene", 0, [](bool)
|
|
|
|
{
|
|
|
|
gameaction = ga_mainmenu;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2022-09-11 06:09:26 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2023-03-23 04:35:04 +00:00
|
|
|
static void GameMove(void)
|
2019-11-03 17:20:05 +00:00
|
|
|
{
|
2023-03-23 04:35:04 +00:00
|
|
|
UpdateInterpolations();
|
|
|
|
|
2019-11-03 17:20:05 +00:00
|
|
|
FixPalette();
|
|
|
|
|
2021-10-19 18:03:11 +00:00
|
|
|
ExhumedSpriteIterator it;
|
|
|
|
while (auto ac = it.Next())
|
2021-01-05 12:47:56 +00:00
|
|
|
{
|
2021-12-30 16:10:08 +00:00
|
|
|
ac->backuploc();
|
2021-01-05 12:47:56 +00:00
|
|
|
}
|
2020-11-26 08:15:49 +00:00
|
|
|
|
2021-05-02 13:54:19 +00:00
|
|
|
if (currentLevel->gameflags & LEVEL_EX_COUNTDOWN)
|
2019-11-03 17:20:05 +00:00
|
|
|
{
|
|
|
|
if (lCountDown <= 0)
|
|
|
|
{
|
2020-08-23 10:26:52 +00:00
|
|
|
DoGameOverScene(true);
|
2019-11-03 17:20:05 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
// Pink section
|
|
|
|
lCountDown--;
|
|
|
|
DrawClock();
|
|
|
|
|
|
|
|
if (nRedTicks)
|
|
|
|
{
|
|
|
|
nRedTicks--;
|
|
|
|
|
|
|
|
if (nRedTicks <= 0) {
|
|
|
|
DoRedAlert(0);
|
|
|
|
}
|
2019-11-18 22:15:48 +00:00
|
|
|
}
|
2019-11-03 17:20:05 +00:00
|
|
|
|
2019-11-18 22:15:48 +00:00
|
|
|
nAlarmTicks--;
|
|
|
|
nButtonColor--;
|
2019-11-03 17:20:05 +00:00
|
|
|
|
2019-11-18 22:15:48 +00:00
|
|
|
if (nAlarmTicks <= 0) {
|
|
|
|
DoRedAlert(1);
|
2019-11-03 17:20:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// YELLOW SECTION
|
|
|
|
MoveThings();
|
|
|
|
|
2019-11-08 16:55:26 +00:00
|
|
|
obobangle = bobangle;
|
|
|
|
|
2021-10-21 10:51:16 +00:00
|
|
|
if (PlayerList[nLocalPlayer].totalvel == 0)
|
2019-11-03 17:20:05 +00:00
|
|
|
{
|
|
|
|
bobangle = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
bobangle += 56;
|
|
|
|
}
|
|
|
|
|
2019-11-03 17:32:02 +00:00
|
|
|
UpdateCreepySounds();
|
|
|
|
|
2019-11-03 17:20:05 +00:00
|
|
|
// loc_120E9:
|
|
|
|
totalmoves++;
|
|
|
|
}
|
|
|
|
|
2023-03-23 01:12:46 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-09-02 20:55:57 +00:00
|
|
|
void GameInterface::Ticker()
|
|
|
|
{
|
2020-09-04 19:59:38 +00:00
|
|
|
if (paused)
|
|
|
|
{
|
|
|
|
r_NoInterpolate = true;
|
|
|
|
}
|
|
|
|
else if (EndLevel == 0)
|
2020-08-23 05:49:58 +00:00
|
|
|
{
|
2023-01-12 07:55:43 +00:00
|
|
|
// disable synchronised input if set by game.
|
|
|
|
resetForcedSyncInput();
|
|
|
|
|
2023-03-23 04:35:04 +00:00
|
|
|
for (int i = connecthead; i >= 0; i = connectpoint2[i])
|
|
|
|
{
|
|
|
|
const auto pPlayer = &PlayerList[i];
|
|
|
|
pPlayer->Angles.resetCameraAngles();
|
|
|
|
pPlayer->input = playercmds[i].ucmd;
|
|
|
|
}
|
2020-09-21 09:28:39 +00:00
|
|
|
|
2023-03-23 01:06:48 +00:00
|
|
|
GameMove();
|
|
|
|
|
2021-02-18 10:46:36 +00:00
|
|
|
PlayClock += 4;
|
2020-09-02 20:55:57 +00:00
|
|
|
r_NoInterpolate = false;
|
|
|
|
}
|
2020-09-04 19:59:38 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
// Wait for the end of level sound to play out, but stop updating the playsim.
|
2020-09-11 18:56:46 +00:00
|
|
|
if (EndLevel == 13)
|
|
|
|
PlayLocalSound(StaticSound[59], 0, true, CHANF_UI);
|
|
|
|
|
|
|
|
if (EndLevel > 1) EndLevel--;
|
|
|
|
int flash = 7 - abs(EndLevel - 7);
|
|
|
|
videoTintBlood(flash * 30, flash * 30, flash * 30);
|
|
|
|
if (EndLevel == 1)
|
|
|
|
{
|
2022-11-24 16:46:39 +00:00
|
|
|
if (!soundEngine->GetSoundPlayingInfo(SOURCE_None, nullptr, FSoundID::fromInt(StaticSound[59] + 1)))
|
2020-09-11 18:56:46 +00:00
|
|
|
{
|
|
|
|
videoTintBlood(0, 0, 0);
|
|
|
|
CompleteLevel(NextMap);
|
|
|
|
NextMap = nullptr;
|
|
|
|
EndLevel = 0;
|
|
|
|
}
|
|
|
|
}
|
2020-09-04 19:59:38 +00:00
|
|
|
}
|
2020-09-02 20:55:57 +00:00
|
|
|
}
|
2020-08-23 05:49:58 +00:00
|
|
|
|
2022-09-11 06:09:26 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-09-11 18:56:46 +00:00
|
|
|
void LevelFinished()
|
|
|
|
{
|
2021-05-02 13:54:19 +00:00
|
|
|
NextMap = FindNextMap(currentLevel);
|
2020-09-11 18:56:46 +00:00
|
|
|
EndLevel = 13;
|
|
|
|
}
|
|
|
|
|
2022-09-11 06:09:26 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-06 20:35:25 +00:00
|
|
|
#define x(a, b) registerName(#a, b);
|
2022-12-07 16:10:27 +00:00
|
|
|
static void SetTileNames(TilesetBuildInfo& info)
|
2020-10-06 20:35:25 +00:00
|
|
|
{
|
2022-12-07 16:10:27 +00:00
|
|
|
auto registerName = [&](const char* name, int index)
|
2020-10-06 20:35:25 +00:00
|
|
|
{
|
2022-12-07 16:10:27 +00:00
|
|
|
info.addName(name, index);
|
2020-10-06 20:35:25 +00:00
|
|
|
};
|
|
|
|
#include "namelist.h"
|
|
|
|
}
|
|
|
|
#undef x
|
|
|
|
|
2022-12-07 16:10:27 +00:00
|
|
|
void GameInterface::SetupSpecialTextures(TilesetBuildInfo& info)
|
2022-11-25 15:52:08 +00:00
|
|
|
{
|
2022-12-07 16:10:27 +00:00
|
|
|
SetTileNames(info);
|
|
|
|
info.CreateWritable(kTile4092, kPlasmaWidth, kPlasmaHeight);
|
|
|
|
info.CreateWritable(kTile4093, kPlasmaWidth, kPlasmaHeight);
|
|
|
|
info.CreateWritable(kTileRamsesWorkTile, kSpiritY * 2, kSpiritX * 2);
|
|
|
|
info.MakeWritable(kTileLoboLaptop);
|
2022-12-05 19:04:31 +00:00
|
|
|
for(int i = kTile3603; i < kClockSymbol1 + 145; i++)
|
2022-12-07 16:10:27 +00:00
|
|
|
info.MakeWritable(kTile3603);
|
|
|
|
info.MakeWritable(kEnergy1);
|
|
|
|
info.MakeWritable(kEnergy2);
|
2022-12-05 19:04:31 +00:00
|
|
|
for (int i = 0; i < 16; i++)
|
2022-12-07 16:10:27 +00:00
|
|
|
info.MakeWritable(kClockSymbol1);
|
2022-12-05 19:04:31 +00:00
|
|
|
}
|
|
|
|
|
2022-09-11 06:09:26 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-08-23 15:47:05 +00:00
|
|
|
void GameInterface::app_init()
|
2019-11-24 12:59:36 +00:00
|
|
|
{
|
2021-12-07 17:53:02 +00:00
|
|
|
GC::AddMarkerFunc(markgcroots);
|
|
|
|
|
2021-11-25 21:33:55 +00:00
|
|
|
|
2020-10-04 16:31:48 +00:00
|
|
|
#if 0
|
2020-02-29 11:55:12 +00:00
|
|
|
help_disabled = true;
|
2020-10-04 16:31:48 +00:00
|
|
|
#endif
|
2019-12-27 09:52:40 +00:00
|
|
|
|
2020-09-02 22:41:32 +00:00
|
|
|
InitCheats();
|
2019-08-31 09:08:38 +00:00
|
|
|
registerosdcommands();
|
2019-08-27 06:08:18 +00:00
|
|
|
if (nNetPlayerCount == -1)
|
|
|
|
{
|
|
|
|
nNetPlayerCount = nCfgNetPlayers - 1;
|
|
|
|
nTotalPlayers += nNetPlayerCount;
|
|
|
|
}
|
|
|
|
|
2022-12-09 11:53:16 +00:00
|
|
|
defineSky(nullptr, 2, nullptr, 256, 1.f);
|
2019-08-27 06:08:18 +00:00
|
|
|
|
2019-09-19 13:38:28 +00:00
|
|
|
InitFX();
|
2019-08-27 06:08:18 +00:00
|
|
|
seq_LoadSequences();
|
|
|
|
InitStatus();
|
2021-12-30 09:30:21 +00:00
|
|
|
|
2019-08-27 06:08:18 +00:00
|
|
|
GrabPalette();
|
2020-08-30 10:49:21 +00:00
|
|
|
|
2022-09-30 21:18:48 +00:00
|
|
|
enginecompatibility_mode = ENGINECOMPATIBILITY_19961112;
|
2023-03-23 04:35:04 +00:00
|
|
|
|
|
|
|
myconnectindex = connecthead = 0;
|
|
|
|
numplayers = 1;
|
|
|
|
connectpoint2[0] = -1;
|
2019-08-26 03:59:14 +00:00
|
|
|
}
|
|
|
|
|
2022-09-11 06:09:26 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void DeleteActor(DExhumedActor* actor)
|
2019-08-26 03:59:14 +00:00
|
|
|
{
|
2021-10-21 19:20:54 +00:00
|
|
|
if (!actor)
|
|
|
|
{
|
|
|
|
return;
|
2019-08-27 06:08:18 +00:00
|
|
|
}
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2022-05-19 20:28:41 +00:00
|
|
|
UnlinkIgnitedAnim(actor);
|
2021-12-06 16:00:15 +00:00
|
|
|
actor->Destroy();
|
2019-08-26 03:59:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-09-11 06:09:26 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2022-12-09 13:24:36 +00:00
|
|
|
void CopyTileToBitmap(FTextureID nSrcTile, FTextureID nDestTile, int xPos, int yPos)
|
2019-08-26 03:59:14 +00:00
|
|
|
{
|
2022-12-09 13:24:36 +00:00
|
|
|
auto pSrcTex = TexMan.GetGameTexture(nSrcTile);
|
|
|
|
auto pDestTex = TexMan.GetGameTexture(nDestTile);
|
|
|
|
int nOffs = pDestTex->GetTexelHeight() * xPos;
|
2019-08-27 06:08:18 +00:00
|
|
|
|
2022-12-09 13:24:36 +00:00
|
|
|
auto pixels = GetWritablePixels(nDestTile);
|
|
|
|
if (!pixels) return;
|
2019-11-24 12:59:36 +00:00
|
|
|
uint8_t *pDest = pixels + nOffs + yPos;
|
2019-08-31 07:47:15 +00:00
|
|
|
uint8_t *pDestB = pDest;
|
2019-08-27 06:08:18 +00:00
|
|
|
|
2022-12-09 13:24:36 +00:00
|
|
|
int destYSize = pDestTex->GetTexelHeight();
|
|
|
|
int srcYSize = pSrcTex->GetTexelHeight();
|
2019-11-20 16:21:32 +00:00
|
|
|
|
2022-12-09 13:24:36 +00:00
|
|
|
const uint8_t *pSrc = GetRawPixels(nSrcTile);
|
|
|
|
if (!pSrc) return;
|
2019-11-20 16:21:32 +00:00
|
|
|
|
2022-12-09 13:24:36 +00:00
|
|
|
for (int x = 0; x < pSrcTex->GetTexelWidth(); x++)
|
2019-08-27 06:08:18 +00:00
|
|
|
{
|
|
|
|
pDest += destYSize;
|
|
|
|
|
|
|
|
for (int y = 0; y < srcYSize; y++)
|
|
|
|
{
|
2019-08-31 07:47:15 +00:00
|
|
|
uint8_t val = *pSrc;
|
2020-04-11 22:04:02 +00:00
|
|
|
if (val != TRANSPARENT_INDEX) {
|
2019-08-27 06:08:18 +00:00
|
|
|
*pDestB = val;
|
|
|
|
}
|
|
|
|
|
|
|
|
pDestB++;
|
|
|
|
pSrc++;
|
|
|
|
}
|
|
|
|
|
|
|
|
// reset pDestB
|
|
|
|
pDestB = pDest;
|
|
|
|
}
|
2019-08-26 03:59:14 +00:00
|
|
|
}
|
|
|
|
|
2022-09-11 06:09:26 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2019-08-26 03:59:14 +00:00
|
|
|
void EraseScreen(int nVal)
|
|
|
|
{
|
2020-04-12 05:44:55 +00:00
|
|
|
// There's no other values than 0 ever coming through here.
|
2020-06-12 18:52:01 +00:00
|
|
|
twod->ClearScreen();
|
2019-08-26 03:59:14 +00:00
|
|
|
}
|
|
|
|
|
2019-12-26 18:41:42 +00:00
|
|
|
bool GameInterface::CanSave()
|
|
|
|
{
|
2023-04-02 09:50:41 +00:00
|
|
|
return !bRecord && !bPlayback && !bInDemo && nTotalPlayers == 1 && nFreeze == 0;
|
2019-12-26 18:41:42 +00:00
|
|
|
}
|
2019-12-27 09:52:40 +00:00
|
|
|
|
2020-08-23 12:39:14 +00:00
|
|
|
::GameStats GameInterface::getStats()
|
|
|
|
{
|
2021-02-18 10:46:36 +00:00
|
|
|
return { nCreaturesKilled, nCreaturesTotal, 0, 0, PlayClock / 120, 0 };
|
2020-08-23 12:39:14 +00:00
|
|
|
}
|
|
|
|
|
2019-12-12 23:19:34 +00:00
|
|
|
::GameInterface* CreateInterface()
|
|
|
|
{
|
|
|
|
return new GameInterface;
|
|
|
|
}
|
|
|
|
|
2022-08-21 22:08:52 +00:00
|
|
|
|
2022-09-11 06:09:26 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2021-12-05 08:20:41 +00:00
|
|
|
void DExhumedActor::Serialize(FSerializer& arc)
|
2021-10-17 16:23:42 +00:00
|
|
|
{
|
2021-12-05 08:20:41 +00:00
|
|
|
Super::Serialize(arc);
|
|
|
|
arc("phase", nPhase)
|
|
|
|
("health", nHealth)
|
|
|
|
("frame", nFrame)
|
|
|
|
("action", nAction)
|
|
|
|
("target", pTarget)
|
|
|
|
("count", nCount)
|
|
|
|
("run", nRun)
|
|
|
|
("index", nIndex)
|
|
|
|
("index2", nIndex2)
|
|
|
|
("channel", nChannel)
|
|
|
|
("damage", nDamage)
|
2022-09-10 13:54:31 +00:00
|
|
|
("angle2", pitch)
|
2021-12-05 08:20:41 +00:00
|
|
|
|
|
|
|
("turn", nTurn)
|
2022-09-10 18:51:42 +00:00
|
|
|
("vec", vec);
|
2021-10-17 16:23:42 +00:00
|
|
|
}
|
|
|
|
|
2022-09-11 06:09:26 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-11-30 00:13:40 +00:00
|
|
|
void SerializeState(FSerializer& arc)
|
2019-12-26 22:17:11 +00:00
|
|
|
{
|
2020-11-30 00:13:40 +00:00
|
|
|
if (arc.BeginObject("state"))
|
2019-12-26 22:17:11 +00:00
|
|
|
{
|
2021-05-02 13:54:19 +00:00
|
|
|
if (arc.isReading() && (currentLevel->gameflags & LEVEL_EX_COUNTDOWN))
|
2020-11-30 00:13:40 +00:00
|
|
|
{
|
|
|
|
InitEnergyTile();
|
2019-12-26 22:17:11 +00:00
|
|
|
}
|
2020-09-11 18:56:46 +00:00
|
|
|
|
2023-03-23 04:11:45 +00:00
|
|
|
arc ("creaturestotal", nCreaturesTotal)
|
2020-11-30 00:13:40 +00:00
|
|
|
("creatureskilled", nCreaturesKilled)
|
|
|
|
("freeze", nFreeze)
|
|
|
|
("snakecam", nSnakeCam)
|
|
|
|
("clockval", nClockVal) // kTile3603
|
|
|
|
("redticks", nRedTicks)
|
|
|
|
("alarmticks", nAlarmTicks)
|
|
|
|
("buttoncolor", nButtonColor)
|
|
|
|
("energychan", nEnergyChan)
|
|
|
|
("countdown", lCountDown)
|
|
|
|
("energytowers", nEnergyTowers)
|
|
|
|
("totalmoves", totalmoves)
|
|
|
|
("curbodynum", nCurBodyNum)
|
|
|
|
("bodytotal", nBodyTotal)
|
2020-12-06 07:22:56 +00:00
|
|
|
("bsnakecam", bSnakeCam)
|
2020-11-30 00:13:40 +00:00
|
|
|
("slipmode", bSlipMode)
|
2021-02-18 10:46:36 +00:00
|
|
|
("PlayClock", PlayClock)
|
2021-10-21 22:08:40 +00:00
|
|
|
("spiritsprite", pSpiritSprite)
|
2020-11-30 00:13:40 +00:00
|
|
|
.EndObject();
|
|
|
|
}
|
2020-09-11 18:56:46 +00:00
|
|
|
}
|
2020-11-30 00:13:40 +00:00
|
|
|
|
2019-11-22 23:11:37 +00:00
|
|
|
END_PS_NS
|