PCExhumed: Misc code tidying. Changed cases in runlist_ProcessSectorTag() to match editor tag numbers,

consolidated duplicate code in runlist_ProcessWallTag(), renamed ActiveSound struct vars etc.

# Conflicts:
#	source/exhumed/src/cd.cpp
#	source/exhumed/src/exhumed.cpp
#	source/exhumed/src/fish.cpp
#	source/exhumed/src/grenade.cpp
#	source/exhumed/src/mummy.cpp
#	source/exhumed/src/sound.cpp
This commit is contained in:
sirlemonhead 2020-02-04 21:45:10 +00:00 committed by Christoph Oelckers
parent b271574f90
commit efaefff3d0
24 changed files with 415 additions and 606 deletions

View file

@ -42,6 +42,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
BEGIN_PS_NS
#define KMaxTimeSlots 16
#define kMessageMask 0x7F0000
#define kAIFish 0x120000
void InitTimeSlot();
int GrabTimeSlot(int nVal);

View file

@ -518,11 +518,11 @@ HITWALL:
}
// loc_2A639:
if (BulletInfo[nType].field_10)
if (BulletInfo[nType].nRadius)
{
nRadialBullet = nType;
runlist_RadialDamageEnemy(nSprite, pBulletInfo->nDamage, pBulletInfo->field_10);
runlist_RadialDamageEnemy(nSprite, pBulletInfo->nDamage, pBulletInfo->nRadius);
nRadialBullet = -1;

View file

@ -31,7 +31,7 @@ struct bulletInfo
short nSeq; // 10
short field_C; // 12
short nFlags;
short field_10; // damage radius?
short nRadius; // damage radius
short xyRepeat;
char pad[12];
};

View file

@ -28,7 +28,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
BEGIN_PS_NS
extern short word_9AC30;
int nLastVolumeSet = 0;

View file

