Banner
Views: 236,357,613
Time: 2013-05-23 12:34:11 AM
15 users online: Alcaro, o AnybodyAgrees, DragezeeY, EvilGuy0613, Fireblast124, Gamma V, Grav, o imamelia, jellybean, o mockingod, Pokeymeister80, Ramidalv, Reggie, o Richard Nixon, o TRS - Guests: 37 - Bots: 14Users: 22,863 (1,277 active)
Latest: LONTOR505
Tip: If you set the upper tile of the door to act like the lower tile, two-tile-high doors can be entered even while riding Yoshi.
OW Sprite Edit
Forum Index - SMW Hacking - General SMW Hacking Help - ASM & Related Topics - OW Sprite Edit
Pages: « 1 »
I'm looking in the Hand.ASM file that comes with the OW Sprite Editor tool and I am trying to make it so that the hand has a 5% chance of forcing you into the level and can't for the life of me find the code that it uses to determine what the probability of being sucked in to the level. I assume it's somewhere with the code that I have copied below (since it say's it is) but nothing is sticking out to me saying "Hi, I'm the code that changes probability"
Thanks.

SetDrawingPosition:
LDA $0E65,x ;sprite position high byte
XBA
LDA $0E35,x ;sprite position low byte
REP #$20
SEC
SBC $001A,y ;Screen Boundry
STA $0000,y ;sprite position relative to screen boarder
SEP #$20
RTS

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; If sprite is near mario/luigi, enter level at the probability of 50%.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
NearMarioCheck:
JSR GetBetweenLength
LDA $06
CMP.W #$0008
BCS NotNear
LDA $08
CMP.W #$0008
BCS NotNear
SEP #$20
LDA $0DD6
LSR A
LSR A
TAY
LDA $0DB4,y
BMI NotNear ;if death
;STX $0EF7 ;delete this index number sprite when a level beaten
LDA $13D9 ;pad input mode
CMP #$04
BEQ NotNear ;when mario is moving, skip
LDA $0E05,x ;timer
BEQ TimerZero
CMP #$80
BCS Return02
JSR TimerCount
Return02:
RTS
NotNear:
SEP #$20
STZ $0E05,x
STZ $0E55,x
RTS

(maybe right here?) TimerZero:
LDA $13
STA $148B
LDA $14
STA $148C
JSL $01ACF9 ;get random value
AND #$01
BNE NotHappen
LDA #$50
STA $0E05,x ;timer
LDA #$01
STA $13D9 ;pad input mode
Return02:
RTS
Originally posted by HuFlungDu

JSL $01ACF9 ;get random value
AND #$01
BNE NotHappen

Change the AND #$01 to AND #$0F to get the chance 1/16, or to AND #$1F to get 1/32. I'm too lazy to make it 1/20.
JSL $01ACF9 ;get random value
AND #$01
BNE NotHappen

There it is. 50/50 the last bit is 1 or 0.

AND #$anyhighernumber will get you a lower precentage- the higher the number the less the chance.

EDIT: Beaten :{
Last edited on 2009-08-03 12:23:18 PM by Maxx.
Code
JSL $01ACF9 ;get random value AND #$01 BNE NotHappen


AND #$01 will check if the first bit is set. Every other number will have this bit set (1, 3, 5, ect), so half the time it will be true. This is your 50%.


5% would be difficult to replicate. 1/16 would be easier, so I'd just change the AND #$01 to AND #$0F. Then it would only happen when the last four bits are set (xxxx1111, where the x's could be anything).


EDIT: Ninja'd twice :(
Last edited on 2009-08-03 12:24:34 PM by Kaijyuu.
Sweet thanks. 1/32 works better than 5% anyway, I was just throwing out an arbitrary number
Pages: « 1 »
Forum Index - SMW Hacking - General SMW Hacking Help - ASM & Related Topics - OW Sprite Edit

The purpose of this site is not to distribute copyrighted material, but to honor one of our favourite games.

Copyright © 2005 - 2013 - SMW Central
Legal Information - Link To Us


Total queries: 29

Menu