Straight Stairs trap doors

Straight Stairs adjustment for different door types
This commit is contained in:
aerinon
2020-04-28 17:05:58 -06:00
parent 45016ed5ce
commit 467507b505
8 changed files with 159 additions and 90 deletions

View File

@@ -1038,10 +1038,6 @@ class Hook(Enum):
South = 2 South = 2
East = 3 East = 3
Stairs = 4 Stairs = 4
NEdge = 5
SEdge = 6
WEdge = 7
EEdge = 8
hook_dir_map = { hook_dir_map = {
@@ -1051,21 +1047,12 @@ hook_dir_map = {
Direction.East: Hook.East, Direction.East: Hook.East,
} }
edge_map = {
Direction.North: Hook.NEdge,
Direction.South: Hook.SEdge,
Direction.West: Hook.WEdge,
Direction.East: Hook.EEdge,
}
def hook_from_door(door): def hook_from_door(door):
if door.type == DoorType.SpiralStairs: if door.type == DoorType.SpiralStairs:
return Hook.Stairs return Hook.Stairs
if door.type == DoorType.Normal: if door.type in [DoorType.Normal, DoorType.Open, DoorType.StraightStairs]:
return hook_dir_map[door.direction] return hook_dir_map[door.direction]
if door.type == DoorType.Open:
return edge_map[door.direction]
return None return None

View File

@@ -8,7 +8,6 @@ from enum import unique, Flag
from functools import reduce from functools import reduce
from BaseClasses import RegionType, Door, DoorType, Direction, Sector, CrystalBarrier from BaseClasses import RegionType, Door, DoorType, Direction, Sector, CrystalBarrier
from Regions import key_only_locations from Regions import key_only_locations
from Dungeons import hyrule_castle_regions, eastern_regions, desert_regions, hera_regions, tower_regions, pod_regions
from Dungeons import dungeon_regions, region_starts, split_region_starts, flexible_starts from Dungeons import dungeon_regions, region_starts, split_region_starts, flexible_starts
from Dungeons import drop_entrances, dungeon_bigs, dungeon_keys, dungeon_hints from Dungeons import drop_entrances, dungeon_bigs, dungeon_keys, dungeon_hints
from Items import ItemFactory from Items import ItemFactory
@@ -55,10 +54,11 @@ def link_doors(world, player):
connect_two_way(world, entrance, ext, player) connect_two_way(world, entrance, ext, player)
within_dungeon(world, player) within_dungeon(world, player)
elif world.doorShuffle[player] == 'crossed': elif world.doorShuffle[player] == 'crossed':
for entrance, ext in open_edges: if not world.experimental[player]:
connect_two_way(world, entrance, ext, player) for entrance, ext in open_edges:
for entrance, ext in straight_staircases: connect_two_way(world, entrance, ext, player)
connect_two_way(world, entrance, ext, player) for entrance, ext in straight_staircases:
connect_two_way(world, entrance, ext, player)
cross_dungeon(world, player) cross_dungeon(world, player)
else: else:
logging.getLogger('').error('Invalid door shuffle setting: %s' % world.doorShuffle[player]) logging.getLogger('').error('Invalid door shuffle setting: %s' % world.doorShuffle[player])
@@ -494,9 +494,10 @@ def cross_dungeon(world, player):
entrances_map, potentials, connections = determine_entrance_list(world, player) entrances_map, potentials, connections = determine_entrance_list(world, player)
connections_tuple = (entrances_map, potentials, connections) connections_tuple = (entrances_map, potentials, connections)
all_sectors = [] all_sectors, all_regions = [], []
for key in dungeon_regions.keys(): for key in dungeon_regions.keys():
all_sectors.extend(convert_to_sectors(dungeon_regions[key], world, player)) all_regions += dungeon_regions[key]
all_sectors.extend(convert_to_sectors(all_regions, world, player))
dungeon_builders = create_dungeon_builders(all_sectors, connections_tuple, world, player) dungeon_builders = create_dungeon_builders(all_sectors, connections_tuple, world, player)
for builder in dungeon_builders.values(): for builder in dungeon_builders.values():
builder.entrance_list = list(entrances_map[builder.name]) builder.entrance_list = list(entrances_map[builder.name])

View File

@@ -14,9 +14,6 @@ from Regions import key_only_locations, dungeon_events, flooded_keys_reverse
from Dungeons import dungeon_regions, split_region_starts from Dungeons import dungeon_regions, split_region_starts
class GraphPiece: class GraphPiece:
def __init__(self): def __init__(self):
@@ -522,11 +519,7 @@ type_map = {
Hook.North: Hook.South, Hook.North: Hook.South,
Hook.South: Hook.North, Hook.South: Hook.North,
Hook.West: Hook.East, Hook.West: Hook.East,
Hook.East: Hook.West, Hook.East: Hook.West
Hook.NEdge: Hook.SEdge,
Hook.SEdge: Hook.NEdge,
Hook.EEdge: Hook.WEdge,
Hook.WEdge: Hook.EEdge,
} }
@@ -542,21 +535,11 @@ hang_dir_map = {
} }
edge_map_back = {
Direction.North: Hook.SEdge,
Direction.South: Hook.NEdge,
Direction.West: Hook.EEdge,
Direction.East: Hook.WEdge,
}
def hanger_from_door(door): def hanger_from_door(door):
if door.type == DoorType.SpiralStairs: if door.type == DoorType.SpiralStairs:
return Hook.Stairs return Hook.Stairs
if door.type == DoorType.Normal: if door.type in [DoorType.Normal, DoorType.Open, DoorType.StraightStairs]:
return hang_dir_map[door.direction] return hang_dir_map[door.direction]
if door.type == DoorType.Open:
return edge_map_back[door.direction]
return None return None

