2020-08-22 19:39:14 +00:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
/*
|
|
|
|
Copyright (C) 2010-2020 EDuke32 developers and contributors
|
|
|
|
Copyright (C) 2020 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.
|
|
|
|
*/
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
#include "ns.h"
|
|
|
|
|
|
|
|
#include "engine.h"
|
|
|
|
#include "exhumed.h"
|
|
|
|
#include "sound.h"
|
|
|
|
#include "view.h"
|
|
|
|
#include "names.h"
|
|
|
|
#include "aistuff.h"
|
|
|
|
#include "player.h"
|
2020-08-23 14:24:54 +00:00
|
|
|
#include "mapinfo.h"
|
2021-01-01 22:38:15 +00:00
|
|
|
#include "input.h"
|
2020-08-22 19:39:14 +00:00
|
|
|
|
|
|
|
|
|
|
|
BEGIN_PS_NS
|
|
|
|
|
2021-11-21 18:24:46 +00:00
|
|
|
int16_t cPupData[300];
|
2020-08-22 19:39:14 +00:00
|
|
|
uint8_t *Worktile;
|
|
|
|
int lHeadStartClock;
|
2021-11-21 18:24:46 +00:00
|
|
|
int16_t* pPupData;
|
2020-08-22 19:39:14 +00:00
|
|
|
int lNextStateChange;
|
|
|
|
int nPixels;
|
|
|
|
int nHeadTimeStart;
|
2021-11-21 18:24:46 +00:00
|
|
|
int nHeadStage;
|
|
|
|
int16_t curx[kSpiritY * kSpiritX];
|
|
|
|
int16_t cury[kSpiritY * kSpiritX];
|
2020-08-26 19:28:57 +00:00
|
|
|
int8_t destvelx[kSpiritY * kSpiritX];
|
|
|
|
int8_t destvely[kSpiritY * kSpiritX];
|
|
|
|
uint8_t pixelval[kSpiritY * kSpiritX];
|
|
|
|
int8_t origy[kSpiritY * kSpiritX];
|
|
|
|
int8_t origx[kSpiritY * kSpiritX];
|
|
|
|
int8_t velx[kSpiritY * kSpiritX];
|
|
|
|
int8_t vely[kSpiritY * kSpiritX];
|
2021-11-21 18:24:46 +00:00
|
|
|
int16_t nMouthTile;
|
2020-08-22 19:39:14 +00:00
|
|
|
|
2021-11-21 18:24:46 +00:00
|
|
|
int nPupData = 0;
|
2020-08-22 19:39:14 +00:00
|
|
|
|
2021-11-21 19:34:15 +00:00
|
|
|
int word_964E8 = 0;
|
|
|
|
int word_964EA = 0;
|
|
|
|
int word_964EC = 10;
|
2020-08-22 19:39:14 +00:00
|
|
|
|
2021-11-21 19:34:15 +00:00
|
|
|
int nSpiritRepeatX;
|
|
|
|
int nSpiritRepeatY;
|
2021-12-07 17:53:02 +00:00
|
|
|
TObjPtr<DExhumedActor*> pSpiritSprite;
|
2021-11-21 19:34:15 +00:00
|
|
|
int nPixelsToShow;
|
|
|
|
int nTalkTime = 0;
|
2020-08-22 19:39:14 +00:00
|
|
|
|
|
|
|
|
|
|
|
void InitSpiritHead()
|
|
|
|
{
|
|
|
|
nPixels = 0;
|
2021-12-23 16:19:21 +00:00
|
|
|
auto pSpiritSpr = pSpiritSprite;
|
2020-08-22 19:39:14 +00:00
|
|
|
|
2021-12-23 16:19:21 +00:00
|
|
|
nSpiritRepeatX = pSpiritSpr->spr.xrepeat;
|
|
|
|
nSpiritRepeatY = pSpiritSpr->spr.yrepeat;
|
2020-08-22 19:39:14 +00:00
|
|
|
|
|
|
|
tileLoad(kTileRamsesNormal); // Ramses Normal Head
|
|
|
|
|
2021-10-21 22:08:40 +00:00
|
|
|
ExhumedSpriteIterator it;
|
|
|
|
while (auto act = it.Next())
|
2020-08-22 19:39:14 +00:00
|
|
|
{
|
2021-12-21 22:18:23 +00:00
|
|
|
if (act->spr.statnum)
|
2020-08-22 19:39:14 +00:00
|
|
|
{
|
2021-12-21 22:18:23 +00:00
|
|
|
act->spr.cstat |= CSTAT_SPRITE_INVISIBLE;
|
2020-08-22 19:39:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
auto pTile = tilePtr(kTileRamsesNormal); // Ramses Normal Head
|
|
|
|
auto pGold = tilePtr(kTileRamsesGold);
|
|
|
|
for (int x = 0; x < 97; x++)
|
|
|
|
{
|
|
|
|
for (int y = 0; y < 106; y++)
|
|
|
|
{
|
|
|
|
if (*pTile != TRANSPARENT_INDEX)
|
|
|
|
{
|
2020-08-26 19:28:57 +00:00
|
|
|
pixelval[nPixels] = *(pGold + x * kSpiritX + y);
|
2020-08-22 19:39:14 +00:00
|
|
|
origx[nPixels] = x - 48;
|
|
|
|
origy[nPixels] = y - 53;
|
|
|
|
curx[nPixels] = 0;
|
|
|
|
cury[nPixels] = 0;
|
|
|
|
vely[nPixels] = 0;
|
|
|
|
velx[nPixels] = 0;
|
|
|
|
|
|
|
|
destvelx[nPixels] = RandomSize(2) + 1;
|
|
|
|
|
|
|
|
if (curx[nPixels] > 0) {
|
|
|
|
destvelx[nPixels] = -destvelx[nPixels];
|
|
|
|
}
|
|
|
|
|
|
|
|
destvely[nPixels] = RandomSize(2) + 1;
|
|
|
|
|
|
|
|
if (cury[nPixels] > 0) {
|
|
|
|
destvely[nPixels] = -destvely[nPixels];
|
|
|
|
}
|
|
|
|
|
|
|
|
nPixels++;
|
|
|
|
}
|
|
|
|
|
|
|
|
pTile++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-12-23 16:19:21 +00:00
|
|
|
pSpiritSpr->spr.yrepeat = 140;
|
|
|
|
pSpiritSpr->spr.xrepeat = 140;
|
|
|
|
pSpiritSpr->spr.picnum = kTileRamsesWorkTile;
|
2020-08-22 19:39:14 +00:00
|
|
|
|
|
|
|
nHeadStage = 0;
|
|
|
|
|
|
|
|
// work tile is twice as big as the normal head size
|
2020-08-26 19:28:57 +00:00
|
|
|
Worktile = TileFiles.tileCreate(kTileRamsesWorkTile, kSpiritY * 2, kSpiritX * 2);
|
2020-08-22 19:39:14 +00:00
|
|
|
|
2021-12-23 21:51:26 +00:00
|
|
|
pSpiritSpr->spr.cstat &= ~CSTAT_SPRITE_INVISIBLE;
|
2020-08-22 19:39:14 +00:00
|
|
|
|
2021-02-18 10:46:36 +00:00
|
|
|
nHeadTimeStart = PlayClock;
|
2020-08-22 19:39:14 +00:00
|
|
|
|
|
|
|
memset(Worktile, TRANSPARENT_INDEX, WorktileSize);
|
|
|
|
TileFiles.InvalidateTile(kTileRamsesWorkTile);
|
|
|
|
|
|
|
|
nPixelsToShow = 0;
|
|
|
|
|
|
|
|
fadecdaudio();
|
|
|
|
|
2021-05-02 13:54:19 +00:00
|
|
|
int nTrack = currentLevel->ex_ramses_cdtrack;
|
2020-08-26 20:22:46 +00:00
|
|
|
playCDtrack(nTrack, false);
|
2020-08-22 19:39:14 +00:00
|
|
|
|
|
|
|
StartSwirlies();
|
|
|
|
|
2021-02-18 10:46:36 +00:00
|
|
|
lNextStateChange = PlayClock;
|
|
|
|
lHeadStartClock = PlayClock;
|
2020-08-22 19:39:14 +00:00
|
|
|
|
2021-05-02 13:54:19 +00:00
|
|
|
auto headfd = fileSystem.OpenFileReader(currentLevel->ex_ramses_pup);
|
2020-08-22 19:39:14 +00:00
|
|
|
if (!headfd.isOpen())
|
|
|
|
{
|
|
|
|
memset(cPupData, 0, sizeof(cPupData));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-05-12 15:09:07 +00:00
|
|
|
nPupData = (int)headfd.Read(cPupData, sizeof(cPupData));
|
2020-08-22 19:39:14 +00:00
|
|
|
pPupData = cPupData;
|
|
|
|
}
|
|
|
|
nMouthTile = 0;
|
|
|
|
nTalkTime = 1;
|
|
|
|
}
|
|
|
|
|
2021-11-22 23:51:32 +00:00
|
|
|
void DimSector(sectortype* pSector)
|
2020-08-22 19:39:14 +00:00
|
|
|
{
|
2021-11-22 23:51:32 +00:00
|
|
|
for(auto& wal : wallsofsector(pSector))
|
2020-08-22 19:39:14 +00:00
|
|
|
{
|
2021-11-21 08:31:40 +00:00
|
|
|
if (wal.shade < 40) {
|
|
|
|
wal.shade++;
|
2020-08-22 19:39:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-22 23:51:32 +00:00
|
|
|
if (pSector->floorshade < 40) {
|
|
|
|
pSector->floorshade++;
|
2020-08-22 19:39:14 +00:00
|
|
|
}
|
|
|
|
|
2021-11-22 23:51:32 +00:00
|
|
|
if (pSector->ceilingshade < 40) {
|
|
|
|
pSector->ceilingshade++;
|
2020-08-22 19:39:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-21 19:34:15 +00:00
|
|
|
void CopyHeadToWorkTile(int nTile)
|
2020-08-22 19:39:14 +00:00
|
|
|
{
|
|
|
|
const uint8_t* pSrc = tilePtr(nTile);
|
|
|
|
uint8_t *pDest = &Worktile[212 * 49 + 53];
|
|
|
|
|
2021-10-08 17:22:21 +00:00
|
|
|
for (unsigned i = 0; i < kSpiritY; i++)
|
2020-08-22 19:39:14 +00:00
|
|
|
{
|
|
|
|
memcpy(pDest, pSrc, kSpiritX);
|
|
|
|
|
|
|
|
pDest += 212;
|
|
|
|
pSrc += kSpiritX;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-06 07:48:26 +00:00
|
|
|
// This is based on BuildGDX's version of this function which was a lot less cryptic than PCExhumed's.
|
|
|
|
void DoSpiritHead()
|
2020-08-22 19:39:14 +00:00
|
|
|
{
|
2021-11-21 19:34:15 +00:00
|
|
|
static int dimSectCount = 0;
|
2021-12-23 16:19:21 +00:00
|
|
|
auto pSpiritSpr = pSpiritSprite;
|
2020-08-22 19:39:14 +00:00
|
|
|
|
2020-09-23 22:11:56 +00:00
|
|
|
sPlayerInput[0].actions |= SB_CENTERVIEW;
|
2020-08-22 19:39:14 +00:00
|
|
|
TileFiles.InvalidateTile(kTileRamsesWorkTile);
|
|
|
|
|
2020-09-06 07:48:26 +00:00
|
|
|
switch (nHeadStage)
|
2020-08-22 19:39:14 +00:00
|
|
|
{
|
2020-09-06 07:48:26 +00:00
|
|
|
case 0:
|
|
|
|
case 1:
|
2020-08-22 19:39:14 +00:00
|
|
|
memset(Worktile, TRANSPARENT_INDEX, WorktileSize);
|
2020-09-06 07:48:26 +00:00
|
|
|
break;
|
|
|
|
case 5:
|
2021-02-18 10:46:36 +00:00
|
|
|
if (lNextStateChange <= PlayClock)
|
2020-08-22 19:39:14 +00:00
|
|
|
{
|
2020-09-06 07:48:26 +00:00
|
|
|
if (nPupData != 0)
|
2020-08-22 19:39:14 +00:00
|
|
|
{
|
2021-11-21 19:34:15 +00:00
|
|
|
int clock = *pPupData++;
|
2020-09-06 07:48:26 +00:00
|
|
|
nPupData -= 2;
|
|
|
|
if (nPupData > 0)
|
|
|
|
{
|
|
|
|
lNextStateChange = lHeadStartClock + clock - 10;
|
|
|
|
nTalkTime = !nTalkTime;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
nTalkTime = false;
|
|
|
|
nPupData = 0;
|
|
|
|
}
|
2020-08-22 19:39:14 +00:00
|
|
|
}
|
2020-09-06 07:48:26 +00:00
|
|
|
else if (!bSubTitles)
|
2020-08-22 19:39:14 +00:00
|
|
|
{
|
2020-09-06 07:48:26 +00:00
|
|
|
if (!CDplaying())
|
2020-08-22 19:39:14 +00:00
|
|
|
{
|
2020-09-24 18:14:25 +00:00
|
|
|
LevelFinished();
|
2020-09-06 07:48:26 +00:00
|
|
|
EndLevel = 1;
|
2020-08-22 19:39:14 +00:00
|
|
|
}
|
2020-09-06 07:48:26 +00:00
|
|
|
}
|
|
|
|
}
|
2020-08-22 19:39:14 +00:00
|
|
|
|
2020-09-06 07:48:26 +00:00
|
|
|
if (--word_964E8 <= 0)
|
|
|
|
{
|
|
|
|
word_964EA = 2 * RandomBit();
|
|
|
|
word_964E8 = RandomSize(5) + 4;
|
|
|
|
}
|
2020-08-22 19:39:14 +00:00
|
|
|
|
2020-09-06 07:48:26 +00:00
|
|
|
int tilenum = kTileRamsesNormal;
|
|
|
|
if (--word_964EC < 3)
|
|
|
|
{
|
|
|
|
tilenum = 593;
|
|
|
|
if (word_964EC <= 0)
|
|
|
|
word_964EC = RandomSize(6) + 4;
|
|
|
|
}
|
2020-08-22 19:39:14 +00:00
|
|
|
|
2020-09-06 07:48:26 +00:00
|
|
|
CopyHeadToWorkTile(word_964EA + tilenum);
|
2020-08-22 19:39:14 +00:00
|
|
|
|
2020-09-06 07:48:26 +00:00
|
|
|
if (nTalkTime)
|
|
|
|
{
|
|
|
|
if (nMouthTile < 2)
|
|
|
|
nMouthTile++;
|
|
|
|
}
|
|
|
|
else if (nMouthTile != 0)
|
|
|
|
nMouthTile--;
|
2020-08-22 19:39:14 +00:00
|
|
|
|
2020-09-06 07:48:26 +00:00
|
|
|
if (nMouthTile != 0)
|
|
|
|
{
|
|
|
|
int srctile = nMouthTile + 598;
|
|
|
|
auto src = tilePtr(srctile);
|
2020-11-23 07:55:02 +00:00
|
|
|
int sizx = tileWidth(srctile);
|
2020-11-23 07:39:49 +00:00
|
|
|
int sizy = tileHeight(srctile);
|
2020-09-06 07:48:26 +00:00
|
|
|
int workptr = 212 * (97 - sizx / 2) + 159 - sizy;
|
|
|
|
int srcptr = 0;
|
|
|
|
while (sizx > 0)
|
|
|
|
{
|
|
|
|
memcpy(Worktile + workptr, src + srcptr, sizy);
|
|
|
|
workptr += 212;
|
|
|
|
srcptr += sizy;
|
|
|
|
sizx--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
2020-08-22 19:39:14 +00:00
|
|
|
|
2021-02-18 10:46:36 +00:00
|
|
|
nPixelsToShow = 15 * (PlayClock - nHeadTimeStart);
|
2020-09-06 07:48:26 +00:00
|
|
|
if (nPixelsToShow > nPixels)
|
|
|
|
nPixelsToShow = nPixels;
|
2020-08-22 19:39:14 +00:00
|
|
|
|
2020-09-06 07:48:26 +00:00
|
|
|
switch (nHeadStage)
|
|
|
|
{
|
|
|
|
case 3:
|
|
|
|
FixPalette();
|
|
|
|
if (nPalDiff == 0)
|
|
|
|
{
|
|
|
|
nFreeze = 2;
|
|
|
|
nHeadStage++;
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
case 0:
|
|
|
|
case 1:
|
|
|
|
case 2:
|
|
|
|
UpdateSwirlies();
|
2021-12-23 16:19:21 +00:00
|
|
|
if (pSpiritSpr->spr.shade > -127)
|
|
|
|
pSpiritSpr->spr.shade--;
|
2020-09-06 07:48:26 +00:00
|
|
|
if (--dimSectCount < 0)
|
|
|
|
{
|
2021-12-23 16:19:21 +00:00
|
|
|
DimSector(pSpiritSpr->spr.sector());
|
2020-09-06 07:48:26 +00:00
|
|
|
dimSectCount = 5;
|
|
|
|
}
|
2020-08-22 19:39:14 +00:00
|
|
|
|
2020-09-06 07:48:26 +00:00
|
|
|
if (nHeadStage == 0)
|
|
|
|
{
|
2021-02-18 10:46:36 +00:00
|
|
|
if (PlayClock - nHeadTimeStart > 480)
|
2020-09-06 07:48:26 +00:00
|
|
|
{
|
|
|
|
nHeadStage = 1;
|
2021-02-18 10:46:36 +00:00
|
|
|
nHeadTimeStart = PlayClock + 480;
|
2020-09-06 07:48:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
for (int i = 0; i < nPixelsToShow; i++)
|
|
|
|
{
|
|
|
|
if (destvely[i] >= 0)
|
|
|
|
{
|
|
|
|
if (++vely[i] >= destvely[i])
|
2020-08-22 19:39:14 +00:00
|
|
|
{
|
2020-09-06 07:48:26 +00:00
|
|
|
destvely[i] = (int8_t)-(RandomSize(2) + 1);
|
2020-08-22 19:39:14 +00:00
|
|
|
}
|
2020-09-06 07:48:26 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
if (--vely[i] <= destvely[i])
|
2020-08-22 19:39:14 +00:00
|
|
|
{
|
2020-09-06 07:48:26 +00:00
|
|
|
destvely[i] = (int8_t)(RandomSize(2) + 1);
|
2020-08-22 19:39:14 +00:00
|
|
|
}
|
2020-09-06 07:48:26 +00:00
|
|
|
}
|
2020-08-22 19:39:14 +00:00
|
|
|
|
2020-09-06 07:48:26 +00:00
|
|
|
if (destvelx[i] >= 0) {
|
|
|
|
if (++velx[i] >= destvelx[i])
|
2020-08-22 19:39:14 +00:00
|
|
|
{
|
2020-09-06 07:48:26 +00:00
|
|
|
destvelx[i] = (int8_t)-(RandomSize(2) + 1);
|
2020-08-22 19:39:14 +00:00
|
|
|
}
|
2020-09-06 07:48:26 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
if (--velx[i] <= destvelx[i])
|
2020-08-22 19:39:14 +00:00
|
|
|
{
|
2020-09-06 07:48:26 +00:00
|
|
|
destvelx[i] = (int8_t)(RandomSize(2) + 1);
|
2020-08-22 19:39:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-06 07:48:26 +00:00
|
|
|
int x = (curx[i] >> 8) + velx[i];
|
|
|
|
if (x < 97)
|
2020-08-22 19:39:14 +00:00
|
|
|
{
|
2020-09-06 07:48:26 +00:00
|
|
|
if (x < -96)
|
2020-08-22 19:39:14 +00:00
|
|
|
{
|
2020-09-06 07:48:26 +00:00
|
|
|
x = 0;
|
|
|
|
velx[i] = 0;
|
2020-08-22 19:39:14 +00:00
|
|
|
}
|
|
|
|
}
|
2020-09-06 07:48:26 +00:00
|
|
|
else
|
2020-08-22 19:39:14 +00:00
|
|
|
{
|
2020-09-06 07:48:26 +00:00
|
|
|
x = 0;
|
|
|
|
velx[i] = 0;
|
2020-08-22 19:39:14 +00:00
|
|
|
}
|
|
|
|
|
2020-09-06 07:48:26 +00:00
|
|
|
int y = (cury[i] >> 8) + vely[i];
|
|
|
|
if (y < 106)
|
2020-08-22 19:39:14 +00:00
|
|
|
{
|
2020-09-06 07:48:26 +00:00
|
|
|
if (y < -105)
|
2020-08-22 19:39:14 +00:00
|
|
|
{
|
2020-09-06 07:48:26 +00:00
|
|
|
y = 0;
|
|
|
|
vely[i] = 0;
|
2020-08-22 19:39:14 +00:00
|
|
|
}
|
|
|
|
}
|
2020-09-06 07:48:26 +00:00
|
|
|
else
|
2020-08-22 19:39:14 +00:00
|
|
|
{
|
2020-09-06 07:48:26 +00:00
|
|
|
y = 0;
|
|
|
|
vely[i] = 0;
|
2020-08-22 19:39:14 +00:00
|
|
|
}
|
|
|
|
|
2021-11-21 18:24:46 +00:00
|
|
|
curx[i] = (int)(x << 8);
|
|
|
|
cury[i] = (int)(y << 8);
|
2020-08-22 19:39:14 +00:00
|
|
|
|
2020-09-06 07:48:26 +00:00
|
|
|
Worktile[212 * (x + 97) + 106 + y] = pixelval[i++];
|
2020-08-22 19:39:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-06 07:48:26 +00:00
|
|
|
if (nHeadStage == 1)
|
2020-08-22 19:39:14 +00:00
|
|
|
{
|
2021-12-23 16:19:21 +00:00
|
|
|
if (pSpiritSpr->spr.xrepeat > nSpiritRepeatX)
|
2020-08-22 19:39:14 +00:00
|
|
|
{
|
2021-12-23 16:19:21 +00:00
|
|
|
pSpiritSpr->spr.xrepeat -= 2;
|
|
|
|
if (pSpiritSpr->spr.xrepeat < nSpiritRepeatX)
|
|
|
|
pSpiritSpr->spr.xrepeat = (uint8_t)nSpiritRepeatX;
|
2020-08-22 19:39:14 +00:00
|
|
|
}
|
2021-12-23 16:19:21 +00:00
|
|
|
if (pSpiritSpr->spr.yrepeat > nSpiritRepeatY)
|
2020-08-22 19:39:14 +00:00
|
|
|
{
|
2021-12-23 16:19:21 +00:00
|
|
|
pSpiritSpr->spr.yrepeat -= 2;
|
|
|
|
if (pSpiritSpr->spr.yrepeat < nSpiritRepeatY)
|
|
|
|
pSpiritSpr->spr.yrepeat = (uint8_t)nSpiritRepeatY;
|
2020-08-22 19:39:14 +00:00
|
|
|
}
|
|
|
|
|
2020-09-06 07:48:26 +00:00
|
|
|
int nCount = 0;
|
|
|
|
for (int i = 0; i < nPixels; i++)
|
|
|
|
{
|
|
|
|
int dx, dy;
|
|
|
|
if (origx[i] << 8 == curx[i] || abs((origx[i] << 8) - curx[i]) >= 8)
|
|
|
|
dx = ((origx[i] << 8) - curx[i]) >> 3;
|
|
|
|
else {
|
|
|
|
dx = 0;
|
2021-11-21 18:24:46 +00:00
|
|
|
curx[i] = (int)(origx[i] << 8);
|
2020-09-06 07:48:26 +00:00
|
|
|
}
|
2020-08-22 19:39:14 +00:00
|
|
|
|
2020-09-06 07:48:26 +00:00
|
|
|
if (origy[i] << 8 == cury[i] || abs((origy[i] << 8) - cury[i]) >= 8)
|
|
|
|
dy = ((origy[i] << 8) - cury[i]) >> 3;
|
|
|
|
else {
|
|
|
|
dy = 0;
|
2021-11-21 18:24:46 +00:00
|
|
|
cury[i] = (int)(origy[i] << 8);
|
2020-09-06 07:48:26 +00:00
|
|
|
}
|
2020-08-22 19:39:14 +00:00
|
|
|
|
2020-09-06 07:48:26 +00:00
|
|
|
if ((dx | dy) != 0)
|
|
|
|
{
|
|
|
|
curx[i] += dx;
|
|
|
|
cury[i] += dy;
|
|
|
|
nCount++;
|
|
|
|
}
|
2020-08-22 19:39:14 +00:00
|
|
|
|
2020-09-06 07:48:26 +00:00
|
|
|
Worktile[((cury[i] >> 8) + (212 * ((curx[i] >> 8) + 97))) + 106] = pixelval[i];
|
2020-08-22 19:39:14 +00:00
|
|
|
}
|
|
|
|
|
2021-02-18 10:46:36 +00:00
|
|
|
if (PlayClock - lHeadStartClock > 600)
|
2020-09-06 07:48:26 +00:00
|
|
|
CopyHeadToWorkTile(590);
|
|
|
|
|
|
|
|
if (nCount < (15 * nPixels) / 16) {
|
|
|
|
SoundBigEntrance();
|
2021-12-23 16:19:21 +00:00
|
|
|
AddGlow(pSpiritSpr->spr.sector(), 20);
|
|
|
|
AddFlash(pSpiritSpr->spr.sector(), pSpiritSpr->spr.pos.X, pSpiritSpr->spr.pos.Y, pSpiritSpr->spr.pos.Z, 128);
|
2020-09-06 07:48:26 +00:00
|
|
|
nHeadStage = 3;
|
|
|
|
TintPalette(255, 255, 255);
|
|
|
|
CopyHeadToWorkTile(kTileRamsesNormal);
|
2020-08-22 19:39:14 +00:00
|
|
|
}
|
|
|
|
}
|
2020-09-06 07:48:26 +00:00
|
|
|
break;
|
2020-08-22 19:39:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
END_PS_NS
|