Skip to content

Commit

Permalink
Introduced BREAK_NEUTRAL_WALLS classic bug (#54)
Browse files Browse the repository at this point in the history
Added BREAK_NEUTRAL_WALLS to classic bug mode, when enabled in the
rules.cfg allows imps in first person to dig through neutral walls.

Enabled it for the ancient keeper campaigns.
  • Loading branch information
Loobinex committed May 6, 2019
1 parent 7e5766e commit 848d849
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 15 deletions.
2 changes: 1 addition & 1 deletion campgns/ancntkpr_cfgs/rules.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ DungeonHeartHealth = 30000
DungeonHeartHealTime = 8
DungeonHeartHealHealth = 1
HeroDoorWaitTime = 200
PreserveClassicBugs = RESURRECT_FOREVER OVERFLOW_8BIT CLAIM_ROOM_ALL_THINGS RESURRECT_REMOVED NO_HAND_PURGE_ON_DEFEAT MUST_OBEY_KEEPS_NOT_DO_JOBS PASSIVE_NEUTRALS
PreserveClassicBugs = RESURRECT_FOREVER OVERFLOW_8BIT CLAIM_ROOM_ALL_THINGS RESURRECT_REMOVED NO_HAND_PURGE_ON_DEFEAT MUST_OBEY_KEEPS_NOT_DO_JOBS PASSIVE_NEUTRALS BREAK_NEUTRAL_WALLS

[computer]
AutoDigLimit = 10
Expand Down
2 changes: 1 addition & 1 deletion config/fxdata/rules.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ DungeonHeartHealth = 30000
DungeonHeartHealTime = 8
DungeonHeartHealHealth = 1
HeroDoorWaitTime = 200
; Possible Classic Bugs: RESURRECT_FOREVER, OVERFLOW_8BIT, CLAIM_ROOM_ALL_THINGS, RESURRECT_REMOVED, NO_HAND_PURGE_ON_DEFEAT, MUST_OBEY_KEEPS_NOT_DO_JOBS, PASSIVE_NEUTRALS
; Possible Classic Bugs: RESURRECT_FOREVER OVERFLOW_8BIT CLAIM_ROOM_ALL_THINGS RESURRECT_REMOVED NO_HAND_PURGE_ON_DEFEAT MUST_OBEY_KEEPS_NOT_DO_JOBS PASSIVE_NEUTRALS BREAK_NEUTRAL_WALLS
PreserveClassicBugs =

[computer]
Expand Down
6 changes: 6 additions & 0 deletions src/config_rules.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ const struct NamedCommand rules_game_classicbugs_commands[] = {
{"NO_HAND_PURGE_ON_DEFEAT", 5},
{"MUST_OBEY_KEEPS_NOT_DO_JOBS", 6},
{"PASSIVE_NEUTRALS", 7},
{"BREAK_NEUTRAL_WALLS", 8},
{NULL, 0},
};

Expand Down Expand Up @@ -619,6 +620,11 @@ TbBool parse_rules_game_blocks(char *buf, long len, const char *config_textname,
gameadd.classic_bugs_flags |= ClscBug_PassiveNeutrals;
n++;
break;

case 8: // BREAK_NEUTRAL_WALLS
gameadd.classic_bugs_flags |= ClscBug_BreakNeutralWalls;
n++;
break;
default:
CONFWRNLOG("Incorrect value of \"%s\" parameter \"%s\" in [%s] block of %s file.",
COMMAND_TEXT(cmd_num),word_buf,block_buf,config_textname);
Expand Down
3 changes: 2 additions & 1 deletion src/game_merge.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ enum ClassicBugFlags {
ClscBug_ResurrectRemoved = 0x0008,
ClscBug_NoHandPurgeOnDefeat = 0x0010,
ClscBug_MustObeyKeepsNotDoJobs = 0x0020,
ClscBug_PassiveNeutrals = 0x0040,
ClscBug_PassiveNeutrals = 0x0040,
ClscBug_BreakNeutralWalls = 0x0080,
};

/******************************************************************************/
Expand Down
34 changes: 22 additions & 12 deletions src/thing_shots.c
Original file line number Diff line number Diff line change
Expand Up @@ -288,18 +288,28 @@ void process_dig_shot_hit_wall(struct Thing *thing, unsigned long blocked_flags)
slb = get_slabmap_for_subtile(stl_x, stl_y);

// You can only dig your own tiles or non-fortified neutral ground (dirt/gold)
// If you're not the tile owner
if (slabmap_owner(slb) != diggertng->owner)
{
struct SlabAttr *slbattr;
slbattr = get_slab_attrs(slb);
// and if it's fortified
if (slbattr->category == SlbAtCtg_FortifiedWall)
{
// digging not allowed
return;
}
}
// If you're not the tile owner, unless the classic bug mode is enabled.
if (!(gameadd.classic_bugs_flags & ClscBug_BreakNeutralWalls))
{
if (slabmap_owner(slb) != diggertng->owner)
{
struct SlabAttr *slbattr;
slbattr = get_slab_attrs(slb);
// and if it's fortified
if (slbattr->category == SlbAtCtg_FortifiedWall)
{
// digging not allowed
return;
}
}
}
else
{
if ((slabmap_owner(slb) != game.neutral_player_num) && (slabmap_owner(slb) != diggertng->owner))
{
return;
}
}

struct Map *mapblk;
mapblk = get_map_block_at(stl_x, stl_y);
Expand Down

0 comments on commit 848d849

Please sign in to comment.