Skip to content

Commit

Permalink
slab placement refactoring and torch walls
Browse files Browse the repository at this point in the history
  • Loading branch information
rainlizard committed Nov 29, 2023
1 parent d68e60b commit 7e76700
Show file tree
Hide file tree
Showing 10 changed files with 223 additions and 237 deletions.
2 changes: 1 addition & 1 deletion Autoload/Slabset.gd
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ func create_object_list(tng_buffer):

return object_info

func fetch_column_index(variation, subtile):
func fetch_columnset_index(variation, subtile):
if variation < dat.size():
return dat[variation][subtile]
else:
Expand Down
8 changes: 4 additions & 4 deletions Scenes/GamePaths.gd
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ var DK_DATA_DIRECTORY = ""
var DK_FXDATA_DIRECTORY = ""
var DK_LEVELS_DIRECTORY = ""
var DK_CAMPGNS_DIRECTORY = ""
var KEEPERFX_VERSION_INT = 0 # This is set in set_paths() when EXECUTABLE_PATH is set.
#var KEEPERFX_VERSION_INT = 0 # This is set in set_paths() when EXECUTABLE_PATH is set.
var KEEPERFX_VERSION_STRING = "0"
const KEEPERFX_VERSION_REQUIRED_INT = 0503372
#const KEEPERFX_VERSION_REQUIRED_INT = 0503372 #0.5.0.3372
#var nosound = true
#var cheats = true
#var gameSpeed = 25
Expand Down Expand Up @@ -192,10 +192,10 @@ func set_keeperfx_version():
var _exit_code = OS.execute(getVer, [EXECUTABLE_PATH], true, output)
if output.size() == 1:
KEEPERFX_VERSION_STRING = output[0].strip_edges()
KEEPERFX_VERSION_INT = int(KEEPERFX_VERSION_STRING.replace(".",""))
#KEEPERFX_VERSION_INT = int(KEEPERFX_VERSION_STRING.replace(".",""))
else:
KEEPERFX_VERSION_STRING = "Undetected"
KEEPERFX_VERSION_INT = 0
#KEEPERFX_VERSION_INT = 0

#func load_command_line_from_settings(COMMAND_LINE):
# COMMAND_LINE = COMMAND_LINE.replace("%DIR%", GAME_DIRECTORY)
Expand Down
8 changes: 4 additions & 4 deletions Scenes/GenerateBorderWindow.gd
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ func _on_NewMapWindow_visibility_changed():
if visible == false: return


var kfxOutOfDate = false
if oGame.KEEPERFX_VERSION_INT != 0 and oGame.KEEPERFX_VERSION_INT < oGame.KEEPERFX_VERSION_REQUIRED_INT:
kfxOutOfDate = true
# var kfxOutOfDate = false
# if oGame.KEEPERFX_VERSION_INT != 0 and oGame.KEEPERFX_VERSION_INT < oGame.KEEPERFX_VERSION_REQUIRED_INT:
# kfxOutOfDate = true

# Default to KFX format

if oGame.running_keeperfx() == false or kfxOutOfDate == true:
if oGame.running_keeperfx() == false:# or kfxOutOfDate == true:
oSetNewFormat.selected = 0 # Set default format to Classic format, for newbies who don't know what KeeperFX is
_on_NewMapFormat_item_selected(0)
else:
Expand Down
11 changes: 6 additions & 5 deletions Scenes/OpenMap.gd
Original file line number Diff line number Diff line change
Expand Up @@ -233,11 +233,12 @@ func finish_opening_map(map):

oDataClm.store_default_data()

if oGame.running_keeperfx() == true:
if oCurrentFormat.selected == 1: # KFX format
if oGame.KEEPERFX_VERSION_INT != 500: # Skip worrying about the compiled versions (0.5.0.0)
if oGame.KEEPERFX_VERSION_INT != 0 and oGame.KEEPERFX_VERSION_INT < oGame.KEEPERFX_VERSION_REQUIRED_INT:
oMessage.big("Warning", "Your KeeperFX version is " + oGame.KEEPERFX_VERSION_STRING + " which is too old to use the features of KFX Map Format in-game. Download the latest alpha to rectify.")
# if oGame.running_keeperfx() == true:
# if oCurrentFormat.selected == 1: # KFX format
# if oGame.KEEPERFX_VERSION_INT != 500: # Skip worrying about the compiled versions (0.5.0.0)
# if oGame.KEEPERFX_VERSION_INT != 0 and oGame.KEEPERFX_VERSION_INT < oGame.KEEPERFX_VERSION_REQUIRED_INT:
#
# oMessage.big("Warning", "Your KeeperFX version is " + oGame.KEEPERFX_VERSION_STRING + " which is too old to use the features of KFX Map Format in-game. Download the latest alpha to rectify.")

print('TOTAL time to open map: '+str(OS.get_ticks_msec()-TOTAL_TIME_TO_OPEN_MAP)+'ms')

Expand Down
6 changes: 3 additions & 3 deletions Scenes/PickSlabWindow.gd
Original file line number Diff line number Diff line change
Expand Up @@ -95,17 +95,17 @@ func add_slabs():
Slabs.PORTAL:
slabVariation = (Slabs.PORTAL*28) + 8
for i in 9:
columnArray[i] = Slabset.fetch_column_index(slabVariation, i)
columnArray[i] = Slabset.fetch_columnset_index(slabVariation, i)
Slabs.WALL_AUTOMATIC:
slabVariation = Slabs.WALL_WITH_BANNER*28
for i in 9:
columnArray[i] = Slabset.fetch_column_index(slabVariation, i)
columnArray[i] = Slabset.fetch_columnset_index(slabVariation, i)
_:
if slabID < 1000:
# Normal slab
slabVariation = slabID*28
for i in 9:
columnArray[i] = Slabset.fetch_column_index(slabVariation, i)
columnArray[i] = Slabset.fetch_columnset_index(slabVariation, i)
else:
# Fake Slab
pass
Expand Down
14 changes: 0 additions & 14 deletions Scenes/PlaceThingWithSlab.gd
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ func place_slab_objects(xSlab, ySlab, slabID, ownership, clmIndexGroup, bitmask,

if slabID == Slabs.PRISON:
bitmask = prison_bar_bitmask(slabID, surrID)
elif slabID == Slabs.WALL_WITH_TORCH or slabID == Slabs.EARTH_WITH_TORCH:
bitmask = torch_object_bitmask(xSlab, ySlab, surrID)
elif slabID == Slabs.WATER:
if Random.rng.randf_range(0.0, 100.0) < oWaterEffectPercent.value:
var xSubtile = (xSlab*3) + Random.randi_range(0,2) + 0.5
Expand Down Expand Up @@ -89,15 +87,3 @@ func prison_bar_bitmask(slabID, surrID):
if Slabs.data[ surrID[dir.n] ][Slabs.IS_SOLID] == false and slabID != surrID[dir.n]: bitmask += 4
if Slabs.data[ surrID[dir.e] ][Slabs.IS_SOLID] == false and slabID != surrID[dir.e]: bitmask += 8
return bitmask

func torch_object_bitmask(xSlab, ySlab, surrID):
var torchSide = oSlabPlacement.pick_torch_side(xSlab, ySlab, surrID)

if Slabs.data[ surrID[torchSide] ][Slabs.IS_SOLID] == true:
torchSide = -1

if torchSide == 0: return 01 # south torch
elif torchSide == 1: return 02 # west torch
elif torchSide == 2: return 04 # north torch
elif torchSide == 3: return 08 # east torch
elif torchSide == -1: return 0 # no torch
Loading

0 comments on commit 7e76700

Please sign in to comment.