lorom

;visor concept by black falcon
;first off, I apologize for the poor support on this one, it's merely just a concept (like almost anything else I put up),
;because this is very old code and I just don't feel like polishing it, you may use it as you want without credit needed
;I still left the random comments and commented code in, I have no idea what does what exactly anymore, you can play with it yourself
;this replaces the xray routine called when selecting the xray icon and holding run

;things that need to be done:
;	- when turning off visor, palette has to be reset
;	- temperature display (adjust palette according to temp,) >> of course Vortoroc depths need to be HOT!
;	- Thermal Visor enemy reaction (visible or not visible)
;	- additional suitpalette updates 
;	- when going through doors, the current palette is stored to 7EC200+, but NOT to 7EC000+
;	-> flag necessary that marks Thermal as active or turned off


!moveblock = $B87E
!movesize = #$01FF

org $90DDC8
	PHA : PHX : PHY : PHB
	JSR $B80D			;this allows samus to shoot, lol
	JSL CHECK			;a whole bank for free use, WEEEEEEEEEEEEEEEEEEEEEEE!
	PLB : PLY : PLA : PLX
	RTS

org $B88400
CHECK:
	LDA $0998 : CMP #$0008 : BEQ +
	JSR NOTHING
	RTL
+

	LDA $8F : BIT $09B6 : BEQ + : INC $0766
+	
	LDA $0766
	AND #$0001
	ASL
	TAX
	JSR (WHATTODO,x)
	RTL
	
WHATTODO:

DW NOTHING
DW THERMAL	
	
	
NOTHING:	
	LDA $0768
	CMP #$1111
	BEQ +
	LDA #$1111
	STA $0768
	LDY #$C000
	LDX #$C200
	LDA #$01FF
	MVN $7E7E
	SEP #$30
	LDA #$00
	STA $57
	REP #$30
	STZ $076A
	LDA #$0002
	JSL $809021
+	
	RTS

THERMAL:
	LDA $0768
	CMP #$2222
	BEQ BLA
	LDA #$2222
	STA $0768
	
	LDY #$C000			;load thermal visor palette
	LDX #$8000
	LDA #$01FF
	MVN $B87E
	
	LDA $196E
	CMP #$0002
	BEQ HOT
	CMP #$0004
	BNE COLD
HOT:		  ;B	;G	  ;R
	LDA #%0000000110010101
	STA $7EC036
	LDA #%0001110111111111
	STA $7EC034
	LDA #%0001111011111111
	STA $7EC032
	LDA #%0000000010010000
	STA $7EC000
	
COLD:	
	SEP #$30
	LDA #$13
	STA $57
	REP #$30

	LDA #$0038
	JSL $809021
BLA:
	LDA $076A
	CMP #$0040
	BMI +
	STZ $076A
	

	LDA #$0018
	JSL $8090A3
+
;	SEP #$20
;	STZ $6E
;	LDA #$82
;	STA $71
;	LDA #$25
;	STA $74
;	LDA #$45
;	STA $75
;	LDA #$85
;	STA $76
;	REP #$20
	
	INC $076A
	LDY #$C180
	LDX #$8180
	LDA #$001F
	MVN $B87E

	RTS