@ -1467,9 +1467,9 @@ void DrawClock()
while (nVal)
{
int v2 = nVal & 0xF;
int yPos = 32 - tilesiz[v2 + kTile3606].y / 2;
int yPos = 32 - tilesiz[v2 + kClockSymbol1].y / 2;
CopyTileToBitmap(v2 + kTile3606, kTile3603, ebp - tilesiz[v2 + kTile3606].x / 2, yPos);
CopyTileToBitmap(v2 + kClockSymbol1, kTile3603, ebp - tilesiz[v2 + kClockSymbol1].x / 2, yPos);
ebp -= 15;
@ -2491,13 +2491,9 @@ void DoGameOverScene()
SetOverscan(BASEPAL);
}
// TODO - missing some values?
short word_10010[] = {6, 25, 43, 50, 68, 78, 101, 111, 134, 158, 173, 230, 6000};
void DoTitle()
{
short theArray[13];
memcpy(theArray, word_10010, sizeof(word_10010));
short skullDurations[] = { 6, 25, 43, 50, 68, 78, 101, 111, 134, 158, 173, 230, 6000 };
videoSetViewableArea(0, 0, xdim - 1, ydim - 1);
@ -2576,12 +2572,12 @@ void DoTitle()
int nStartTime = (int)totalclock;
int nCount = 0;
int var_18 = (int)totalclock;
int var_18 = (int)totalclock + skullDurations[0];
int var_4 = 0;
int esi = 130;
var_18 += theArray[0];
inputState.ClearAllInput();
while (LocalSoundPlaying())
@ -2607,8 +2603,7 @@ void DoTitle()
nCount++;
if (nCount > 12) break;
var_18 = nStartTime + theArray[nCount];
var_18 = nStartTime + skullDurations[nCount];
var_4 = var_4 == 0;
}
@ -2924,9 +2919,6 @@ int DoSpiritHead()
nHeadTimeStart = (int)totalclock + 480;
}
// int ecx = 0;
// loc_1362C
for (int i = 0; i < nPixelsToShow; i++)
{
if (destvely[i] >= 0)
@ -2968,7 +2960,6 @@ int DoSpiritHead()
}
}
// loc_13593
int esi = vely[i] + (cury[i] >> 8);
if (esi < 106)
@ -2985,7 +2976,6 @@ int DoSpiritHead()
esi = 0;
}
// loc_135C6
int ebx = velx[i] + (curx[i] >> 8);
if (ebx < 97)
@ -3002,13 +2992,9 @@ int DoSpiritHead()
ebx = 0;
}
// loc_135F9
curx[i] = ebx * 256;
cury[i] = esi * 256;
//ecx += 2;
// ecx++;
esi += (ebx + 97) * 212;
Worktile[106 + esi] = pixelval[i];
@ -3018,7 +3004,6 @@ int DoSpiritHead()
}
else
{
// loc_13679:
if (nHeadStage != 1) {
return 1;
}
@ -3047,11 +3032,8 @@ int DoSpiritHead()
}
}
// loc_13705
int esi = 0;
// int edx = 0;
// loc_137E7:
for (int i = 0; i < nPixels; i++)
{
int eax = (origx[i] << 8) - curx[i];
@ -3077,7 +3059,6 @@ int DoSpiritHead()
ecx >>= 3;
}
// loc_1374B
int var_1C = (origy[i] << 8) - cury[i];
int ebp = var_1C;
@ -3114,7 +3095,6 @@ int DoSpiritHead()
ecx = (((curx[i] >> 8) + 97) * 212) + (cury[i] >> 8);
// edx++;
Worktile[106 + ecx] = pixelval[i];
}
@ -3146,7 +3126,6 @@ int DoSpiritHead()
}
else
{
// loc_138A7
FixPalette();
if (!nPalDiff)
@ -3209,7 +3188,6 @@ int DoSpiritHead()
ebx += word_964EA;
// TODO - fixme. How big is worktile?
uint8_t *pDest = &Worktile[10441];
const uint8_t* pSrc = tilePtr(ebx);
@ -3237,10 +3215,6 @@ int DoSpiritHead()
short nTileSizeX = tilesiz[nMouthTile + 598].x;
short nTileSizeY = tilesiz[nMouthTile + 598].y;
// TODO - checkme. near loc_133AA
// uint8_t *pDest = (uint8_t*)worktile;
// pDest += (212 * (97 - nTileSizeX / 2)) + (159 - nTileSizeY);
uint8_t *pDest = &Worktile[212 * (97 - nTileSizeX / 2)] + (159 - nTileSizeY);
const uint8_t *pSrc = tilePtr(nMouthTile + 598);

View file

@ -16,6 +16,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//-------------------------------------------------------------------------
#include "ns.h"
#include "aistuff.h"
#include "fish.h"
#include "anims.h"
#include "engine.h"
@ -161,7 +162,7 @@ void FuncFishLimb(int a, int UNUSED(nDamage), int nRun)
int nSeq = SeqOffsets[kSeqFish] + FishChunk[nFish].field_4;
int nMessage = a & 0x7F0000;
int nMessage = a & kMessageMask;
switch (nMessage)
{
@ -328,13 +329,13 @@ void FuncFish(int a, int nDamage, int nRun)
short nSprite = FishList[nFish].nSprite;
short nAction = FishList[nFish].nAction;
int nMessage = a & 0x7F0000;
int nMessage = a & kMessageMask;
switch (nMessage)
{
default:
{
Printf("unknown msg %d for Fish\n", a & 0x7F0000);
Printf("unknown msg %d for Fish\n", nMessage);
return;
}

View file

@ -16,6 +16,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//-------------------------------------------------------------------------
#include "ns.h"
#include "aistuff.h"
#include "grenade.h"
#include "engine.h"
#include "player.h"
@ -96,7 +97,7 @@ void BounceGrenade(short nGrenade, short nAngle)
{
GrenadeList[nGrenade].field_10 >>= 1;
GrenadeList[nGrenade].x = (Sin(nAngle + 512) >> 5) * GrenadeList[nGrenade].field_10;
GrenadeList[nGrenade].x = (Cos(nAngle) >> 5) * GrenadeList[nGrenade].field_10;
GrenadeList[nGrenade].y = (Sin(nAngle) >> 5) * GrenadeList[nGrenade].field_10;
D3PlayFX(StaticSound[kSound3], GrenadeList[nGrenade].nSprite);
@ -134,7 +135,7 @@ int ThrowGrenade(short nPlayer, int UNUSED(edx), int UNUSED(ebx), int ecx, int p
GrenadeList[nGrenade].field_10 = ((90 - GrenadeList[nGrenade].field_E) * (90 - GrenadeList[nGrenade].field_E)) + nVel;
sprite[nGrenadeSprite].zvel = (-64 * push1) - 4352;
int nMov = movesprite(nGrenadeSprite, Sin(nAngle + 512) * (sprite[nPlayerSprite].clipdist << 3), Sin(nAngle) * (sprite[nPlayerSprite].clipdist << 3), ecx, 0, 0, CLIPMASK1);
int nMov = movesprite(nGrenadeSprite, Cos(nAngle) * (sprite[nPlayerSprite].clipdist << 3), Sin(nAngle) * (sprite[nPlayerSprite].clipdist << 3), ecx, 0, 0, CLIPMASK1);
if (nMov & 0x8000)
{
nAngle = GetWallNormal(nMov & 0x3FFF);
@ -147,7 +148,7 @@ int ThrowGrenade(short nPlayer, int UNUSED(edx), int UNUSED(ebx), int ecx, int p
sprite[nGrenadeSprite].zvel = sprite[nPlayerSprite].zvel;
}
GrenadeList[nGrenade].x = Sin(nAngle + 512) >> 4;
GrenadeList[nGrenade].x = Cos(nAngle) >> 4;
GrenadeList[nGrenade].x *= GrenadeList[nGrenade].field_10;
GrenadeList[nGrenade].y = Sin(nAngle) >> 4;
@ -176,16 +177,16 @@ int BuildGrenade(int nPlayer)
sprite[nSprite].shade = -64;
sprite[nSprite].xrepeat = 20;
sprite[nSprite].yrepeat = 20;
sprite[nSprite].cstat = 0x8000u;
sprite[nSprite].cstat = 0x8000;
sprite[nSprite].picnum = 1;
sprite[nSprite].pal = 0;
sprite[nSprite].clipdist = 30;
sprite[nSprite].xoffset = 0;
sprite[nSprite].yoffset = 0;
sprite[nSprite].ang = sprite[nPlayerSprite].ang;
sprite[nSprite].yvel = 0;
sprite[nSprite].owner = nPlayerSprite;
sprite[nSprite].xvel = 0;
sprite[nSprite].yvel = 0;
sprite[nSprite].zvel = 0;
sprite[nSprite].hitag = 0;
sprite[nSprite].lotag = runlist_HeadRun() + 1;
@ -248,7 +249,7 @@ void ExplodeGrenade(short nGrenade)
short nAngle = sprite[nPlayerSprite].ang;
sprite[nGrenadeSprite].z = sprite[nPlayerSprite].z;
sprite[nGrenadeSprite].x = (Sin(nAngle + 512) >> 5) + sprite[nPlayerSprite].x;
sprite[nGrenadeSprite].x = (Cos(nAngle) >> 5) + sprite[nPlayerSprite].x;
sprite[nGrenadeSprite].y = (Sin(nAngle) >> 5) + sprite[nPlayerSprite].y;
changespritesect(nGrenadeSprite, sprite[nPlayerSprite].sectnum);
@ -264,7 +265,7 @@ void ExplodeGrenade(short nGrenade)
nDamage *= 2;
}
runlist_RadialDamageEnemy(nGrenadeSprite, nDamage, BulletInfo[kWeaponGrenade].field_10);
runlist_RadialDamageEnemy(nGrenadeSprite, nDamage, BulletInfo[kWeaponGrenade].nRadius);
BuildAnim(-1, var_28, 0, sprite[nGrenadeSprite].x, sprite[nGrenadeSprite].y, sprite[nGrenadeSprite].z, sprite[nGrenadeSprite].sectnum, var_20, 4);
AddFlash(sprite[nGrenadeSprite].sectnum, sprite[nGrenadeSprite].x, sprite[nGrenadeSprite].y, sprite[nGrenadeSprite].z, 128);
@ -290,7 +291,7 @@ void FuncGrenade(int a, int UNUSED(nDamage), int nRun)
nSeq = SeqOffsets[kSeqGrenRoll] + GrenadeList[nGrenade].field_A;
}
int nMessage = a & 0x7F0000;
int nMessage = a & kMessageMask;
switch (nMessage)
{
@ -302,7 +303,7 @@ void FuncGrenade(int a, int UNUSED(nDamage), int nRun)
default:
{
Printf("unknown msg %d for bullet\n", a & 0x7F0000); // TODO - change 'bullet' to 'grenade' ?
Printf("unknown msg %d for grenade\n", nMessage);
return;
}

View file

@ -700,7 +700,7 @@ loc_flag:
int theY = sprite[nPlayerSprite].y;
int theZ = sprite[nPlayerSprite].z;
int ebp = Sin(nAngle + 512) * (sprite[nPlayerSprite].clipdist << 3);
int ebp = Cos(nAngle) * (sprite[nPlayerSprite].clipdist << 3);
int ebx = Sin(nAngle) * (sprite[nPlayerSprite].clipdist << 3);
if (WeaponInfo[nWeapon].c)
@ -714,7 +714,7 @@ loc_flag:
ecx = theVal;
int var_44 = (nAngle + 512) & kAngleMask;
ebp += ((Sin(var_44 + 512) >> 11) * ecx);
ebp += (Cos(var_44) >> 11) * ecx;
ebx += (Sin(var_44) >> 11) * ecx;
}
@ -884,7 +884,7 @@ loc_flag:
nDamage *= 2;
}
runlist_RadialDamageEnemy(nPlayerSprite, nDamage, BulletInfo[kWeaponMummified].field_10);
runlist_RadialDamageEnemy(nPlayerSprite, nDamage, BulletInfo[kWeaponMummified].nRadius);
break;
}
}

View file

@ -342,33 +342,29 @@ void InitSectFlag()
}
}
void ProcessSpriteTag(short nSprite, short lotag, short hitag)
void ProcessSpriteTag(short nSprite, short nLotag, short nHitag)
{
int nChannel = runlist_AllocChannel(hitag % 1000);
// int ebp = nChannel;
int nChannel = runlist_AllocChannel(nHitag % 1000);
// int nHitag2 = hitag / 1000;
int nLotag2 = lotag / 1000;
if (nLotag2 == 0) {
nLotag2 = 1;
int nSpeed = nLotag / 1000;
if (!nSpeed) {
nSpeed = 1;
}
// this value can change in the below code but we also need to retain the original hitag value
int nVal = hitag;
int nVal = nHitag;
if (lotag >= 900 && lotag <= 949)
if (nLotag >= 900 && nLotag <= 949)
{
ProcessTrailSprite(nSprite, lotag, hitag);
ProcessTrailSprite(nSprite, nLotag, nHitag);
return;
}
// handle tags 6 to 60
switch (lotag)
switch (nLotag)
{
case 8: // M-60 ammo belt
{
nVal = 3 * (hitag / 3);
nVal = 3 * (nHitag / 3);
// fall through to 6,7 etc
fallthrough__;
}
@ -420,7 +416,7 @@ void ProcessSpriteTag(short nSprite, short lotag, short hitag)
case 60:
{
sprite[nSprite].hitag = nVal;
changespritestat(nSprite, lotag + 900);
changespritestat(nSprite, nLotag + 900);
sprite[nSprite].cstat &= 0xFEFE;
BuildItemAnim(nSprite);
return;
@ -428,7 +424,7 @@ void ProcessSpriteTag(short nSprite, short lotag, short hitag)
case 12: // berry twig
{
sprite[nSprite].hitag = 40;
changespritestat(nSprite, lotag + 900);
changespritestat(nSprite, nLotag + 900);
sprite[nSprite].cstat &= 0xFEFE;
BuildItemAnim(nSprite);
return;
@ -436,7 +432,7 @@ void ProcessSpriteTag(short nSprite, short lotag, short hitag)
case 13: // blood bowl
{
sprite[nSprite].hitag = 160;
changespritestat(nSprite, lotag + 900);
changespritestat(nSprite, nLotag + 900);
sprite[nSprite].cstat &= 0xFEFE;
BuildItemAnim(nSprite);
return;
@ -444,7 +440,7 @@ void ProcessSpriteTag(short nSprite, short lotag, short hitag)
case 14: // venom bowl
{
sprite[nSprite].hitag = -200;
changespritestat(nSprite, lotag + 900);
changespritestat(nSprite, nLotag + 900);
sprite[nSprite].cstat &= 0xFEFE;
BuildItemAnim(nSprite);
return;
@ -467,7 +463,7 @@ void ProcessSpriteTag(short nSprite, short lotag, short hitag)
else
{
sprite[nSprite].hitag = nVal;
changespritestat(nSprite, lotag + 900);
changespritestat(nSprite, nLotag + 900);
sprite[nSprite].cstat &= 0xFEFE;
BuildItemAnim(nSprite);
return;
@ -487,14 +483,14 @@ void ProcessSpriteTag(short nSprite, short lotag, short hitag)
nVal++;
nVal--; // CHECKME ??
sprite[nSprite].hitag = nVal;
changespritestat(nSprite, lotag + 900);
changespritestat(nSprite, nLotag + 900);
sprite[nSprite].cstat &= 0xFEFE;
BuildItemAnim(nSprite);
return;
}
}
int v6 = lotag % 1000;
int v6 = nLotag % 1000;
if (!bNoCreatures || v6 < 100 || v6 > 118)
{
@ -507,12 +503,12 @@ void ProcessSpriteTag(short nSprite, short lotag, short hitag)
{
case 999:
{
AddFlicker(sprite[nSprite].sectnum, nLotag2);
AddFlicker(sprite[nSprite].sectnum, nSpeed);
break;
}
case 998:
{
AddGlow(sprite[nSprite].sectnum, nLotag2);
AddGlow(sprite[nSprite].sectnum, nSpeed);
break;
}
case 118: // Anubis with drum
@ -658,7 +654,7 @@ void ProcessSpriteTag(short nSprite, short lotag, short hitag)
case 99: // underwater type 2
{
short nSector = sprite[nSprite].sectnum;
SetAbove(nSector, hitag);
SetAbove(nSector, nHitag);
SectFlag[nSector] |= kSectUnderwater;
mydeletesprite(nSprite);
@ -667,29 +663,29 @@ void ProcessSpriteTag(short nSprite, short lotag, short hitag)
case 98:
{
short nSector = sprite[nSprite].sectnum;
SetBelow(nSector, hitag);
SnapSectors(nSector, hitag, 1);
SetBelow(nSector, nHitag);
SnapSectors(nSector, nHitag, 1);
mydeletesprite(nSprite);
return;
}
case 97:
{
AddSectorBob(sprite[nSprite].sectnum, hitag, 1);
AddSectorBob(sprite[nSprite].sectnum, nHitag, 1);
mydeletesprite(nSprite);
return;
}
case 96: // Lava sector
{
hitag /= 4; // hitag is damage level?
if (hitag == 0) {
hitag = 1;
int nDamage = nHitag / 4;
if (!nDamage) {
nDamage = 1;
}
short nSector = sprite[nSprite].sectnum;
SectDamage[nSector] = hitag;
SectDamage[nSector] = nDamage;
SectFlag[nSector] |= kSectLava;
mydeletesprite(nSprite);
@ -697,7 +693,7 @@ void ProcessSpriteTag(short nSprite, short lotag, short hitag)
}
case 95:
{
AddSectorBob(sprite[nSprite].sectnum, hitag, 0);
AddSectorBob(sprite[nSprite].sectnum, nHitag, 0);
mydeletesprite(nSprite);
return;
@ -705,7 +701,7 @@ void ProcessSpriteTag(short nSprite, short lotag, short hitag)
case 94: // water
{
short nSector = sprite[nSprite].sectnum;
SectDepth[nSector] = hitag << 8;
SectDepth[nSector] = nHitag << 8;
mydeletesprite(nSprite);
return;
@ -717,7 +713,7 @@ void ProcessSpriteTag(short nSprite, short lotag, short hitag)
}
case 90:
{
BuildObject(nSprite, 3, hitag);
BuildObject(nSprite, 3, nHitag);
return;
}
case 79:
@ -725,7 +721,7 @@ void ProcessSpriteTag(short nSprite, short lotag, short hitag)
{
short nSector = sprite[nSprite].sectnum;
SectSpeed[nSector] = nLotag2;
SectSpeed[nSector] = nSpeed;
SectFlag[nSector] |= sprite[nSprite].ang;
mydeletesprite(nSprite);
@ -733,7 +729,7 @@ void ProcessSpriteTag(short nSprite, short lotag, short hitag)
}
case 88:
{
AddFlow(nSprite, nLotag2, 0);
AddFlow(nSprite, nSpeed, 0);
mydeletesprite(nSprite);
return;
@ -748,7 +744,7 @@ void ProcessSpriteTag(short nSprite, short lotag, short hitag)
}
case 78:
{
AddFlow(nSprite, nLotag2, 1);
AddFlow(nSprite, nSpeed, 1);
short nSector = sprite[nSprite].sectnum;
SectFlag[nSector] |= 0x8000;
@ -758,24 +754,24 @@ void ProcessSpriteTag(short nSprite, short lotag, short hitag)
}
case 77:
{
int nArrow = BuildArrow(nSprite, nLotag2);
int nArrow = BuildArrow(nSprite, nSpeed);
runlist_AddRunRec(sRunChannels[nChannel].a, nArrow);
return;
}
case 76: // Explosion Trigger (Exploding Fire Cauldron)
{
BuildObject(nSprite, 0, hitag);
BuildObject(nSprite, 0, nHitag);
return;
}
case 75: // Explosion Target (Cauldrons, fireballs and grenades will destroy nearby 75 sprites)
{
BuildObject(nSprite, 1, hitag);
BuildObject(nSprite, 1, nHitag);
return;
}
case 71:
{
int nFireball = BuildFireBall(nSprite, hitag, nLotag2);
int nFireball = BuildFireBall(nSprite, nHitag, nSpeed);
runlist_AddRunRec(sRunChannels[nChannel].a, nFireball);
return;

View file

@ -612,7 +612,7 @@ void DoFlickers()
}
// nWall can also be passed in here via nSprite parameter - TODO - rename nSprite parameter :)
void AddFlow(int nSprite, int a, int b)
void AddFlow(int nSprite, int nSpeed, int b)
{
if (nFlowCount >= kMaxFlows)
return;
@ -630,8 +630,8 @@ void AddFlow(int nSprite, int a, int b)
sFlowInfo[nFlow].field_14 = (tilesiz[nPic].x << 14) - 1;
sFlowInfo[nFlow].field_18 = (tilesiz[nPic].y << 14) - 1;
sFlowInfo[nFlow].field_C = -Cos(nAngle) * a;
sFlowInfo[nFlow].field_10 = Sin(nAngle) * a;
sFlowInfo[nFlow].field_C = -Cos(nAngle) * nSpeed;
sFlowInfo[nFlow].field_10 = Sin(nAngle) * nSpeed;
}
else
{
@ -649,8 +649,8 @@ void AddFlow(int nSprite, int a, int b)
sFlowInfo[nFlow].field_14 = (tilesiz[nPic].x * wall[var_18].xrepeat) << 8;
sFlowInfo[nFlow].field_18 = (tilesiz[nPic].y * wall[var_18].yrepeat) << 8;
sFlowInfo[nFlow].field_C = -Cos(nAngle) * a;
sFlowInfo[nFlow].field_10 = Sin(nAngle) * a;
sFlowInfo[nFlow].field_C = -Cos(nAngle) * nSpeed;
sFlowInfo[nFlow].field_10 = Sin(nAngle) * nSpeed;
}
sFlowInfo[nFlow].field_8 = 0;

View file

@ -28,7 +28,7 @@ void AddFlash(short nSector, int x, int y, int z, int val);
void SetTorch(int nPlayer, int bTorchOnOff);
void UndoFlashes();
void DoLights();
void AddFlow(int nSprite, int a, int b);
void AddFlow(int nSprite, int nSpeed, int b);
void BuildFlash(short nPlayer, short nSector, int nVal);
void AddGlow(short nSector, int nVal);
void AddFlicker(short nSector, int nVal);

View file

@ -82,27 +82,29 @@ static SavegameHelper sgh("move",
signed int lsqrt(int a1)
{
int v1; // edx@1
int v2; // ebx@1
signed int result; // eax@1
int v1;
int v2;
signed int result;
v1 = a1;
v2 = a1 - 0x40000000;
result = 0;
if (v2 >= 0)
{
result = 0x8000;
result = 32768;
v1 = v2;
}
if (v1 - ((result << 15) + 0x10000000) >= 0)
{
v1 -= (result << 15) + 0x10000000;
result += 0x4000;
result += 16384;
}
if (v1 - ((result << 14) + 0x4000000) >= 0)
{
v1 -= (result << 14) + 0x4000000;
result += 0x2000;
result += 8192;
}
if (v1 - ((result << 13) + 0x1000000) >= 0)
{
@ -165,7 +167,8 @@ signed int lsqrt(int a1)
result += 2;
}
if (v1 - (2 * result + 1) >= 0)
++result;
result += 1;
return result;
}
@ -694,7 +697,7 @@ int PlotCourseToSprite(int nSprite1, int nSprite2)
return ksqrt(y * y + x * x);
}
int FindPlayer(int nSprite, int nVal)
int FindPlayer(int nSprite, int nDistance)
{
int var_18 = 0;
if (nSprite >= 0)
@ -703,8 +706,8 @@ int FindPlayer(int nSprite, int nVal)
if (nSprite < 0)
nSprite = -nSprite;
if (nVal < 0)
nVal = 100;
if (nDistance < 0)
nDistance = 100;
int x = sprite[nSprite].x;
int y = sprite[nSprite].y;
@ -712,7 +715,7 @@ int FindPlayer(int nSprite, int nVal)
int z = sprite[nSprite].z - GetSpriteHeight(nSprite);
nVal <<= 8;
nDistance <<= 8;
short nPlayerSprite;
int i = 0;
@ -726,20 +729,13 @@ int FindPlayer(int nSprite, int nVal)
if ((sprite[nPlayerSprite].cstat & 0x101) && (!(sprite[nPlayerSprite].cstat & 0x8000)))
{
int v9 = sprite[nPlayerSprite].x - x;
if (v9 < 0) {
v9 = -v9;
}
int v9 = klabs(sprite[nPlayerSprite].x - x);
int v10 = sprite[nPlayerSprite].y - y;
if (v9 < nVal)
if (v9 < nDistance)
{
if (v10 < 0) {
v10 = -v10;
}
int v10 = klabs(sprite[nPlayerSprite].y - y);
if (v10 < nVal && cansee(sprite[nPlayerSprite].x, sprite[nPlayerSprite].y, sprite[nPlayerSprite].z - 7680, sprite[nPlayerSprite].sectnum, x, y, z, nSector))
if (v10 < nDistance && cansee(sprite[nPlayerSprite].x, sprite[nPlayerSprite].y, sprite[nPlayerSprite].z - 7680, sprite[nPlayerSprite].sectnum, x, y, z, nSector))
{
break;
}
@ -756,7 +752,7 @@ int FindPlayer(int nSprite, int nVal)
return nPlayerSprite;
}
void CheckSectorFloor(short nSector, int z, int *a, int *b)
void CheckSectorFloor(short nSector, int z, int *x, int *y)
{
short nSpeed = SectSpeed[nSector];
@ -769,13 +765,13 @@ void CheckSectorFloor(short nSector, int z, int *a, int *b)
if (z >= sector[nSector].floorz)
{
*a += (Sin(nAng + 512) << 3) * nSpeed;
*b += (sintable[nAng] << 3) * nSpeed;
*x += (Cos(nAng) << 3) * nSpeed;
*y += (sintable[nAng] << 3) * nSpeed; // no anglemask in original code
}
else if (nFlag & 0x800)
{
*a += (Sin(nAng + 512) << 4) * nSpeed;
*b += (sintable[nAng] << 4) * nSpeed;
*x += (Cos(nAng) << 4) * nSpeed;
*y += (sintable[nAng] << 4) * nSpeed; // no anglemask in original code
}
}
@ -821,27 +817,27 @@ void CreatePushBlock(int nSector)
int startwall = sector[nSector].wallptr;
int nWalls = sector[nSector].wallnum;
int ecx = 0;
int ebx = 0;
int xSum = 0;
int ySum = 0;
for (i = 0; i < nWalls; i++)
{
ecx += wall[startwall + i].x;
ebx += wall[startwall + i].y;
xSum += wall[startwall + i].x;
ySum += wall[startwall + i].y;
}
int avgx = ecx / nWalls;
int avgy = ebx / nWalls;
int xAvg = xSum / nWalls;
int yAvg = ySum / nWalls;
sBlockInfo[nBlock].x = avgx;
sBlockInfo[nBlock].y = avgy;
sBlockInfo[nBlock].x = xAvg;
sBlockInfo[nBlock].y = yAvg;
int nSprite = insertsprite(nSector, 0);
sBlockInfo[nBlock].nSprite = nSprite;
sprite[nSprite].x = avgx;
sprite[nSprite].y = avgy;
sprite[nSprite].x = xAvg;
sprite[nSprite].y = yAvg;
sprite[nSprite].z = sector[nSector].floorz - 256;
sprite[nSprite].cstat = 0x8000;
@ -849,8 +845,8 @@ void CreatePushBlock(int nSector)
for (i = 0; i < nWalls; i++)
{
int x = avgx - wall[startwall + i].x;
int y = avgy - wall[startwall + i].y;
int x = xAvg - wall[startwall + i].x;
int y = yAvg - wall[startwall + i].y;
int nSqrt = ksqrt(x * x + y * y);
if (nSqrt > var_28) {
@ -1095,14 +1091,18 @@ void SetQuake(short nSprite, int nVal)
int x = sprite[nSprite].x;
int y = sprite[nSprite].y;
nVal *= 256;
for (int i = 0; i < nTotalPlayers; i++)
{
int nPlayerSprite = PlayerList[i].nSprite;
int nSqrt = ksqrt(((sprite[nPlayerSprite].x - x) >> 8) * ((sprite[nPlayerSprite].x - x) >> 8) + ((sprite[nPlayerSprite].y - y) >> 8)
* ((sprite[nPlayerSprite].y - y) >> 8));
int xDiff = sprite[nPlayerSprite].x - x;
int yDiff = sprite[nPlayerSprite].y - y;
int eax = nVal * 256;
int nSqrt = ksqrt((xDiff >> 8)* (xDiff >> 8) + (yDiff >> 8)* (yDiff >> 8));
int eax = nVal;
if (nSqrt)
{
@ -1149,48 +1149,30 @@ int AngleChase(int nSprite, int nSprite2, int ebx, int ecx, int push1)
{
int nHeight = tilesiz[sprite[nSprite2].picnum].y * sprite[nSprite2].yrepeat * 2;
int nMyAngle = GetMyAngle(sprite[nSprite2].x - sprite[nSprite].x, sprite[nSprite2].y - sprite[nSprite].y);
int xDiff = sprite[nSprite2].x - sprite[nSprite].x;
int yDiff = sprite[nSprite2].y - sprite[nSprite].y;
int nSqrt = ksqrt(
(sprite[nSprite2].y - sprite[nSprite].y)
*
(sprite[nSprite2].y - sprite[nSprite].y)
+
(sprite[nSprite2].x - sprite[nSprite].x)
*
(sprite[nSprite2].x - sprite[nSprite].x)
);
int nMyAngle = GetMyAngle(xDiff, yDiff);
int nSqrt = ksqrt(xDiff * xDiff + yDiff * yDiff);
int var_18 = GetMyAngle(nSqrt, ((sprite[nSprite2].z - nHeight) - sprite[nSprite].z) >> 8);
// int edx = nMyAngle;
int nAngDelta = AngleDelta(sprite[nSprite].ang, nMyAngle, 1024);
int nAngDelta2 = nAngDelta;
if (nAngDelta2 < 0)
nAngDelta2 = -nAngDelta2;
int nAngDelta2 = klabs(nAngDelta);
if (nAngDelta2 > 63)
{
nAngDelta2 = nAngDelta;
nAngDelta2 >>= 6;
// edx = ebx;
if (nAngDelta2 < 0)
nAngDelta2 = -nAngDelta2;
nAngDelta2 = klabs(nAngDelta >> 6);
ebx /= nAngDelta2;
if (ebx < 5)
if (ebx < 5) {
ebx = 5;
}
}
int nAngDeltaC = nAngDelta;
if (nAngDeltaC < 0)
nAngDeltaC = -nAngDeltaC;
int nAngDeltaC = klabs(nAngDelta);
if (nAngDeltaC > push1)
{
@ -1200,32 +1182,23 @@ int AngleChase(int nSprite, int nSprite2, int ebx, int ecx, int push1)
nAngDelta = -push1;
}
int nAngDeltaD = AngleDelta(sprite[nSprite].zvel, var_18, 24);
nAngle = (nAngDelta + sprite[nSprite].ang) & kAngleMask;
// TODO - CHECKME int ebx = 24;
int nAngDeltaD = AngleDelta(sprite[nSprite].zvel, var_18, 24);
sprite[nSprite].zvel = (sprite[nSprite].zvel + nAngDeltaD) & kAngleMask;
}
sprite[nSprite].ang = nAngle;
int eax = Sin(sprite[nSprite].zvel + 512);
int edx = (nAngle + 512) & kAngleMask;
if (eax < 0)
eax = -eax;
// rename this var. CHECKME
int x = ((sintable[edx] * ebx) >> 14) * eax;
int ceildist = x >> 8;
int eax = klabs(Cos(sprite[nSprite].zvel));
int x = ((Cos(nAngle) * ebx) >> 14)* eax;
int y = ((Sin(nAngle) * ebx) >> 14) * eax;
int nVal = y >> 8;
int xshift = x >> 8;
int yshift = y >> 8;
int z = Sin(sprite[nSprite].zvel) * ksqrt((nVal * nVal) + (ceildist * ceildist));
int z = Sin(sprite[nSprite].zvel) * ksqrt((yshift * yshift) + (xshift * xshift));
return movesprite(nSprite, x >> 2, y >> 2, (z >> 13) + (Sin(ecx) >> 5), 0, 0, nClipType);
}
@ -1253,7 +1226,7 @@ void WheresMyMouth(int nPlayer, int *x, int *y, int *z, short *sectnum)
*sectnum = sprite[nSprite].sectnum;
clipmove_old((int32_t*)x, (int32_t*)y, (int32_t*)z, sectnum,
Sin(sprite[nSprite].ang + 512) << 7,
Cos(sprite[nSprite].ang) << 7,
Sin(sprite[nSprite].ang) << 7,
5120, 1280, 1280, CLIPMASK1);
}
@ -1323,8 +1296,7 @@ int GrabBody()
if (nCurBodyNum >= 50) {
nCurBodyNum = 0;
}
}
while (sprite[nSprite].cstat & 0x101);
} while (sprite[nSprite].cstat & 0x101);
if (nBodyTotal < 50) {
nBodyTotal++;
@ -1445,9 +1417,9 @@ void FuncCreatureChunk(int a, int, int nRun)
// re-grab this variable as it may have changed in movesprite(). Note the check above is against the value *before* movesprite so don't change it.
nSector = sprite[nSprite].sectnum;
sprite[nSprite].zvel = 0;
sprite[nSprite].yvel = 0;
sprite[nSprite].xvel = 0;
sprite[nSprite].yvel = 0;
sprite[nSprite].zvel = 0;
sprite[nSprite].z = sector[nSector].floorz;
}
else
@ -1487,7 +1459,7 @@ void FuncCreatureChunk(int a, int, int nRun)
int nSqrt = lsqrt(((sprite[nSprite].yvel >> 10) * (sprite[nSprite].yvel >> 10)
+ (sprite[nSprite].xvel >> 10) * (sprite[nSprite].xvel >> 10)) >> 8);
sprite[nSprite].xvel = Sin(nAngle + 512) * (nSqrt >> 1);
sprite[nSprite].xvel = Cos(nAngle) * (nSqrt >> 1);
sprite[nSprite].yvel = Sin(nAngle) * (nSqrt >> 1);
return;
}

View file

@ -55,7 +55,7 @@ void CreatePushBlock(int nSector);
void FuncCreatureChunk(int a, int, int nRun);
int FindPlayer(int nSprite, int nVal);
int FindPlayer(int nSprite, int nDistance);
int BuildCreatureChunk(int nVal, int nPic);
@ -64,7 +64,7 @@ int BelowNear(short nSprite);
int PlotCourseToSprite(int nSprite1, int nSprite2);
void CheckSectorFloor(short nSector, int z, int *a, int *b);
void CheckSectorFloor(short nSector, int z, int *x, int *y);
int GetAngleToSprite(int nSprite1, int nSprite2);

View file

@ -161,7 +161,6 @@ int ReadFrame(FileReader &fp)
}
tileInvalidate(kMovieTile, -1, -1);
break;
}
case kFrameDone:
@ -173,7 +172,7 @@ int ReadFrame(FileReader &fp)
}
}
void ServeSample(const char** ptr, uint32_t* length)
static void ServeSample(const char** ptr, uint32_t* length)
{
//mutex_lock(&mutex);

View file

@ -16,6 +16,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//-------------------------------------------------------------------------
#include "ns.h"
#include "aistuff.h"
#include "mummy.h"
#include "sequence.h"
#include "move.h"
@ -64,13 +65,12 @@ static SavegameHelper sgh("mummy",
SA(MummyList),
nullptr);
// done
void InitMummy()
{
nMummies = 0;
}
// done
int BuildMummy(int nSprite, int x, int y, int z, int nSector, int nAngle)
{
if (nMummies >= kMaxMummies) {
@ -134,7 +134,6 @@ int BuildMummy(int nSprite, int x, int y, int z, int nSector, int nAngle)
return (nMummy | 0xE0000);
}
// done
void CheckMummyRevive(short nMummy)
{
short nSprite = MummyList[nMummy].nSprite;
@ -179,7 +178,7 @@ void FuncMummy(int a, int nDamage, int nRun)
short nSprite = MummyList[nMummy].nSprite;
short nAction = MummyList[nMummy].nAction;
int nMessage = a & 0x7F0000;
int nMessage = a & kMessageMask;
switch (nMessage)
{
@ -196,14 +195,14 @@ void FuncMummy(int a, int nDamage, int nRun)
seq_MoveSequence(nSprite, nSeq, MummyList[nMummy].B);
short ecx = 0;
bool bVal = 0;
MummyList[nMummy].B++;
if (MummyList[nMummy].B >= SeqSize[nSeq])
{
MummyList[nMummy].B = 0;
ecx = 1;
bVal = true;
}
if (nTarget != -1 && nAction < 4)
@ -378,7 +377,7 @@ void FuncMummy(int a, int nDamage, int nRun)
case 3:
{
if (ecx)
if (bVal)
{
MummyList[nMummy].B = 0;
MummyList[nMummy].nAction = 0;
@ -391,7 +390,7 @@ void FuncMummy(int a, int nDamage, int nRun)
SetQuake(nSprite, 100);
// low 16 bits of returned var contains the sprite index, the high 16 the bullet number
int nBullet = BuildBullet(nSprite, 9, 0, 0, 0x0FFFFC400, sprite[nSprite].ang, nTarget + 10000, 1);
int nBullet = BuildBullet(nSprite, 9, 0, 0, -15360, sprite[nSprite].ang, nTarget + 10000, 1);
CheckMummyRevive(nMummy);
if (nBullet > -1)
@ -410,7 +409,7 @@ void FuncMummy(int a, int nDamage, int nRun)
case 4:
{
if (ecx)
if (bVal)
{
MummyList[nMummy].B = 0;
MummyList[nMummy].nAction = 5;
@ -426,7 +425,7 @@ void FuncMummy(int a, int nDamage, int nRun)
case 6:
{
if (ecx)
if (bVal)
{
MummyList[nMummy].nAction = 0;
sprite[nSprite].cstat = 0x101;
@ -445,7 +444,7 @@ void FuncMummy(int a, int nDamage, int nRun)
sprite[nSprite].yvel >>= 1;
}
if (ecx)
if (bVal)
{
sprite[nSprite].xvel = 0;
sprite[nSprite].yvel = 0;

View file

@ -3625,22 +3625,22 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#define kTile3603 3603
#define kEnergy1 3604
#define kEnergy2 3605
#define kTile3606 3606
#define kTile3607 3607
#define kTile3608 3608
#define kTile3609 3609
#define kTile3610 3610
#define kTile3611 3611
#define kTile3612 3612
#define kTile3613 3613
#define kTile3614 3614
#define kTile3615 3615
#define kTile3616 3616
#define kTile3617 3617
#define kTile3618 3618
#define kTile3619 3619
#define kTile3620 3620
#define kTile3621 3621
#define kClockSymbol1 3606
#define kClockSymbol2 3607
#define kClockSymbol3 3608
#define kClockSymbol4 3609
#define kClockSymbol5 3610
#define kClockSymbol6 3611
#define kClockSymbol7 3612
#define kClockSymbol8 3613
#define kClockSymbol9 3614
#define kClockSymbol10 3615
#define kClockSymbol11 3616
#define kClockSymbol12 3617
#define kClockSymbol13 3618
#define kClockSymbol14 3619
#define kClockSymbol15 3620
#define kClockSymbol16 3621
#define kTile3622 3622
#define kTileLoboLaptop 3623
#define kTile3624 3624

View file

@ -150,10 +150,10 @@ struct slideData
int field_4;
int field_8;
int field_C;
int field_10;
int field_14;
int field_18;
int field_1C;
int x1;
int y1;
int x2;
int y2;
int field_20;
int field_24;
int field_28;
@ -888,12 +888,8 @@ int IdentifySector(int nVal)
return -1;
}
int BuildSlide(int nChannel, int edx, int ebx, int ecx, int arg1, int arg2, int arg3)
int BuildSlide(int nChannel, int nStartWall, int ebx, int ecx, int nWall2, int nWall3, int nWall4)
{
int var_1C = edx;
int ebp = ebx;
int nVal = ecx;
if (SlideCount <= 0) {
I_Error("Too many slides!\n");
return -1;
@ -903,7 +899,7 @@ int BuildSlide(int nChannel, int edx, int ebx, int ecx, int arg1, int arg2, int
int nSlide = SlideCount;
short nSector = IdentifySector(var_1C);
short nSector = IdentifySector(nStartWall);
SlideData2[nSlide].field_4 = -1;
SlideData2[nSlide].nChannel = nChannel;
@ -948,33 +944,35 @@ int BuildSlide(int nChannel, int edx, int ebx, int ecx, int arg1, int arg2, int
}
}
SlideData[nSlide].field_0 = var_1C;
SlideData[nSlide].field_8 = arg1;
SlideData[nSlide].field_C = arg2;
SlideData[nSlide].field_10 = wall[var_1C].x;
SlideData[nSlide].field_14 = wall[var_1C].y;
SlideData[nSlide].field_0 = nStartWall;
SlideData[nSlide].field_4 = ebx;
SlideData[nSlide].field_8 = nWall2;
SlideData[nSlide].field_C = nWall3;
SlideData[nSlide].field_1C = wall[arg1].y;
SlideData[nSlide].field_18 = wall[arg1].x;
SlideData[nSlide].x1 = wall[nStartWall].x;
SlideData[nSlide].y1 = wall[nStartWall].y;
SlideData[nSlide].field_24 = wall[ebp].y;
SlideData[nSlide].field_20 = wall[ebp].x;
SlideData[nSlide].x2 = wall[nWall2].x;
SlideData[nSlide].y2 = wall[nWall2].y;
SlideData[nSlide].field_2C = wall[arg2].y;
SlideData[nSlide].field_28 = wall[arg2].x;
SlideData[nSlide].field_20 = wall[ebx].x;
SlideData[nSlide].field_24 = wall[ebx].y;
SlideData[nSlide].field_34 = wall[nVal].y;
SlideData[nSlide].field_4 = ebp;
SlideData[nSlide].field_30 = wall[nVal].x;
SlideData[nSlide].field_38 = wall[arg3].x;
SlideData[nSlide].field_3C = wall[arg3].y;
SlideData[nSlide].field_28 = wall[nWall3].x;
SlideData[nSlide].field_2C = wall[nWall3].y;
SlideData[nSlide].field_30 = wall[ecx].x;
SlideData[nSlide].field_34 = wall[ecx].y;
SlideData[nSlide].field_38 = wall[nWall4].x;
SlideData[nSlide].field_3C = wall[nWall4].y;
int nSprite = insertsprite(nSector, 899);
SlideData2[nSlide].field_6 = nSprite;
sprite[nSprite].cstat = 0x8000;
sprite[nSprite].x = wall[var_1C].x;
sprite[nSprite].y = wall[var_1C].y;
sprite[nSprite].x = wall[nStartWall].x;
sprite[nSprite].y = wall[nStartWall].y;
sprite[nSprite].z = sector[nSector].floorz;
SlideData2[nSlide].field_8 = 0;
@ -1088,11 +1086,11 @@ void FuncSlide(int a, int UNUSED(b), int nRun)
int x = wall[nWall].x;
int y = wall[nWall].y;
int nSeekA = LongSeek(&x, SlideData[nSlide].field_10, 20, 20);
int nSeekA = LongSeek(&x, SlideData[nSlide].x1, 20, 20);
int edi = nSeekA;
int var_1C = nSeekA;
int nSeekB = LongSeek(&y, SlideData[nSlide].field_14, 20, 20);
int nSeekB = LongSeek(&y, SlideData[nSlide].y1, 20, 20);
int ecx = nSeekB;
int var_28 = nSeekB;
@ -1114,11 +1112,11 @@ void FuncSlide(int a, int UNUSED(b), int nRun)
x = wall[nWall].x;
y = wall[nWall].y;
int nSeekC = LongSeek(&x, SlideData[nSlide].field_18, 20, 20);
int nSeekC = LongSeek(&x, SlideData[nSlide].x2, 20, 20);
edi = nSeekC;
var_1C = nSeekC;
int nSeekD = LongSeek(&y, SlideData[nSlide].field_1C, 20, 20);
int nSeekD = LongSeek(&y, SlideData[nSlide].y2, 20, 20);
ecx = nSeekD;
var_28 = nSeekD;
@ -1391,17 +1389,17 @@ int BuildSpark(int nSprite, int nVal)
if (nVal)
{
sprite[var_14].xvel = Sin(nAngle + 512) >> 5;
sprite[var_14].xvel = Cos(nAngle) >> 5;
sprite[var_14].yvel = Sin(nAngle) >> 5;
}
else
{
sprite[var_14].xvel = Sin(nAngle + 512) >> 6;
sprite[var_14].xvel = Cos(nAngle) >> 6;
sprite[var_14].yvel = Sin(nAngle) >> 6;
}
sprite[var_14].zvel = -(RandomSize(4) << 7);
sprite[var_14].picnum = nVal + 985;
sprite[var_14].picnum = kTile985 + nVal;
}
sprite[var_14].z = sprite[nSprite].z;
@ -1436,6 +1434,7 @@ void FuncSpark(int a, int UNUSED(b), int nRun)
{
sprite[nSprite].yrepeat -= 2;
// calling BuildSpark() with 2nd parameter as '1' will set kTile986
if (sprite[nSprite].picnum == kTile986 && (sprite[nSprite].xrepeat & 2))
{
BuildSpark(nSprite, 2);
@ -1539,7 +1538,7 @@ void DoFinale()
StopLocalSound();
PlayLocalSound(StaticSound[kSound76], 0);
dword_1542FC = (int)totalclock + 120;
++nFinaleStage;
nFinaleStage++;
}
}
else if (nFinaleStage <= 2)
@ -1578,7 +1577,7 @@ int BuildEnergyBlock(short nSector)
x += wall[startwall + i].x;
y += wall[startwall + i].y;
wall[startwall + i].picnum = kTile3621;
wall[startwall + i].picnum = kClockSymbol16;
wall[startwall + i].pal = 0;
wall[startwall + i].shade = 50;
}
@ -1698,8 +1697,7 @@ void ExplodeEnergyBlock(int nSprite)
for (i = 0; i < 20; i++)
{
sprite[nSprite].ang = RandomSize(11);
BuildSpark(nSprite, 1);
BuildSpark(nSprite, 1); // shoot out blue orbs
}
TintPalette(64, 64, 64);
@ -1707,7 +1705,6 @@ void ExplodeEnergyBlock(int nSprite)
if (nEnergyTowers == 1)
{
runlist_ChangeChannel(nEnergyChan, nEnergyTowers);
StatusMessage(1000, "TAKE OUT THE CONTROL CENTER!");
}
else if (nEnergyTowers != 0)
@ -1810,13 +1807,12 @@ void FuncEnergyBlock(int a, int nDamage, int nRun)
sprite[nSprite2].y = lasthity;
sprite[nSprite2].z = lasthitz;
BuildSpark(nSprite2, 0);
BuildSpark(nSprite2, 0); // shoot out blue orb when damaged
mydeletesprite(nSprite2);
}
else
{
sprite[nSprite].xrepeat = 0;
sprite[nSprite].xrepeat = 0; // using xrepeat to store health
ExplodeEnergyBlock(nSprite);
}
@ -1893,12 +1889,13 @@ int BuildObject(short nSprite, int nOjectType, int nHitag)
return nObject | 0x170000;
}
// in-game destructable wall mounted screen
void ExplodeScreen(short nSprite)
{
sprite[nSprite].z -= GetSpriteHeight(nSprite) / 2;
for (int i = 0; i < 30; i++) {
BuildSpark(nSprite, 0);
BuildSpark(nSprite, 0); // shoot out blue orbs
}
sprite[nSprite].cstat = 0x8000;

View file

@ -1688,7 +1688,7 @@ do_default_b:
{
if (AddAmmo(nPlayer, 1, sprite[nValB].hitag))
{
var_88 = StaticSound[kSound69];
var_88 = StaticSound[kSoundAmmoPickup];
goto do_default;
}
@ -1698,7 +1698,7 @@ do_default_b:
{
if (AddAmmo(nPlayer, 3, sprite[nValB].hitag))
{
var_88 = StaticSound[kSound69];
var_88 = StaticSound[kSoundAmmoPickup];
goto do_default;
}
break;
@ -1707,7 +1707,7 @@ do_default_b:
{
if (AddAmmo(nPlayer, 2, sprite[nValB].hitag))
{
var_88 = StaticSound[kSound69];
var_88 = StaticSound[kSoundAmmoPickup];
CheckClip(nPlayer);
goto do_default;
}
@ -1719,7 +1719,7 @@ do_default_b:
{
if (AddAmmo(nPlayer, 4, 1))
{
var_88 = StaticSound[kSound69];
var_88 = StaticSound[kSoundAmmoPickup];
if (!(nPlayerWeapons[nPlayer] & 0x10))
{
nPlayerWeapons[nPlayer] |= 0x10;
@ -2474,7 +2474,7 @@ do_default_b:
case 31: // Cobra staff ammo
{
if (AddAmmo(nPlayer, 5, 1)) {
var_88 = StaticSound[kSound69];
var_88 = StaticSound[kSoundAmmoPickup];
goto do_default;
}
@ -2484,7 +2484,7 @@ do_default_b:
case 32: // Raw Energy
{
if (AddAmmo(nPlayer, 6, sprite[nValB].hitag)) {
var_88 = StaticSound[kSound69];
var_88 = StaticSound[kSoundAmmoPickup];
goto do_default;
}
@ -2604,7 +2604,7 @@ do_default_b:
break;
}
var_88 = StaticSound[kSound67];
var_88 = StaticSound[kSoundMana1];
PlayerList[nPlayer].nMagic += 100;
if (PlayerList[nPlayer].nMagic >= 1000) {

File diff suppressed because it is too large Load diff

View file

@ -68,11 +68,11 @@ int runlist_HeadRun();
void runlist_InitChan();
void runlist_ChangeChannel(int eax, short dx);
void runlist_ReadyChannel(short eax);
void runlist_ProcessSectorTag(int nSector, int lotag, int hitag);
void runlist_ProcessSectorTag(int nSector, int nLotag, int nHitag);
int runlist_AllocChannel(int a);
void runlist_DoSubRunRec(int RunPtr);
void runlist_SubRunRec(int RunPtr);
void runlist_ProcessWallTag(int nWall, short lotag, short hitag);
void runlist_ProcessWallTag(int nWall, short nLotag, short nHitag);
int runlist_CheckRadialDamage(short nSprite);
void runlist_RadialDamageEnemy(short nSprite, short nDamage, short nRadius);
void runlist_DamageEnemy(int nSprite, int nSprite2, short nDamage);

View file

@ -113,7 +113,7 @@ void ExplodeSnakeSprite(int nSprite, short nPlayer)
short nOwner = sprite[nSprite].owner;
sprite[nSprite].owner = PlayerList[nPlayer].nSprite;
runlist_RadialDamageEnemy(nSprite, nDamage, BulletInfo[kWeaponStaff].field_10);
runlist_RadialDamageEnemy(nSprite, nDamage, BulletInfo[kWeaponStaff].nRadius);
sprite[nSprite].owner = nOwner;

View file

@ -42,7 +42,7 @@ enum {
kSound7,
kSound8,
kSound9,
kSound10,
kSoundItemSpecial,
kSound11,
kSoundTorchOn,
kSound13,
@ -60,7 +60,7 @@ enum {
kSound25,
kSound26,
kSound27,
kSound28,
kSoundJonLaugh2,
kSound29,
kSound30,
kSound31,
@ -87,9 +87,9 @@ enum {
kSound64,
kSound65,
kSound66,
kSound67,
kSound68,
kSound69,
kSoundMana1,
kSoundMana2,
kSoundAmmoPickup,
kSound70,
kSound71,
kSound72,
@ -135,8 +135,8 @@ void BendAmbientSound();
void CheckAmbience(short nSector);
short PlayFX2(unsigned short nSound, short nSprite);
short PlayFXAtXYZ(unsigned short ax, int x, int y, int z, int nSector);
short D3PlayFX(unsigned short nSound, short nVal);
short PlayFXAtXYZ(unsigned short nSound, int x, int y, int z, int nSector);
short D3PlayFX(unsigned short nSound, short nSprite);
void StopSpriteSound(short nSprite);
void StartSwirlies();

View file

@ -401,7 +401,7 @@ void FuncSwNotOnPause(int a, int, int nRun)
}
}
int BuildSwPressSector(int nChannel, int nLink, int nSector, int ecx)
int BuildSwPressSector(int nChannel, int nLink, int nSector, int keyMask)
{
if (SwitchCount <= 0 || nLink < 0 || nSector < 0)
I_Error("Too many switches!\n");
@ -411,7 +411,7 @@ int BuildSwPressSector(int nChannel, int nLink, int nSector, int ecx)
SwitchData[nSwitch].nChannel = nChannel;
SwitchData[nSwitch].nLink = nLink;
SwitchData[nSwitch].nSector = nSector;
SwitchData[nSwitch].field_12 = ecx;
SwitchData[nSwitch].field_12 = keyMask;
SwitchData[nSwitch].field_C = -1;
return nSwitch | 0x50000;

View file

@ -39,7 +39,6 @@ int GetMyAngle(int x, int y)
if (ebx >= 0)
{
// left path
edx = ebx << 11;
if (y >= 0)