Skip to content

Commit 62f249b

Browse files
committed
-
- Changed the way height is calculated - When you use the 'reload map' button, keep the camera and zoom position
1 parent 5ddf86c commit 62f249b

File tree

9 files changed

+25
-11
lines changed

9 files changed

+25
-11
lines changed

Class/ClmClass.gd

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,18 @@ extends Node
22

33
# Class is used by both DkClm and DataClm
44

5-
func get_real_height(cubeArray):
5+
func get_highest_cube_height(cubeArray):
66
for cubeNumber in 8:
77
if cubeArray[7-cubeNumber] != 0:
88
return 8-cubeNumber
99
return 0
1010

11+
func get_height_from_bottom(cubeArray):
12+
for cubeNumber in 7:
13+
if cubeArray[cubeNumber] == 0:
14+
return cubeNumber
15+
return 8
16+
1117
func calculate_solid_mask(cubeArray):
1218
# For each cube value that isn't 0, add a bitmask value.
1319
# 0 = 1
@@ -93,7 +99,7 @@ func find_cubearray_index(cubeArray, floorID):
9399
func get_top_cube_face(index, slabID):
94100
var get_height = self.height[index]
95101
if slabID == Slabs.PORTAL:
96-
get_height = get_real_height(self.cubes[index])
102+
get_height = get_highest_cube_height(self.cubes[index])
97103
if get_height == 0:
98104
return self.floorTexture[index]
99105
else:

Scenes/3dSelector.gd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ extends Spatial
6464
# clmIndex = oGenerateTerrain.get_clm_index(translation.x,translation.z)
6565
#
6666
# if clmIndex != null:
67-
# newSize = oDataClm.get_real_height(clmIndex)
67+
# newSize = oDataClm.get_height_from_bottom(clmIndex)
6868
# else:
6969
# newSize = 0
7070
#

Scenes/Camera2D.gd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ var middleMousePanning = false
2424
#var mouseIsMoving = false
2525

2626
var mouseInWindow = true
27+
var skip_camera_reset = false
2728

2829
func _ready():
2930
reset_camera(M.xSize, M.ySize)

Scenes/ClmControls.gd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ func _on_cube_value_changed(value, cubeNumber): # signal connected by GDScript
142142
nodeClm.cubes[clmIndex][cubeNumber] = int(value)
143143
nodeVoxelView.update_column_view()
144144

145-
oHeightSpinBox.value = nodeClm.get_real_height(nodeClm.cubes[clmIndex])
145+
oHeightSpinBox.value = nodeClm.get_height_from_bottom(nodeClm.cubes[clmIndex])
146146
oSolidMaskSpinBox.value = nodeClm.calculate_solid_mask(nodeClm.cubes[clmIndex])
147147

148148
_on_cube_mouse_entered(cubeNumber) # Update tooltip

Scenes/ClmControls.tscn

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ unique_name_in_owner = true
336336
margin_left = 132.0
337337
margin_right = 206.0
338338
margin_bottom = 24.0
339-
hint_tooltip = "Height is set to the position of highest cube for this column"
339+
hint_tooltip = "Height is set to the position of highest cube for this column."
340340
size_flags_horizontal = 10
341341
max_value = 99999.0
342342
script = ExtResource( 1 )
@@ -356,7 +356,7 @@ margin_left = 132.0
356356
margin_top = 28.0
357357
margin_right = 206.0
358358
margin_bottom = 52.0
359-
hint_tooltip = "Determines which cubes in this column have collision"
359+
hint_tooltip = "Needs more info."
360360
size_flags_horizontal = 10
361361
max_value = 99999.0
362362
script = ExtResource( 1 )
@@ -376,7 +376,7 @@ margin_left = 132.0
376376
margin_top = 56.0
377377
margin_right = 206.0
378378
margin_bottom = 80.0
379-
hint_tooltip = "Non-permanent columns are recycled when their Utilized drops to zero"
379+
hint_tooltip = "Non-permanent columns are recycled when their Utilized drops to zero."
380380
size_flags_horizontal = 10
381381
max_value = 99999.0
382382
script = ExtResource( 1 )
@@ -418,7 +418,7 @@ margin_left = 132.0
418418
margin_top = 84.0
419419
margin_right = 206.0
420420
margin_bottom = 108.0
421-
hint_tooltip = "Whether the column is attached to the ceiling in first person view"
421+
hint_tooltip = "This should affect how columns are attached to the ceiling, but it may be non-functional. Needs more info."
422422
size_flags_horizontal = 10
423423
max_value = 99999.0
424424
script = ExtResource( 1 )

Scenes/CustomSlabSystem.gd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ func remove_custom_slab(header_id):
136136

137137
func get_top_fake_cube_face(indexIn3x3, slabID):
138138
var cubesArray = Slabs.fake_extra_data[slabID][Slabs.FAKE_CUBE_DATA][indexIn3x3]
139-
var get_height = oDataClm.get_real_height(cubesArray)
139+
var get_height = oDataClm.get_highest_cube_height(cubesArray)
140140
if get_height == 0:
141141
return Slabs.fake_extra_data[slabID][Slabs.FAKE_FLOOR_DATA][indexIn3x3]
142142
else:

Scenes/DataClm.gd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ func index_entry(cubeArray, setFloorID):
5858
solidMask[index] = calculate_solid_mask(cubeArray)
5959
permanent[index] = 1 # Does this affect whether columns get reset?
6060
lintel[index] = 0
61-
height[index] = get_real_height(cubeArray)
61+
height[index] = get_height_from_bottom(cubeArray)
6262
cubes[index] = cubeArray
6363
floorTexture[index] = setFloorID
6464

Scenes/Menu.gd

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ onready var oDataLof = Nodelist.list["oDataLof"]
3838
onready var oExportPreview = Nodelist.list["oExportPreview"]
3939
onready var oResizeCurrentMapSize = Nodelist.list["oResizeCurrentMapSize"]
4040
onready var oGridDataWindow = Nodelist.list["oGridDataWindow"]
41+
onready var oCamera2D = Nodelist.list["oCamera2D"]
4142

4243
var recentlyOpened = []
4344
var recentlyOpenedPopupMenu = PopupMenu.new()
@@ -280,4 +281,5 @@ func _on_PlayButton_pressed(): # Use normal Button instead of MenuButton in comb
280281
oMenuPlayButton.connect("pressed",self,"_on_PlayButton_pressed")
281282

282283
func _on_ConfirmDiscardChanges_confirmed():
284+
oCamera2D.skip_camera_reset = true
283285
oOpenMap.open_map(oCurrentMap.path)

Scenes/OpenMap.gd

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ func finish_opening_map(map):
203203
oScriptEditor.initialize_for_new_map()
204204
oOverheadOwnership.start()
205205
oScriptHelpers.start()
206-
oCamera2D.reset_camera(M.xSize, M.ySize)
206+
207207

208208
if Slabset.dat.empty() == true: Slabset.load_default_slabset()
209209
if Columnset.cubes.empty() == true: Columnset.load_default_columnset()
@@ -233,6 +233,11 @@ func finish_opening_map(map):
233233

234234
oDataClm.store_default_data()
235235

236+
if oCamera2D.skip_camera_reset == false:
237+
oCamera2D.reset_camera(M.xSize, M.ySize)
238+
else:
239+
oCamera2D.skip_camera_reset = false
240+
236241
# if oGame.running_keeperfx() == true:
237242
# if oCurrentFormat.selected == 1: # KFX format
238243
# if oGame.KEEPERFX_VERSION_INT != 500: # Skip worrying about the compiled versions (0.5.0.0)

0 commit comments

Comments
 (0)