BREAK_INFOp SetupSpriteForBreak ( SPRITEp sp ) { short picnum = sp->picnum; BREAK_INFOp break_info; // ignore as a breakable if true if ( sp->lotag == TAG_SPRITE_HIT_MATCH ) { return ( NULL ); } break_info = FindSpriteBreakInfo ( picnum ); if ( break_info ) { // use certain sprites own blocking for determination if ( TEST ( break_info->flags, BF_OVERRIDE_BLOCK ) ) { // if not blocking then skip this code if ( !TEST ( sp->cstat, CSTAT_SPRITE_BLOCK ) ) { return ( BREAK_INFOp ) ( -1 ); } } if ( TEST ( break_info->flags, BF_BURN ) ) { SET ( sp->extra, SPRX_BURNABLE ); } else { SET ( sp->extra, SPRX_BREAKABLE ); } sp->clipdist = SPRITEp_SIZE_X ( sp ); SET ( sp->cstat, CSTAT_SPRITE_BREAKABLE ); // set for cacheing if ( break_info->breaknum >= 0 ) { SET_GOTPIC ( break_info->breaknum ); } } return ( break_info ); }
int AutoBreakSprite(short BreakSprite, short type) { SPRITEp bp = &sprite[BreakSprite]; BREAK_INFOp break_info; extern void DoWallBreakMatch( short match ); int SpawnBreakFlames(SHORT SpriteNum); break_info = FindSpriteBreakInfo(bp->picnum); if(bp->hitag < 0) DoWallBreakMatch(bp->hitag); if (!break_info) { //DSPRINTF(ds,"Break Info not found - sprite %d", bp - sprite); MONO_PRINT(ds); return(FALSE); } // Check to see if it should break with current weapon type if(!CheckBreakToughness(break_info, type)) { if (break_info->breaknum != -1) { if (!TEST(break_info->flags, BF_LEAVE_BREAK)) { RESET(bp->extra, SPRX_BREAKABLE); RESET(bp->cstat, CSTAT_SPRITE_BREAKABLE); } bp->picnum = break_info->breaknum; // pass Break Info Globally GlobBreakInfo = break_info; SpawnShrap(BreakSprite, -1); GlobBreakInfo = NULL; if(bp->picnum == 3683) RESET(bp->cstat, CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN); } return(FALSE); } RESET(bp->extra, SPRX_BREAKABLE); RESET(bp->cstat, CSTAT_SPRITE_BREAKABLE); // pass Break Info Globally GlobBreakInfo = break_info; SpawnShrap(BreakSprite, -1); GlobBreakInfo = NULL; // kill it or change the pic if (TEST(break_info->flags, BF_KILL) || break_info->breaknum == -1) { if (TEST(break_info->flags, BF_FIRE_FALL)) SpawnBreakFlames(BreakSprite); RESET(bp->cstat, CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN); SET(bp->cstat, CSTAT_SPRITE_INVISIBLE); // Kill sound if one is attached DeleteNoSoundOwner(BreakSprite); KillBreakSprite(BreakSprite); //change_sprite_stat(BreakSprite, STAT_SUICIDE); //KillSprite(BreakSprite); return(TRUE); } else { bp->picnum = break_info->breaknum; if(bp->picnum == 3683) RESET(bp->cstat, CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN); } return(FALSE); }