Skip to content

Commit

Permalink
Allow tileGetSurfType() to return ceiling type if supplied nType bitflag
Browse files Browse the repository at this point in the history
  • Loading branch information
tmyqlfpir authored and nukeykt committed Sep 24, 2023
1 parent 4969f87 commit 5837c79
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion source/blood/src/actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3922,7 +3922,7 @@ void actTouchFloor(spritetype *pSprite, int nSector)
nDamage = 1000;
actDamageSprite(pSprite->index, pSprite, nDamageType, scale(4, nDamage, 120) << 4);
}
if (tileGetSurfType(nSector + 0x4000) == kSurfLava)
if (tileGetSurfType(nSector, 0x4000) == kSurfLava)
{
actDamageSprite(pSprite->index, pSprite, kDamageBurn, 16);
sfxPlay3DSound(pSprite, 352, 5, 2);
Expand Down
2 changes: 1 addition & 1 deletion source/blood/src/nnexts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1609,7 +1609,7 @@ int getSpriteMassBySize(spritetype* pSprite) {
short xrepeat = pSprite->xrepeat; short yrepeat = pSprite->yrepeat;

// take surface type into account
switch (tileGetSurfType(pSprite->index + 0xc000)) {
switch (tileGetSurfType(pSprite->index, 0xc000)) {
case 1: massDiv = 16; break; // stone
case 2: massDiv = 18; break; // metal
case 3: massDiv = 21; break; // wood
Expand Down
2 changes: 1 addition & 1 deletion source/blood/src/seq.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ void SEQINST::Update(ACTIVE *pActive)
if (!VanillaMode() && pSequence->frames[frameIndex].surfaceSound && zvel[pSprite->index] == 0 && xvel[pSprite->index] != 0) {

if (gUpperLink[pSprite->sectnum] >= 0) break; // don't play surface sound for stacked sectors
int surf = tileGetSurfType(pSprite->sectnum + 0x4000); if (!surf) break;
int surf = tileGetSurfType(pSprite->sectnum, 0x4000); if (!surf) break;
static int surfSfxMove[15][4] = {
/* {snd1, snd2, gameVolume, myVolume} */
{800,801,80,25},
Expand Down
7 changes: 5 additions & 2 deletions source/blood/src/tile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,10 +268,13 @@ void tilePrecacheTile(int nTile, int nType)
}
}

char tileGetSurfType(int hit)
char tileGetSurfType(int hit, int nType)
{
int n = hit & 0x3fff;
switch (hit&0xc000)
if (nType == 0) // no type supplied, get type from hit index
nType = hit & 0xc000;

switch (nType)
{
case 0x4000:
return surfType[sector[n].floorpicnum];
Expand Down
2 changes: 1 addition & 1 deletion source/blood/src/tile.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,4 @@ char * tileLoadTile(int nTile);
char * tileAllocTile(int nTile, int x, int y, int ox, int oy);
void tilePreloadTile(int nTile);
void tilePrecacheTile(int nTile, int nType = 1);
char tileGetSurfType(int hit);
char tileGetSurfType(int hit, int nType = 0);

0 comments on commit 5837c79

Please sign in to comment.