View File

@@ -22,7 +22,6 @@ incsrc keydoors.asm
incsrc overrides.asm incsrc overrides.asm
incsrc edges.asm incsrc edges.asm
incsrc math.asm incsrc math.asm
incsrc hudadditions.asm
warnpc $279000 warnpc $279000
; Data Section ; Data Section
@@ -36,26 +35,8 @@ dw 0
DRScroll: DRScroll:
db 0 db 0
; Vert 0,6,0 Horz 2,0,8 org $279030
org $279010 incsrc hudadditions.asm
CoordIndex: ; Horizontal 1st warnpc $279700
db 2, 0 ; Coordinate Index $20-$23
OppCoordIndex:
db 0, 2 ; Swapped coordinate Index $20-$23 (minor optimization)
CameraIndex: ; Horizontal 1st
db 0, 6 ; Camera Index $e2-$ea
CamQuadIndex: ; Horizontal 1st
db 8, 0 ; Camera quadrants $600-$60f
ShiftQuadIndex:
db 2, 1 ; see ShiftQuad func (relates to $a9,$aa)
CamBoundIndex: ; Horizontal 1st
db 0, 4 ; Camera Bounds $0618-$61f
OppCamBoundIndex: ; Horizontal 1st
db 4, 0 ; Camera Bounds $0618-$61f
CamBoundBaseLine: ; X camera stuff is 1st column todo Y camera needs more testing
dw $007f, $0077 ; Left/Top camera bounds when at edge or layout frozen
dw $0007, $000b ; Left/Top camera bounds when not frozen + appropriate low byte $22/$20 (preadj. by #$78/#$6c)
dw $00ff, $010b ; Right/Bot camera bounds when not frozen + appropriate low byte $20/$22
dw $017f, $0187 ; Right/Bot camera bound when at edge or layout frozen
incsrc doortables.asm incsrc doortables.asm

View File

@@ -1,23 +1,3 @@
org $279500
TilesetTable:
; 0 1 2 3 4 5 6 7 8 9 a b c d e f --Offset Ruler
db $13,$04,$04,$06,$0d,$ff,$08,$05,$06,$07,$07,$07,$0e,$0e,$0b,$ff
db $13,$04,$04,$0d,$0d,$0d,$08,$05,$06,$07,$07,$07,$0e,$0e,$0b,$0b
db $04,$04,$04,$0d,$0d,$ff,$08,$05,$08,$09,$07,$07,$06,$ff,$0b,$06
db $04,$05,$04,$12,$08,$08,$08,$08,$08,$09,$07,$07,$06,$0e,$0b,$0b
db $04,$04,$04,$12,$0a,$0a,$08,$ff,$ff,$09,$07,$07,$0e,$0e,$0b,$0b
db $04,$04,$04,$12,$08,$01,$09,$09,$09,$09,$07,$0e,$0e,$0e,$0b,$0b
db $04,$04,$04,$12,$0a,$0a,$08,$09,$09,$ff,$07,$0e,$0e,$0e,$0b,$ff
db $04,$04,$04,$12,$12,$12,$08,$05,$ff,$ff,$ff,$0e,$0e,$0e,$0b,$0b
db $04,$04,$04,$12,$12,$12,$ff,$05,$ff,$05,$ff,$0e,$0e,$0e,$0b,$ff
db $0c,$0c,$0c,$0c,$ff,$0e,$0e,$0c,$0c,$05,$ff,$0e,$0e,$0e,$0b,$0b
db $0c,$0c,$0c,$0c,$0d,$0e,$0e,$05,$05,$05,$05,$0a,$0a,$ff,$0b,$0b
db $04,$0c,$0c,$0c,$0d,$0d,$0d,$0d,$05,$05,$05,$0a,$0a,$ff,$0b,$0b
db $04,$0c,$0c,$0c,$0d,$0d,$0d,$0d,$05,$05,$ff,$0a,$0a,$ff,$0b,$ff
db $04,$0c,$0c,$ff,$ff,$0d,$0d,$ff,$05,$05,$05,$0a,$0a,$ff,$0b,$06
db $04,$06,$06,$06,$06,$06,$06,$06,$06,$ff,$06,$06,$ff,$06,$06,$06
db $06,$06,$03,$03,$03,$03,$ff,$ff,$06,$06,$06,$06,$ff,$06,$06,$06
org $279700 org $279700
KeyDoorOffset: KeyDoorOffset:
; 0 1 2 3 4 5 6 7 8 9 a b c d e f --Offset Ruler ; 0 1 2 3 4 5 6 7 8 9 a b c d e f --Offset Ruler
@@ -582,3 +562,47 @@ DungeonReminderTable: ;27f054
dw $2D50, $2D50, $2D51, $2D52, $2D54, $2D56, $2D55, $2D5A, $2D57, $2D59, $2D53, $2D58, $2D5B, $2D5C dw $2D50, $2D50, $2D51, $2D52, $2D54, $2D56, $2D55, $2D5A, $2D57, $2D59, $2D53, $2D58, $2D5B, $2D5C
;27f070 ;27f070
; Vert 0,6,0 Horz 2,0,8
org $27f080
CoordIndex: ; Horizontal 1st
db 2, 0 ; Coordinate Index $20-$23
OppCoordIndex:
db 0, 2 ; Swapped coordinate Index $20-$23 (minor optimization)
CameraIndex: ; Horizontal 1st
db 0, 6 ; Camera Index $e2-$ea
CamQuadIndex: ; Horizontal 1st
db 8, 0 ; Camera quadrants $600-$60f
ShiftQuadIndex:
db 2, 1 ; see ShiftQuad func (relates to $a9,$aa)
CamBoundIndex: ; Horizontal 1st
db 0, 4 ; Camera Bounds $0618-$61f
OppCamBoundIndex: ; Horizontal 1st
db 4, 0 ; Camera Bounds $0618-$61f
CamBoundBaseLine: ; X camera stuff is 1st column todo Y camera needs more testing
dw $007f, $0077 ; Left/Top camera bounds when at edge or layout frozen
dw $0007, $000b ; Left/Top camera bounds when not frozen + appropriate low byte $22/$20 (preadj. by #$78/#$6c)
dw $00ff, $010b ; Right/Bot camera bounds when not frozen + appropriate low byte $20/$22
dw $017f, $0187 ; Right/Bot camera bound when at edge or layout frozen
;27f09e next free byte
org $27f100
TilesetTable:
; 0 1 2 3 4 5 6 7 8 9 a b c d e f --Offset Ruler
db $13,$04,$04,$06,$0d,$ff,$08,$05,$06,$07,$07,$07,$0e,$0e,$0b,$ff
db $13,$04,$04,$0d,$0d,$0d,$08,$05,$06,$07,$07,$07,$0e,$0e,$0b,$0b
db $04,$04,$04,$0d,$0d,$ff,$08,$05,$08,$09,$07,$07,$06,$ff,$0b,$06
db $04,$05,$04,$12,$08,$08,$08,$08,$08,$09,$07,$07,$06,$0e,$0b,$0b
db $04,$04,$04,$12,$0a,$0a,$08,$ff,$ff,$09,$07,$07,$0e,$0e,$0b,$0b
db $04,$04,$04,$12,$08,$01,$09,$09,$09,$09,$07,$0e,$0e,$0e,$0b,$0b
db $04,$04,$04,$12,$0a,$0a,$08,$09,$09,$ff,$07,$0e,$0e,$0e,$0b,$ff
db $04,$04,$04,$12,$12,$12,$08,$05,$ff,$ff,$ff,$0e,$0e,$0e,$0b,$0b
db $04,$04,$04,$12,$12,$12,$ff,$05,$ff,$05,$ff,$0e,$0e,$0e,$0b,$ff
db $0c,$0c,$0c,$0c,$ff,$0e,$0e,$0c,$0c,$05,$ff,$0e,$0e,$0e,$0b,$0b
db $0c,$0c,$0c,$0c,$0d,$0e,$0e,$05,$05,$05,$05,$0a,$0a,$ff,$0b,$0b
db $04,$0c,$0c,$0c,$0d,$0d,$0d,$0d,$05,$05,$05,$0a,$0a,$ff,$0b,$0b
db $04,$0c,$0c,$0c,$0d,$0d,$0d,$0d,$05,$05,$ff,$0a,$0a,$ff,$0b,$ff
db $04,$0c,$0c,$ff,$ff,$0d,$0d,$ff,$05,$05,$05,$0a,$0a,$ff,$0b,$06
db $04,$06,$06,$06,$06,$06,$06,$06,$06,$ff,$06,$06,$ff,$06,$06,$06
db $06,$06,$03,$03,$03,$03,$ff,$ff,$06,$06,$06,$06,$ff,$06,$06,$06
;27f200

View File

@@ -29,13 +29,21 @@ jsl RecordStairType : nop
org $02a1e7 ;(PC: 121e7) org $02a1e7 ;(PC: 121e7)
jsl SpiralWarp jsl SpiralWarp
org $029369 ; <- 11369 - Bank02.asm : 3610 (STX $0464 : STY $012E)
jsl StraightStairsAdj : nop #2
org $029383 ; <- 11384 - Bank02.asm : 3629 (.walkingDownStaircase-> ADD $20 : STA $20) org $029383 ; <- 11384 - Bank02.asm : 3629 (.walkingDownStaircase-> ADD $20 : STA $20)
jsl StraightStairsFix : nop jsl StraightStairsFix : nop
org $0293aa ; <- 113aa - Bank02.asm : 3653 (ADD $20 : STA $20) org $0293aa ; <- 113aa - Bank02.asm : 3653 (ADD $20 : STA $20)
jsl StraightStairsFix : nop jsl StraightStairsFix : nop
org $029396 ; <- 11384 - Bank02.asm : 3641 (LDA $01C322, X) org $0293d1 ; <- 113d1 - Bank02.asm : 3683 (ADD $20 : STA $20 BRANCH_IOTA)
jsl StraightStairsFix : nop
org $029396 ; <- 11396 - Bank02.asm : 3641 (LDA $01C322, X)
jsl StraightStairLayerFix jsl StraightStairLayerFix
org $02c06d ; <- Bank02.asm : 9874 (LDX $0418, CMP.b #$02)
jsl DoorToStraight : nop
org $02941a ; <- Bank02.asm : 3748 module 7.12.11 (LDA $0464 : BNE BRANCH_$11513 : INC $B0 : RTS)
jsl StraightStairsTrapDoor : rts
; Graphics fix ; Graphics fix
org $02895d ; Bank 02 line 1812 (JSL Dungeon_LoadRoom : JSL Dungeon_InitStarTileChr : JSL $00D6F9 : INC $B0) org $02895d ; Bank 02 line 1812 (JSL Dungeon_LoadRoom : JSL Dungeon_InitStarTileChr : JSL $00D6F9 : INC $B0)
@@ -58,6 +66,8 @@ org $00df5a ;(PC: 5f5a)
PrepTransAuxGfx: PrepTransAuxGfx:
org $0ffd65 ;(PC: 07fd65) org $0ffd65 ;(PC: 07fd65)
Dungeon_LoadCustomTileAttr: Dungeon_LoadCustomTileAttr:
org $01feb0
Dungeon_ApproachFixedColor:
;org $01fec1 ;org $01fec1
;Dungeon_ApproachFixedColor_variable: ;Dungeon_ApproachFixedColor_variable:
;org $a0f972 ; Rando version ;org $a0f972 ; Rando version

View File

@@ -206,10 +206,56 @@ PrepScrollToNormal:
.end rts .end rts
} }
StraightStairsAdj:
{
stx $0464 : sty $012e ; what we wrote over
lda DRMode : beq +
jsr GetTileAttribute : tax
lda $11 : cmp #$12 : beq .goingNorth
lda $a2 : cmp #$51 : bne ++
rep #$20 : lda #$0018 : !add $20 : sta $20 : sep #$20 ; special fix for throne room
jsr GetTileAttribute : tax
++ lda StepAdjustmentDown, X : bra .end
; lda $ee : beq .end
; rep #$20 : lda #$ffe0 : !add $20 : sta $20 : sep #$20
.goingNorth
cpx #$00 : bne ++
lda $a0 : cmp #$51 : bne ++
lda #$36 : bra .end ; special fix for throne room
++ ldy $ee : cpy #$00 : beq ++
inx
++ lda StepAdjustmentUp, X
.end
pha : lda $0462 : and #$04 : bne ++
pla : !add #$f6 : pha
++ pla : !add $0464 : sta $0464
+ rtl
}
GetTileAttribute:
{
phk : pea.w .jslrtsreturn-1
pea.w $02802c
jml $02c11d ; mucks with x/y sets a to Tile Attribute, I think
.jslrtsreturn
rts
}
; 0 open edge
; 1 nrm door high
; 2 straight str
; 3 nrm door low
; 4 trap door high
; 5 trap door low (none of these exist on North direction)
StepAdjustmentUp: ; really North Stairs
db $00, $f6, $1a, $18, $16, $38
StepAdjustmentDown: ; really South Stairs
db $d0, $f6, $10, $1a, $f0, $00
StraightStairsFix: StraightStairsFix:
{ {
lda DRMode : bne + lda DRMode : bne +
!add $20 : sta $20 !add $20 : sta $20 ;what we wrote over
+ rtl + rtl
} }
@@ -217,5 +263,38 @@ StraightStairLayerFix:
{ {
lda DRMode : beq + lda DRMode : beq +
lda $ee : rtl lda $ee : rtl
+ lda $01c322, x : rtl + lda $01c322, x : rtl ; what we wrote over
}
DoorToStraight:
{
pha
lda DRMode : beq .skip
pla : bne .end
pha
lda $a0 : cmp #$51 : bne .skip
lda #$04 : sta $4e
.skip pla
.end ldx $0418 : cmp #$02 ;what we wrote over
rtl
}
StraightStairsTrapDoor:
{
lda $0464 : bne +
; reset function
phk : pea.w .jslrtsreturn-1
pea.w $02802c
jml $028c73 ; $10D71 .reset label of Bank02
.jslrtsreturn
lda $0468 : bne ++
lda $a0 : cmp.b #$ac : bne .animateTraps
lda $0403 : and.b #$20 : bne .animateTraps
lda $0403 : and.b #$10 : beq ++
.animateTraps
lda #$05 : sta $11
inc $0468 : stz $068e : stz $0690
++ rtl
+ jsl Dungeon_ApproachFixedColor ; what we wrote over
.end rtl
} }

View File

@@ -1,8 +1,12 @@
RecordStairType: { RecordStairType: {
pha : lda DRMode : beq + pha
lda $0e : sta $045e : pla : bra .end lda DRMode : beq .norm
+ pla : sta $a0 lda $040c : cmp #$ff : beq .norm
.end lda $063d, x lda $0e : sta $045e
cmp #$26 : beq .norm ; skipping in-floor staircases
pla : bra +
.norm pla : sta $a0
+ lda $063d, x
rtl rtl
} }