Fix Ramses head being all tiny

# Conflicts:
#	source/exhumed/src/exhumed.cpp
This commit is contained in:
sirlemonhead 2019-11-24 22:23:33 +00:00 committed by Christoph Oelckers
parent 326947d976
commit 803f22904b

View file

@ -3030,6 +3030,10 @@ void InitSpiritHead()
nPixels = 0; nPixels = 0;
nSpiritRepeatX = sprite[nSpiritSprite].xrepeat;
nSpiritRepeatY = sprite[nSpiritSprite].yrepeat;
tileLoad(kTileRamsesNormal); // Ramses Normal Head
for (int i = 0; i < kMaxSprites; i++) for (int i = 0; i < kMaxSprites; i++)
{ {
@ -3165,7 +3169,6 @@ void CopyHeadToWorkTile(short nTile)
} }
} }
#if 1
int DoSpiritHead() int DoSpiritHead()
{ {
static short word_964E6 = 0; static short word_964E6 = 0;
@ -3547,349 +3550,4 @@ int DoSpiritHead()
return 0; return 0;
} }
#endif
#if 0
int DoSpiritHead()
{
static short word_964E6 = 0;
nVertPan[0] += (nDestVertPan[0] - nVertPan[0]) / 4;
if (nHeadStage < 2)
{
memset(worktile, -1, sizeof(worktile));
}
else if (nHeadStage == 5)
{
if (lNextStateChange <= (int)totalclock)
{
if (nPupData)
{
short nPupVal = *pPupData;
pPupData++;
nPupData -= 2;
if (nPupData > 0)
{
lNextStateChange = (nPupVal + lHeadStartClock) - 10;
nTalkTime = !nTalkTime;
}
else
{
nTalkTime = 0;
nPupData = 0;
}
}
else if (!bSubTitles)
{
if (!CDplaying())
{
levelnew = levelnum + 1;
fadecdaudio();
}
}
}
word_964E8--;
if (word_964E8 <= 0)
{
word_964EA = RandomBit() * 2;
word_964E8 = RandomSize(5) + 4;
}
int ebx = 592;
word_964EC--;
if (word_964EC < 3)
{
ebx = 593;
if (word_964EC <= 0) {
word_964EC = RandomSize(6) + 4;
}
}
ebx += word_964EA;
loadtile(ebx);
// TODO - fixme. How big is worktile?
uint8_t *pDest = (uint8_t*)&worktile[10441];
uint8_t *pSrc = waloff[ebx];
for (int i = 0; i < 97; i++)
{
memcpy(pDest, pSrc, 106);
pDest += 212;
pSrc += 106;
}
if (nTalkTime)
{
if (nMouthTile < 2) {
nMouthTile++;
}
}
else if (nMouthTile != 0)
{
nMouthTile--;
}
if (nMouthTile)
{
loadtile(nMouthTile + 598);
short nTileSizeX = tilesizx[nMouthTile + 598];
short nTileSizeY = tilesizy[nMouthTile + 598];
// TODO - checkme. near loc_133AA
// uint8_t *pDest = (uint8_t*)worktile;
// pDest += (212 * (97 - nTileSizeX / 2)) + (159 - nTileSizeY);
uint8_t *pDest = (uint8_t*)&worktile[212 * (97 - nTileSizeX / 2)] + (159 - nTileSizeY);
uint8_t *pSrc = waloff[nMouthTile + 598];
while (nTileSizeX > 0)
{
memcpy(pDest, pSrc, nTileSizeY);
nTileSizeX--;
pDest += 212;
pSrc += nTileSizeY;
}
}
return 1;
}
nPixelsToShow = ((int)totalclock - nHeadTimeStart) * 15;
if (nPixelsToShow > nPixels) {
nPixelsToShow = nPixels;
}
if (nHeadStage < 3)
{
UpdateSwirlies();
if (sprite[nSpiritSprite].shade > -127) {
sprite[nSpiritSprite].shade--;
}
word_964E6--;
if (word_964E6 < 0)
{
DimSector(sprite[nSpiritSprite].sectnum);
word_964E6 = 5;
}
if (!nHeadStage)
{
if (((int)totalclock - nHeadTimeStart) > 480)
{
nHeadStage = 1;
nHeadTimeStart = (int)totalclock + 480;
}
// int ecx = 0;
// loc_1362C
for (int i = 0; i < nPixelsToShow; i++)
{
if (destvely[i] < 0)
{
vely[i]--;
if (vely[i] <= destvely[i])
{
destvely[i] = RandomSize(2) + 1;
}
}
else
{
vely[i]++;
if (vely[i] >= destvely[i])
{
destvely[i] = -(RandomSize(2) + 1);
}
}
// loc_13541
if (destvelx[i] >= 0)
{
velx[i]--;
if (velx[i] <= destvelx[i])
{
destvelx[i] = RandomSize(2) + 1;
}
}
else
{
velx[i]++;
if (velx[i] >= destvelx[i])
{
destvelx[i] = -(RandomSize(2) + 1);
}
}
// loc_13593
int esi = vely[i] + (cury[i] >> 8);
if (esi >= 106)
{
vely[i] = 0;
esi = 0;
}
else if (esi < -105)
{
vely[i] = 0;
esi = 0;
}
// loc_135C6
int ebx = velx[i] + (curx[i] >> 8);
if (ebx >= 97)
{
velx[i] = 0;
ebx = 0;
}
else if (ebx < -96)
{
velx[i] = 0;
ebx = 0;
}
// loc_135F9
curx[i] = ebx << 8;
cury[i] = esi << 8;
//ecx += 2;
// ecx++;
// uint8_t *pVal = (uint8_t*)worktile;
worktile[106 + esi + (ebx + 97) * 212] = pixelval[i];
//pVal += (106 + esi);
//*pVal = pixelval[i];
}
}
else if (nHeadStage == 1)
{
uint8_t nXRepeat = sprite[nSpiritSprite].xrepeat;
if (nXRepeat > nSpiritRepeatX)
{
sprite[nSpiritSprite].xrepeat -= 2;
nXRepeat = sprite[nSpiritSprite].xrepeat;
if (nXRepeat < nSpiritRepeatX)
{
sprite[nSpiritSprite].xrepeat = nSpiritRepeatX;
}
}
uint8_t nYRepeat = sprite[nSpiritSprite].yrepeat;
if (nYRepeat > nSpiritRepeatY)
{
sprite[nSpiritSprite].yrepeat -= 2;
nYRepeat = sprite[nSpiritSprite].yrepeat;
if (nYRepeat < nSpiritRepeatY)
{
sprite[nSpiritSprite].yrepeat = nSpiritRepeatY;
}
}
// loc_13705
int esi = 0;
// int edx = 0;
// loc_137E7:
for (int i = 0; i < nPixels; i++)
{
int eax = (origx[i] << 8) - curx[i];
int ecx = eax;
if (eax && klabs(eax) < 8)
{
curx[i] = origx[i] << 8;
ecx = 0;
}
else
{
ecx >>= 3;
}
// loc_1374B
int var_1C = (origy[i] << 8) - cury[i];
int ebp = var_1C;
if (ebp && klabs(ebp) < 8)
{
cury[i] = origy[i] << 8;
var_1C = 0;
}
else
{
var_1C >>= 3;
}
if (var_1C | ecx)
{
curx[i] += ecx;
cury[i] += var_1C;
esi++;
}
// edx++;
// uint8_t *pVal = (uint8_t*)worktile;
worktile[106 + (((curx[i] >> 8) + 97) * 212) + (cury[i] >> 8)] = pixelval[i];
//pVal += (106 + ecx);
//*pVal = pixelval[i];
}
if (((int)totalclock - lHeadStartClock) > 600) {
CopyHeadToWorkTile(kTileRamsesGold);
}
int eax = (nPixels * 15) / 16;
if (esi < eax)
{
// SoundBigEntrance(); // TODO
AddGlow(sprite[nSpiritSprite].sectnum, 20);
AddFlash(
sprite[nSpiritSprite].sectnum,
sprite[nSpiritSprite].x,
sprite[nSpiritSprite].y,
sprite[nSpiritSprite].z,
128);
nHeadStage = 3;
TintPalette(255, 255, 255);
CopyHeadToWorkTile(kTileRamsesNormal);
}
}
return 1;
}
// loc_138A7
FixPalette();
if (!nPalDiff)
{
nFreeze = 2;
nHeadStage++;
}
return 0;
}
#endif
END_PS_NS END_PS_NS